summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Croce <mcroce@microsoft.com>2021-07-13 02:05:26 +0300
committerJens Axboe <axboe@kernel.dk>2021-08-02 22:37:28 +0300
commit87eb710747126ca6606f064deef93d045486ebbe (patch)
tree7202f45e52b131a914705c85cf50ff93bd565784
parentcf179948554a2e0d2b622317bf6bf33138ac36e5 (diff)
downloadlinux-87eb710747126ca6606f064deef93d045486ebbe.tar.xz
block: export the diskseq in uevents
Export the newly introduced diskseq in uevents: $ udevadm info /sys/class/block/* |grep -e DEVNAME -e DISKSEQ E: DEVNAME=/dev/loop0 E: DISKSEQ=1 E: DEVNAME=/dev/loop1 E: DISKSEQ=2 E: DEVNAME=/dev/loop2 E: DISKSEQ=3 E: DEVNAME=/dev/loop3 E: DISKSEQ=4 E: DEVNAME=/dev/loop4 E: DISKSEQ=5 E: DEVNAME=/dev/loop5 E: DISKSEQ=6 E: DEVNAME=/dev/loop6 E: DISKSEQ=7 E: DEVNAME=/dev/loop7 E: DISKSEQ=8 E: DEVNAME=/dev/nvme0n1 E: DISKSEQ=9 E: DEVNAME=/dev/nvme0n1p1 E: DISKSEQ=9 E: DEVNAME=/dev/nvme0n1p2 E: DISKSEQ=9 E: DEVNAME=/dev/nvme0n1p3 E: DISKSEQ=9 E: DEVNAME=/dev/nvme0n1p4 E: DISKSEQ=9 E: DEVNAME=/dev/nvme0n1p5 E: DISKSEQ=9 E: DEVNAME=/dev/sda E: DISKSEQ=10 E: DEVNAME=/dev/sda1 E: DISKSEQ=10 E: DEVNAME=/dev/sda2 E: DISKSEQ=10 Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Matteo Croce <mcroce@microsoft.com> Tested-by: Luca Boccassi <bluca@debian.org> Link: https://lore.kernel.org/r/20210712230530.29323-3-mcroce@linux.microsoft.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--block/genhd.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/block/genhd.c b/block/genhd.c
index ceb08af72c1a..e1b2f898d790 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1092,8 +1092,17 @@ static void disk_release(struct device *dev)
blk_put_queue(disk->queue);
iput(disk->part0->bd_inode); /* frees the disk */
}
+
+static int block_uevent(struct device *dev, struct kobj_uevent_env *env)
+{
+ struct gendisk *disk = dev_to_disk(dev);
+
+ return add_uevent_var(env, "DISKSEQ=%llu", disk->diskseq);
+}
+
struct class block_class = {
.name = "block",
+ .dev_uevent = block_uevent,
};
static char *block_devnode(struct device *dev, umode_t *mode,