Commit f2cf96d9 authored by Federico Vaga's avatar Federico Vaga

kernel: use devname attribute also for trigger and buffer

The reason to extended it is that it makes easier the identification
of a single zio object from user-space.
It is, in a way, similar to the zio_addr, but this is ascii and with
less information (indeed it can be used only locally on the same machine)
Signed-off-by: Federico Vaga's avatarfederico.vaga@cern.ch <federico.vaga@cern.ch>
parent 6c933c79
......@@ -697,6 +697,8 @@ static ssize_t zobj_show_devname(struct device *dev,
struct zio_obj_head *head = to_zio_head(dev);
struct zio_channel *chan;
struct zio_cset *cset;
struct zio_ti *ti;
struct zio_bi *bi;
char *mask;
switch (head->zobj_type) {
......@@ -712,6 +714,18 @@ static ssize_t zobj_show_devname(struct device *dev,
"%s-%i-%i\n";
return sprintf(buf, mask, dev_name(&chan->cset->zdev->head.dev),
chan->cset->index, chan->index);
case ZIO_TI:
ti = to_zio_ti(dev);
cset = ti->cset;
return sprintf(buf, "%s-%i-t\n",
dev_name(&cset->zdev->head.dev), cset->index);
case ZIO_BI:
bi = to_zio_bi(dev);
chan = bi->chan;
mask = chan->flags & ZIO_CSET_CHAN_INTERLEAVE ? "%s-%i-i-b\n" :
"%s-%i-%i-b\n";
return sprintf(buf, mask, dev_name(&chan->cset->zdev->head.dev),
chan->cset->index, chan->index);
default:
WARN(1, "ZIO: unknown zio object %i for address\n",
head->zobj_type);
......@@ -952,6 +966,7 @@ static struct device_attribute zio_default_attributes[] = {
};
/* default attributes for most of the zio objects */
static struct attribute *def_obj_attrs_ptr[] = {
&zio_default_attributes[ZIO_DAN_DNAM].attr,
&zio_default_attributes[ZIO_DAN_NAME].attr,
&zio_default_attributes[ZIO_DAN_ENAB].attr,
&zio_default_attributes[ZIO_DAN_TYPE].attr,
......@@ -959,7 +974,6 @@ static struct attribute *def_obj_attrs_ptr[] = {
};
/* default attributes for hierachy components (dev/cset/chan) */
static struct attribute *def_hie_attrs_ptr[] = {
&zio_default_attributes[ZIO_DAN_DNAM].attr,
NULL,
};
/* default attributes for channel set */
......@@ -976,6 +990,7 @@ static struct attribute *def_chan_attrs_ptr[] = {
};
/* default attributes for buffer instance */
static struct attribute *def_bi_attrs_ptr[] = {
&zio_default_attributes[ZIO_DAN_DNAM].attr,
&zio_default_attributes[ZIO_DAN_NAME].attr,
&zio_default_attributes[ZIO_DAN_TYPE].attr,
&zio_default_attributes[ZIO_DAN_FLUS].attr,
......
Markdown is supported
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