mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Malcolm Rowe <malcolm-linux@farside.org.uk>
To: Greg Kroah-Hartman <gregkh@suse.de>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] Symlink /sys/class/block to /sys/block
Date: Sat, 19 Feb 2005 23:29:13 +0000	[thread overview]
Message-ID: <courier.4217CBC9.000027C1@mail.farside.org.uk> (raw)

Greg, 

Following the discussion in [1], the attached patch creates /sys/class/block
as a symlink to /sys/block. The patch applies to 2.6.11-rc4-bk7. 

Please cc: me on any replies - I'm not subscribed to the mailing list. 

[1] http://marc.theaimsgroup.com/?m=110506536315986 

Regards,
Malcolm 

Signed-off-by: Malcolm Rowe <malcolm-linux@farside.org.uk> 

diff -ur linux-2.6.11-rc4-bk7/drivers/base/class.c 
linux-2.6.11-rc4-bk7-diff/drivers/base/class.c
 --- linux-2.6.11-rc4-bk7/drivers/base/class.c	2005-02-19 21:34:31.000000000 
+0000
+++ linux-2.6.11-rc4-bk7-diff/drivers/base/class.c	2005-02-19 
21:38:31.000000000 +0000
@@ -69,7 +69,7 @@
}; 

/* Hotplug events for classes go to the class_obj subsys */
 -static decl_subsys(class, &ktype_class, NULL);
+decl_subsys(class, &ktype_class, NULL); 


int class_create_file(struct class * cls, const struct class_attribute * 
attr)
diff -ur linux-2.6.11-rc4-bk7/drivers/block/genhd.c 
linux-2.6.11-rc4-bk7-diff/drivers/block/genhd.c
 --- linux-2.6.11-rc4-bk7/drivers/block/genhd.c	2005-02-19 21:34:31.000000000 
+0000
+++ linux-2.6.11-rc4-bk7-diff/drivers/block/genhd.c	2005-02-19 
22:01:56.000000000 +0000
@@ -14,6 +14,7 @@
#include <linux/slab.h>
#include <linux/kmod.h>
#include <linux/kobj_map.h>
+#include <linux/sysfs.h> 

#define MAX_PROBE_HASH 255	/* random */ 

@@ -300,11 +301,24 @@
	return NULL;
} 

+extern struct subsystem class_subsys;
+
static int __init genhd_device_init(void)
{
	bdev_map = kobj_map_init(base_probe, &block_subsys);
	blk_dev_init();
 -	subsystem_register(&block_subsys);
+	if (!subsystem_register(&block_subsys)) {
+		/*
+		 * /sys/block should really live under /sys/class, but for
+		 * the moment, we can only have class devices, not
+		 * sub-classes-devices. Until we can move /sys/block into
+		 * the right place, create a symlink from /sys/class/block to
+		 * /sys/block, so that userspace doesn't need to know about
+		 * the difference.
+		 */
+		sysfs_create_link(&class_subsys.kset.kobj,
+				  &block_subsys.kset.kobj, "block");
+	}
	return 0;
} 

@@ -406,6 +420,7 @@
static void disk_release(struct kobject * kobj)
{
	struct gendisk *disk = to_disk(kobj);
+	sysfs_remove_link(&class_subsys.kset.kobj, "block");
	kfree(disk->random);
	kfree(disk->part);
	free_disk_stats(disk); 



             reply	other threads:[~2005-02-19 23:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-19 23:29 Malcolm Rowe [this message]
2005-02-22 19:04 ` Greg KH
     [not found]   ` <courier.421C5047.00003EBA@mail.farside.org.uk>
2005-02-24 23:34     ` Greg KH
2005-02-25  1:35       ` Kay Sievers
2005-02-25 22:39         ` Greg KH
2005-02-25 23:53           ` Kay Sievers
2005-02-25 23:58             ` Greg KH
2005-02-22 23:06 ` Chris Wedgwood
2005-02-22 23:21   ` 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=courier.4217CBC9.000027C1@mail.farside.org.uk \
    --to=malcolm-linux@farside.org.uk \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.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

all inboxes | Powered by JetHome®