1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
#include <linux/ioctl.h>
#include <linux/loop.h>
#include "utils.h"
#include "ioctls.h"
/* Intentionally mix the loop and loop-control ioctls. */
static const struct ioctl loop_ioctls[] = {
IOCTL(LOOP_SET_FD),
IOCTL(LOOP_CLR_FD),
IOCTL(LOOP_SET_STATUS),
IOCTL(LOOP_GET_STATUS),
IOCTL(LOOP_SET_STATUS64),
IOCTL(LOOP_GET_STATUS64),
IOCTL(LOOP_CHANGE_FD),
IOCTL(LOOP_SET_CAPACITY),
#ifdef LOOP_CTL_ADD
IOCTL(LOOP_CTL_ADD),
#endif
#ifdef LOOP_CTL_REMOVE
IOCTL(LOOP_CTL_REMOVE),
#endif
#ifdef LOOP_CTL_GET_FREE
IOCTL(LOOP_CTL_GET_FREE),
#endif
};
static const char *const loop_ctrl_devs[] = {
"loop-control",
//FIXME: Need to glob /dev/loop*
};
static const struct ioctl_group loop_ctrl_grp = {
.devtype = DEV_MISC,
.devs = loop_ctrl_devs,
.devs_cnt = ARRAY_SIZE(loop_ctrl_devs),
.sanitise = pick_random_ioctl,
.ioctls = loop_ioctls,
.ioctls_cnt = ARRAY_SIZE(loop_ioctls),
};
REG_IOCTL_GROUP(loop_ctrl_grp)
static const char *const loop_devs[] = {
"loop",
};
static const struct ioctl_group loop_grp = {
.devtype = DEV_BLOCK,
.devs = loop_devs,
.devs_cnt = ARRAY_SIZE(loop_devs),
.sanitise = pick_random_ioctl,
.ioctls = loop_ioctls,
.ioctls_cnt = ARRAY_SIZE(loop_ioctls),
};
REG_IOCTL_GROUP(loop_grp)
|