On Wed, 16 Mar 2011 15:09:58 +0100, Christoph Hellwig<hch@xxxxxx> wrote:On Wed, Mar 16, 2011 at 02:39:39PM +1030, Rusty Russell wrote:Of course, that's assuming buf is nul terminated.I'm happ to switch strcmp.+ if (strncmp(buf, "write through", sizeof("write through") - 1) == 0) {Is there a reason we're not letting gcc and/or strcmp do the
+ ;
+ } else if (strncmp(buf, "write back", sizeof("write back") - 1) == 0) {
optimization work here?
OK, under what circumstances could it fail?No, it's intentional. config space writes can't return errors, so we need+ vdev->config->set(vdev, offsetof(struct virtio_blk_config, features),This seems like a debugging check you left in. Or do you suspect
+ &features, sizeof(features));
+
+ vdev->config->get(vdev, offsetof(struct virtio_blk_config, features),
+ &features2, sizeof(features2));
+
+ if ((features& VIRTIO_BLK_RT_WCE) !=
+ (features2& VIRTIO_BLK_RT_WCE))
+ return -EIO;
some issues?
to check that the value has really changed. I'll add a comment explaining it.
If you're using this mechanism to indicate that the host doesn't support
the feature, that's making an assumption about the nature of config
space writes which isn't true for non-PCI virtio.
ie. lguest and S/390 don't trap writes to config space.
Or perhaps they should? But we should be explicit about needing it...
Thanks,
Rusty.