int compress_level;
int done;
int data;
- int sanitize_names;
+ enum sanitize_mode sanitize_names;
int error;
};
u32 cur = 0;
u32 this_len;
u32 name_len;
- int free_garbage = (md->sanitize_names == 1);
+ int free_garbage = (md->sanitize_names == SANITIZE_NAMES);
dir_item = btrfs_item_ptr(eb, slot, struct btrfs_dir_item);
total_len = btrfs_item_size_nr(eb, slot);
name_ptr = (unsigned long)(dir_item + 1);
name_len = btrfs_dir_name_len(eb, dir_item);
- if (md->sanitize_names > 1) {
+ if (md->sanitize_names == SANITIZE_COLLISIONS) {
buf = malloc(name_len);
if (!buf) {
error("cannot sanitize name, not enough memory");
u32 item_size;
u32 cur_offset = 0;
int len;
- int free_garbage = (md->sanitize_names == 1);
+ int free_garbage = (md->sanitize_names == SANITIZE_NAMES);
item_size = btrfs_item_size_nr(eb, slot);
ptr = btrfs_item_ptr_offset(eb, slot);
}
cur_offset += len;
- if (md->sanitize_names > 1) {
+ if (md->sanitize_names == SANITIZE_COLLISIONS) {
buf = malloc(len);
if (!buf) {
error("cannot sanitize name, not enough memory");
static int metadump_init(struct metadump_struct *md, struct btrfs_root *root,
FILE *out, int num_threads, int compress_level,
- int sanitize_names)
+ enum sanitize_mode sanitize_names)
{
int i, ret = 0;
md->pending_start = (u64)-1;
md->compress_level = compress_level;
md->sanitize_names = sanitize_names;
- if (sanitize_names > 1)
+ if (sanitize_names == SANITIZE_COLLISIONS)
crc32c_optimization_init();
md->name_tree.rb_node = NULL;
}
static int create_metadump(const char *input, FILE *out, int num_threads,
- int compress_level, int sanitize, int walk_trees)
+ int compress_level, enum sanitize_mode sanitize,
+ int walk_trees)
{
struct btrfs_root *root;
struct btrfs_path path;
int walk_trees = 0;
int multi_devices = 0;
int ret;
- int sanitize = 0;
+ enum sanitize_mode sanitize = SANITIZE_NONE;
int dev_cnt = 0;
int usage_error = 0;
FILE *out;
old_restore = 1;
break;
case 's':
- sanitize++;
+ if (sanitize == SANITIZE_NONE)
+ sanitize = SANITIZE_NAMES;
+ else if (sanitize == SANITIZE_NAMES)
+ sanitize = SANITIZE_COLLISIONS;
break;
case 'w':
walk_trees = 1;
usage_error++;
}
} else {
- if (walk_trees || sanitize || compress_level) {
+ if (walk_trees || sanitize != SANITIZE_NONE || compress_level) {
error(
"useing -w, -s, -c options for restore makes no sense");
usage_error++;