]> wimlib.net Git - wimlib/blobdiff - src/update_image.c
Add a new flag for capturing WIMBoot-compatible WIM
[wimlib] / src / update_image.c
index b7a3abdff9c14ec64d6ac9d4ad0d142e6d396e16..9e6262cf6c2125e387219bf07da38303a6d0f80b 100644 (file)
@@ -42,8 +42,6 @@
 static int
 do_overlay(struct wim_dentry *target, struct wim_dentry *branch)
 {
-       struct rb_root *rb_root;
-
        DEBUG("Doing overlay \"%"WS"\" => \"%"WS"\"",
              branch->file_name, target->file_name);
 
@@ -53,10 +51,9 @@ do_overlay(struct wim_dentry *target, struct wim_dentry *branch)
                return WIMLIB_ERR_INVALID_OVERLAY;
        }
 
-       rb_root = &branch->d_inode->i_children;
        LIST_HEAD(moved_children);
-       while (rb_root->rb_node) { /* While @branch has children... */
-               struct wim_dentry *child = rbnode_dentry(rb_root->rb_node);
+       while (dentry_has_children(branch)) {
+               struct wim_dentry *child = dentry_any_child(branch);
                struct wim_dentry *existing;
 
                /* Move @child to the directory @target */
@@ -465,6 +462,23 @@ check_add_command(struct wimlib_update_command *cmd,
 {
        int add_flags = cmd->add.add_flags;
 
+       if (add_flags & ~(WIMLIB_ADD_FLAG_NTFS |
+                         WIMLIB_ADD_FLAG_DEREFERENCE |
+                         WIMLIB_ADD_FLAG_VERBOSE |
+                         /* BOOT doesn't make sense for wimlib_update_image().
+                          * Same with WIMBOOT.  */
+                         /*WIMLIB_ADD_FLAG_BOOT |*/
+                         /*WIMLIB_ADD_FLAG_WIMBOOT |*/
+                         WIMLIB_ADD_FLAG_UNIX_DATA |
+                         WIMLIB_ADD_FLAG_NO_ACLS |
+                         WIMLIB_ADD_FLAG_STRICT_ACLS |
+                         WIMLIB_ADD_FLAG_EXCLUDE_VERBOSE |
+                         WIMLIB_ADD_FLAG_RPFIX |
+                         WIMLIB_ADD_FLAG_NORPFIX |
+                         WIMLIB_ADD_FLAG_NO_UNSUPPORTED_EXCLUDE |
+                         WIMLIB_ADD_FLAG_WINCONFIG))
+               return WIMLIB_ERR_INVALID_PARAM;
+
        /* Are we adding the entire image or not?  An empty wim_target_path
         * indicates that the tree we're adding is to be placed in the root of
         * the image.  We consider this to be capturing the entire image,
@@ -534,6 +548,23 @@ check_add_command(struct wimlib_update_command *cmd,
        return 0;
 }
 
+static int
+check_delete_command(const struct wimlib_update_command *cmd)
+{
+       if (cmd->delete_.delete_flags & ~(WIMLIB_DELETE_FLAG_FORCE |
+                                         WIMLIB_DELETE_FLAG_RECURSIVE))
+               return WIMLIB_ERR_INVALID_PARAM;
+       return 0;
+}
+
+static int
+check_rename_command(const struct wimlib_update_command *cmd)
+{
+       if (cmd->rename.rename_flags != 0)
+               return WIMLIB_ERR_INVALID_PARAM;
+       return 0;
+}
+
 static int
 check_update_command(struct wimlib_update_command *cmd,
                     const struct wim_header *hdr)
@@ -542,8 +573,9 @@ check_update_command(struct wimlib_update_command *cmd,
        case WIMLIB_UPDATE_OP_ADD:
                return check_add_command(cmd, hdr);
        case WIMLIB_UPDATE_OP_DELETE:
+               return check_delete_command(cmd);
        case WIMLIB_UPDATE_OP_RENAME:
-               break;
+               return check_rename_command(cmd);
        }
        return 0;
 }
@@ -667,6 +699,9 @@ wimlib_update_image(WIMStruct *wim,
        struct wimlib_update_command *cmds_copy;
        bool deletion_requested = false;
 
+       if (update_flags & ~WIMLIB_UPDATE_FLAG_SEND_PROGRESS)
+               return WIMLIB_ERR_INVALID_PARAM;
+
        DEBUG("Updating image %d with %zu commands", image, num_cmds);
 
        for (size_t i = 0; i < num_cmds; i++)