if (!copy)
return WIMLIB_ERR_NOMEM;
memcpy(copy, lte, sizeof(struct lookup_table_entry));
- INIT_LIST_HEAD(©->lte_group_list);
lookup_table_insert(table, copy);
return 0;
}
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)
{
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;
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,