Lines Matching refs:args
149 struct btrfs_ioctl_vol_args args = {};
164 strncpy(args.name, subvolume, sizeof(args.name)-1);
166 if (ioctl(fd, BTRFS_IOC_SUBVOL_CREATE, &args) < 0)
271 struct btrfs_ioctl_clone_range_args args = {
290 r = ioctl(outfd, BTRFS_IOC_CLONE_RANGE, &args);
361 struct btrfs_ioctl_ino_lookup_args args = {
375 if (ioctl(fd, BTRFS_IOC_INO_LOOKUP, &args) < 0)
378 *ret = args.treeid;
395 static bool btrfs_ioctl_search_args_inc(struct btrfs_ioctl_search_args *args) {
396 assert(args);
403 if (args->key.min_offset < (uint64_t) -1) {
404 args->key.min_offset++;
408 if (args->key.min_type < (uint8_t) -1) {
409 args->key.min_type++;
410 args->key.min_offset = 0;
414 if (args->key.min_objectid < (uint64_t) -1) {
415 args->key.min_objectid++;
416 args->key.min_offset = 0;
417 args->key.min_type = 0;
424 static void btrfs_ioctl_search_args_set(struct btrfs_ioctl_search_args *args, const struct btrfs_ioctl_search_header *h) {
425 assert(args);
428 args->key.min_objectid = h->objectid;
429 args->key.min_type = h->type;
430 args->key.min_offset = h->offset;
433 static int btrfs_ioctl_search_args_compare(const struct btrfs_ioctl_search_args *args) {
434 assert(args);
438 if (args->key.min_objectid < args->key.max_objectid)
440 if (args->key.min_objectid > args->key.max_objectid)
443 if (args->key.min_type < args->key.max_type)
445 if (args->key.min_type > args->key.max_type)
448 if (args->key.min_offset < args->key.max_offset)
450 if (args->key.min_offset > args->key.max_offset)
456 #define FOREACH_BTRFS_IOCTL_SEARCH_HEADER(i, sh, args) \
458 (sh) = (const struct btrfs_ioctl_search_header*) (args).buf; \
459 (i) < (args).key.nr_items; \
467 struct btrfs_ioctl_search_args args = {
501 args.key.min_objectid = args.key.max_objectid = subvol_id;
503 while (btrfs_ioctl_search_args_compare(&args) <= 0) {
507 args.key.nr_items = 256;
508 if (ioctl(fd, BTRFS_IOC_TREE_SEARCH, &args) < 0)
511 if (args.key.nr_items <= 0)
514 FOREACH_BTRFS_IOCTL_SEARCH_HEADER(i, sh, args) {
519 btrfs_ioctl_search_args_set(&args, sh);
547 if (!btrfs_ioctl_search_args_inc(&args))
560 struct btrfs_ioctl_search_args args = {
595 args.key.min_offset = args.key.max_offset = qgroupid;
597 while (btrfs_ioctl_search_args_compare(&args) <= 0) {
601 args.key.nr_items = 256;
602 if (ioctl(fd, BTRFS_IOC_TREE_SEARCH, &args) < 0) {
609 if (args.key.nr_items <= 0)
612 FOREACH_BTRFS_IOCTL_SEARCH_HEADER(i, sh, args) {
615 btrfs_ioctl_search_args_set(&args, sh);
651 if (!btrfs_ioctl_search_args_inc(&args))
803 struct btrfs_ioctl_quota_ctl_args args = {
816 if (ioctl(fd, BTRFS_IOC_QUOTA_CTL, &args) < 0)
834 struct btrfs_ioctl_qgroup_limit_args args = {
855 args.qgroupid = qgroupid;
858 if (ioctl(fd, BTRFS_IOC_QGROUP_LIMIT, &args) < 0) {
908 struct btrfs_ioctl_vol_args args = {};
960 if (snprintf(args.name, sizeof(args.name), "%" PRIu64, new_size) >= (int) sizeof(args.name))
965 if (ioctl(fd, BTRFS_IOC_RESIZE, &args) < 0)
977 if (ioctl(fd, BTRFS_IOC_RESIZE, &args) < 0)
1025 struct btrfs_ioctl_qgroup_create_args args = {
1039 if (ioctl(fd, BTRFS_IOC_QGROUP_CREATE, &args) < 0) {
1109 struct btrfs_ioctl_quota_rescan_args args = {};
1113 if (ioctl(fd, BTRFS_IOC_QUOTA_RESCAN, &args) < 0)
1129 struct btrfs_ioctl_quota_rescan_args args = {};
1133 if (ioctl(fd, BTRFS_IOC_QUOTA_RESCAN_STATUS, &args) < 0)
1136 return !!args.flags;
1140 struct btrfs_ioctl_qgroup_assign_args args = {
1155 r = ioctl(fd, BTRFS_IOC_QGROUP_ASSIGN, &args);
1184 struct btrfs_ioctl_search_args args = {
1235 args.key.min_offset = args.key.max_offset = subvol_id;
1237 while (btrfs_ioctl_search_args_compare(&args) <= 0) {
1241 args.key.nr_items = 256;
1242 if (ioctl(fd, BTRFS_IOC_TREE_SEARCH, &args) < 0)
1245 if (args.key.nr_items <= 0)
1248 FOREACH_BTRFS_IOCTL_SEARCH_HEADER(i, sh, args) {
1253 btrfs_ioctl_search_args_set(&args, sh);
1303 if (!btrfs_ioctl_search_args_inc(&args))
1340 struct btrfs_ioctl_search_args args = {
1369 while (btrfs_ioctl_search_args_compare(&args) <= 0) {
1373 args.key.nr_items = 256;
1374 if (ioctl(fd, BTRFS_IOC_TREE_SEARCH, &args) < 0) {
1381 if (args.key.nr_items <= 0)
1384 FOREACH_BTRFS_IOCTL_SEARCH_HEADER(i, sh, args) {
1390 btrfs_ioctl_search_args_set(&args, sh);
1431 if (!btrfs_ioctl_search_args_inc(&args))
1531 struct btrfs_ioctl_search_args args = {
1586 args.key.min_offset = args.key.max_offset = old_subvol_id;
1588 while (btrfs_ioctl_search_args_compare(&args) <= 0) {
1592 args.key.nr_items = 256;
1593 if (ioctl(old_fd, BTRFS_IOC_TREE_SEARCH, &args) < 0)
1596 if (args.key.nr_items <= 0)
1599 FOREACH_BTRFS_IOCTL_SEARCH_HEADER(i, sh, args) {
1605 btrfs_ioctl_search_args_set(&args, sh);
1699 if (!btrfs_ioctl_search_args_inc(&args))
1771 struct btrfs_ioctl_search_args args = {
1806 args.key.min_objectid = args.key.max_objectid = qgroupid;
1808 while (btrfs_ioctl_search_args_compare(&args) <= 0) {
1812 args.key.nr_items = 256;
1813 if (ioctl(fd, BTRFS_IOC_TREE_SEARCH, &args) < 0) {
1820 if (args.key.nr_items <= 0)
1823 FOREACH_BTRFS_IOCTL_SEARCH_HEADER(i, sh, args) {
1826 btrfs_ioctl_search_args_set(&args, sh);
1842 if (!btrfs_ioctl_search_args_inc(&args))
2017 struct btrfs_ioctl_search_args args = {
2049 args.key.min_objectid = args.key.max_objectid = subvol_id;
2051 while (btrfs_ioctl_search_args_compare(&args) <= 0) {
2055 args.key.nr_items = 256;
2056 if (ioctl(fd, BTRFS_IOC_TREE_SEARCH, &args) < 0)
2059 if (args.key.nr_items <= 0)
2062 FOREACH_BTRFS_IOCTL_SEARCH_HEADER(i, sh, args) {