public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Robert Love <rml@novell.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>,
	akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: [patch] kernel sysfs events layer
Date: Wed, 15 Sep 2004 14:21:10 -0700	[thread overview]
Message-ID: <20040915212110.GA25840@kroah.com> (raw)
In-Reply-To: <1095279043.23385.102.camel@betsy.boston.ximian.com>

On Wed, Sep 15, 2004 at 04:10:43PM -0400, Robert Love wrote:
> On Wed, 2004-09-15 at 12:40 -0700, Greg KH wrote:
> 
> > And here's the patch I applied to my trees and will show up in the next
> > -mm release.
> > 
> > I'll go convert Kay's mount patch to the new interface and add it too.
> 
> I think you want an "unmount" signal, too.

Doh!  You're right.  Here's Kay's patch ported to the new interface, and
adding a umount event type.  I've applied it to my trees.

thanks,

greg k-h

-----


kevent: add block mount and umount support

Send notification over the new netlink socket to let userspace know that
the filesystem code claims/releases the superblock on an blockdevice.
This way, userspace can get rid of constantly polling /proc/mounts to
watch for filesystem changes.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>

diff -Nru a/fs/super.c b/fs/super.c
--- a/fs/super.c	2004-09-15 14:15:54 -07:00
+++ b/fs/super.c	2004-09-15 14:15:54 -07:00
@@ -35,6 +35,7 @@
 #include <linux/vfs.h>
 #include <linux/writeback.h>		/* for the emergency remount stuff */
 #include <linux/idr.h>
+#include <linux/kobject.h>
 #include <asm/uaccess.h>
 
 
@@ -633,6 +634,16 @@
 	return (void *)s->s_bdev == data;
 }
 
+static void bdev_uevent(struct block_device *bdev, enum kobject_action action)
+{
+	if (bdev->bd_disk) {
+		if (bdev->bd_part)
+			kobject_uevent(&bdev->bd_part->kobj, action, NULL);
+		else
+			kobject_uevent(&bdev->bd_disk->kobj, action, NULL);
+	}
+}
+
 struct super_block *get_sb_bdev(struct file_system_type *fs_type,
 	int flags, const char *dev_name, void *data,
 	int (*fill_super)(struct super_block *, void *, int))
@@ -675,8 +686,10 @@
 			up_write(&s->s_umount);
 			deactivate_super(s);
 			s = ERR_PTR(error);
-		} else
+		} else {
 			s->s_flags |= MS_ACTIVE;
+			bdev_uevent(bdev, KOBJ_MOUNT);
+		}
 	}
 
 	return s;
@@ -691,6 +704,8 @@
 void kill_block_super(struct super_block *sb)
 {
 	struct block_device *bdev = sb->s_bdev;
+
+	bdev_uevent(bdev, KOBJ_UMOUNT);
 	generic_shutdown_super(sb);
 	set_blocksize(bdev, sb->s_old_blocksize);
 	close_bdev_excl(bdev);
diff -Nru a/include/linux/kobject_uevent.h b/include/linux/kobject_uevent.h
--- a/include/linux/kobject_uevent.h	2004-09-15 14:15:54 -07:00
+++ b/include/linux/kobject_uevent.h	2004-09-15 14:15:54 -07:00
@@ -21,6 +21,7 @@
 	KOBJ_REMOVE	= 0x01,	/* remove event, for hotplug */
 	KOBJ_CHANGE	= 0x02,	/* a sysfs attribute file has changed */
 	KOBJ_MOUNT	= 0x03,	/* mount event for block devices */
+	KOBJ_UMOUNT	= 0x04,	/* umount event for block devices */
 	KOBJ_MAX_ACTION,	/* must be last action listed */
 };
 
diff -Nru a/lib/kobject_uevent.c b/lib/kobject_uevent.c
--- a/lib/kobject_uevent.c	2004-09-15 14:15:54 -07:00
+++ b/lib/kobject_uevent.c	2004-09-15 14:15:54 -07:00
@@ -32,6 +32,7 @@
 	"remove",	/* 0x01 */
 	"change",	/* 0x02 */
 	"mount",	/* 0x03 */
+	"umount",	/* 0x04 */
 };
 
 static char *action_to_string(enum kobject_action action)

  parent reply	other threads:[~2004-09-15 21:31 UTC|newest]

