]> wimlib.net Git - wimlib/blobdiff - src/dentry.h
Align security data correctly
[wimlib] / src / dentry.h
index be0b058605c0a6e869cd9dfdfa0410454ce92fb8..ba100029cc5b08e888a5440073717cea8db09ada 100644 (file)
@@ -89,7 +89,9 @@ struct ads_entry {
  * entry to align the next one (or the next dentry) on an 8-byte boundary. */
 static inline u64 ads_entry_total_length(const struct ads_entry *entry)
 {
-       u64 len = WIM_ADS_ENTRY_DISK_SIZE + entry->stream_name_len + 2;
+       u64 len = WIM_ADS_ENTRY_DISK_SIZE;
+       if (entry->stream_name_len)
+               len += entry->stream_name_len + 2;
        return (len + 7) & ~7;
 }
 
@@ -155,7 +157,11 @@ struct dentry {
         * The length here includes the base directory entry on disk as well as
         * the long and short filenames.  It does NOT include any alternate
         * stream entries that may follow the directory entry, even though the
-        * size of those needs to be considered.
+        * size of those needs to be considered.  The length SHOULD be 8-byte
+        * aligned, although we don't require it to be.  We do require the
+        * length to be large enough to hold the file name(s) of the dentry;
+        * additionally, a warning is issued if this field is larger than the
+        * aligned size.
         */
        u64 length;
 
@@ -297,6 +303,7 @@ extern void dentry_remove_ads(struct dentry *dentry, struct ads_entry *entry);
 extern const char *path_stream_name(const char *path);
 
 extern u64 dentry_total_length(const struct dentry *dentry);
+extern u64 dentry_correct_total_length(const struct dentry *dentry);
 
 extern void stbuf_to_dentry(const struct stat *stbuf, struct dentry *dentry);
 
@@ -349,6 +356,8 @@ extern void calculate_dir_tree_statistics(struct dentry *root,
 extern int read_dentry(const u8 metadata_resource[], u64 metadata_resource_len, 
                       u64 offset, struct dentry *dentry);
 
+extern int verify_dentry(struct dentry *dentry, void *wim);
+
 extern int read_dentry_tree(const u8 metadata_resource[], 
                            u64 metadata_resource_len, struct dentry *dentry);