return 0;
}
-u64 parse_qgroupid(char *p)
-{
- char *s = strchr(p, '/');
- char *ptr_src_end = p + strlen(p);
- char *ptr_parse_end = NULL;
- u64 level;
- u64 id;
-
- if (!s) {
- id = strtoull(p, &ptr_parse_end, 10);
- if (ptr_parse_end != ptr_src_end)
- goto err;
- return id;
- }
- level = strtoull(p, &ptr_parse_end, 10);
- if (ptr_parse_end != s)
- goto err;
-
- id = strtoull(s+1, &ptr_parse_end, 10);
- if (ptr_parse_end != ptr_src_end)
- goto err;
-
- return (level << 48) | id;
-err:
- fprintf(stderr, "ERROR:invalid qgroupid\n");
- exit(-1);
-}
-
int qgroup_inherit_size(struct btrfs_qgroup_inherit *p)
{
return sizeof(*p) + sizeof(p->qgroups[0]) *
int btrfs_qgroup_setup_comparer(struct btrfs_qgroup_comparer_set **comp_set,
enum btrfs_qgroup_comp_enum comparer,
int is_descending);
-u64 parse_qgroupid(char *p);
int qgroup_inherit_size(struct btrfs_qgroup_inherit *p);
int qgroup_inherit_add_group(struct btrfs_qgroup_inherit **inherit, char *arg);
int qgroup_inherit_add_copy(struct btrfs_qgroup_inherit **inherit, char *arg,
return ret;
}
+u64 parse_qgroupid(const char *p)
+{
+ char *s = strchr(p, '/');
+ const char *ptr_src_end = p + strlen(p);
+ char *ptr_parse_end = NULL;
+ u64 level;
+ u64 id;
+
+ if (!s) {
+ id = strtoull(p, &ptr_parse_end, 10);
+ if (ptr_parse_end != ptr_src_end)
+ goto err;
+ return id;
+ }
+ level = strtoull(p, &ptr_parse_end, 10);
+ if (ptr_parse_end != s)
+ goto err;
+
+ id = strtoull(s + 1, &ptr_parse_end, 10);
+ if (ptr_parse_end != ptr_src_end)
+ goto err;
+
+ return (level << BTRFS_QGROUP_LEVEL_SHIFT) | id;
+err:
+ fprintf(stderr, "ERROR: invalid qgroupid %s\n", p);
+ exit(-1);
+}
+
int open_file_or_dir3(const char *fname, DIR **dirstream, int open_flags)
{
int ret;
int get_mountpt(char *dev, char *mntpt, size_t size);
int btrfs_scan_block_devices(int run_ioctl);
u64 parse_size(char *s);
+u64 parse_qgroupid(const char *p);
u64 arg_strtou64(const char *str);
int open_file_or_dir(const char *fname, DIR **dirstream);
int open_file_or_dir3(const char *fname, DIR **dirstream, int open_flags);