... and use it in wimlib_join() and wimlib_overwrite().
Remove the guid_set_explicitly hack.
* already implied for wimlib_overwrite(). */
#define WIMLIB_WRITE_FLAG_STREAMS_OK 0x00000400
* already implied for wimlib_overwrite(). */
#define WIMLIB_WRITE_FLAG_STREAMS_OK 0x00000400
-#define WIMLIB_WRITE_FLAG_RESERVED 0x00000800
+/** For wimlib_write() and wimlib_write_to_fd(), retain the same GUID instead of
+ * generating a new one. This is already the default for wimlib_overwrite().
+ */
+#define WIMLIB_WRITE_FLAG_RETAIN_GUID 0x00000800
/**
* When writing streams in the resulting WIM file, pack multiple streams into a
/**
* When writing streams in the resulting WIM file, pack multiple streams into a
- u8 guid_set_explicitly : 1;
-
/* One of WIMLIB_COMPRESSION_TYPE_*, cached from the header flags. */
u8 compression_type;
/* One of WIMLIB_COMPRESSION_TYPE_*, cached from the header flags. */
u8 compression_type;
WIMLIB_WRITE_FLAG_IGNORE_READONLY_FLAG | \
WIMLIB_WRITE_FLAG_SKIP_EXTERNAL_WIMS | \
WIMLIB_WRITE_FLAG_STREAMS_OK | \
WIMLIB_WRITE_FLAG_IGNORE_READONLY_FLAG | \
WIMLIB_WRITE_FLAG_SKIP_EXTERNAL_WIMS | \
WIMLIB_WRITE_FLAG_STREAMS_OK | \
- WIMLIB_WRITE_FLAG_RESERVED | \
+ WIMLIB_WRITE_FLAG_RETAIN_GUID | \
WIMLIB_WRITE_FLAG_PACK_STREAMS)
#if defined(HAVE_SYS_FILE_H) && defined(HAVE_FLOCK)
WIMLIB_WRITE_FLAG_PACK_STREAMS)
#if defined(HAVE_SYS_FILE_H) && defined(HAVE_FLOCK)
if (ret)
goto out_free_swms;
if (ret)
goto out_free_swms;
- swm0->guid_set_explicitly = 1;
-
/* It is reasonably safe to provide, WIMLIB_WRITE_FLAG_STREAMS_OK, as we
* have verified that the specified split WIM parts form a spanned set.
*/
ret = wimlib_write(swm0, output_path, WIMLIB_ALL_IMAGES,
/* It is reasonably safe to provide, WIMLIB_WRITE_FLAG_STREAMS_OK, as we
* have verified that the specified split WIM parts form a spanned set.
*/
ret = wimlib_write(swm0, output_path, WIMLIB_ALL_IMAGES,
- wim_write_flags | WIMLIB_WRITE_FLAG_STREAMS_OK,
+ wim_write_flags |
+ WIMLIB_WRITE_FLAG_STREAMS_OK |
+ WIMLIB_WRITE_FLAG_RETAIN_GUID,
1, progress_func);
out_free_swms:
for (i = 0; i < num_additional_swms + 1; i++)
1, progress_func);
out_free_swms:
for (i = 0; i < num_additional_swms + 1; i++)
- if (which & WIMLIB_CHANGE_GUID) {
+ if (which & WIMLIB_CHANGE_GUID)
memcpy(wim->hdr.guid, info->guid, WIM_GUID_LEN);
memcpy(wim->hdr.guid, info->guid, WIM_GUID_LEN);
- wim->guid_set_explicitly = 1;
- }
if (which & WIMLIB_CHANGE_BOOT_INDEX) {
if (info->boot_index > wim->hdr.image_count) {
if (which & WIMLIB_CHANGE_BOOT_INDEX) {
if (info->boot_index > wim->hdr.image_count) {
if (write_flags & WIMLIB_WRITE_FLAG_STREAMS_OK)
DEBUG("\tSTREAMS_OK");
if (write_flags & WIMLIB_WRITE_FLAG_STREAMS_OK)
DEBUG("\tSTREAMS_OK");
+ if (write_flags & WIMLIB_WRITE_FLAG_RETAIN_GUID)
+ DEBUG("\tRETAIN_GUID");
+
if (write_flags & WIMLIB_WRITE_FLAG_PACK_STREAMS)
DEBUG("\tPACK_STREAMS");
if (write_flags & WIMLIB_WRITE_FLAG_PACK_STREAMS)
DEBUG("\tPACK_STREAMS");
DEBUG("Number of threads: %u", num_threads);
DEBUG("Progress function: %s", (progress_func ? "yes" : "no"));
DEBUG("Stream list: %s", (stream_list_override ? "specified" : "autodetect"));
DEBUG("Number of threads: %u", num_threads);
DEBUG("Progress function: %s", (progress_func ? "yes" : "no"));
DEBUG("Stream list: %s", (stream_list_override ? "specified" : "autodetect"));
- DEBUG("GUID: %s", ((guid || wim->guid_set_explicitly) ?
- "specified" : "generate new"));
+ DEBUG("GUID: %s", (guid ||
+ (write_flags & WIMLIB_WRITE_FLAG_RETAIN_GUID)) ?
+ "explicit" : "generate new");
/* Internally, this is always called with a valid part number and total
* parts. */
/* Internally, this is always called with a valid part number and total
* parts. */
/* Use GUID if specified; otherwise generate a new one. */
if (guid)
memcpy(wim->hdr.guid, guid, WIMLIB_GUID_LEN);
/* Use GUID if specified; otherwise generate a new one. */
if (guid)
memcpy(wim->hdr.guid, guid, WIMLIB_GUID_LEN);
- else if (!wim->guid_set_explicitly)
+ else if (!(write_flags & WIMLIB_WRITE_FLAG_RETAIN_GUID))
randomize_byte_array(wim->hdr.guid, WIMLIB_GUID_LEN);
/* Clear references to resources that have not been written yet. */
randomize_byte_array(wim->hdr.guid, WIMLIB_GUID_LEN);
/* Clear references to resources that have not been written yet. */
tmpfile[wim_name_len + 9] = T('\0');
ret = wimlib_write(wim, tmpfile, WIMLIB_ALL_IMAGES,
tmpfile[wim_name_len + 9] = T('\0');
ret = wimlib_write(wim, tmpfile, WIMLIB_ALL_IMAGES,
- write_flags | WIMLIB_WRITE_FLAG_FSYNC,
+ write_flags |
+ WIMLIB_WRITE_FLAG_FSYNC |
+ WIMLIB_WRITE_FLAG_RETAIN_GUID,
num_threads, progress_func);
if (ret) {
tunlink(tmpfile);
num_threads, progress_func);
if (ret) {
tunlink(tmpfile);