ret = root_tree_insert(root_lookup, ri);
if (ret) {
- printf("failed to insert tree %llu\n", (unsigned long long)root_id);
+ error("failed to insert tree %llu",
+ (unsigned long long)root_id);
exit(1);
}
return 0;
ri->ref_tree = 0;
return -ENOENT;
}
- fprintf(stderr, "ERROR: Failed to lookup path for root %llu - %s\n",
- (unsigned long long)ri->ref_tree,
- strerror(errno));
+ error("failed to lookup path for root %llu: %s",
+ (unsigned long long)ri->ref_tree, strerror(errno));
return ret;
}
/* this ioctl fills in ino_args->treeid */
ret = ioctl(fd, BTRFS_IOC_INO_LOOKUP, &ino_args);
if (ret < 0) {
- fprintf(stderr, "ERROR: Failed to lookup path for dirid %llu - %s\n",
+ error("failed to lookup path for dirid %llu: %s",
(unsigned long long)BTRFS_FIRST_FREE_OBJECTID,
strerror(errno));
return 0;
while (1) {
ret = ioctl(fd, BTRFS_IOC_TREE_SEARCH, &args);
if (ret < 0) {
- fprintf(stderr, "ERROR: can't perform the search - %s\n",
- strerror(errno));
+ error("can't perform the search: %s", strerror(errno));
return 0;
}
/* the ioctl returns the number of item it found in nr_items */
ret = ioctl(fd, BTRFS_IOC_INO_LOOKUP, &args);
if (ret < 0) {
- fprintf(stderr, "ERROR: Failed to lookup path for dirid %llu - %s\n",
+ error("failed to lookup path for dirid %llu: %s",
(unsigned long long)dirid, strerror(errno));
return ERR_PTR(ret);
}
ret = ioctl(fd, BTRFS_IOC_TREE_SEARCH, &args);
if (ret < 0) {
- fprintf(stderr, "ERROR: can't perform the search - %s\n",
- strerror(errno));
+ error("can't perform the search: %s", strerror(errno));
return NULL;
}
/* the ioctl returns the number of item it found in nr_items */
ret = list_subvol_search(fd, root_lookup);
if (ret) {
- fprintf(stderr, "ERROR: can't perform the search - %s\n",
- strerror(errno));
+ error("can't perform the search: %s", strerror(errno));
return ret;
}
disk_offset = 0;
len = btrfs_stack_file_extent_ram_bytes(item);
} else {
- printf("unhandled extent type %d for inode %llu "
- "file offset %llu gen %llu\n",
+ error(
+ "unhandled extent type %d for inode %llu file offset %llu gen %llu",
type,
(unsigned long long)btrfs_search_header_objectid(sh),
(unsigned long long)btrfs_search_header_offset(sh),
while(1) {
ret = ioctl(fd, BTRFS_IOC_TREE_SEARCH, &args);
if (ret < 0) {
- fprintf(stderr, "ERROR: can't perform the search - %s\n",
- strerror(errno));
+ error("can't perform the search: %s", strerror(errno));
break;
}
/* the ioctl returns the number of item it found in nr_items */