btrfs-progs: use template for out of memory error messages

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2022-09-30 09:12:06 +02:00
parent 74eb8c68cf
commit c2be0e2ce0
21 changed files with 77 additions and 78 deletions

View File

@ -1471,7 +1471,7 @@ int main(int argc, char **argv)
del = rand_range(3);
path = btrfs_alloc_path();
if (!path) {
error("path allocation failed");
error_msg(ERROR_MSG_MEMORY, NULL);
goto out_close;
}
@ -1597,8 +1597,8 @@ int main(int argc, char **argv)
eb = btrfs_find_create_tree_block(root->fs_info,
logical);
if (!eb) {
error(
"not enough memory to allocate extent buffer for bytenr %llu",
error_msg(ERROR_MSG_MEMORY,
"allocating extent buffer for bytenr %llu",
logical);
ret = 1;
goto out_close;

View File

@ -1387,7 +1387,7 @@ static int add_mismatch_dir_hash(struct inode_record *dir_rec,
hash_record = malloc(sizeof(*hash_record) + namelen);
if (!hash_record) {
error("failed to allocate memory for mismatch dir hash rec");
error_msg(ERROR_MSG_MEMORY, "mismatch dir hash record");
return -ENOMEM;
}
memcpy(&hash_record->key, key, sizeof(*key));
@ -5224,7 +5224,7 @@ struct chunk_record *btrfs_new_chunk_record(struct extent_buffer *leaf,
rec = calloc(1, btrfs_chunk_record_size(num_stripes));
if (!rec) {
fprintf(stderr, "memory allocation failed\n");
error_msg(ERROR_MSG_MEMORY, NULL);
exit(-1);
}
@ -5311,7 +5311,7 @@ static int process_device_item(struct rb_root *dev_cache,
rec = malloc(sizeof(*rec));
if (!rec) {
fprintf(stderr, "memory allocation failed\n");
error_msg(ERROR_MSG_MEMORY, NULL);
return -ENOMEM;
}
@ -5366,7 +5366,7 @@ btrfs_new_block_group_record(struct extent_buffer *leaf, struct btrfs_key *key,
rec = calloc(1, sizeof(*rec));
if (!rec) {
fprintf(stderr, "memory allocation failed\n");
error_msg(ERROR_MSG_MEMORY, NULL);
exit(-1);
}
@ -5430,7 +5430,7 @@ btrfs_new_device_extent_record(struct extent_buffer *leaf,
rec = calloc(1, sizeof(*rec));
if (!rec) {
fprintf(stderr, "memory allocation failed\n");
error_msg(ERROR_MSG_MEMORY, NULL);
exit(-1);
}
@ -8895,7 +8895,7 @@ static int check_chunks_and_extents(void)
bits_nr = 1024;
bits = malloc(bits_nr * sizeof(struct block_info));
if (!bits) {
perror("malloc");
error_msg(ERROR_MSG_MEMORY, NULL);
exit(1);
}

View File

@ -580,7 +580,7 @@ static int account_all_refs(int do_qgroups, u64 search_subvol)
ulist_free(roots);
return 0;
enomem:
error("Out of memory while accounting refs for qgroups");
error_msg(ERROR_MSG_MEMORY, "accounting for refs for qgroups");
return -ENOMEM;
}
@ -1006,7 +1006,7 @@ loop:
count = alloc_count(&disk_key, leaf, item);
if (!count) {
ret = ENOMEM;
error("out of memory");
error_msg(ERROR_MSG_MEMORY, NULL);
goto out;
}
@ -1414,7 +1414,7 @@ int qgroup_verify_all(struct btrfs_fs_info *info)
tree_blocks = ulist_alloc(0);
if (!tree_blocks) {
error("out of memory while allocating ulist");
error_msg(ERROR_MSG_MEMORY, "allocate ulist");
return ENOMEM;
}
@ -1521,7 +1521,7 @@ int print_extent_state(struct btrfs_fs_info *info, u64 subvol)
tree_blocks = ulist_alloc(0);
if (!tree_blocks) {
error("out of memory while allocating ulist");
error_msg(ERROR_MSG_MEMORY, "allocate ulist");
return ENOMEM;
}

View File

@ -607,7 +607,7 @@ static int print_device_stat_string(struct format_ctx *fctx,
canonical_path = malloc(32);
if (!canonical_path) {
error("not enough memory for path buffer");
error_msg(ERROR_MSG_MEMORY, "device path buffer");
return -ENOMEM;
}
@ -671,7 +671,7 @@ static int print_device_stat_tabular(struct string_table *table, int row,
canonical_path = malloc(32);
if (!canonical_path) {
error("not enough memory for path buffer");
error_msg(ERROR_MSG_MEMORY, "device path buffer");
return -ENOMEM;
}
@ -775,7 +775,7 @@ static int cmd_device_stats(const struct cmd_struct *cmd, int argc, char **argv)
*/
table = table_create(7, fi_args.num_devices + 2);
if (!table) {
error("not enough memory");
error_msg(ERROR_MSG_MEMORY, NULL);
goto out;
}
free_table = true;

View File

@ -77,7 +77,7 @@ static int add_info_to_list(struct chunk_info **chunkinfo_ret,
if (!res) {
free(*chunkinfo_ret);
error("not enough memory");
error_msg(ERROR_MSG_MEMORY, NULL);
return -ENOMEM;
}
@ -240,7 +240,7 @@ static struct btrfs_ioctl_space_args *load_space_info(int fd, const char *path)
sargs_orig = sargs = calloc(1, sizeof(struct btrfs_ioctl_space_args));
if (!sargs) {
error("not enough memory");
error_msg(ERROR_MSG_MEMORY, NULL);
return NULL;
}
@ -265,7 +265,7 @@ static struct btrfs_ioctl_space_args *load_space_info(int fd, const char *path)
(count * sizeof(struct btrfs_ioctl_space_info)));
if (!sargs) {
free(sargs_orig);
error("not enough memory");
error_msg(ERROR_MSG_MEMORY, NULL);
return NULL;
}
@ -725,7 +725,7 @@ static int load_device_info(int fd, struct device_info **devinfo_ret,
info = calloc(fi_args.num_devices, sizeof(struct device_info));
if (!info) {
error("not enough memory");
error_msg(ERROR_MSG_MEMORY, NULL);
return 1;
}
@ -873,7 +873,7 @@ static void _cmd_filesystem_usage_tabular(unsigned unit_mode,
matrix = table_create(ncols, nrows);
if (!matrix) {
error("not enough memory");
error_msg(ERROR_MSG_MEMORY, NULL);
return;
}

View File

@ -507,7 +507,7 @@ static struct btrfs_qgroup_comparer_set *qgroup_alloc_comparer_set(void)
sizeof(struct btrfs_qgroup_comparer);
set = calloc(1, size);
if (!set) {
error("memory allocation failed");
error_msg(ERROR_MSG_MEMORY, NULL);
exit(1);
}
@ -667,7 +667,7 @@ static struct btrfs_qgroup *get_or_add_qgroup(
bq = calloc(1, sizeof(*bq));
if (!bq) {
error("memory allocation failed");
error_msg(ERROR_MSG_MEMORY, NULL);
return ERR_PTR(-ENOMEM);
}
@ -754,7 +754,7 @@ static int update_qgroup_relation(struct qgroup_lookup *qgroup_lookup,
list = malloc(sizeof(*list));
if (!list) {
error("memory allocation failed");
error_msg(ERROR_MSG_MEMORY, NULL);
return -ENOMEM;
}
@ -888,7 +888,7 @@ static struct btrfs_qgroup_filter_set *qgroup_alloc_filter_set(void)
sizeof(struct btrfs_qgroup_filter);
set = calloc(1, size);
if (!set) {
error("memory allocation failed");
error_msg(ERROR_MSG_MEMORY, NULL);
exit(1);
}
set->total = BTRFS_QGROUP_NFILTERS_INCREASE;
@ -915,7 +915,7 @@ static int qgroup_setup_filter(struct btrfs_qgroup_filter_set **filter_set,
tmp = set;
set = realloc(set, size);
if (!set) {
error("memory allocation failed");
error_msg(ERROR_MSG_MEMORY, NULL);
free(tmp);
exit(1);
}
@ -1441,7 +1441,7 @@ static int qgroup_inherit_realloc(struct btrfs_qgroup_inherit **inherit, int n,
out = calloc(sizeof(*out) + sizeof(out->qgroups[0]) * (nitems + n), 1);
if (out == NULL) {
error("not enough memory");
error_msg(ERROR_MSG_MEMORY, NULL);
return -ENOMEM;
}

View File

@ -1009,7 +1009,7 @@ static int decompress_zlib(struct btrfs_receive *rctx, const char *encoded_data,
init = true;
rctx->zlib_stream = malloc(sizeof(z_stream));
if (!rctx->zlib_stream) {
error("failed to allocate zlib stream %m");
error_msg(ERROR_MSG_MEMORY, "zlib stream: %m");
return -ENOMEM;
}
}
@ -1163,7 +1163,7 @@ static int decompress_and_write(struct btrfs_receive *rctx,
unencoded_data = calloc(unencoded_len, 1);
if (!unencoded_data) {
error("allocating space for unencoded data failed: %m");
error_msg(ERROR_MSG_MEMORY, "unencoded data: %m");
return -errno;
}

View File

@ -86,7 +86,7 @@ static struct extent_record *btrfs_new_extent_record(struct extent_buffer *eb)
rec = calloc(1, sizeof(*rec));
if (!rec) {
fprintf(stderr, "Fail to allocate memory for extent record.\n");
error_msg(ERROR_MSG_MEMORY, "extent record");
exit(1);
}
@ -1437,7 +1437,7 @@ open_ctree_with_broken_chunk(struct recover_control *rc)
fs_info = btrfs_new_fs_info(1, BTRFS_SUPER_INFO_OFFSET);
if (!fs_info) {
fprintf(stderr, "Failed to allocate memory for fs_info\n");
error_msg(ERROR_MSG_MEMORY, "fs_info");
return ERR_PTR(-ENOMEM);
}
fs_info->is_chunk_recover = 1;

View File

@ -327,7 +327,7 @@ static int copy_one_inline(struct btrfs_root *root, int fd,
ram_size = btrfs_file_extent_ram_bytes(leaf, fi);
outbuf = calloc(1, ram_size);
if (!outbuf) {
error("not enough memory");
error_msg(ERROR_MSG_MEMORY, NULL);
return -ENOMEM;
}
@ -397,14 +397,14 @@ static int copy_one_extent(struct btrfs_root *root, int fd,
inbuf = malloc(size_left);
if (!inbuf) {
error("not enough memory");
error_msg(ERROR_MSG_MEMORY, NULL);
return -ENOMEM;
}
if (compress != BTRFS_COMPRESS_NONE) {
outbuf = calloc(1, ram_size);
if (!outbuf) {
error("not enough memory");
error_msg(ERROR_MSG_MEMORY, NULL);
free(inbuf);
return -ENOMEM;
}
@ -1035,7 +1035,7 @@ static int search_dir(struct btrfs_root *root, struct btrfs_key *key,
char *dir = strdup(fs_name);
if (!dir) {
error("ran out of memory");
error_msg(ERROR_MSG_MEMORY, NULL);
ret = -ENOMEM;
goto out;
}

View File

@ -383,7 +383,7 @@ static int btrfs_list_setup_comparer(struct btrfs_list_comparer_set **comp_set,
tmp = set;
set = realloc(set, size);
if (!set) {
fprintf(stderr, "memory allocation failed\n");
error_msg(ERROR_MSG_MEMORY, NULL);
free(tmp);
exit(1);
}
@ -533,7 +533,7 @@ static int update_root(struct rb_root *root_lookup,
ri->name = malloc(name_len + 1);
if (!ri->name) {
fprintf(stderr, "memory allocation failed\n");
error_msg(ERROR_MSG_MEMORY, NULL);
exit(1);
}
strncpy(ri->name, name, name_len);
@ -597,7 +597,7 @@ static int add_root(struct rb_root *root_lookup,
ri = calloc(1, sizeof(*ri));
if (!ri) {
printf("memory allocation failed\n");
error_msg(ERROR_MSG_MEMORY, NULL);
exit(1);
}
ri->root_id = root_id;
@ -605,7 +605,7 @@ static int add_root(struct rb_root *root_lookup,
if (name && name_len > 0) {
ri->name = malloc(name_len + 1);
if (!ri->name) {
fprintf(stderr, "memory allocation failed\n");
error_msg(ERROR_MSG_MEMORY, NULL);
exit(1);
}
strncpy(ri->name, name, name_len);
@ -708,7 +708,7 @@ static int resolve_root(struct rb_root *rl, struct root_info *ri,
/* room for / and for null */
tmp = malloc(add_len + 2 + len);
if (!tmp) {
perror("malloc failed");
error_msg(ERROR_MSG_MEMORY, NULL);
exit(1);
}
memcpy(tmp + add_len + 1, full_path, len);
@ -790,7 +790,7 @@ static int lookup_ino_path(int fd, struct root_info *ri)
*/
ri->path = malloc(strlen(ri->name) + strlen(args.name) + 1);
if (!ri->path) {
perror("malloc failed");
error_msg(ERROR_MSG_MEMORY, NULL);
exit(1);
}
strcpy(ri->path, args.name);
@ -977,7 +977,7 @@ static int filter_full_path(struct root_info *ri, u64 data)
tmp = malloc(len + add_len + 2);
if (!tmp) {
fprintf(stderr, "memory allocation failed\n");
error_msg(ERROR_MSG_MEMORY, NULL);
exit(1);
}
memcpy(tmp + add_len + 1, ri->full_path, len);
@ -1038,7 +1038,7 @@ static void btrfs_list_setup_filter(struct btrfs_list_filter_set **filter_set,
tmp = set;
set = realloc(set, size);
if (!set) {
fprintf(stderr, "memory allocation failed\n");
error_msg(ERROR_MSG_MEMORY, NULL);
free(tmp);
exit(1);
}
@ -1457,7 +1457,7 @@ static struct btrfs_list_filter_set *btrfs_list_alloc_filter_set(void)
BTRFS_LIST_NFILTERS_INCREASE * sizeof(struct btrfs_list_filter);
set = calloc(1, size);
if (!set) {
fprintf(stderr, "memory allocation failed\n");
error_msg(ERROR_MSG_MEMORY, NULL);
exit(1);
}
@ -1475,7 +1475,7 @@ static struct btrfs_list_comparer_set *btrfs_list_alloc_comparer_set(void)
BTRFS_LIST_NCOMPS_INCREASE * sizeof(struct btrfs_list_comparer);
set = calloc(1, size);
if (!set) {
fprintf(stderr, "memory allocation failed\n");
error_msg(ERROR_MSG_MEMORY, NULL);
exit(1);
}

View File

@ -908,7 +908,7 @@ static char *__ino_resolve(int fd, u64 dirid)
*/
full = strdup(args.name);
if (!full) {
perror("malloc failed");
error_msg(ERROR_MSG_MEMORY, NULL);
return ERR_PTR(-ENOMEM);
}
} else {
@ -1580,7 +1580,7 @@ static int cmd_subvol_sync(const struct cmd_struct *cmd, int argc, char **argv)
} else {
ids = malloc(id_count * sizeof(uint64_t));
if (!ids) {
error("not enough memory");
error_msg(ERROR_MSG_MEMORY, NULL);
ret = 1;
goto out;
}

View File

@ -574,7 +574,7 @@ ssize_t btrfs_direct_pio(int rw, int fd, void *buf, size_t count, off_t offset)
ret = posix_memalign(&bounce_buf, alignment, iosize);
if (ret) {
error("failed to allocate bounce buffer: %m");
error_msg(ERROR_MSG_MEMORY, "bounce buffer");
errno = ret;
return 0;
}

View File

@ -140,7 +140,7 @@ static int read_cmd(struct btrfs_send_stream *sctx)
if (!new_read_buf) {
ret = -ENOMEM;
errno = -ret;
error("failed to reallocate read buffer for cmd: %m");
error_msg(ERROR_MSG_MEMORY, "read buffer for command");
goto out;
}
sctx->read_buf = new_read_buf;
@ -631,8 +631,7 @@ int btrfs_read_and_process_send_stream(int fd,
sctx.read_buf = malloc(BTRFS_SEND_BUF_SIZE_V1);
if (!sctx.read_buf) {
ret = -ENOMEM;
errno = -ret;
error("unable to allocate send stream read buffer: %m");
error_msg(ERROR_MSG_MEMORY, "send stream read buffer");
goto out;
}
sctx.read_buf_size = BTRFS_SEND_BUF_SIZE_V1;

View File

@ -406,7 +406,7 @@ static void *dump_worker(void *data)
async->bufsize = compressBound(async->size);
async->buffer = malloc(async->bufsize);
if (!async->buffer) {
error("not enough memory for async buffer");
error_msg(ERROR_MSG_MEMORY, "async buffer");
pthread_mutex_lock(&md->mutex);
if (!md->error)
md->error = -ENOMEM;
@ -1546,7 +1546,7 @@ static void *restore_worker(void *data)
buffer = malloc(buffer_size);
if (!buffer) {
error("not enough memory for restore worker buffer");
error_msg(ERROR_MSG_MEMORY, "restore worker buffer");
pthread_mutex_lock(&mdres->mutex);
if (!mdres->error)
mdres->error = -ENOMEM;
@ -1763,14 +1763,14 @@ static int add_cluster(struct meta_cluster *cluster,
item = &cluster->items[i];
async = calloc(1, sizeof(*async));
if (!async) {
error("not enough memory for async data");
error_msg(ERROR_MSG_MEMORY, "async data");
return -ENOMEM;
}
async->start = le64_to_cpu(item->bytenr);
async->bufsize = le32_to_cpu(item->size);
async->buffer = malloc(async->bufsize);
if (!async->buffer) {
error("not enough memory for async buffer");
error_msg(ERROR_MSG_MEMORY, "async buffer");
free(async);
return -ENOMEM;
}
@ -1898,7 +1898,7 @@ static int read_chunk_tree_block(struct mdrestore_struct *mdres,
fs_chunk = malloc(sizeof(struct fs_chunk));
if (!fs_chunk) {
error("not enough memory to allocate chunk");
error_msg(ERROR_MSG_MEMORY, "allocate chunk");
return -ENOMEM;
}
memset(fs_chunk, 0, sizeof(*fs_chunk));
@ -2013,13 +2013,13 @@ static int search_for_chunk_blocks(struct mdrestore_struct *mdres)
cluster = malloc(BLOCK_SIZE);
if (!cluster) {
error("not enough memory for cluster");
error_msg(ERROR_MSG_MEMORY, NULL);
return -ENOMEM;
}
buffer = malloc(max_size);
if (!buffer) {
error("not enough memory for buffer");
error_msg(ERROR_MSG_MEMORY, NULL);
free(cluster);
return -ENOMEM;
}
@ -2027,7 +2027,7 @@ static int search_for_chunk_blocks(struct mdrestore_struct *mdres)
if (mdres->compress_method == COMPRESS_ZLIB) {
tmp = malloc(max_size);
if (!tmp) {
error("not enough memory for buffer");
error_msg(ERROR_MSG_MEMORY, NULL);
free(cluster);
free(buffer);
return -ENOMEM;
@ -2288,7 +2288,7 @@ static int build_chunk_tree(struct mdrestore_struct *mdres,
buffer = malloc(le32_to_cpu(item->size));
if (!buffer) {
error("not enough memory to allocate buffer");
error_msg(ERROR_MSG_MEMORY, NULL);
return -ENOMEM;
}
@ -2806,7 +2806,7 @@ static int restore_metadump(const char *input, FILE *out, int old_restore,
cluster = malloc(BLOCK_SIZE);
if (!cluster) {
error("not enough memory for cluster");
error_msg(ERROR_MSG_MEMORY, NULL);
ret = -ENOMEM;
goto failed_info;
}

View File

@ -260,7 +260,7 @@ static char *find_collision(struct rb_root *name_tree, char *name,
val = malloc(sizeof(struct name));
if (!val) {
error("cannot sanitize name, not enough memory");
error_msg(ERROR_MSG_MEMORY, "sanitize name");
free(name);
return NULL;
}
@ -271,7 +271,7 @@ static char *find_collision(struct rb_root *name_tree, char *name,
val->len = name_len;
val->sub = malloc(name_len);
if (!val->sub) {
error("cannot sanitize name, not enough memory");
error_msg(ERROR_MSG_MEMORY, "sanitize name");
free(val);
free(name);
return NULL;
@ -340,7 +340,7 @@ static void sanitize_dir_item(enum sanitize_mode sanitize,
if (sanitize == SANITIZE_COLLISIONS) {
buf = malloc(name_len);
if (!buf) {
error("cannot sanitize name, not enough memory");
error_msg(ERROR_MSG_MEMORY, "sanitize name");
return;
}
read_extent_buffer(eb, buf, name_ptr, name_len);
@ -349,7 +349,7 @@ static void sanitize_dir_item(enum sanitize_mode sanitize,
garbage = generate_garbage(name_len);
}
if (!garbage) {
error("cannot sanitize name, not enough memory");
error_msg(ERROR_MSG_MEMORY, "sanitize name");
return;
}
write_extent_buffer(eb, garbage, name_ptr, name_len);
@ -395,7 +395,7 @@ static void sanitize_inode_ref(enum sanitize_mode sanitize,
if (sanitize == SANITIZE_COLLISIONS) {
buf = malloc(len);
if (!buf) {
error("cannot sanitize name, not enough memory");
error_msg(ERROR_MSG_MEMORY, "sanitize name");
return;
}
read_extent_buffer(eb, buf, name_ptr, len);
@ -405,7 +405,7 @@ static void sanitize_inode_ref(enum sanitize_mode sanitize,
}
if (!garbage) {
error("cannot sanitize name, not enough memory");
error_msg(ERROR_MSG_MEMORY, "sanitize name");
return;
}
write_extent_buffer(eb, garbage, name_ptr, len);
@ -449,7 +449,7 @@ void sanitize_name(enum sanitize_mode sanitize, struct rb_root *name_tree,
eb = alloc_dummy_eb(src->start, src->len);
if (!eb) {
error("cannot sanitize name, not enough memory");
error_msg(ERROR_MSG_MEMORY, "sanitize name");
return;
}

View File

@ -1469,7 +1469,7 @@ static struct btrfs_fs_info *__open_ctree_fd(int fp, struct open_ctree_flags *oc
fs_info = btrfs_new_fs_info(flags & OPEN_CTREE_WRITES, sb_bytenr);
if (!fs_info) {
fprintf(stderr, "Failed to allocate memory for fs_info\n");
error_msg(ERROR_MSG_MEMORY, "fs_info");
return NULL;
}
if (flags & OPEN_CTREE_RESTORE)

View File

@ -976,7 +976,7 @@ int write_data_to_disk(struct btrfs_fs_info *info, void *buf, u64 offset,
eb = malloc(sizeof(struct extent_buffer) + this_len);
if (!eb) {
fprintf(stderr, "cannot allocate memory for eb\n");
error_msg(ERROR_MSG_MEMORY, "extent buffer");
ret = -ENOMEM;
goto out;
}

View File

@ -1786,7 +1786,7 @@ static void print_sys_chunk_array(struct btrfs_super_block *sb)
buf = malloc(sizeof(*buf) + sizeof(*sb));
if (!buf) {
error("not enough memory");
error_msg(ERROR_MSG_MEMORY, NULL);
return;
}
write_extent_buffer(buf, sb, 0, sizeof(*sb));

View File

@ -305,7 +305,7 @@ static int report_zones(int fd, const char *file,
zinfo->zones = calloc(zinfo->nr_zones, sizeof(struct blk_zone));
if (!zinfo->zones) {
error("zoned: no memory for zone information");
error_msg(ERROR_MSG_MEMORY, "zone information");
exit(1);
}
@ -314,7 +314,7 @@ static int report_zones(int fd, const char *file,
sizeof(struct blk_zone) * BTRFS_REPORT_NR_ZONES;
rep = malloc(rep_size);
if (!rep) {
error("zoned: no memory for zones report");
error_msg(ERROR_MSG_MEMORY, "zone report");
exit(1);
}
@ -535,7 +535,7 @@ size_t btrfs_sb_io(int fd, void *buf, off_t offset, int rw)
rep_size = sizeof(struct blk_zone_report) + sizeof(struct blk_zone) * 2;
rep = calloc(1, rep_size);
if (!rep) {
error("zoned: no memory for zones report");
error_msg(ERROR_MSG_MEMORY, "zone report");
exit(1);
}
@ -853,7 +853,7 @@ int btrfs_load_block_group_zone_info(struct btrfs_fs_info *fs_info,
alloc_offsets = calloc(map->num_stripes, sizeof(*alloc_offsets));
if (!alloc_offsets) {
error("zoned: failed to allocate alloc_offsets");
error_msg(ERROR_MSG_MEMORY, "zone offsets");
return -ENOMEM;
}
@ -1080,7 +1080,7 @@ int btrfs_get_zone_info(int fd, const char *file,
#ifdef BTRFS_ZONED
zinfo = calloc(1, sizeof(*zinfo));
if (!zinfo) {
error("zoned: no memory for zone information");
error_msg(ERROR_MSG_MEMORY, "zone information");
exit(1);
}

View File

@ -1457,7 +1457,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
prepare_ctx = calloc(device_count, sizeof(*prepare_ctx));
if (!t_prepare || !prepare_ctx) {
error("unable to alloc thread for preparing devices");
error_msg(ERROR_MSG_MEMORY, "thread for preparing devices");
goto error;
}

View File

@ -589,7 +589,7 @@ static int traverse_directory(struct btrfs_trans_handle *trans,
}
dir_entry->path = strdup(tmp);
if (!dir_entry->path) {
error("not enough memory to store path");
error_msg(ERROR_MSG_MEMORY, NULL);
ret = -ENOMEM;
goto fail;
}