#if 0
static long bch2_ioctl_start(struct bch_fs *c, struct bch_ioctl_start arg)
{
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
if (arg.flags || arg.pad)
return -EINVAL;
static long bch2_ioctl_stop(struct bch_fs *c)
{
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
bch2_fs_stop(c);
return 0;
}
char *path;
int ret;
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
if (arg.flags || arg.pad)
return -EINVAL;
{
struct bch_dev *ca;
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
if ((arg.flags & ~(BCH_FORCE_IF_DATA_LOST|
BCH_FORCE_IF_METADATA_LOST|
BCH_FORCE_IF_DEGRADED|
char *path;
int ret;
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
if (arg.flags || arg.pad)
return -EINVAL;
struct bch_dev *ca;
int ret;
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
if ((arg.flags & ~(BCH_FORCE_IF_DATA_LOST|
BCH_FORCE_IF_METADATA_LOST|
BCH_FORCE_IF_DEGRADED|
struct bch_dev *ca;
int ret;
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
if ((arg.flags & ~(BCH_FORCE_IF_DATA_LOST|
BCH_FORCE_IF_METADATA_LOST|
BCH_FORCE_IF_DEGRADED|
unsigned flags = O_RDONLY|O_CLOEXEC|O_NONBLOCK;
int ret, fd = -1;
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
if (arg.op >= BCH_DATA_OP_NR || arg.flags)
return -EINVAL;
struct bch_sb *sb;
int ret = 0;
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
if ((arg.flags & ~(BCH_BY_INDEX|BCH_READ_DEV)) ||
arg.pad)
return -EINVAL;
struct bch_dev *ca;
unsigned i;
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
for_each_online_member(ca, c, i)
if (ca->disk_sb.bdev->bd_dev == dev) {
percpu_ref_put(&ca->io_ref);
struct bch_dev *ca;
int ret;
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
if ((arg.flags & ~BCH_BY_INDEX) ||
arg.pad)
return -EINVAL;
struct bch_dev *ca;
int ret;
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
if ((arg.flags & ~BCH_BY_INDEX) ||
arg.pad)
return -EINVAL;
long bch2_fs_ioctl(struct bch_fs *c, unsigned cmd, void __user *arg)
{
- /* ioctls that don't require admin cap: */
switch (cmd) {
case BCH_IOCTL_QUERY_UUID:
return bch2_ioctl_query_uuid(c, arg);
return bch2_ioctl_fs_usage(c, arg);
case BCH_IOCTL_DEV_USAGE:
return bch2_ioctl_dev_usage(c, arg);
- }
-
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
-
- switch (cmd) {
#if 0
case BCH_IOCTL_START:
BCH_IOCTL(start, struct bch_ioctl_start);
if (!test_bit(BCH_FS_STARTED, &c->flags))
return -EINVAL;
- /* ioctls that do require admin cap: */
switch (cmd) {
case BCH_IOCTL_DISK_ADD:
BCH_IOCTL(disk_add, struct bch_ioctl_disk);