Thread overview: 105+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-31 21:42 [patch] kernel sysfs events layer Robert Love
2004-08-31 21:56 ` Andrew Morton
2004-08-31 21:58   ` Robert Love
     [not found]     ` <20040831150645.4aa8fd27.akpm@osdl.org>
2004-08-31 22:05       ` Robert Love
2004-09-02  8:34         ` Greg KH
2004-09-02 12:02           ` Daniel Stekloff
2004-09-02 13:26             ` Kay Sievers
2004-09-02 16:27               ` Robert Love
2004-09-02 20:29                 ` Kay Sievers
2004-09-02 12:49           ` Kay Sievers
2004-09-02 16:25           ` Robert Love
2004-09-02 18:35             ` Daniel Stekloff
2004-09-02 18:41               ` Robert Love
2004-09-04  0:54             ` Greg KH
2004-09-05  2:18               ` Kay Sievers
2004-09-05  3:01                 ` Robert Love
2004-09-05  2:58               ` Robert Love
2004-09-05  7:35                 ` Arjan van de Ven
2004-09-05 12:18                 ` Kay Sievers
2004-09-06  2:06                   ` Kay Sievers
2004-09-10 23:54                     ` Greg KH
2004-09-11  0:18                       ` Tim Hockin
2004-09-11  0:48                         ` Greg KH
2004-09-11  1:23                           ` Daniel Stekloff
2004-09-11  4:45                             ` Robert Love
2004-09-11  1:45                           ` Tim Hockin
2004-09-11 16:56                             ` Greg KH
2004-09-11 11:35                           ` Dave Jones
2004-09-11 18:15                             ` Greg KH
2004-09-11  4:09                       ` Robert Love
2004-09-11 16:53                         ` Greg KH
2004-09-13 14:45                           ` Kay Sievers
2004-09-15  0:07                             ` Greg KH
2004-09-15  1:09                               ` Kay Sievers
2004-09-15  1:11                                 ` Tim Hockin
2004-09-15  2:10                                   ` Robert Love
2004-09-15  3:17                                     ` Tim Hockin
2004-09-15  3:42                                       ` Greg KH
2004-09-15  4:48                                         ` Tim Hockin
2004-09-15  5:09                                           ` Greg KH
2004-09-15  6:21                                             ` Tim Hockin
2004-09-15  6:45                                               ` Jan Dittmer
2004-09-15  6:47                                                 ` Tim Hockin
2004-09-15  6:50                                                   ` Jan Dittmer
     [not found]                                                     ` <20040915065515.GA11587@hockin.org>
2004-09-15  7:39                                                       ` Jan Dittmer
2004-09-15  7:56                                                         ` Paul Jackson
2004-09-15  8:32                                                           ` Jan Dittmer
2004-09-15 14:24                                                             ` Paul Jackson
2004-09-15  8:19                                                 ` Karol Kozimor
2004-09-15 15:48                                                   ` Tim Hockin
2004-09-15 16:11                                                     ` Jan Dittmer
2004-09-15 13:14                                               ` Kay Sievers
2004-09-15 21:27                                               ` Greg KH
2004-09-15  9:07                                           ` Andrew Grover
2004-09-15 18:58                                             ` Robert Love
2004-09-15  3:48                                 ` Greg KH
2004-09-15  1:19                               ` Robert Love
2004-09-15  3:44                                 ` Greg KH
2004-09-15 19:40                                   ` Greg KH
2004-09-15 20:10                                     ` Robert Love
2004-09-15 20:22                                       ` Tim Hockin
2004-09-15 20:26                                         ` Robert Love
2004-09-15 20:31                                           ` Tim Hockin
2004-09-15 20:33                                             ` Robert Love
2004-09-15 20:47                                               ` Tim Hockin
2004-09-15 20:49                                                 ` Robert Love
2004-09-15 20:56                                                   ` Tim Hockin
2004-09-15 21:01                                                     ` Robert Love
2004-09-15 21:03                                                     ` Kay Sievers
2004-09-15 21:23                                                     ` Greg KH
2004-09-15 21:26                                                       ` Robert Love
2004-09-15 21:34                                                         ` Tim Hockin
2004-09-15 21:38                                                           ` Robert Love
2004-09-16  1:21                                                             ` Herbert Poetzl
2004-09-16  4:08                                                               ` Greg KH
2004-09-16 14:10                                                                 ` Herbert Poetzl
2004-09-16 15:08                                                                   ` Greg KH
2004-09-16 18:33                                                                     ` Herbert Poetzl
2004-09-15 21:35                                                         ` Greg KH
2004-09-15 21:46                                                           ` Tim Hockin
2004-09-15 21:47                                                             ` Robert Love
2004-09-15 21:38                                                         ` Kay Sievers
2004-09-15 21:39                                                           ` Robert Love
2004-09-15 21:49                                                             ` Tim Hockin
2004-09-15 21:54                                                               ` Greg KH
2004-09-15 20:34                                             ` Kay Sievers
2004-09-15 21:21                                       ` Greg KH [this message]
2004-09-15 21:26                                         ` Robert Love
2004-09-15 21:34                                           ` Kay Sievers
2004-09-15 21:35                                           ` Greg KH
2005-07-06 22:02                     ` Mike Snitzer
2005-07-06 22:18                       ` Greg KH
2004-09-05  3:59               ` Robert Love
2004-08-31 21:58 ` Chris Wedgwood
2004-08-31 22:02   ` Robert Love
2004-08-31 22:00 ` Andrew Morton
2004-08-31 22:00   ` Robert Love
2004-08-31 22:10     ` Andrew Morton
2004-08-31 22:08       ` Robert Love
2004-09-01  2:05 ` Daniel Stekloff
2004-09-01 10:07   ` Kay Sievers
2004-09-02 20:45     ` Daniel Stekloff
2004-09-02 22:15       ` Kay Sievers
2004-09-03 23:59         ` Daniel Stekloff
2004-09-04  8:14           ` Greg KH

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=20040915212110.GA25840@kroah.com \
    --to=greg@kroah.com \
    --cc=akpm@osdl.org \
    --cc=kay.sievers@vrfy.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rml@novell.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