From: Peter Rajnoha <prajnoha@redhat.com>
To: gregkh@linuxfoundation.org, rafael@kernel.org, jeyu@kernel.org,
linux-kernel@vger.kernel.org
Cc: msekleta@redhat.com, Peter Rajnoha <prajnoha@redhat.com>
Subject: [PATCH 2/2] kobject: add kernel/uevent_features sysfs file
Date: Wed, 5 Dec 2018 12:27:45 +0100 [thread overview]
Message-ID: <20181205112745.12276-3-prajnoha@redhat.com> (raw)
In-Reply-To: <20181205112745.12276-1-prajnoha@redhat.com>
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.
Signed-off-by: Peter Rajnoha <prajnoha@redhat.com>
---
kernel/ksysfs.c | 8 ++++++++
1 file changed, 8 insertions(+)
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
next prev parent reply other threads:[~2018-12-05 11:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-05 11:27 [PATCH 0/2] Fix return code and improve feature check for synthetic uevents Peter Rajnoha
2018-12-05 11:27 ` [PATCH 1/2] kobject: return error code if writing /sys/.../uevent fails Peter Rajnoha
2021-04-29 13:40 ` Phillip Susi
2021-04-29 17:27 ` Greg KH
2018-12-05 11:27 ` Peter Rajnoha [this message]
2018-12-06 15:07 ` [PATCH 2/2] kobject: add kernel/uevent_features sysfs file Greg KH
2018-12-05 16:30 ` [PATCH 0/2] Fix return code and improve feature check for synthetic uevents Greg KH
2018-12-06 8:40 ` Peter Rajnoha
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181205112745.12276-3-prajnoha@redhat.com \
--to=prajnoha@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=jeyu@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=msekleta@redhat.com \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).