summaryrefslogtreecommitdiff
path: root/include/linux/raid/md.h
diff options
context:
space:
mode:
authorAndrew Morton <akpm@digeo.com>2003-05-07 08:17:47 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2003-05-07 08:17:47 -0700
commit65faa449f2d83c822c4175af311bab3c78c90f2b (patch)
tree687bbd4edffa1a548835732a6dbad78ca4ee6835 /include/linux/raid/md.h
parentbd1f184d1f44fd6aadc8f5d84da348a885f872d1 (diff)
[PATCH] remove partition_name()
From: Christoph Hellwig <hch@lst.de> partition_name() is a variant of __bdevname() that caches results and returns a pointrer to kmalloc()ed data instead of printing into a buffer. Due to it's caching it gets utterly confused when the name for a dev_t changes (can happen easily now with device mapper and probably in the future with dynamic dev_t users). It's only used by the raid code and most calls are through a wrapper, bdev_partition_name() which takes a struct block_device * that maybe be NULL. The patch below changes the bdev_partition_name() to call bdevname() if possible and the other calls where we really have nothing more than a dev_t to __bdevname. Btw, it would be nice if someone who knows the md code a bit better than me could remove bdev_partition_name() in favour of direct calls to bdevname() where possible - that would also get rid of the returns pointer to string on stack issue that this patch can't fix yet.
Diffstat (limited to 'include/linux/raid/md.h')
-rw-r--r--include/linux/raid/md.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
index 02ff30e5a187..98f0d1e27c4c 100644
--- a/include/linux/raid/md.h
+++ b/include/linux/raid/md.h
@@ -61,9 +61,20 @@
#define MD_MINOR_VERSION 90
#define MD_PATCHLEVEL_VERSION 0
-extern inline char * bdev_partition_name (struct block_device *bdev)
+/*
+ * XXX(hch): This function is broken. Someone who understands the md
+ * code needs to go through all callers, check whether bdev could
+ * be NULL and replace it with direct calls to bdevmame.
+ *
+ * This would also fix the returns buffer on stack issue nicely :)
+ */
+static inline const char *bdev_partition_name (struct block_device *bdev)
{
- return partition_name(bdev ? bdev->bd_dev : 0);
+ char b[BDEVNAME_SIZE];
+
+ if (!bdev)
+ return __bdevname(0, b);
+ return bdevname(bdev, b);
}
extern int register_md_personality (int p_num, mdk_personality_t *p);
extern int unregister_md_personality (int p_num);