From: Andy Grover <agrover@redhat.com>
To: gregkh@linuxfoundation.org, snitzer@redhat.com
Cc: dm-devel@redhat.com, linux-kernel@vger.kernel.org
Subject: [PATCH 7/9] dm: Implement dm_uevent_add()
Date: Mon, 3 Oct 2016 12:22:58 -0700 [thread overview]
Message-ID: <1475522580-16723-8-git-send-email-agrover@redhat.com> (raw)
In-Reply-To: <1475522580-16723-1-git-send-email-agrover@redhat.com>
This helper function builds and enqueues the uevent. Targets can use this
when they do not need to customize the uevent beyond its name.
Signed-off-by: Andy Grover <agrover@redhat.com>
---
Documentation/device-mapper/dm-uevent.txt | 5 +++++
drivers/md/dm-uevent.c | 26 ++++++++++++++++++++++++++
include/linux/device-mapper.h | 1 +
3 files changed, 32 insertions(+)
diff --git a/Documentation/device-mapper/dm-uevent.txt b/Documentation/device-mapper/dm-uevent.txt
index 4fcb71d..097e7f4 100644
--- a/Documentation/device-mapper/dm-uevent.txt
+++ b/Documentation/device-mapper/dm-uevent.txt
@@ -30,6 +30,11 @@ void dm_uevent_free(struct dm_uevent *event)
Something went wrong, free the uevent instead of queueing it.
+void dm_uevent_add(struct dm_target *ti, enum kobject_action action, char *name)
+
+Helper function that builds and queues a uevent if no additional
+variables need to be added.
+
void dm_table_event(struct dm_table *t)
Triggers sending of queued uevents as well as waking up processes waiting on
diff --git a/drivers/md/dm-uevent.c b/drivers/md/dm-uevent.c
index 6a72de7..d139135 100644
--- a/drivers/md/dm-uevent.c
+++ b/drivers/md/dm-uevent.c
@@ -95,6 +95,32 @@ err_nomem:
EXPORT_SYMBOL_GPL(dm_uevent_build);
/**
+ * dm_uevent_add - Create and queue a basic uevent
+ *
+ * @ti: The target to add a uevent for
+ * @action: The kobject action
+ * @name: The name of the uevent to add and queue
+ *
+ * If targets wish to create and queue a uevent but don't need to add
+ * extra vars, they can do so more easily by calling this.
+ * This is usually followed by a call to dm_table_event().
+ */
+void dm_uevent_add(struct dm_target *ti, enum kobject_action action, char *name)
+{
+ struct mapped_device *md = dm_table_get_md(ti->table);
+ struct dm_uevent *event;
+
+ event = dm_uevent_build(md, ti, action, name);
+ if (IS_ERR(event)) {
+ DMERR("%s: dm_uevent_build() failed", __func__);
+ return;
+ }
+
+ dm_uevent_queue(md, &event->elist);
+}
+EXPORT_SYMBOL_GPL(dm_uevent_add);
+
+/**
* dm_send_uevents - send uevents for given list
*
* @events: list of events to send
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 024207c..c102e29 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -420,6 +420,7 @@ uint32_t dm_get_event_nr(struct mapped_device *md);
int dm_wait_event(struct mapped_device *md, int event_nr);
uint32_t dm_next_uevent_seq(struct mapped_device *md);
void dm_uevent_queue(struct mapped_device *md, struct list_head *elist);
+void dm_uevent_add(struct dm_target *ti, enum kobject_action action, char *name);
/*
* Info functions.
--
2.7.4
next prev parent reply other threads:[~2016-10-03 19:24 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-03 19:22 [PATCH 0/9] Generate uevents for all DM events Andy Grover
2016-10-03 19:22 ` [PATCH 1/9] dm: Do not export dm_send_uevents Andy Grover
2016-10-03 19:22 ` [PATCH 2/9] dm: Move multipath-specific stuff out of dm-uevent.c Andy Grover
2016-10-03 19:22 ` [PATCH 3/9] dm: Inline dm_build_path_uevent into dm_path_uevent Andy Grover
2016-10-03 19:22 ` [PATCH 4/9] dm: Update dm-uevent.txt Andy Grover
2016-10-03 19:22 ` [PATCH 5/9] dm: Rename dm_build_uevent to dm_uevent_build Andy Grover
2016-10-03 19:22 ` [PATCH 6/9] dm: Rename dm_event_add to dm_event_queue Andy Grover
2016-10-03 19:22 ` Andy Grover [this message]
2016-10-03 19:22 ` [PATCH 8/9] dm: Generate uevents for thin targets Andy Grover
2016-10-03 19:23 ` [PATCH 9/9] dm: Generate uevents for other targets Andy Grover
2016-10-03 19:29 ` [PATCH 0/9] Generate uevents for all DM events Mike Snitzer
2016-10-04 7:20 ` Greg KH
2016-10-04 23:39 ` Andy Grover
2016-10-05 0:40 ` [dm-devel] " Alasdair G Kergon
2016-10-05 6:26 ` Hannes Reinecke
2016-10-05 6:51 ` Greg KH
2016-10-05 17:06 ` Andy Grover
2016-10-05 17:43 ` Alasdair G Kergon
2016-10-05 22:30 ` Andy Grover
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=1475522580-16723-8-git-send-email-agrover@redhat.com \
--to=agrover@redhat.com \
--cc=dm-devel@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=snitzer@redhat.com \
/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
all inboxes | Powered by JetHome®