===================================================================
@@ -188,6 +188,7 @@ struct target_type {
const char *name;
struct module *module;
unsigned version[3];
+ uint64_t feature_bitmap;
dm_ctr_fn ctr;
dm_dtr_fn dtr;
dm_map_fn map;
===================================================================
@@ -138,7 +138,10 @@ struct dm_ioctl {
__u32 event_nr; /* in/out */
__s32 error; /* out */
- __u64 dev; /* in/out */
+ union {
+ __u64 dev; /* in/out */
+ __u64 feature_bitmap; /* out */
+ };
char name[DM_NAME_LEN]; /* device name */
char uuid[DM_UUID_LEN]; /* unique identifier for
@@ -286,9 +289,9 @@ enum {
#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
#define DM_VERSION_MAJOR 4
-#define DM_VERSION_MINOR 48
+#define DM_VERSION_MINOR 49
#define DM_VERSION_PATCHLEVEL 0
-#define DM_VERSION_EXTRA "-ioctl (2022-08-24)"
+#define DM_VERSION_EXTRA "-ioctl (2022-09-16)"
/* Status bits */
#define DM_READONLY_FLAG (1 << 0) /* In/Out */
===================================================================
@@ -26,6 +26,8 @@
#define DM_MSG_PREFIX "ioctl"
#define DM_DRIVER_EMAIL "dm-devel@redhat.com"
+static const __u64 feature_bitmap = 0;
+
struct dm_file {
/*
* poll will wait until the global event number is greater than
@@ -650,6 +652,12 @@ static int list_devices(struct file *fil
return 0;
}
+static int version(struct file *filp, struct dm_ioctl *param, size_t param_size)
+{
+ param->feature_bitmap = feature_bitmap;
+ return 0;
+}
+
static void list_version_get_needed(struct target_type *tt, void *needed_param)
{
size_t *needed = needed_param;
@@ -657,11 +665,13 @@ static void list_version_get_needed(stru
*needed += sizeof(struct dm_target_versions);
*needed += strlen(tt->name);
*needed += ALIGN_MASK;
+ *needed += sizeof(__u64);
}
static void list_version_get_info(struct target_type *tt, void *param)
{
struct vers_iter *info = param;
+ __u64 *feature_bitmap;
/* Check space - it might have changed since the first iteration */
if ((char *)info->vers + sizeof(tt->version) + strlen(tt->name) + 1 >
@@ -680,8 +690,10 @@ static void list_version_get_info(struct
info->vers->next = 0;
strcpy(info->vers->name, tt->name);
+ feature_bitmap = align_ptr(((void *)(info->vers + 1)) + strlen(tt->name) + 1);
+ *feature_bitmap = tt->feature_bitmap;
info->old_vers = info->vers;
- info->vers = align_ptr(((void *) ++info->vers) + strlen(tt->name) + 1);
+ info->vers = (void *)(feature_bitmap + 1);
}
static int __list_versions(struct dm_ioctl *param, size_t param_size, const char *name)
@@ -1789,7 +1801,7 @@ static ioctl_fn lookup_ioctl(unsigned in
int flags;
ioctl_fn fn;
} _ioctls[] = {
- {DM_VERSION_CMD, 0, NULL}, /* version is dealt with elsewhere */
+ {DM_VERSION_CMD, IOCTL_FLAGS_NO_PARAMS, version},
{DM_REMOVE_ALL_CMD, IOCTL_FLAGS_NO_PARAMS | IOCTL_FLAGS_ISSUE_GLOBAL_EVENT, remove_all},
{DM_LIST_DEVICES_CMD, 0, list_devices},
@@ -1944,7 +1956,8 @@ static int validate_params(uint cmd, str
param->error = 0;
/* Ignores parameters */
- if (cmd == DM_REMOVE_ALL_CMD ||
+ if (cmd == DM_VERSION_CMD ||
+ cmd == DM_REMOVE_ALL_CMD ||
cmd == DM_LIST_DEVICES_CMD ||
cmd == DM_LIST_VERSIONS_CMD)
return 0;
@@ -1994,12 +2007,6 @@ static int ctl_ioctl(struct file *file,
if (r)
return r;
- /*
- * Nothing more to do for the version command.
- */
- if (cmd == DM_VERSION_CMD)
- return 0;
-
fn = lookup_ioctl(cmd, &ioctl_flags);
if (!fn) {
DMERR("dm_ctl_ioctl: unknown command 0x%x", command);
This commit introduces feature bitmaps for dm targets and for dm core. The dm-core bitmap is returned in the ioctl field "feature_bitmap" of the ioctl DM_VERSION_CMD. The per-target bitmap is returned after the target name in the ioctls DM_LIST_VERSIONS_CMD or DM_GET_TARGET_VERSION. The bitmaps are empty so far. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> --- drivers/md/dm-ioctl.c | 25 ++++++++++++++++--------- include/linux/device-mapper.h | 1 + include/uapi/linux/dm-ioctl.h | 9 ++++++--- 3 files changed, 23 insertions(+), 12 deletions(-) -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel