Displaying 9 results from an estimated 9 matches for "dev_to_disk".
2012 Jul 04
1
[PATCH] virtio-blk: allow toggling host cache between writeback and writethrough
...ake it discoverable what the legal
values are. Another attribute valid_cache_types with all values
space separated?
> +static ssize_t
> +virtblk_cache_type_store(struct device *dev, struct device_attribute *attr,
> + const char *buf, size_t count)
> +{
> + struct gendisk *disk = dev_to_disk(dev);
> + struct virtio_blk *vblk = disk->private_data;
> + struct virtio_device *vdev = vblk->vdev;
> + int i;
> + u8 writeback;
> +
> + BUG_ON(!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_CONFIG_WCE));
> + for (i = ARRAY_SIZE(virtblk_cache_types); --i >= 0; )
>...
2012 Jul 04
1
[PATCH] virtio-blk: allow toggling host cache between writeback and writethrough
...ake it discoverable what the legal
values are. Another attribute valid_cache_types with all values
space separated?
> +static ssize_t
> +virtblk_cache_type_store(struct device *dev, struct device_attribute *attr,
> + const char *buf, size_t count)
> +{
> + struct gendisk *disk = dev_to_disk(dev);
> + struct virtio_blk *vblk = disk->private_data;
> + struct virtio_device *vdev = vblk->vdev;
> + int i;
> + u8 writeback;
> +
> + BUG_ON(!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_CONFIG_WCE));
> + for (i = ARRAY_SIZE(virtblk_cache_types); --i >= 0; )
>...
2010 Jun 18
4
[PATCH 1/2] Add 'serial' attribute to virtio-blk devices
...# of bytes copied.
+ */
+static inline int serial_sysfs(char *d, char *s, int n)
+{
+ char *di = d;
+
+ while (*s && n--)
+ *d++ = *s++;
+ return d - di;
+}
+
+static ssize_t virtblk_serial_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct gendisk *disk = dev_to_disk(dev);
+ char id_str[VIRTIO_BLK_ID_BYTES];
+
+ if (IS_ERR(virtblk_get_id(disk, id_str)))
+ return 0;
+ return serial_sysfs(buf, id_str, min(VIRTIO_BLK_ID_BYTES, PAGE_SIZE));
+}
+DEVICE_ATTR(serial, S_IRUGO, virtblk_serial_show, NULL);
+
static int __devinit virtblk_probe(struct virtio_device *vdev...
2010 Jun 18
4
[PATCH 1/2] Add 'serial' attribute to virtio-blk devices
...# of bytes copied.
+ */
+static inline int serial_sysfs(char *d, char *s, int n)
+{
+ char *di = d;
+
+ while (*s && n--)
+ *d++ = *s++;
+ return d - di;
+}
+
+static ssize_t virtblk_serial_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct gendisk *disk = dev_to_disk(dev);
+ char id_str[VIRTIO_BLK_ID_BYTES];
+
+ if (IS_ERR(virtblk_get_id(disk, id_str)))
+ return 0;
+ return serial_sysfs(buf, id_str, min(VIRTIO_BLK_ID_BYTES, PAGE_SIZE));
+}
+DEVICE_ATTR(serial, S_IRUGO, virtblk_serial_show, NULL);
+
static int __devinit virtblk_probe(struct virtio_device *vdev...
2020 Jun 12
0
[PATCH] drivers\block: Use kobj_to_dev() API
...ic struct attribute *virtblk_attrs[] = {
> static umode_t virtblk_attrs_are_visible(struct kobject *kobj,
> struct attribute *a, int n)
> {
> - struct device *dev = container_of(kobj, struct device, kobj);
> + struct device *dev = kobj_to_dev(kobj);
> struct gendisk *disk = dev_to_disk(dev);
> struct virtio_blk *vblk = disk->private_data;
> struct virtio_device *vdev = vblk->vdev;
> --
> 2.7.4
2020 Aug 04
0
[PATCH] drivers\block: Use kobj_to_dev() API
...ic struct attribute *virtblk_attrs[] = {
> static umode_t virtblk_attrs_are_visible(struct kobject *kobj,
> struct attribute *a, int n)
> {
> - struct device *dev = container_of(kobj, struct device, kobj);
> + struct device *dev = kobj_to_dev(kobj);
> struct gendisk *disk = dev_to_disk(dev);
> struct virtio_blk *vblk = disk->private_data;
> struct virtio_device *vdev = vblk->vdev;
> --
> 2.7.4
>
Reviewed-by: Ming Lei <ming.lei at redhat.com>
--
Ming
2020 Aug 21
0
[PATCH] virtio-blk: Use kobj_to_dev() instead of container_of()
...ic struct attribute *virtblk_attrs[] = {
> static umode_t virtblk_attrs_are_visible(struct kobject *kobj,
> struct attribute *a, int n)
> {
> - struct device *dev = container_of(kobj, struct device, kobj);
> + struct device *dev = kobj_to_dev(kobj);
> struct gendisk *disk = dev_to_disk(dev);
> struct virtio_blk *vblk = disk->private_data;
> struct virtio_device *vdev = vblk->vdev;
> --
> 2.7.4
>
Reviewed-by: Stefano Garzarella <sgarzare at redhat.com>
Thanks,
Stefano
2010 Jun 24
3
[PATCH 0/2] v2: Add 'serial' attribute to virtio-blk devices
Using Rusty's suggestion I've respun the patch removing the special copy
function. I've tested this patch in a guest kernel with and without qemu
supplying serial numbers for the block devices and it's working as expected.
When qemu supplies serial numbers, the correct value is supplied to
/sys/block/vdX/serial and can be used by udev for generating disk/by-id paths
(without
2010 Jun 24
3
[PATCH 0/2] v2: Add 'serial' attribute to virtio-blk devices
Using Rusty's suggestion I've respun the patch removing the special copy
function. I've tested this patch in a guest kernel with and without qemu
supplying serial numbers for the block devices and it's working as expected.
When qemu supplies serial numbers, the correct value is supplied to
/sys/block/vdX/serial and can be used by udev for generating disk/by-id paths
(without