Linux virtualization list
 help / color / mirror / Atom feed
From: weiping zhang <zhangweiping@didichuxing.com>
To: cohuck@redhat.com, mst@redhat.com, jasowang@redhat.com
Cc: virtualization@lists.linux-foundation.org
Subject: [RFC PATCH] virtio: add space for device features show
Date: Tue, 26 Dec 2017 21:35:44 +0800	[thread overview]
Message-ID: <20171226133539.GA15965@localhost.didichuxing.com> (raw)

make features string more readable, add space every 8bit.
example:
00101010 01110000 00000000 00001100

Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
---
 drivers/virtio/virtio.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index 59e36ef..d7d2db1 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -50,9 +50,12 @@ static ssize_t features_show(struct device *_d,
 
 	/* We actually represent this as a bitstring, as it could be
 	 * arbitrary length in future. */
-	for (i = 0; i < sizeof(dev->features)*8; i++)
-		len += sprintf(buf+len, "%c",
+	for (i = 0; i < sizeof(dev->features) * 8; i++) {
+		len += sprintf(buf + len, "%c",
 			       __virtio_test_bit(dev, i) ? '1' : '0');
+		if (i % 8 == 7)
+			len += sprintf(buf + len, " ");
+	}
 	len += sprintf(buf+len, "\n");
 	return len;
 }
-- 
2.9.4

             reply	other threads:[~2017-12-26 13:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-26 13:35 weiping zhang [this message]
2018-01-08 12:50 ` [RFC PATCH] virtio: add space for device features show Cornelia Huck

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=20171226133539.GA15965@localhost.didichuxing.com \
    --to=zhangweiping@didichuxing.com \
    --cc=cohuck@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox