Lines Matching refs:arg

57 	struct bch_ioctl_assemble arg;
64 if (copy_from_user(&arg, user_arg, sizeof(arg)))
67 if (arg.flags || arg.pad)
70 user_devs = kmalloc_array(arg.nr_devs, sizeof(u64), GFP_KERNEL);
74 devs = kcalloc(arg.nr_devs, sizeof(char *), GFP_KERNEL);
77 sizeof(u64) * arg.nr_devs))
80 for (i = 0; i < arg.nr_devs; i++) {
89 c = bch2_fs_open(devs, arg.nr_devs, bch2_opts_empty());
95 for (i = 0; i < arg.nr_devs; i++)
103 struct bch_ioctl_incremental arg;
107 if (copy_from_user(&arg, user_arg, sizeof(arg)))
110 if (arg.flags || arg.pad)
113 path = strndup_user((const char __user *)(unsigned long) arg.dev, PATH_MAX);
175 struct bch_ioctl_fsck_offline arg; in bch2_ioctl_fsck_offline() local
180 if (copy_from_user(&arg, user_arg, sizeof(arg))) in bch2_ioctl_fsck_offline()
183 if (arg.flags) in bch2_ioctl_fsck_offline()
189 for (size_t i = 0; i < arg.nr_devs; i++) { in bch2_ioctl_fsck_offline()
215 if (arg.opts) { in bch2_ioctl_fsck_offline()
216 char *optstr = strndup_user((char __user *)(unsigned long) arg.opts, 1 << 16); in bch2_ioctl_fsck_offline()
235 thr->c = bch2_fs_open(devs.data, arg.nr_devs, thr->opts); in bch2_ioctl_fsck_offline()
254 static long bch2_global_ioctl(unsigned cmd, void __user *arg) in bch2_global_ioctl() argument
261 return bch2_ioctl_assemble(arg); in bch2_global_ioctl()
263 return bch2_ioctl_incremental(arg); in bch2_global_ioctl()
266 ret = bch2_ioctl_fsck_offline(arg); in bch2_global_ioctl()
287 static long bch2_ioctl_start(struct bch_fs *c, struct bch_ioctl_start arg)
292 if (arg.flags || arg.pad)
308 static long bch2_ioctl_disk_add(struct bch_fs *c, struct bch_ioctl_disk arg) in bch2_ioctl_disk_add() argument
316 if (arg.flags || arg.pad) in bch2_ioctl_disk_add()
319 path = strndup_user((const char __user *)(unsigned long) arg.dev, PATH_MAX); in bch2_ioctl_disk_add()
331 static long bch2_ioctl_disk_remove(struct bch_fs *c, struct bch_ioctl_disk arg) in bch2_ioctl_disk_remove() argument
338 if ((arg.flags & ~(BCH_FORCE_IF_DATA_LOST| in bch2_ioctl_disk_remove()
342 arg.pad) in bch2_ioctl_disk_remove()
345 ca = bch2_device_lookup(c, arg.dev, arg.flags); in bch2_ioctl_disk_remove()
349 return bch2_dev_remove(c, ca, arg.flags); in bch2_ioctl_disk_remove()
352 static long bch2_ioctl_disk_online(struct bch_fs *c, struct bch_ioctl_disk arg) in bch2_ioctl_disk_online() argument
360 if (arg.flags || arg.pad) in bch2_ioctl_disk_online()
363 path = strndup_user((const char __user *)(unsigned long) arg.dev, PATH_MAX); in bch2_ioctl_disk_online()
373 static long bch2_ioctl_disk_offline(struct bch_fs *c, struct bch_ioctl_disk arg) in bch2_ioctl_disk_offline() argument
381 if ((arg.flags & ~(BCH_FORCE_IF_DATA_LOST| in bch2_ioctl_disk_offline()
385 arg.pad) in bch2_ioctl_disk_offline()
388 ca = bch2_device_lookup(c, arg.dev, arg.flags); in bch2_ioctl_disk_offline()
392 ret = bch2_dev_offline(c, ca, arg.flags); in bch2_ioctl_disk_offline()
398 struct bch_ioctl_disk_set_state arg) in bch2_ioctl_disk_set_state() argument
406 if ((arg.flags & ~(BCH_FORCE_IF_DATA_LOST| in bch2_ioctl_disk_set_state()
410 arg.pad[0] || arg.pad[1] || arg.pad[2] || in bch2_ioctl_disk_set_state()
411 arg.new_state >= BCH_MEMBER_STATE_NR) in bch2_ioctl_disk_set_state()
414 ca = bch2_device_lookup(c, arg.dev, arg.flags); in bch2_ioctl_disk_set_state()
418 ret = bch2_dev_set_state(c, ca, arg.new_state, arg.flags); in bch2_ioctl_disk_set_state()
430 struct bch_ioctl_data arg; member
434 static int bch2_data_thread(void *arg) in bch2_data_thread() argument
436 struct bch_data_ctx *ctx = container_of(arg, struct bch_data_ctx, thr); in bch2_data_thread()
438 ctx->thr.ret = bch2_data_job(ctx->c, &ctx->stats, ctx->arg); in bch2_data_thread()
478 struct bch_ioctl_data arg) in bch2_ioctl_data() argument
486 if (arg.op >= BCH_DATA_OP_NR || arg.flags) in bch2_ioctl_data()
494 ctx->arg = arg; in bch2_ioctl_data()
507 struct bch_ioctl_fs_usage arg = {}; in bch2_ioctl_fs_usage() local
525 arg.capacity = c->capacity; in bch2_ioctl_fs_usage()
526 arg.used = u.used; in bch2_ioctl_fs_usage()
527 arg.online_reserved = percpu_u64_get(c->online_reserved); in bch2_ioctl_fs_usage()
528 arg.replica_entries_bytes = replicas.nr; in bch2_ioctl_fs_usage()
538 &arg.persistent_reserved[i], 1); in bch2_ioctl_fs_usage()
541 ret = copy_to_user_errcode(user_arg, &arg, sizeof(arg)); in bch2_ioctl_fs_usage()
550 struct bch_ioctl_query_accounting arg; in bch2_ioctl_query_accounting() local
557 ret = copy_from_user_errcode(&arg, user_arg, sizeof(arg)) ?: in bch2_ioctl_query_accounting()
558 bch2_fs_accounting_read(c, &accounting, arg.accounting_types_mask) ?: in bch2_ioctl_query_accounting()
559 (arg.accounting_u64s * sizeof(u64) < accounting.nr ? -ERANGE : 0) ?: in bch2_ioctl_query_accounting()
564 arg.capacity = c->capacity; in bch2_ioctl_query_accounting()
565 arg.used = bch2_fs_usage_read_short(c).used; in bch2_ioctl_query_accounting()
566 arg.online_reserved = percpu_u64_get(c->online_reserved); in bch2_ioctl_query_accounting()
567 arg.accounting_u64s = accounting.nr / sizeof(u64); in bch2_ioctl_query_accounting()
569 ret = copy_to_user_errcode(user_arg, &arg, sizeof(arg)); in bch2_ioctl_query_accounting()
579 struct bch_ioctl_dev_usage arg; in bch2_ioctl_dev_usage() local
587 if (copy_from_user(&arg, user_arg, sizeof(arg))) in bch2_ioctl_dev_usage()
590 if ((arg.flags & ~BCH_BY_INDEX) || in bch2_ioctl_dev_usage()
591 arg.pad[0] || in bch2_ioctl_dev_usage()
592 arg.pad[1] || in bch2_ioctl_dev_usage()
593 arg.pad[2]) in bch2_ioctl_dev_usage()
596 ca = bch2_device_lookup(c, arg.dev, arg.flags); in bch2_ioctl_dev_usage()
602 arg.state = ca->mi.state; in bch2_ioctl_dev_usage()
603 arg.bucket_size = ca->mi.bucket_size; in bch2_ioctl_dev_usage()
604 arg.nr_buckets = ca->mi.nbuckets - ca->mi.first_bucket; in bch2_ioctl_dev_usage()
606 for (i = 0; i < ARRAY_SIZE(arg.d); i++) { in bch2_ioctl_dev_usage()
607 arg.d[i].buckets = src.d[i].buckets; in bch2_ioctl_dev_usage()
608 arg.d[i].sectors = src.d[i].sectors; in bch2_ioctl_dev_usage()
609 arg.d[i].fragmented = src.d[i].fragmented; in bch2_ioctl_dev_usage()
614 return copy_to_user_errcode(user_arg, &arg, sizeof(arg)); in bch2_ioctl_dev_usage()
620 struct bch_ioctl_dev_usage_v2 arg; in bch2_ioctl_dev_usage_v2() local
628 if (copy_from_user(&arg, user_arg, sizeof(arg))) in bch2_ioctl_dev_usage_v2()
631 if ((arg.flags & ~BCH_BY_INDEX) || in bch2_ioctl_dev_usage_v2()
632 arg.pad[0] || in bch2_ioctl_dev_usage_v2()
633 arg.pad[1] || in bch2_ioctl_dev_usage_v2()
634 arg.pad[2]) in bch2_ioctl_dev_usage_v2()
637 ca = bch2_device_lookup(c, arg.dev, arg.flags); in bch2_ioctl_dev_usage_v2()
643 arg.state = ca->mi.state; in bch2_ioctl_dev_usage_v2()
644 arg.bucket_size = ca->mi.bucket_size; in bch2_ioctl_dev_usage_v2()
645 arg.nr_data_types = min(arg.nr_data_types, BCH_DATA_NR); in bch2_ioctl_dev_usage_v2()
646 arg.nr_buckets = ca->mi.nbuckets - ca->mi.first_bucket; in bch2_ioctl_dev_usage_v2()
648 ret = copy_to_user_errcode(user_arg, &arg, sizeof(arg)); in bch2_ioctl_dev_usage_v2()
652 for (unsigned i = 0; i < arg.nr_data_types; i++) { in bch2_ioctl_dev_usage_v2()
669 struct bch_ioctl_read_super arg) in bch2_ioctl_read_super() argument
678 if ((arg.flags & ~(BCH_BY_INDEX|BCH_READ_DEV)) || in bch2_ioctl_read_super()
679 arg.pad) in bch2_ioctl_read_super()
684 if (arg.flags & BCH_READ_DEV) { in bch2_ioctl_read_super()
685 ca = bch2_device_lookup(c, arg.dev, arg.flags); in bch2_ioctl_read_super()
695 if (vstruct_bytes(sb) > arg.size) { in bch2_ioctl_read_super()
700 ret = copy_to_user_errcode((void __user *)(unsigned long)arg.sb, sb, in bch2_ioctl_read_super()
710 struct bch_ioctl_disk_get_idx arg) in bch2_ioctl_disk_get_idx() argument
712 dev_t dev = huge_decode_dev(arg.dev); in bch2_ioctl_disk_get_idx()
730 struct bch_ioctl_disk_resize arg) in bch2_ioctl_disk_resize() argument
738 if ((arg.flags & ~BCH_BY_INDEX) || in bch2_ioctl_disk_resize()
739 arg.pad) in bch2_ioctl_disk_resize()
742 ca = bch2_device_lookup(c, arg.dev, arg.flags); in bch2_ioctl_disk_resize()
746 ret = bch2_dev_resize(c, ca, arg.nbuckets); in bch2_ioctl_disk_resize()
753 struct bch_ioctl_disk_resize_journal arg) in bch2_ioctl_disk_resize_journal() argument
761 if ((arg.flags & ~BCH_BY_INDEX) || in bch2_ioctl_disk_resize_journal()
762 arg.pad) in bch2_ioctl_disk_resize_journal()
765 if (arg.nbuckets > U32_MAX) in bch2_ioctl_disk_resize_journal()
768 ca = bch2_device_lookup(c, arg.dev, arg.flags); in bch2_ioctl_disk_resize_journal()
772 ret = bch2_set_nr_journal_buckets(c, ca, arg.nbuckets); in bch2_ioctl_disk_resize_journal()
819 struct bch_ioctl_fsck_online arg) in bch2_ioctl_fsck_online() argument
824 if (arg.flags) in bch2_ioctl_fsck_online()
847 if (arg.opts) { in bch2_ioctl_fsck_online()
848 char *optstr = strndup_user((char __user *)(unsigned long) arg.opts, 1 << 16); in bch2_ioctl_fsck_online()
875 if (copy_from_user(&i, arg, sizeof(i))) \
881 long bch2_fs_ioctl(struct bch_fs *c, unsigned cmd, void __user *arg) in bch2_fs_ioctl() argument
887 return bch2_ioctl_query_uuid(c, arg); in bch2_fs_ioctl()
889 return bch2_ioctl_fs_usage(c, arg); in bch2_fs_ioctl()
891 return bch2_ioctl_dev_usage(c, arg); in bch2_fs_ioctl()
893 return bch2_ioctl_dev_usage_v2(c, arg); in bch2_fs_ioctl()
929 return bch2_ioctl_query_accounting(c, arg); in bch2_fs_ioctl()
945 void __user *arg = (void __user *) v; in bch2_chardev_ioctl() local
948 ? bch2_fs_ioctl(c, cmd, arg) in bch2_chardev_ioctl()
949 : bch2_global_ioctl(cmd, arg); in bch2_chardev_ioctl()