Add WIMLIB_ADD_FLAG_NO_UNSUPPORTED_EXCLUDE
authorEric Biggers <ebiggers3@gmail.com>
Sat, 17 Aug 2013 18:12:40 +0000 (13:12 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Sat, 17 Aug 2013 18:12:40 +0000 (13:12 -0500)
include/wimlib.h
src/ntfs-3g_capture.c
src/unix_capture.c
src/util.c

index eb8a33b..f3b395f 100644 (file)
@@ -971,6 +971,13 @@ typedef int (*wimlib_iterate_lookup_table_callback_t)(const struct wimlib_resour
  * documentation for ::WIMLIB_ADD_FLAG_RPFIX. */
 #define WIMLIB_ADD_FLAG_NORPFIX                        0x00000200
 
+/** Do not exclude unsupported files or directories from capture; e.g. encrypted
+ * directories in NTFS-3g capture mode, or device files and FIFOs on UNIX-like
+ * systems.  Instead, fail with ::WIMLIB_ERR_UNSUPPORTED_FILE when such a file
+ * is encountered.  */
+#define WIMLIB_ADD_FLAG_NO_UNSUPPORTED_EXCLUDE 0x00000400
+
+
 #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
@@ -981,6 +988,8 @@ typedef int (*wimlib_iterate_lookup_table_callback_t)(const struct wimlib_resour
 #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
+#define WIMLIB_ADD_IMAGE_FLAG_NO_UNSUPPORTED_EXCLUDE \
+                                               WIMLIB_ADD_FLAG_NO_UNSUPPORTED_EXCLUDE
 
 /******************************
  * WIMLIB_DELETE_FLAG_*
@@ -1391,6 +1400,7 @@ enum wimlib_error_code {
        WIMLIB_ERR_UNICODE_STRING_NOT_REPRESENTABLE,
        WIMLIB_ERR_UNKNOWN_VERSION,
        WIMLIB_ERR_UNSUPPORTED,
+       WIMLIB_ERR_UNSUPPORTED_FILE,
        WIMLIB_ERR_VOLUME_LACKS_FEATURES,
        WIMLIB_ERR_WIM_IS_READONLY,
        WIMLIB_ERR_WRITE,
index 27c446a..f8c6a18 100644 (file)
@@ -575,6 +575,11 @@ build_dentry_tree_ntfs_recursive(struct wim_dentry **root_ret,
        if ((attributes & (FILE_ATTRIBUTE_DIRECTORY |
                           FILE_ATTRIBUTE_ENCRYPTED)) == FILE_ATTRIBUTE_ENCRYPTED)
        {
+               if (params->add_flags & WIMLIB_ADD_FLAG_NO_UNSUPPORTED_EXCLUDE)
+               {
+                       ERROR("Can't archive unsupported encrypted file \"%s\"", path);
+                       return WIMLIB_ERR_UNSUPPORTED_FILE;
+               }
                if ((params->add_flags & WIMLIB_ADD_FLAG_EXCLUDE_VERBOSE)
                    && params->progress_func)
                {
index a080e8c..fe95b9a 100644 (file)
@@ -241,6 +241,11 @@ unix_build_dentry_tree_recursive(struct wim_dentry **root_ret,
        }
        if (!S_ISREG(stbuf.st_mode) && !S_ISDIR(stbuf.st_mode)
            && !S_ISLNK(stbuf.st_mode)) {
+               if (params->add_flags & WIMLIB_ADD_FLAG_NO_UNSUPPORTED_EXCLUDE)
+               {
+                       ERROR("Can't archive unsupported file \"%s\"", path);
+                       return WIMLIB_ERR_UNSUPPORTED_FILE;
+               }
                if ((params->add_flags & WIMLIB_ADD_FLAG_EXCLUDE_VERBOSE)
                    && params->progress_func)
                {
index 8cb5777..8875e4c 100644 (file)
@@ -406,6 +406,8 @@ static const tchar *error_strings[] = {
                = T("The WIM file is marked with an unknown version number"),
        [WIMLIB_ERR_UNSUPPORTED]
                = T("The requested operation is unsupported"),
+       [WIMLIB_ERR_UNSUPPORTED_FILE]
+               = T("A file in the directory tree to archive was not of a supported type"),
        [WIMLIB_ERR_VOLUME_LACKS_FEATURES]
                = T("The volume did not support a feature necessary to complete the operation"),
        [WIMLIB_ERR_WIM_IS_READONLY]