Skip to content
Snippets Groups Projects
Commit 3ceb7f6b authored by Federico Vaga's avatar Federico Vaga
Browse files

sysfs: add 'devtype' sysfs attribute to all zio object


The Linux kernel automatic updates the uevent attributes only if the
device has a bus or a class. When the Linux kernel updates the uevent it
automatically adds the DEVTYPE attribute if the device has a
device_type. In ZIO cset, channel, buffer and trigger have not a bus or
a class, but they have a different device_type. These attributes are used
to export the device_type to user-space and allow libudev to easy
inspect the ZIO device hierarchy.

Signed-off-by: default avatarFederico Vaga <federico.vaga@gmail.com>
Acked-by: default avatarAlessandro Rubini <rubini@gnudd.com>
parent a9d0f9d8
Branches
Tags
No related merge requests found
......@@ -403,6 +403,12 @@ static ssize_t zobj_show_name(struct device *dev,
{
return sprintf(buf, "%s\n", to_zio_head(dev)->name);
}
/* Print the name of a zio object */
static ssize_t zobj_show_dev_type(struct device *dev,
struct device_attribute *attr, char *buf)
{
return sprintf(buf, "%s\n", dev->type->name);
}
/* Print the current trigger name */
static ssize_t zobj_show_cur_trig(struct device *dev,
struct device_attribute *attr, char *buf)
......@@ -647,12 +653,15 @@ static struct device_attribute zio_default_attributes[] = {
zobj_show_cur_zbuf, zobj_store_cur_zbuf),
[ZIO_DAN_DNAM] = __ATTR(devname, ZIO_RO_PERM,
zobj_show_devname, NULL),
[ZIO_DAN_TYPE] = __ATTR(devtype, ZIO_RO_PERM,
zobj_show_dev_type, NULL),
__ATTR_NULL,
};
/* default attributes for most of the zio objects */
static struct attribute *def_obj_attrs_ptr[] = {
&zio_default_attributes[ZIO_DAN_NAME].attr,
&zio_default_attributes[ZIO_DAN_ENAB].attr,
&zio_default_attributes[ZIO_DAN_TYPE].attr,
NULL,
};
/* default attributes for hierachy components (dev/cset/chan) */
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment