From 143db75c035e6ecaca451ce70a4ed58a01102b43 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sat, 11 May 2013 20:42:55 -0500 Subject: [PATCH 1/1] add_image => add --- src/add_image.c | 18 ++++----- src/dentry.h | 2 +- src/ntfs-apply.c | 2 +- src/ntfs-capture.c | 8 ++-- src/unix_capture.c | 16 ++++---- src/update_image.c | 37 +++++++++--------- src/wimlib.h | 89 ++++++++++++++++++++++++------------------- src/wimlib_internal.h | 8 ++-- src/win32.c | 28 +++++++------- 9 files changed, 110 insertions(+), 98 deletions(-) diff --git a/src/add_image.c b/src/add_image.c index dbc97e66..263c2e75 100644 --- a/src/add_image.c +++ b/src/add_image.c @@ -121,7 +121,7 @@ out: static struct wimlib_update_command * capture_sources_to_add_cmds(const struct wimlib_capture_source *sources, size_t num_sources, - int add_image_flags, + int add_flags, const struct wimlib_capture_config *config) { struct wimlib_update_command *add_cmds; @@ -137,7 +137,7 @@ capture_sources_to_add_cmds(const struct wimlib_capture_source *sources, sources[i].fs_source_path, sources[i].wim_target_path); add_cmds[i].op = WIMLIB_UPDATE_OP_ADD; - add_cmds[i].add.add_flags = add_image_flags; + add_cmds[i].add.add_flags = add_flags; add_cmds[i].add.config = (struct wimlib_capture_config*)config; add_cmds[i].add.fs_source_path = sources[i].fs_source_path; add_cmds[i].add.wim_target_path = sources[i].wim_target_path; @@ -154,14 +154,14 @@ wimlib_add_image_multisource(WIMStruct *wim, size_t num_sources, const tchar *name, const struct wimlib_capture_config *config, - int add_image_flags, + int add_flags, wimlib_progress_func_t progress_func) { int ret; struct wimlib_update_command *add_cmds; - DEBUG("Adding image \"%"TS"\" from %zu sources (add_image_flags=%#x)", - name, num_sources, add_image_flags); + DEBUG("Adding image \"%"TS"\" from %zu sources (add_flags=%#x)", + name, num_sources, add_flags); /* Add the new image (initially empty) */ ret = wimlib_add_empty_image(wim, name, NULL); @@ -170,7 +170,7 @@ wimlib_add_image_multisource(WIMStruct *wim, /* Translate the "capture sources" into generic update commands. */ add_cmds = capture_sources_to_add_cmds(sources, num_sources, - add_image_flags, config); + add_flags, config); if (!add_cmds) { ret = WIMLIB_ERR_NOMEM; goto out_delete_image; @@ -184,7 +184,7 @@ wimlib_add_image_multisource(WIMStruct *wim, goto out_delete_image; /* Success; set boot index if requested. */ - if (add_image_flags & WIMLIB_ADD_IMAGE_FLAG_BOOT) + if (add_flags & WIMLIB_ADD_FLAG_BOOT) wim->hdr.boot_idx = wim->hdr.image_count; ret = 0; goto out; @@ -204,7 +204,7 @@ wimlib_add_image(WIMStruct *wim, const tchar *source, const tchar *name, const struct wimlib_capture_config *config, - int add_image_flags, + int add_flags, wimlib_progress_func_t progress_func) { /* Delegate the work to the more general wimlib_add_image_multisource(). @@ -215,6 +215,6 @@ wimlib_add_image(WIMStruct *wim, .reserved = 0, }; return wimlib_add_image_multisource(wim, &capture_src, 1, name, - config, add_image_flags, + config, add_flags, progress_func); } diff --git a/src/dentry.h b/src/dentry.h index d3060be9..58adb5e6 100644 --- a/src/dentry.h +++ b/src/dentry.h @@ -461,7 +461,7 @@ inode_remove_ads(struct wim_inode *inode, u16 idx, #define WIMLIB_UNIX_DATA_TAG_UTF16LE_NBYTES (sizeof(WIMLIB_UNIX_DATA_TAG_UTF16LE) - 1) /* Format for special alternate data stream entries to store UNIX data for files - * and directories (see: WIMLIB_ADD_IMAGE_FLAG_UNIX_DATA) */ + * and directories (see: WIMLIB_ADD_FLAG_UNIX_DATA) */ struct wimlib_unix_data { u16 version; /* Must be 0 */ u16 uid; diff --git a/src/ntfs-apply.c b/src/ntfs-apply.c index 35760400..3881f0f4 100644 --- a/src/ntfs-apply.c +++ b/src/ntfs-apply.c @@ -117,7 +117,7 @@ write_ntfs_data_streams(ntfs_inode *ni, struct wim_dentry *dentry, for (;;) { if (stream_name_nbytes) { /* Skip special UNIX data entries (see documentation for - * WIMLIB_ADD_IMAGE_FLAG_UNIX_DATA) */ + * WIMLIB_ADD_FLAG_UNIX_DATA) */ if (stream_name_nbytes == WIMLIB_UNIX_DATA_TAG_UTF16LE_NBYTES && !memcmp(stream_name, WIMLIB_UNIX_DATA_TAG_UTF16LE, diff --git a/src/ntfs-capture.c b/src/ntfs-capture.c index 9797e338..b0258a89 100644 --- a/src/ntfs-capture.c +++ b/src/ntfs-capture.c @@ -546,7 +546,7 @@ build_dentry_tree_ntfs_recursive(struct wim_dentry **root_ret, if (exclude_path(path, path_len, params->config, false)) { /* Exclude a file or directory tree based on the capture * configuration file */ - if ((params->add_image_flags & WIMLIB_ADD_IMAGE_FLAG_EXCLUDE_VERBOSE) + if ((params->add_flags & WIMLIB_ADD_FLAG_EXCLUDE_VERBOSE) && params->progress_func) { union wimlib_progress_info info; @@ -572,7 +572,7 @@ build_dentry_tree_ntfs_recursive(struct wim_dentry **root_ret, return WIMLIB_ERR_NTFS_3G; } - if ((params->add_image_flags & WIMLIB_ADD_IMAGE_FLAG_VERBOSE) + if ((params->add_flags & WIMLIB_ADD_FLAG_VERBOSE) && params->progress_func) { union wimlib_progress_info info; @@ -647,11 +647,11 @@ build_dentry_tree_ntfs_recursive(struct wim_dentry **root_ret, /* Reparse-point fixups are a no-op because in NTFS-3g capture mode we * only allow capturing an entire volume. */ - if (params->add_image_flags & WIMLIB_ADD_IMAGE_FLAG_RPFIX && + if (params->add_flags & WIMLIB_ADD_FLAG_RPFIX && inode_is_symlink(inode)) inode->i_not_rpfixed = 0; - if (!(params->add_image_flags & WIMLIB_ADD_IMAGE_FLAG_NO_ACLS)) { + if (!(params->add_flags & WIMLIB_ADD_FLAG_NO_ACLS)) { /* Get security descriptor */ char _sd[1]; char *sd = _sd; diff --git a/src/unix_capture.c b/src/unix_capture.c index f3e9f0e5..4f526f7d 100644 --- a/src/unix_capture.c +++ b/src/unix_capture.c @@ -147,7 +147,7 @@ unix_capture_symlink(struct wim_dentry **root_p, dest[deref_name_len] = '\0'; DEBUG("Read symlink `%s'", dest); - if ((params->add_image_flags & WIMLIB_ADD_IMAGE_FLAG_RPFIX) && + if ((params->add_flags & WIMLIB_ADD_FLAG_RPFIX) && dest[0] == '/') { dest = capture_fixup_absolute_symlink(dest, @@ -196,7 +196,7 @@ unix_build_dentry_tree_recursive(struct wim_dentry **root_ret, struct wim_inode *inode; if (exclude_path(path, path_len, params->config, true)) { - if ((params->add_image_flags & WIMLIB_ADD_IMAGE_FLAG_EXCLUDE_VERBOSE) + if ((params->add_flags & WIMLIB_ADD_FLAG_EXCLUDE_VERBOSE) && params->progress_func) { union wimlib_progress_info info; @@ -207,7 +207,7 @@ unix_build_dentry_tree_recursive(struct wim_dentry **root_ret, goto out; } - if ((params->add_image_flags & WIMLIB_ADD_IMAGE_FLAG_VERBOSE) + if ((params->add_flags & WIMLIB_ADD_FLAG_VERBOSE) && params->progress_func) { union wimlib_progress_info info; @@ -218,8 +218,8 @@ unix_build_dentry_tree_recursive(struct wim_dentry **root_ret, struct stat stbuf; int (*stat_fn)(const char *restrict, struct stat *restrict); - if ((params->add_image_flags & WIMLIB_ADD_IMAGE_FLAG_DEREFERENCE) || - (params->add_image_flags & WIMLIB_ADD_IMAGE_FLAG_ROOT)) + if ((params->add_flags & WIMLIB_ADD_FLAG_DEREFERENCE) || + (params->add_flags & WIMLIB_ADD_FLAG_ROOT)) stat_fn = stat; else stat_fn = lstat; @@ -258,7 +258,7 @@ unix_build_dentry_tree_recursive(struct wim_dentry **root_ret, inode->i_last_access_time = unix_timestamp_to_wim(stbuf.st_atime); #endif inode->i_resolved = 1; - if (params->add_image_flags & WIMLIB_ADD_IMAGE_FLAG_UNIX_DATA) { + if (params->add_flags & WIMLIB_ADD_FLAG_UNIX_DATA) { ret = inode_set_unix_data(inode, stbuf.st_uid, stbuf.st_gid, stbuf.st_mode, @@ -267,7 +267,7 @@ unix_build_dentry_tree_recursive(struct wim_dentry **root_ret, if (ret) goto out; } - params->add_image_flags &= ~WIMLIB_ADD_IMAGE_FLAG_ROOT; + params->add_flags &= ~WIMLIB_ADD_FLAG_ROOT; if (S_ISREG(stbuf.st_mode)) ret = unix_capture_regular_file(path, stbuf.st_size, inode, params->lookup_table); @@ -320,7 +320,7 @@ unix_build_dentry_tree(struct wim_dentry **root_ret, return WIMLIB_ERR_STAT; } - if ((params->add_image_flags & WIMLIB_ADD_IMAGE_FLAG_ROOT) && + if ((params->add_flags & WIMLIB_ADD_FLAG_ROOT) && !S_ISDIR(root_stbuf.st_mode)) { ERROR("Root of capture \"%s\" is not a directory", diff --git a/src/update_image.c b/src/update_image.c index 96583927..6ad963f0 100644 --- a/src/update_image.c +++ b/src/update_image.c @@ -207,7 +207,7 @@ execute_add_command(WIMStruct *wim, imd = wim->image_metadata[wim->current_image - 1]; - if (add_flags & WIMLIB_ADD_IMAGE_FLAG_NTFS) { + if (add_flags & WIMLIB_ADD_FLAG_NTFS) { #ifdef WITH_NTFS_3G capture_tree = build_dentry_tree_ntfs; extra_arg = &ntfs_vol; @@ -243,7 +243,7 @@ execute_add_command(WIMStruct *wim, params.inode_table = &inode_table; params.sd_set = &sd_set; params.config = config; - params.add_image_flags = add_flags; + params.add_flags = add_flags; params.progress_func = progress_func; params.extra_arg = extra_arg; @@ -257,7 +257,7 @@ execute_add_command(WIMStruct *wim, config->_prefix_num_tchars = tstrlen(fs_source_path); if (wim_target_path[0] == T('\0')) - add_flags |= WIMLIB_ADD_IMAGE_FLAG_ROOT; + add_flags |= WIMLIB_ADD_FLAG_ROOT; ret = (*capture_tree)(&branch, fs_source_path, ¶ms); if (ret) { ERROR("Failed to build dentry tree for \"%"TS"\"", @@ -287,7 +287,7 @@ execute_add_command(WIMStruct *wim, inode_table_prepare_inode_list(&inode_table, &imd->inode_list); ret = 0; rollback_sd = false; - if (add_flags & WIMLIB_ADD_IMAGE_FLAG_RPFIX) + if (add_flags & WIMLIB_ADD_FLAG_RPFIX) wim->hdr.flags |= WIM_HDR_FLAG_RP_FIX; goto out_destroy_sd_set; out_ntfs_umount: @@ -502,30 +502,30 @@ check_add_command(struct wimlib_update_command *cmd, #ifdef __WIN32__ /* Check for flags not supported on Windows */ - if (add_flags & WIMLIB_ADD_IMAGE_FLAG_NTFS) { + if (add_flags & WIMLIB_ADD_FLAG_NTFS) { ERROR("wimlib was compiled without support for NTFS-3g, so"); ERROR("we cannot capture a WIM image directly from a NTFS volume"); return WIMLIB_ERR_UNSUPPORTED; } - if (add_flags & WIMLIB_ADD_IMAGE_FLAG_UNIX_DATA) { + if (add_flags & WIMLIB_ADD_FLAG_UNIX_DATA) { ERROR("Capturing UNIX-specific data is not supported on Windows"); return WIMLIB_ERR_INVALID_PARAM; } - if (add_flags & WIMLIB_ADD_IMAGE_FLAG_DEREFERENCE) { + if (add_flags & WIMLIB_ADD_FLAG_DEREFERENCE) { ERROR("Dereferencing symbolic links is not supported on Windows"); return WIMLIB_ERR_INVALID_PARAM; } #endif /* VERBOSE implies EXCLUDE_VERBOSE */ - if (add_flags & WIMLIB_ADD_IMAGE_FLAG_VERBOSE) - add_flags |= WIMLIB_ADD_IMAGE_FLAG_EXCLUDE_VERBOSE; + if (add_flags & WIMLIB_ADD_FLAG_VERBOSE) + add_flags |= WIMLIB_ADD_FLAG_EXCLUDE_VERBOSE; /* Check for contradictory reparse point fixup flags */ - if ((add_flags & (WIMLIB_ADD_IMAGE_FLAG_RPFIX | - WIMLIB_ADD_IMAGE_FLAG_NORPFIX)) == - (WIMLIB_ADD_IMAGE_FLAG_RPFIX | - WIMLIB_ADD_IMAGE_FLAG_NORPFIX)) + if ((add_flags & (WIMLIB_ADD_FLAG_RPFIX | + WIMLIB_ADD_FLAG_NORPFIX)) == + (WIMLIB_ADD_FLAG_RPFIX | + WIMLIB_ADD_FLAG_NORPFIX)) { ERROR("Cannot specify RPFIX and NORPFIX flags " "at the same time!"); @@ -533,30 +533,31 @@ check_add_command(struct wimlib_update_command *cmd, } /* Set default behavior on reparse point fixups if requested */ - if ((add_flags & (WIMLIB_ADD_IMAGE_FLAG_RPFIX | - WIMLIB_ADD_IMAGE_FLAG_NORPFIX)) == 0) + if ((add_flags & (WIMLIB_ADD_FLAG_RPFIX | + WIMLIB_ADD_FLAG_NORPFIX)) == 0) { /* Do reparse-point fixups by default if we are capturing an * entire image and either the header flag is set from previous * images, or if this is the first image being added. */ if (is_entire_image && ((hdr->flags & WIM_HDR_FLAG_RP_FIX) || hdr->image_count == 1)) - add_flags |= WIMLIB_ADD_IMAGE_FLAG_RPFIX; + add_flags |= WIMLIB_ADD_FLAG_RPFIX; } if (!is_entire_image) { - if (add_flags & WIMLIB_ADD_IMAGE_FLAG_NTFS) { + if (add_flags & WIMLIB_ADD_FLAG_NTFS) { ERROR("Cannot add directly from a NTFS volume " "when not capturing a full image!"); return WIMLIB_ERR_INVALID_PARAM; } - if (add_flags & WIMLIB_ADD_IMAGE_FLAG_RPFIX) { + if (add_flags & WIMLIB_ADD_FLAG_RPFIX) { ERROR("Cannot do reparse point fixups when " "not capturing a full image!"); return WIMLIB_ERR_INVALID_PARAM; } } + /* We may have modified the add flags. */ cmd->add.add_flags = add_flags; return 0; } diff --git a/src/wimlib.h b/src/wimlib.h index a433a9bc..48922f55 100644 --- a/src/wimlib.h +++ b/src/wimlib.h @@ -142,7 +142,7 @@ * wimlib_add_image(). This can be done with a ::WIMStruct gotten from * wimlib_open_wim() or from wimlib_create_new_wim(). wimlib_add_image() can * also capture a WIM image directly from a NTFS volume if you provide the - * ::WIMLIB_ADD_IMAGE_FLAG_NTFS flag, provided that wimlib was not compiled with + * ::WIMLIB_ADD_FLAG_NTFS flag, provided that wimlib was not compiled with * the --without-ntfs-3g flag. * * To extract an image from a WIM file, call wimlib_extract_image(). You may @@ -345,7 +345,7 @@ enum wimlib_progress_msg { /** A directory or file is being scanned. @a info will point to * ::wimlib_progress_info.scan, and its @a cur_path member will be - * valid. This message is only sent if ::WIMLIB_ADD_IMAGE_FLAG_VERBOSE + * valid. This message is only sent if ::WIMLIB_ADD_FLAG_VERBOSE * is passed to wimlib_add_image(). */ WIMLIB_PROGRESS_MSG_SCAN_DENTRY, @@ -665,49 +665,49 @@ struct wimlib_capture_config { /***************************** - * WIMLIB_ADD_IMAGE_FLAG_* * + * WIMLIB_ADD_FLAG_* * *****************************/ /** Directly capture a NTFS volume rather than a generic directory. This flag - * cannot be combined with ::WIMLIB_ADD_IMAGE_FLAG_DEREFERENCE or - * ::WIMLIB_ADD_IMAGE_FLAG_UNIX_DATA. */ -#define WIMLIB_ADD_IMAGE_FLAG_NTFS 0x00000001 + * cannot be combined with ::WIMLIB_ADD_FLAG_DEREFERENCE or + * ::WIMLIB_ADD_FLAG_UNIX_DATA. */ +#define WIMLIB_ADD_FLAG_NTFS 0x00000001 /** Follow symlinks; archive and dump the files they point to. Cannot be used - * with ::WIMLIB_ADD_IMAGE_FLAG_NTFS. */ -#define WIMLIB_ADD_IMAGE_FLAG_DEREFERENCE 0x00000002 + * with ::WIMLIB_ADD_FLAG_NTFS. */ +#define WIMLIB_ADD_FLAG_DEREFERENCE 0x00000002 /** Call the progress function with the message * ::WIMLIB_PROGRESS_MSG_SCAN_DENTRY when each directory or file is starting to * be scanned. */ -#define WIMLIB_ADD_IMAGE_FLAG_VERBOSE 0x00000004 +#define WIMLIB_ADD_FLAG_VERBOSE 0x00000004 /** Mark the image being added as the bootable image of the WIM. */ -#define WIMLIB_ADD_IMAGE_FLAG_BOOT 0x00000008 +#define WIMLIB_ADD_FLAG_BOOT 0x00000008 /** Store the UNIX owner, group, and mode. This is done by adding a special * alternate data stream to each regular file, symbolic link, and directory to * contain this information. Please note that this flag is for convenience * only; Microsoft's @a imagex.exe will not understand this special information. - * This flag cannot be combined with ::WIMLIB_ADD_IMAGE_FLAG_NTFS. */ -#define WIMLIB_ADD_IMAGE_FLAG_UNIX_DATA 0x00000010 + * This flag cannot be combined with ::WIMLIB_ADD_FLAG_NTFS. */ +#define WIMLIB_ADD_FLAG_UNIX_DATA 0x00000010 /** Do not capture security descriptors. Only has an effect in NTFS capture * mode, or in Win32 native builds. */ -#define WIMLIB_ADD_IMAGE_FLAG_NO_ACLS 0x00000020 +#define WIMLIB_ADD_FLAG_NO_ACLS 0x00000020 /** Fail immediately if the full security descriptor of any file or directory * cannot be accessed. Only has an effect in Win32 native builds. The default * behavior without this flag is to first try omitting the SACL from the * security descriptor, then to try omitting the security descriptor entirely. * */ -#define WIMLIB_ADD_IMAGE_FLAG_STRICT_ACLS 0x00000040 +#define WIMLIB_ADD_FLAG_STRICT_ACLS 0x00000040 /** Call the progress function with the message * ::WIMLIB_PROGRESS_MSG_SCAN_DENTRY when a directory or file is excluded from * capture. This is a subset of the messages provided by - * ::WIMLIB_ADD_IMAGE_FLAG_VERBOSE. */ -#define WIMLIB_ADD_IMAGE_FLAG_EXCLUDE_VERBOSE 0x00000080 + * ::WIMLIB_ADD_FLAG_VERBOSE. */ +#define WIMLIB_ADD_FLAG_EXCLUDE_VERBOSE 0x00000080 /** Reparse-point fixups: Modify absolute symbolic links (or junction points, * in the case of Windows) that point inside the directory being captured to @@ -719,11 +719,22 @@ struct wimlib_capture_config { * the WIM header or if this is the first image being added. * WIM_HDR_FLAG_RP_FIX is set if the first image in a WIM is captured with * reparse point fixups enabled and currently cannot be unset. */ -#define WIMLIB_ADD_IMAGE_FLAG_RPFIX 0x00000100 +#define WIMLIB_ADD_FLAG_RPFIX 0x00000100 /** Don't do reparse point fixups. The default behavior is described in the - * documentation for ::WIMLIB_ADD_IMAGE_FLAG_RPFIX. */ -#define WIMLIB_ADD_IMAGE_FLAG_NORPFIX 0x00000200 + * documentation for ::WIMLIB_ADD_FLAG_RPFIX. */ +#define WIMLIB_ADD_FLAG_NORPFIX 0x00000200 + +#define WIMLIB_ADD_IMAGE_FLAG_NTFS WIMLIB_ADD_FLAG_NTFS +#define WIMLIB_ADD_IMAGE_FLAG_DEREFERENCE WIMLIB_ADD_FLAG_DEREFERENCE +#define WIMLIB_ADD_IMAGE_FLAG_VERBOSE WIMLIB_ADD_FLAG_VERBOSE +#define WIMLIB_ADD_IMAGE_FLAG_BOOT WIMLIB_ADD_FLAG_BOOT +#define WIMLIB_ADD_IMAGE_FLAG_UNIX_DATA WIMLIB_ADD_FLAG_UNIX_DATA +#define WIMLIB_ADD_IMAGE_FLAG_NO_ACLS WIMLIB_ADD_FLAG_NO_ACLS +#define WIMLIB_ADD_IMAGE_FLAG_STRICT_ACLS WIMLIB_ADD_FLAG_STRICT_ACLS +#define WIMLIB_ADD_IMAGE_FLAG_EXCLUDE_VERBOSE WIMLIB_ADD_FLAG_EXCLUDE_VERBOSE +#define WIMLIB_ADD_IMAGE_FLAG_RPFIX WIMLIB_ADD_FLAG_RPFIX +#define WIMLIB_ADD_IMAGE_FLAG_NORPFIX WIMLIB_ADD_FLAG_NORPFIX /** Do not issue an error if the path to delete does not exist. */ #define WIMLIB_DELETE_FLAG_FORCE 0x00000001 @@ -764,7 +775,7 @@ struct wimlib_capture_config { /** Read the WIM file sequentially while extracting the image. */ #define WIMLIB_EXTRACT_FLAG_SEQUENTIAL 0x00000010 -/** Extract special UNIX data captured with ::WIMLIB_ADD_IMAGE_FLAG_UNIX_DATA. +/** Extract special UNIX data captured with ::WIMLIB_ADD_FLAG_UNIX_DATA. * Cannot be used with ::WIMLIB_EXTRACT_FLAG_NTFS. */ #define WIMLIB_EXTRACT_FLAG_UNIX_DATA 0x00000020 @@ -779,7 +790,7 @@ struct wimlib_capture_config { * not have permission to set the desired one. */ #define WIMLIB_EXTRACT_FLAG_STRICT_ACLS 0x00000080 -/* Extract equivalent to ::WIMLIB_ADD_IMAGE_FLAG_RPFIX; force reparse-point +/* Extract equivalent to ::WIMLIB_ADD_FLAG_RPFIX; force reparse-point * fixups on, so absolute symbolic links or junction points will be fixed to be * absolute relative to the actual extraction root. Done by default if * WIM_HDR_FLAG_RP_FIX is set in the WIM header. This flag may only be @@ -815,7 +826,7 @@ struct wimlib_capture_config { #define WIMLIB_MOUNT_FLAG_STREAM_INTERFACE_WINDOWS 0x00000010 /** Use UNIX file owners, groups, and modes if available in the WIM (see - * ::WIMLIB_ADD_IMAGE_FLAG_UNIX_DATA). */ + * ::WIMLIB_ADD_FLAG_UNIX_DATA). */ #define WIMLIB_MOUNT_FLAG_UNIX_DATA 0x00000020 /** Allow other users to see the mounted filesystem. (this passes the @c @@ -1047,7 +1058,7 @@ wimlib_add_empty_image(WIMStruct *wim, * * See the manual page for the @b wimlib-imagex program for more information * about the "normal" capture mode versus the NTFS capture mode (entered by - * providing the flag ::WIMLIB_ADD_IMAGE_FLAG_NTFS). + * providing the flag ::WIMLIB_ADD_FLAG_NTFS). * * Note that @b no changes are committed to the underlying WIM file (if * any) until wimlib_write() or wimlib_overwrite() is called. @@ -1064,8 +1075,8 @@ wimlib_add_empty_image(WIMStruct *wim, * Capture configuration that specifies files, directories, or path globs * to exclude from being captured. If @c NULL, a dummy configuration where * no paths are treated specially is used. - * @param add_image_flags - * Bitwise OR of flags prefixed with WIMLIB_ADD_IMAGE_FLAG. + * @param add_flags + * Bitwise OR of flags prefixed with WIMLIB_ADD_FLAG. * @param progress_func * If non-NULL, a function that will be called periodically with the * progress of the current operation. @@ -1084,34 +1095,34 @@ wimlib_add_empty_image(WIMStruct *wim, * @retval ::WIMLIB_ERR_NOMEM * Failed to allocate needed memory. * @retval ::WIMLIB_ERR_NOTDIR - * @a source is not a directory (only if ::WIMLIB_ADD_IMAGE_FLAG_NTFS was - * not specified in @a add_image_flags). + * @a source is not a directory (only if ::WIMLIB_ADD_FLAG_NTFS was + * not specified in @a add_flags). * @retval ::WIMLIB_ERR_NTFS_3G * An error was returned from a libntfs-3g function when the NTFS volume * was being opened, scanned, or closed (only if - * ::WIMLIB_ADD_IMAGE_FLAG_NTFS was specified in @a add_image_flags). + * ::WIMLIB_ADD_FLAG_NTFS was specified in @a add_flags). * @retval ::WIMLIB_ERR_OPEN * Failed to open a file or directory in the directory tree rooted at @a - * source (only if ::WIMLIB_ADD_IMAGE_FLAG_NTFS was not specified in @a - * add_image_flags). + * source (only if ::WIMLIB_ADD_FLAG_NTFS was not specified in @a + * add_flags). * @retval ::WIMLIB_ERR_READ * Failed to read a file in the directory tree rooted at @a source (only if - * ::WIMLIB_ADD_IMAGE_FLAG_NTFS was not specified in @a add_image_flags). + * ::WIMLIB_ADD_FLAG_NTFS was not specified in @a add_flags). * @retval ::WIMLIB_ERR_SPECIAL_FILE * The directory tree rooted at @a source contains a special file that is * not a directory, regular file, or symbolic link. This currently can - * only be returned if ::WIMLIB_ADD_IMAGE_FLAG_NTFS was not specified in @a - * add_image_flags, but it may be returned for unsupported NTFS files in + * only be returned if ::WIMLIB_ADD_FLAG_NTFS was not specified in @a + * add_flags, but it may be returned for unsupported NTFS files in * the future. * @retval ::WIMLIB_ERR_STAT * Failed obtain the metadata for a file or directory in the directory tree - * rooted at @a source (only if ::WIMLIB_ADD_IMAGE_FLAG_NTFS was not - * specified in @a add_image_flags). + * rooted at @a source (only if ::WIMLIB_ADD_FLAG_NTFS was not + * specified in @a add_flags). * @retval ::WIMLIB_ERR_SPLIT_UNSUPPORTED * @a wim is part of a split WIM. Adding an image to a split WIM is * unsupported. * @retval ::WIMLIB_ERR_UNSUPPORTED - * ::WIMLIB_ADD_IMAGE_FLAG_NTFS was specified in @a add_image_flags, but + * ::WIMLIB_ADD_FLAG_NTFS was specified in @a add_flags, but * wimlib was configured with the @c --without-ntfs-3g flag. */ extern int @@ -1119,7 +1130,7 @@ wimlib_add_image(WIMStruct *wim, const wimlib_tchar *source, const wimlib_tchar *name, const struct wimlib_capture_config *config, - int add_image_flags, + int add_flags, wimlib_progress_func_t progress_func); /** This function is equivalent to wimlib_add_image() except it allows for @@ -1134,7 +1145,7 @@ wimlib_add_image(WIMStruct *wim, * when trying to overlay a non-directory on a directory or when otherwise * trying to overlay multiple conflicting files to the same location in the WIM * image. It will also return ::WIMLIB_ERR_INVALID_PARAM if - * ::WIMLIB_ADD_IMAGE_FLAG_NTFS was specified in @a add_image_flags but there + * ::WIMLIB_ADD_FLAG_NTFS was specified in @a add_flags but there * was not exactly one capture source with the target being the root directory. * (In this respect, there is no advantage to using * wimlib_add_image_multisource() instead of wimlib_add_image() when requesting @@ -1145,7 +1156,7 @@ wimlib_add_image_multisource(WIMStruct *w, size_t num_sources, const wimlib_tchar *name, const struct wimlib_capture_config *config, - int add_image_flags, + int add_flags, wimlib_progress_func_t progress_func); /** diff --git a/src/wimlib_internal.h b/src/wimlib_internal.h index 55fcd8f3..bde81152 100644 --- a/src/wimlib_internal.h +++ b/src/wimlib_internal.h @@ -198,7 +198,7 @@ struct wim_header { #define WIM_HDR_FLAG_WRITE_IN_PROGRESS 0x00000040 /* Reparse point fixup flag. See docs for --rpfix and --norpfix in imagex, or - * WIMLIB_ADD_IMAGE_FLAG_{RPFIX,NORPFIX} in wimlib.h. Note that + * WIMLIB_ADD_FLAG_{RPFIX,NORPFIX} in wimlib.h. Note that * WIM_HDR_FLAG_RP_FIX is a header flag and just sets the default behavior for * the WIM; it can still be overridder on a per-image basis. But there is no * flag to set the default behavior for a specific image. */ @@ -437,8 +437,8 @@ struct add_image_params { * files should be excluded from capture or not. */ const struct wimlib_capture_config *config; - /* Flags that affect the capture operation (WIMLIB_ADD_IMAGE_FLAG_*) */ - int add_image_flags; + /* Flags that affect the capture operation (WIMLIB_ADD_FLAG_*) */ + int add_flags; /* If non-NULL, the user-supplied progress function. */ wimlib_progress_func_t progress_func; @@ -811,7 +811,7 @@ close_wim(WIMStruct *w); #define WIMLIB_WRITE_MASK_PUBLIC 0x1fffffff /* We are capturing a tree to be placed in the root of the WIM image */ -#define WIMLIB_ADD_IMAGE_FLAG_ROOT 0x80000000 +#define WIMLIB_ADD_FLAG_ROOT 0x80000000 extern int begin_write(WIMStruct *w, const tchar *path, int write_flags); diff --git a/src/win32.c b/src/win32.c index f49cbeb1..f9f42765 100644 --- a/src/win32.c +++ b/src/win32.c @@ -702,7 +702,7 @@ win32_get_security_descriptor(struct wim_dentry *dentry, struct sd_set *sd_set, const wchar_t *path, struct win32_capture_state *state, - int add_image_flags) + int add_flags) { SECURITY_INFORMATION requestedInformation; DWORD lenNeeded = 0; @@ -737,7 +737,7 @@ again: } } - if (add_image_flags & WIMLIB_ADD_IMAGE_FLAG_STRICT_ACLS) + if (add_flags & WIMLIB_ADD_FLAG_STRICT_ACLS) goto fail; switch (err) { @@ -927,7 +927,7 @@ enum rp_status { * fixup where we change it to be absolute relative to the root of the directory * tree being captured. * - * Note that this is only executed when WIMLIB_ADD_IMAGE_FLAG_RPFIX has been + * Note that this is only executed when WIMLIB_ADD_FLAG_RPFIX has been * set. * * @capture_root_ino and @capture_root_dev indicate the inode number and device @@ -1085,7 +1085,7 @@ win32_get_reparse_data(HANDLE hFile, const wchar_t *path, rpbuflen = bytesReturned; reparse_tag = le32_to_cpu(*(u32*)rpbuf); - if (params->add_image_flags & WIMLIB_ADD_IMAGE_FLAG_RPFIX && + if (params->add_flags & WIMLIB_ADD_FLAG_RPFIX && (reparse_tag == WIM_IO_REPARSE_TAG_SYMLINK || reparse_tag == WIM_IO_REPARSE_TAG_MOUNT_POINT)) { @@ -1405,12 +1405,12 @@ win32_build_dentry_tree_recursive(struct wim_dentry **root_ret, u16 not_rpfixed; if (exclude_path(path, path_num_chars, params->config, true)) { - if (params->add_image_flags & WIMLIB_ADD_IMAGE_FLAG_ROOT) { + if (params->add_flags & WIMLIB_ADD_FLAG_ROOT) { ERROR("Cannot exclude the root directory from capture"); ret = WIMLIB_ERR_INVALID_CAPTURE_CONFIG; goto out; } - if ((params->add_image_flags & WIMLIB_ADD_IMAGE_FLAG_EXCLUDE_VERBOSE) + if ((params->add_flags & WIMLIB_ADD_FLAG_EXCLUDE_VERBOSE) && params->progress_func) { union wimlib_progress_info info; @@ -1422,7 +1422,7 @@ win32_build_dentry_tree_recursive(struct wim_dentry **root_ret, goto out; } - if ((params->add_image_flags & WIMLIB_ADD_IMAGE_FLAG_VERBOSE) + if ((params->add_flags & WIMLIB_ADD_FLAG_VERBOSE) && params->progress_func) { union wimlib_progress_info info; @@ -1501,14 +1501,14 @@ win32_build_dentry_tree_recursive(struct wim_dentry **root_ret, inode->i_last_access_time = FILETIME_to_u64(&file_info.ftLastAccessTime); inode->i_resolved = 1; - params->add_image_flags &= ~WIMLIB_ADD_IMAGE_FLAG_ROOT; + params->add_flags &= ~WIMLIB_ADD_FLAG_ROOT; - if (!(params->add_image_flags & WIMLIB_ADD_IMAGE_FLAG_NO_ACLS) + if (!(params->add_flags & WIMLIB_ADD_FLAG_NO_ACLS) && (vol_flags & FILE_PERSISTENT_ACLS)) { ret = win32_get_security_descriptor(root, params->sd_set, path, state, - params->add_image_flags); + params->add_flags); if (ret) goto out_close_handle; } @@ -1558,7 +1558,7 @@ out: static void win32_do_capture_warnings(const struct win32_capture_state *state, - int add_image_flags) + int add_flags) { if (state->num_get_sacl_priv_notheld == 0 && state->num_get_sd_access_denied == 0) @@ -1581,7 +1581,7 @@ win32_do_capture_warnings(const struct win32_capture_state *state, " desired metadata has been captured exactly. However, if you\n" " do not care about capturing security descriptors correctly, then\n" " nothing more needs to be done%ls\n", - (add_image_flags & WIMLIB_ADD_IMAGE_FLAG_NO_ACLS) ? L"." : + (add_flags & WIMLIB_ADD_FLAG_NO_ACLS) ? L"." : L", although you might consider\n" " passing the --no-acls flag to `wimlib-imagex capture' or\n" " `wimlib-imagex append' to explicitly capture no security\n" @@ -1637,7 +1637,7 @@ win32_build_dentry_tree(struct wim_dentry **root_ret, &state, vol_flags); FREE(path); if (ret == 0) - win32_do_capture_warnings(&state, params->add_image_flags); + win32_do_capture_warnings(&state, params->add_flags); return ret; } @@ -2617,7 +2617,7 @@ win32_extract_streams(const struct wim_dentry *dentry, continue; /* Skip special UNIX data entries (see documentation for - * WIMLIB_ADD_IMAGE_FLAG_UNIX_DATA) */ + * WIMLIB_ADD_FLAG_UNIX_DATA) */ if (ads_entry->stream_name_nbytes == WIMLIB_UNIX_DATA_TAG_UTF16LE_NBYTES && !memcmp(ads_entry->stream_name, WIMLIB_UNIX_DATA_TAG_UTF16LE, -- 2.43.0