X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fdentry.c;h=3783434c062d167396db895834f810efbe96502d;hb=fafad622d2727848834f0a0803bec6c09bc8d743;hp=0a898ff73943e3327b3f3b604c96630080fe9cad;hpb=e074c6d474920b8bc1436f105e0dff89e6a4bccb;p=wimlib diff --git a/src/dentry.c b/src/dentry.c index 0a898ff7..3783434c 100644 --- a/src/dentry.c +++ b/src/dentry.c @@ -931,120 +931,6 @@ out: } #endif /* WITH_FUSE */ -/* Prints the full path of a dentry. */ -int -print_dentry_full_path(struct wim_dentry *dentry, void *_ignore) -{ - int ret = calculate_dentry_full_path(dentry); - if (ret) - return ret; - tprintf(T("%"TS"\n"), dentry->_full_path); - return 0; -} - -/* We want to be able to show the names of the file attribute flags that are - * set. */ -struct file_attr_flag { - u32 flag; - const tchar *name; -}; -struct file_attr_flag file_attr_flags[] = { - {FILE_ATTRIBUTE_READONLY, T("READONLY")}, - {FILE_ATTRIBUTE_HIDDEN, T("HIDDEN")}, - {FILE_ATTRIBUTE_SYSTEM, T("SYSTEM")}, - {FILE_ATTRIBUTE_DIRECTORY, T("DIRECTORY")}, - {FILE_ATTRIBUTE_ARCHIVE, T("ARCHIVE")}, - {FILE_ATTRIBUTE_DEVICE, T("DEVICE")}, - {FILE_ATTRIBUTE_NORMAL, T("NORMAL")}, - {FILE_ATTRIBUTE_TEMPORARY, T("TEMPORARY")}, - {FILE_ATTRIBUTE_SPARSE_FILE, T("SPARSE_FILE")}, - {FILE_ATTRIBUTE_REPARSE_POINT, T("REPARSE_POINT")}, - {FILE_ATTRIBUTE_COMPRESSED, T("COMPRESSED")}, - {FILE_ATTRIBUTE_OFFLINE, T("OFFLINE")}, - {FILE_ATTRIBUTE_NOT_CONTENT_INDEXED,T("NOT_CONTENT_INDEXED")}, - {FILE_ATTRIBUTE_ENCRYPTED, T("ENCRYPTED")}, - {FILE_ATTRIBUTE_VIRTUAL, T("VIRTUAL")}, -}; - -/* Prints a directory entry. @lookup_table is a pointer to the lookup table, if - * available. If the dentry is unresolved and the lookup table is NULL, the - * lookup table entries will not be printed. Otherwise, they will be. */ -int -print_dentry(struct wim_dentry *dentry, void *lookup_table) -{ - const u8 *hash; - struct wim_lookup_table_entry *lte; - const struct wim_inode *inode = dentry->d_inode; - tchar buf[50]; - - tprintf(T("[DENTRY]\n")); - tprintf(T("Length = %"PRIu64"\n"), dentry->length); - tprintf(T("Attributes = 0x%x\n"), inode->i_attributes); - for (size_t i = 0; i < ARRAY_LEN(file_attr_flags); i++) - if (file_attr_flags[i].flag & inode->i_attributes) - tprintf(T(" FILE_ATTRIBUTE_%"TS" is set\n"), - file_attr_flags[i].name); - tprintf(T("Security ID = %d\n"), inode->i_security_id); - tprintf(T("Subdir offset = %"PRIu64"\n"), dentry->subdir_offset); - - wim_timestamp_to_str(inode->i_creation_time, buf, sizeof(buf)); - tprintf(T("Creation Time = %"TS"\n"), buf); - - wim_timestamp_to_str(inode->i_last_access_time, buf, sizeof(buf)); - tprintf(T("Last Access Time = %"TS"\n"), buf); - - wim_timestamp_to_str(inode->i_last_write_time, buf, sizeof(buf)); - tprintf(T("Last Write Time = %"TS"\n"), buf); - - if (inode->i_attributes & FILE_ATTRIBUTE_REPARSE_POINT) { - tprintf(T("Reparse Tag = 0x%"PRIx32"\n"), inode->i_reparse_tag); - tprintf(T("Reparse Point Flags = 0x%"PRIx16"\n"), - inode->i_not_rpfixed); - tprintf(T("Reparse Point Unknown 2 = 0x%"PRIx32"\n"), - inode->i_rp_unknown_2); - } - tprintf(T("Reparse Point Unknown 1 = 0x%"PRIx32"\n"), - inode->i_rp_unknown_1); - tprintf(T("Hard Link Group = 0x%"PRIx64"\n"), inode->i_ino); - tprintf(T("Hard Link Group Size = %"PRIu32"\n"), inode->i_nlink); - tprintf(T("Number of Alternate Data Streams = %hu\n"), inode->i_num_ads); - if (dentry_has_long_name(dentry)) - wimlib_printf(T("Filename = \"%"WS"\"\n"), dentry->file_name); - if (dentry_has_short_name(dentry)) - wimlib_printf(T("Short Name \"%"WS"\"\n"), dentry->short_name); - if (dentry->_full_path) - tprintf(T("Full Path = \"%"TS"\"\n"), dentry->_full_path); - - lte = inode_stream_lte(dentry->d_inode, 0, lookup_table); - if (lte) { - print_lookup_table_entry(lte, stdout); - } else { - hash = inode_stream_hash(inode, 0); - if (hash) { - tprintf(T("Hash = 0x")); - print_hash(hash, stdout); - tputchar(T('\n')); - tputchar(T('\n')); - } - } - for (u16 i = 0; i < inode->i_num_ads; i++) { - tprintf(T("[Alternate Stream Entry %u]\n"), i); - wimlib_printf(T("Name = \"%"WS"\"\n"), - inode->i_ads_entries[i].stream_name); - tprintf(T("Name Length (UTF16 bytes) = %hu\n"), - inode->i_ads_entries[i].stream_name_nbytes); - hash = inode_stream_hash(inode, i + 1); - if (hash) { - tprintf(T("Hash = 0x")); - print_hash(hash, stdout); - tputchar(T('\n')); - } - print_lookup_table_entry(inode_stream_lte(inode, i + 1, lookup_table), - stdout); - } - return 0; -} - /* Initializations done on every `struct wim_dentry'. */ static void dentry_common_init(struct wim_dentry *dentry) @@ -1471,8 +1357,6 @@ read_dentry(const u8 * restrict buf, size_t buf_len, inode->i_attributes = le32_to_cpu(disk_dentry->attributes); inode->i_security_id = le32_to_cpu(disk_dentry->security_id); dentry->subdir_offset = le64_to_cpu(disk_dentry->subdir_offset); - dentry->d_unused_1 = le64_to_cpu(disk_dentry->unused_1); - dentry->d_unused_2 = le64_to_cpu(disk_dentry->unused_2); inode->i_creation_time = le64_to_cpu(disk_dentry->creation_time); inode->i_last_access_time = le64_to_cpu(disk_dentry->last_access_time); inode->i_last_write_time = le64_to_cpu(disk_dentry->last_write_time); @@ -1842,8 +1726,8 @@ write_dentry(const struct wim_dentry * restrict dentry, u8 * restrict p) disk_dentry->attributes = cpu_to_le32(inode->i_attributes); disk_dentry->security_id = cpu_to_le32(inode->i_security_id); disk_dentry->subdir_offset = cpu_to_le64(dentry->subdir_offset); - disk_dentry->unused_1 = cpu_to_le64(dentry->d_unused_1); - disk_dentry->unused_2 = cpu_to_le64(dentry->d_unused_2); + disk_dentry->unused_1 = cpu_to_le64(0); + disk_dentry->unused_2 = cpu_to_le64(0); disk_dentry->creation_time = cpu_to_le64(inode->i_creation_time); disk_dentry->last_access_time = cpu_to_le64(inode->i_last_access_time); disk_dentry->last_write_time = cpu_to_le64(inode->i_last_write_time);