]> wimlib.net Git - wimlib/blobdiff - src/join.c
do_add_image(): Set boot_idx directly
[wimlib] / src / join.c
index 07cbfa971c92622b08eb72df6b39e9d26e18524a..f41cf047bc80ceb79f2bbd5450f8faa6f93d134a 100644 (file)
@@ -35,7 +35,6 @@ static int copy_lte_to_table(struct lookup_table_entry *lte, void *table)
        if (!copy)
                return WIMLIB_ERR_NOMEM;
        memcpy(copy, lte, sizeof(struct lookup_table_entry));
-       INIT_LIST_HEAD(&copy->lte_group_list);
        lookup_table_insert(table, copy);
        return 0;
 }
@@ -54,6 +53,23 @@ static int cmp_swms_by_part_number(const void *swm1, const void *swm2)
        return (int)partno_1 - (int)partno_2;
 }
 
+/*
+ * Sanity checks to make sure a set of WIMs correctly correspond to a spanned
+ * set.
+ *
+ * @w:
+ *     Part 1 of the set.
+ *
+ * @additional_swms:
+ *     All parts of the set other than part 1.
+ *
+ * @num_additional_swms:
+ *     Number of WIMStructs in @additional_swms.  Or, the total number of parts
+ *     in the set minus 1.
+ *
+ * @return:
+ *     0 on success; WIMLIB_ERR_SPLIT_INVALID if the set is not valid.
+ */
 int verify_swm_set(WIMStruct *w, WIMStruct **additional_swms,
                   unsigned num_additional_swms)
 {
@@ -64,8 +80,8 @@ int verify_swm_set(WIMStruct *w, WIMStruct **additional_swms,
        if (total_parts != num_additional_swms + 1) {
                ERROR("`%s' says there are %u parts in the spanned set, "
                      "but %s%u part%s provided",
-                     w->filename, w->hdr.total_parts,
-                     (num_additional_swms + 1 < w->hdr.total_parts) ? "only " : "",
+                     w->filename, total_parts,
+                     (num_additional_swms + 1 < total_parts) ? "only " : "",
                      num_additional_swms + 1,
                      (num_additional_swms) ? "s were" : " was");
                return WIMLIB_ERR_SPLIT_INVALID;
@@ -138,6 +154,21 @@ int verify_swm_set(WIMStruct *w, WIMStruct **additional_swms,
        return 0;
 }
 
+/* 
+ * Joins lookup tables from the parts of a split WIM.
+ *
+ * @w specifies the first part, while @additional_swms and @num_additional_swms
+ * specify an array of points to the WIMStruct's for additional split WIM parts.
+ *
+ * On success, 0 is returned on a pointer to the joined lookup table is returned
+ * in @table_ret.
+ *
+ * The reason we join the lookup tables is so:
+ *     - We only have to search one lookup table to find the location of a
+ *     resource in the entire split WIM.
+ *     - Each lookup table entry will have a pointer to its split WIM part (and
+ *     a part number field, although we don't really use it).
+ */
 int new_joined_lookup_table(WIMStruct *w,
                            WIMStruct **additional_swms,
                            unsigned num_additional_swms,