[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [dm-devel] RFC: dm-switch target [v3]



On Fri, Oct 21 2011 at  4:22pm -0400,
Jim Ramsay <jim_ramsay dell com> wrote:

> Note: This is a repost with a few important implementation improvements.
...
> - Added a sysfs file so userland applications can easily check the version of
>   this module.
...

> static ssize_t sysfs_version_show(struct kobject *kobj,
> 				  struct attribute *attr, char *buff)
> {
> 	return snprintf(buff, PAGE_SIZE, "%d.%d.%d\n",
> 			__g_switch_target.version[0],
> 			__g_switch_target.version[1],
> 			__g_switch_target.version[2]);
> }
> 
> static ssize_t sysfs_version_store(struct kobject *kobj,
> 				   struct attribute *attr, const char *buff,
> 				   size_t size)
> {
> 	return -EINVAL;
> }
> 
> static const struct _sysfs_attr_ops __g_sysfs_version = {
> 	.attr = {"version", 0444},
> 	.ops = {&sysfs_version_show, &sysfs_version_store}
> };

One would hope that this "version" file isn't needed.  DM already
provides the ability to query the version of targets via the
DM_LIST_VERSIONS dm-ioctl.  E.g.:

# dmsetup targets
thin-pool        v1.0.0
thin             v1.0.0
mirror           v1.12.1
multipath        v1.3.0
striped          v1.4.0
linear           v1.1.0
error            v1.0.1

But we don't have the ability to ask for a specific target's version.

(lvm2's tools/dmsetup.c:_targets() illustrates how to collect the
targets and access their versions -- would require linking against
libdm).

But we could add a --target flag to dmsetup targets (like 'dmsetup ls'
allows), e.g.: dmsetup targets --target switch

Mike


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]