summaryrefslogtreecommitdiff
path: root/block/partition-generic.c
diff options
context:
space:
mode:
authorSan Mehat <san@google.com>2009-10-10 09:35:24 -0700
committerArve Hjønnevåg <arve@android.com>2013-07-01 13:40:28 -0700
commitac0949ebe87beb9cc06a4f27ab6be1bd39c2fa3c (patch)
treecd590fdbacfd8ddf59dd2ec7bf12f298b4ac55de /block/partition-generic.c
parentd590b5b6953304edb000de90335a3b4838b2482c (diff)
block: genhd: Add disk/partition specific uevent callbacks for partition info
For disk devices, a new uevent parameter 'NPARTS' specifies the number of partitions detected by the kernel. Partition devices get 'PARTN' which specifies the partitions index in the table, and 'PARTNAME', which specifies PARTNAME specifices the partition name of a partition device Signed-off-by: Dima Zavin <dima@android.com>
Diffstat (limited to 'block/partition-generic.c')
-rw-r--r--block/partition-generic.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/block/partition-generic.c b/block/partition-generic.c
index 789cdea05893..c7942acf1379 100644
--- a/block/partition-generic.c
+++ b/block/partition-generic.c
@@ -216,10 +216,21 @@ static void part_release(struct device *dev)
kfree(p);
}
+static int part_uevent(struct device *dev, struct kobj_uevent_env *env)
+{
+ struct hd_struct *part = dev_to_part(dev);
+
+ add_uevent_var(env, "PARTN=%u", part->partno);
+ if (part->info && part->info->volname[0])
+ add_uevent_var(env, "PARTNAME=%s", part->info->volname);
+ return 0;
+}
+
struct device_type part_type = {
.name = "partition",
.groups = part_attr_groups,
.release = part_release,
+ .uevent = part_uevent,
};
static void delete_partition_rcu_cb(struct rcu_head *head)