*
* WIM files can optionally contain a table of SHA1 message digests at the end,
* one digest for each chunk of the file of some specified size (often 10 MB).
- * This file implements the checking and writing this table.
+ * This file implements the checking and writing of this table.
*/
/*
- * Copyright (C) 2012 Eric Biggers
+ * Copyright (C) 2012, 2013 Eric Biggers
*
* This file is part of wimlib, a library for working with WIM files.
*
*/
#include "wimlib_internal.h"
-#include "io.h"
+#include "buffer_io.h"
#include "sha1.h"
/* Size, in bytes, of each SHA1-summed chunk, when wimlib writes integrity
u8 sha1sums[0][20];
};
-static int calculate_chunk_sha1(FILE *fp, size_t this_chunk_size,
- off_t offset, u8 sha1_md[])
+static int
+calculate_chunk_sha1(FILE *fp, size_t this_chunk_size,
+ off_t offset, u8 sha1_md[])
{
int ret;
u8 buf[BUFFER_SIZE];
/*
- * Reads the integrity table from a WIM file.
+ * read_integrity_table: - Reads the integrity table from a WIM file.
*
* @res_entry:
* The resource entry that specifies the location of the integrity table.
* data.
* * WIMLIB_ERR_READ: Could not read the integrity data from the WIM file.
*/
-static int read_integrity_table(const struct resource_entry *res_entry,
- FILE *fp,
- u64 num_checked_bytes,
- struct integrity_table **table_ret)
+static int
+read_integrity_table(const struct resource_entry *res_entry,
+ FILE *fp,
+ u64 num_checked_bytes,
+ struct integrity_table **table_ret)
{
struct integrity_table *table = NULL;
int ret = 0;
}
/*
+ * calculate_integrity_table():
+ *
* Calculates an integrity table for the data in a file beginning at offset 208
* (WIM_HEADER_DISK_SIZE).
*
* Offset of byte after the last byte to be checked.
*
* @old_table:
- * If non-NULL, a pointer to the table containing previously contained
+ * If non-NULL, a pointer to the table containing the previously calculated
* integrity data for a prefix of this file.
*
* @old_check_end:
*
* Returns 0 on success; nonzero on failure.
*/
-static int calculate_integrity_table(FILE *fp,
- off_t new_check_end,
- const struct integrity_table *old_table,
- off_t old_check_end,
- wimlib_progress_func_t progress_func,
- struct integrity_table **integrity_table_ret)
+static int
+calculate_integrity_table(FILE *fp,
+ off_t new_check_end,
+ const struct integrity_table *old_table,
+ off_t old_check_end,
+ wimlib_progress_func_t progress_func,
+ struct integrity_table **integrity_table_ret)
{
int ret = 0;
size_t chunk_size = INTEGRITY_CHUNK_SIZE;
}
/*
+ * write_integrity_table():
+ *
* Writes a WIM integrity table (a list of SHA1 message digests of raw 10 MiB
* chunks of the file).
*
* * WIMLIB_ERR_READ: Could not read a chunk of data that needed
* to be checked.
*/
-int write_integrity_table(FILE *fp,
- struct resource_entry *integrity_res_entry,
- off_t new_lookup_table_end,
- off_t old_lookup_table_end,
- wimlib_progress_func_t progress_func)
+int
+write_integrity_table(FILE *fp,
+ struct resource_entry *integrity_res_entry,
+ off_t new_lookup_table_end,
+ off_t old_lookup_table_end,
+ wimlib_progress_func_t progress_func)
{
struct integrity_table *old_table;
struct integrity_table *new_table;
}
/*
+ * verify_integrity():
+ *
* Checks a WIM for consistency with the integrity table.
*
* @fp:
* were no inconsistencies.
* -1 (WIM_INTEGRITY_NOT_OK) if the WIM failed the integrity check.
*/
-static int verify_integrity(FILE *fp, const char *filename,
- const struct integrity_table *table,
- u64 bytes_to_check,
- wimlib_progress_func_t progress_func)
+static int
+verify_integrity(FILE *fp, const tchar *filename,
+ const struct integrity_table *table,
+ u64 bytes_to_check,
+ wimlib_progress_func_t progress_func)
{
int ret;
u64 offset = WIM_HEADER_DISK_SIZE;
/*
+ * check_wim_integrity():
+ *
* Verifies the integrity of the WIM by making sure the SHA1 message digests of
* ~10 MiB chunks of the WIM match up with the values given in the integrity
* table.
* -2 (WIM_INTEGRITY_NONEXISTENT) if the WIM contains no integrity
* information.
*/
-int check_wim_integrity(WIMStruct *w, wimlib_progress_func_t progress_func)
+int
+check_wim_integrity(WIMStruct *w, wimlib_progress_func_t progress_func)
{
int ret;
u64 bytes_to_check;