All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] kobject: add kernel/uevent_features sysfs file
@ 2018-12-07 11:46 Peter Rajnoha
  2018-12-07 12:01 ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Rajnoha @ 2018-12-07 11:46 UTC (permalink / raw)
  To: gregkh, linux-kernel; +Cc: msekleta, Peter Rajnoha

We can use extended format when writing /sys/.../uevent files to
generate synthetic uevents, introduced with commit f36776fafbaa
("kobject: support passing in variables for synthetic uevents").

Before using this extended format, we need to know if it's supported
and kernel version check may not be appropriate in all cases - there
are possible differences from upstream kernel in distributions with
backports.

This patch adds /sys/kernel/uevent_features file which currently lists
'synthargs' string to denote that the kernel is able to recognize the
extended synthetic uevent arguments. Userspace can easily check for
the feature then.

Updates for v2:
        Add Documentation/ABI/testing/sysfs-kernel-uevent_features.

Signed-off-by: Peter Rajnoha <prajnoha@redhat.com>
---
 .../ABI/testing/sysfs-kernel-uevent_features         | 12 ++++++++++++
 kernel/ksysfs.c                                      |  8 ++++++++
 2 files changed, 20 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-kernel-uevent_features

diff --git a/Documentation/ABI/testing/sysfs-kernel-uevent_features b/Documentation/ABI/testing/sysfs-kernel-uevent_features
new file mode 100644
index 000000000000..10b1d07c5ef9
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-kernel-uevent_features
@@ -0,0 +1,12 @@
+What:           /sys/kernel/uevent_features
+Date:           December 2018
+KernelVersion:  4.21
+Contact:        Linux kernel mailing list <linux-kernel@vger.kernel.org>
+Description:
+                Reading from this file returns space-separated list of
+                supported uevent features in current kernel.
+
+                Possible values:
+                        synthargs: passing additional variables for synthetic
+                                   uevents is supported (see also related
+                                   sysfs-uevent ABI documentation)
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c
index 46ba853656f6..d893d7442f61 100644
--- a/kernel/ksysfs.c
+++ b/kernel/ksysfs.c
@@ -37,6 +37,13 @@ static ssize_t uevent_seqnum_show(struct kobject *kobj,
 }
 KERNEL_ATTR_RO(uevent_seqnum);
 
+static ssize_t uevent_features_show(struct kobject *kobj,
+				    struct kobj_attribute *attr, char *buf)
+{
+	return sprintf(buf, "synthargs\n");
+}
+KERNEL_ATTR_RO(uevent_features);
+
 #ifdef CONFIG_UEVENT_HELPER
 /* uevent helper program, used during early boot */
 static ssize_t uevent_helper_show(struct kobject *kobj,
@@ -213,6 +220,7 @@ EXPORT_SYMBOL_GPL(kernel_kobj);
 static struct attribute * kernel_attrs[] = {
 	&fscaps_attr.attr,
 	&uevent_seqnum_attr.attr,
+	&uevent_features_attr.attr,
 #ifdef CONFIG_UEVENT_HELPER
 	&uevent_helper_attr.attr,
 #endif
-- 
2.19.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-01-08 14:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-07 11:46 [PATCH v2] kobject: add kernel/uevent_features sysfs file Peter Rajnoha
2018-12-07 12:01 ` Greg KH
2018-12-07 12:28   ` Peter Rajnoha
2018-12-19  9:24     ` Greg KH
2019-01-02  9:59       ` Peter Rajnoha
2019-01-08 14:23         ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.