From 4c4bfdf7c6d423b82728e837430d49c4c9b5a086 Mon Sep 17 00:00:00 2001 From: Konstantin Khlebnikov Date: Fri, 4 Oct 2024 17:13:43 -0700 Subject: [PATCH] FROMGIT: block: add partition uuid into uevent as "PARTUUID" Both most common formats have uuid in addition to partition name: GPT: standard uuid xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx DOS: 4 byte disk signature and 1 byte partition xxxxxxxx-xx Tools from util-linux use the same notation for them. Signed-off-by: Konstantin Khlebnikov Reviewed-by: Kyle Fortin [dianders: rebased to modern kernels] Signed-off-by: Douglas Anderson Signed-off-by: Douglas Anderson Reviewed-by: Christoph Hellwig Link: https://lore.kernel.org/r/20241004171340.v2.1.I938c91d10e454e841fdf5d64499a8ae8514dc004@changeid Signed-off-by: Jens Axboe (cherry picked from commit 758737d86f8a2d74c0fa9f8b2523fa7fd1e0d0aa git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-6.13/block) Bug: 316324155 Test: PARTUUID shows up in uevent Signed-off-by: Douglas Anderson (cherry picked from https://android-review.googlesource.com/q/commit:d5815ee061657ca7f34ce54c8c0fa316c95221d5) Merged-In: I938c91d10e454e841fdf5d64499a8ae8514dc004 Change-Id: I938c91d10e454e841fdf5d64499a8ae8514dc004 --- block/partitions/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block/partitions/core.c b/block/partitions/core.c index 5bd7a603092e..aa54c1f4eaa5 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -253,6 +253,8 @@ static int part_uevent(const struct device *dev, struct kobj_uevent_env *env) add_uevent_var(env, "PARTN=%u", bdev_partno(part)); if (part->bd_meta_info && part->bd_meta_info->volname[0]) add_uevent_var(env, "PARTNAME=%s", part->bd_meta_info->volname); + if (part->bd_meta_info && part->bd_meta_info->uuid[0]) + add_uevent_var(env, "PARTUUID=%s", part->bd_meta_info->uuid); return 0; }