Skip to contentSkip to conversation

block: how shall register_blkdev() work?

PATCH Németh Márton 1 participant 1 message Jan 11, 2009 Block layer

lore
Share & tools
lore
#0 lore raw

Hi,

I started to write some testcases for register_blkdev(), see
http://sourceforge.net/mailarchive/forum.php?thread_name=4969BE28.2030303%40freemail.hu&forum_name=ltp-list .

I am not sure how register_blkdev() should work, so I tried to write down what I could find out so far, but there are still some open questions.

Could you please review and correct the following description?

block/genhd.c renamed from block/genhd.c.orig +18 -0
@@ -244,6 +244,24 @@ void blkdev_show(struct seq_file *seqf,
 }
 #endif /* CONFIG_PROC_FS */
 
+/**
+ * register_blkdev - register a new block device
+ *
+ * @major: [in] the requested major device number [1..255]. If
+ *         @major=0, try to allocate any unused major number.
+ * @name: [in] the name of the new block device
+ *
+ * ??? The @name must be unique within the system. ???
+ * OR: ??? You can use any zero terminated @name string. Note, however, if
+ *         you use a name which is already used it might mask the previous
+ *         device. ???
+ *
+ * Returns the allocated major number [1..255] or the return value is
+ * a negative error code if the wanted @major number is not available
+ * or there is no more major nubmers available when @major=0.
+ *
+ * ??? What does the return value 0 mean?
+ */
 int register_blkdev(unsigned int major, const char *name)
 {
 	struct blk_major_name **n, *p;

Regards,

Márton Németh