From: Mikulas Patocka <mpatocka@redhat.com>
To: Mike Snitzer <msnitzer@redhat.com>, David Teigland <teigland@redhat.com>
Cc: dm-devel@redhat.com
Subject: [dm-devel] [PATCH] dm: introduce feature bitmaps
Date: Mon, 19 Sep 2022 05:35:40 -0400 (EDT) [thread overview]
Message-ID: <alpine.LRH.2.02.2209190533540.1511@file01.intranet.prod.int.rdu2.redhat.com> (raw)
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(-)
Index: linux-2.6/include/linux/device-mapper.h
===================================================================
--- linux-2.6.orig/include/linux/device-mapper.h
+++ linux-2.6/include/linux/device-mapper.h
@@ -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;
Index: linux-2.6/include/uapi/linux/dm-ioctl.h
===================================================================
--- linux-2.6.orig/include/uapi/linux/dm-ioctl.h
+++ linux-2.6/include/uapi/linux/dm-ioctl.h
@@ -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 */
Index: linux-2.6/drivers/md/dm-ioctl.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-ioctl.c
+++ linux-2.6/drivers/md/dm-ioctl.c
@@ -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);
--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel
reply other threads:[~2022-09-19 9:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LRH.2.02.2209190533540.1511@file01.intranet.prod.int.rdu2.redhat.com \
--to=mpatocka@redhat.com \
--cc=dm-devel@redhat.com \
--cc=msnitzer@redhat.com \
--cc=teigland@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.