- /* Calculate the byte offset, in the WIM file, of the first chunk table
- * entry to read. Take into account that if the WIM file is in the
- * special "pipable" format, then the chunk table is at the end of the
- * resource, not the beginning. */
- const u64 file_offset_of_needed_chunk_entries =
- lte->resource_entry.offset
- + (start_table_idx * chunk_entry_size)
- + (lte->is_pipable ? (lte->resource_entry.size - chunk_table_size) : 0);
-
- /* Read the needed chunk table entries into the end of the chunk_offsets
- * buffer. */
- void * const chunk_tab_data = (u8*)&chunk_offsets[num_alloc_chunk_entries] -
- chunk_table_needed_size;
- ret = full_pread(in_fd, chunk_tab_data, chunk_table_needed_size,
- file_offset_of_needed_chunk_entries);
- if (ret)
- goto read_error;
-
- /* Now fill in chunk_offsets from the entries we have read in
- * chunk_tab_data. Careful: chunk_offsets aliases chunk_tab_data, which
- * breaks C's aliasing rules when we read 32-bit integers and store
- * 64-bit integers. But since the operations are safe as long as the
- * compiler doesn't mess with their order, we use the gcc may_alias
- * extension to tell the compiler that loads from the 32-bit integers
- * may alias stores to the 64-bit integers. */
- {
- typedef le64 __attribute__((may_alias)) aliased_le64_t;
- typedef le32 __attribute__((may_alias)) aliased_le32_t;
- u64 * const chunk_offsets_p = chunk_offsets + (start_chunk == 0);
- u64 i;
-
- if (chunk_entry_size == 4) {
- aliased_le32_t *raw_entries = (aliased_le32_t*)chunk_tab_data;
- for (i = 0; i < num_needed_chunk_entries; i++)
- chunk_offsets_p[i] = le32_to_cpu(raw_entries[i]);
- } else {
- aliased_le64_t *raw_entries = (aliased_le64_t*)chunk_tab_data;
- for (i = 0; i < num_needed_chunk_entries; i++)
- chunk_offsets_p[i] = le64_to_cpu(raw_entries[i]);
+ /* Now fill in chunk_offsets from the entries we have read in
+ * chunk_tab_data. Careful: chunk_offsets aliases
+ * chunk_tab_data, which breaks C's aliasing rules when we read
+ * 32-bit integers and store 64-bit integers. But since the
+ * operations are safe as long as the compiler doesn't mess with
+ * their order, we use the gcc may_alias extension to tell the
+ * compiler that loads from the 32-bit integers may alias stores
+ * to the 64-bit integers. */
+ {
+ typedef le64 __attribute__((may_alias)) aliased_le64_t;
+ typedef le32 __attribute__((may_alias)) aliased_le32_t;
+ u64 * const chunk_offsets_p = chunk_offsets + (start_chunk == 0);
+ u64 i;
+
+ if (chunk_entry_size == 4) {
+ aliased_le32_t *raw_entries = (aliased_le32_t*)chunk_tab_data;
+ for (i = 0; i < num_needed_chunk_entries; i++)
+ chunk_offsets_p[i] = le32_to_cpu(raw_entries[i]);
+ } else {
+ aliased_le64_t *raw_entries = (aliased_le64_t*)chunk_tab_data;
+ for (i = 0; i < num_needed_chunk_entries; i++)
+ chunk_offsets_p[i] = le64_to_cpu(raw_entries[i]);
+ }