Displaying 1 result from an estimated 1 matches for "dev_attr_virtio_buf".
2019 Apr 29
1
[RFC-PATCH] Introducing virtio-example.
...truct device *dev, struct device_attribute *attr, char *buf)
+{
+ /* cast dev into a virtio_device */
+ struct virtio_device *vdev = dev_to_virtio(dev);
+ struct virtexample_info *vi = vdev->priv;
+
+ return sprintf(buf, "%d\n", vi->in);
+}
+
+/*
+ * struct device_attribute dev_attr_virtio_buf = {
+ * .attr = {
+ * .name = "virtio_buf",
+ * .mode = 0644
+ * },
+ * .show = virtio_buf_show,
+ * .store = virtio_buf_store
+ * }
+ */
+static DEVICE_ATTR_RW(virtio_buf);
+
+
+/*
+ * The example_attr defined above is then grouped in the struct attribute...