From 8f8de4c1f3888273b5b7dfae29e87dce79d37b02 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 12 Jun 2009 22:16:37 -0600 Subject: [PATCH] --- yaml --- r: 147966 b: refs/heads/master c: a92892825a122a74ddad1d408fa27132e28b05ae h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/virtio/virtio.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 324e66119dab..a0a7cb8baa9a 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 82af8ce84ed65d2fb6d8c017d3f2bbbf161061fb +refs/heads/master: a92892825a122a74ddad1d408fa27132e28b05ae diff --git a/trunk/drivers/virtio/virtio.c b/trunk/drivers/virtio/virtio.c index 3f52c767dfe9..bd0745250fd9 100644 --- a/trunk/drivers/virtio/virtio.c +++ b/trunk/drivers/virtio/virtio.c @@ -31,11 +31,27 @@ static ssize_t modalias_show(struct device *_d, return sprintf(buf, "virtio:d%08Xv%08X\n", dev->id.device, dev->id.vendor); } +static ssize_t features_show(struct device *_d, + struct device_attribute *attr, char *buf) +{ + struct virtio_device *dev = container_of(_d, struct virtio_device, dev); + unsigned int i; + ssize_t len = 0; + + /* We actually represent this as a bitstring, as it could be + * arbitrary length in future. */ + for (i = 0; i < ARRAY_SIZE(dev->features)*BITS_PER_LONG; i++) + len += sprintf(buf+len, "%c", + test_bit(i, dev->features) ? '1' : '0'); + len += sprintf(buf+len, "\n"); + return len; +} static struct device_attribute virtio_dev_attrs[] = { __ATTR_RO(device), __ATTR_RO(vendor), __ATTR_RO(status), __ATTR_RO(modalias), + __ATTR_RO(features), __ATTR_NULL };