def add_dir_entry(backup_run, dir_entry_path, process_bar, result):
<EOL>backup_entry = Path2(dir_entry_path.path)<EOL>filesize = dir_entry_path.stat.st_size<EOL>hash_filepath = Path2("<STR_LIT>" % (backup_entry.path, os.extsep, phlb_config.hash_name))<EOL>if hash_filepath.is_file():<EOL><INDENT>with hash_filepath.open("<STR_LIT:r>") as hash_file:<EOL><INDENT>hash_hexdigest = hash_file.read().strip()<EOL><DEDENT>if filesize > <NUM_LIT:0>:<EOL><INDENT>process_bar.update(filesize)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>with hash_filepath.open("<STR_LIT:w>") as hash_file:<EOL><INDENT>callback = HashCallback(process_bar)<EOL>with backup_entry.open("<STR_LIT:rb>") as f:<EOL><INDENT>hash = calculate_hash(f, callback)<EOL><DEDENT>hash_hexdigest = hash.hexdigest()<EOL>hash_file.write(hash_hexdigest)<EOL><DEDENT><DEDENT>old_backup_entry = deduplicate(backup_entry, hash_hexdigest)<EOL>if old_backup_entry is None:<EOL><INDENT>result.add_new_file(filesize)<EOL><DEDENT>else:<EOL><INDENT>result.add_stined_file(filesize)<EOL><DEDENT>BackupEntry.objects.create(<EOL>backup_run, dir_entry_path.path_instance, hash_hexdigest=hash_hexdigest  <EOL>)<EOL>
:param backup_run:
:param dir_entry_path: filesystem_walk.DirEntryPath() instance
:param process_bar: