linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Jan-Benedict Glaw <jbglaw@lug-owl.de>
To: linux-lvm@sistina.com
Subject: [linux-lvm] Removing direct access to gendisk_head
Date: Sat, 6 Oct 2001 13:01:47 +0200	[thread overview]
Message-ID: <20011006130147.C31614@lug-owl.de> (raw)

Hi!

I'm currently looking over kernel code (for cleaning-up purposes)
and removed EXPORT_SYMBOL(gendisk_head) which was a no-no for
current LVM kernel code. Please think about picking up this patch

	- Named struct initializers
	- Removing direct use of gendisk_head

There's an open Q: Do we need to nullify ->real_devices and ->next?
I don't think so (but I am unsure) so please remove these two lines
upon your oppinion:-)

MfG, JBG


--- lvm.c.orig	Sat Oct  6 11:19:40 2001
+++ lvm.c	Sat Oct  6 12:48:27 2001
@@ -414,17 +414,17 @@
 
 static struct gendisk lvm_gendisk =
 {
-	MAJOR_NR,		/* major # */
-	LVM_NAME,		/* name of major */
-	0,			/* number of times minor is shifted
-				   to get real minor */
-	1,			/* maximum partitions per device */
-	lvm_hd_struct,		/* partition table */
-	lvm_size,		/* device size in blocks, copied
-				   to block_size[] */
-	MAX_LV,			/* number or real devices */
-	NULL,			/* internal */
-	NULL,			/* pointer to next gendisk struct (internal) */
+	major:		MAJOR_NR,		/* major number */
+	major_name:	LVM_NAME,		/* name of major */
+	minor_shift:	0,			/* number of times minor is shifted
+						   to get real minor */
+	max_p:		1,			/* maximum partitions per device */
+	part:		lvm_hd_struct,		/* partition table */
+	sizes:		lvm_size,		/* device size in blocks, copied
+						   to block_size[] */
+	nr_real:	MAX_LV,			/* number or real devices */
+	real_devices:	NULL,			/* internal */
+	next:		NULL,			/* pointer to next gendisk struct (internal) */
 };
 
 /*
@@ -454,19 +454,8 @@
 	lvm_init_vars();
 	lvm_geninit(&lvm_gendisk);
 
-	/* insert our gendisk at the corresponding major */
-	if (gendisk_head != NULL) {
-		gendisk_ptr = gendisk_head;
-		while (gendisk_ptr->next != NULL &&
-		       gendisk_ptr->major > lvm_gendisk.major) {
-			gendisk_ptr = gendisk_ptr->next;
-		}
-		lvm_gendisk.next = gendisk_ptr->next;
-		gendisk_ptr->next = &lvm_gendisk;
-	} else {
-		gendisk_head = &lvm_gendisk;
-		lvm_gendisk.next = NULL;
-	}
+	/* insert our gendisk */
+	add_gendisk(&lvm_gendisk);
 
 #ifdef LVM_HD_NAME
 	/* reference from drivers/block/genhd.c */
@@ -508,18 +497,8 @@
 		printk(KERN_ERR "%s -- devfs_unregister_blkdev failed\n",
 		       lvm_name);
 
-
-
-	gendisk_ptr = gendisk_ptr_prev = gendisk_head;
-	while (gendisk_ptr != NULL) {
-		if (gendisk_ptr == &lvm_gendisk)
-			break;
-		gendisk_ptr_prev = gendisk_ptr;
-		gendisk_ptr = gendisk_ptr->next;
-	}
 	/* delete our gendisk from chain */
-	if (gendisk_ptr == &lvm_gendisk)
-		gendisk_ptr_prev->next = gendisk_ptr->next;
+	del_gendisk(&lvm_gendisk);
 
 	blk_size[MAJOR_NR] = NULL;
 	blksize_size[MAJOR_NR] = NULL;
-- 
Jan-Benedict Glaw . jbglaw@lug-owl.de . +49-172-7608481

             reply	other threads:[~2001-10-06 11:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-06 11:01 Jan-Benedict Glaw [this message]
2001-10-07 10:02 ` [linux-lvm] Removing direct access to gendisk_head Christoph Hellwig

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=20011006130147.C31614@lug-owl.de \
    --to=jbglaw@lug-owl.de \
    --cc=linux-lvm@sistina.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;
as well as URLs for NNTP newsgroup(s).