]> wimlib.net Git - wimlib/commitdiff
Add more comments
authorEric Biggers <ebiggers3@gmail.com>
Sat, 6 Apr 2013 23:03:18 +0000 (18:03 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Sat, 6 Apr 2013 23:03:18 +0000 (18:03 -0500)
src/extract_image.c
src/lookup_table.c
src/lookup_table.h
src/mount_image.c
src/wim.c

index fa72edb845c19e4cf52801b11b31362399d4cb0c..b18270dfb899ef1a5bc702c908930ebed23d807a 100644 (file)
@@ -1027,7 +1027,7 @@ wimlib_extract_image(WIMStruct *w,
        if (num_additional_swms) {
                ret = new_joined_lookup_table(w, additional_swms,
                                              num_additional_swms, &joined_tab);
-               if (ret != 0)
+               if (ret)
                        return ret;
                w_tab_save = w->lookup_table;
                w->lookup_table = joined_tab;
index 0ebaf61eb503848ff6d5262e7751013b34715056..4fbcf7e56a3ccea040c19ffae1e466d34b2e86ff 100644 (file)
@@ -595,23 +595,22 @@ write_lookup_table(WIMStruct *w, int image, struct resource_entry *out_res_entry
        return 0;
 }
 
-
 int
-lte_zero_real_refcnt(struct wim_lookup_table_entry *lte, void *ignore)
+lte_zero_real_refcnt(struct wim_lookup_table_entry *lte, void *_ignore)
 {
        lte->real_refcnt = 0;
        return 0;
 }
 
 int
-lte_zero_out_refcnt(struct wim_lookup_table_entry *lte, void *ignore)
+lte_zero_out_refcnt(struct wim_lookup_table_entry *lte, void *_ignore)
 {
        lte->out_refcnt = 0;
        return 0;
 }
 
 int
-lte_free_extracted_file(struct wim_lookup_table_entry *lte, void *ignore)
+lte_free_extracted_file(struct wim_lookup_table_entry *lte, void *_ignore)
 {
        if (lte->extracted_file != NULL) {
                FREE(lte->extracted_file);
index c1716088f590206e802e4f71dda46552b1b374b2..83796aae2d8bca57cf4566de9467755444da9cfa 100644 (file)
@@ -135,9 +135,13 @@ struct wim_lookup_table_entry {
         */
        u16 part_number;
 
-       /* See enum resource_location above */
+       /* One of the `enum resource_location' values documented above. */
        u16 resource_location : 5;
+
+       /* 1 if this stream is a unique size (only set while writing streams). */
        u8 unique_size : 1;
+
+       /* 1 if this stream had a SHA1-message digest calculated for it yet? */
        u8 unhashed : 1;
 
        /* (On-disk field)
@@ -160,9 +164,11 @@ struct wim_lookup_table_entry {
                size_t hash_short;
 
                /* Unhashed entries only (unhashed == 1): these variables make
-                * it possible to find the to the pointer to this 'struct
-                * wim_lookup_table_entry' contained in a 'struct wim_ads_entry'
-                * or 'struct wim_inode'.  */
+                * it possible to find the pointer to this 'struct
+                * wim_lookup_table_entry' contained in either 'struct
+                * wim_ads_entry' or 'struct wim_inode'.  There can be at most 1
+                * such pointer, as we can only join duplicate streams after
+                * they have been hashed.  */
                struct {
                        struct wim_inode *back_inode;
                        u32 back_stream_id;
@@ -170,16 +176,14 @@ struct wim_lookup_table_entry {
        };
 
        /* When a WIM file is written, out_refcnt starts at 0 and is incremented
-        * whenever the file resource pointed to by this lookup table entry
-        * needs to be written.  The file resource only need to be written when
-        * out_refcnt is nonzero, since otherwise it is not referenced by any
-        * dentries. */
+        * whenever the stream pointed to by this lookup table entry needs to be
+        * written.  The stream only need to be written when out_refcnt is
+        * nonzero, since otherwise it is not referenced by any dentries. */
        u32 out_refcnt;
 
        /* Pointers to somewhere where the stream is actually located.  See the
         * comments for the @resource_location field above. */
        union {
-               void *resource_loc_private;
                WIMStruct *wim;
                tchar *file_on_disk;
                void *attached_buffer;
@@ -191,10 +195,14 @@ struct wim_lookup_table_entry {
        #endif
        };
 
+       /* Actual reference count to this stream (only used while
+        * verifying an image). */
        u32 real_refcnt;
 
        union {
        #ifdef WITH_FUSE
+               /* Number of times this stream has been opened (used only during
+                * mounting) */
                u16 num_opened_fds;
        #endif
 
index 4b4a87bffaf6bbd63030762f3bba357fbc571d5a..a2e09b435e43a60a72db289e0839c747315ceeaa 100644 (file)
@@ -2483,7 +2483,6 @@ wimlib_mount_image(WIMStruct *wim, int image, const char *dir,
                       WIMLIB_MOUNT_FLAG_STREAM_INTERFACE_WINDOWS)))
                mount_flags |= WIMLIB_MOUNT_FLAG_STREAM_INTERFACE_XATTR;
 
-
        DEBUG("Initializing struct wimfs_context");
        init_wimfs_context(&ctx);
        ctx.wim = wim;
index 128bddac428e50f9260d4d8f9b8d0ce7fd7419b8..25b5c3367d9e2bd7421b6889a2234f22333756a4 100644 (file)
--- a/src/wim.c
+++ b/src/wim.c
@@ -617,6 +617,10 @@ new_image_metadata_array(unsigned num_images)
        return imd_array;
 }
 
+/* Checksum all streams that are unhashed (other than the metadata streams),
+ * merging them into the lookup table as needed.  This is a no-op unless the
+ * library has previously used to add or mount an image using the same
+ * WIMStruct. */
 int
 wim_checksum_unhashed_streams(WIMStruct *w)
 {