problem with mtdblock dev entries over 9

Aras Vaichas arasv at magellan-technology.com
Sun Dec 5 21:40:12 EST 2004


I'm using the 2.4.x version of the MTD cvs.

I recently created over 9 MTD partitions and I noticed that /dev/mtdblock had 
incorrect names for entries 10 and 11 instead they were ":" and ";". The 
/dev/mtd directory was OK though.

e.g

/root # ll /dev/mtdblock
drwxr-xr-x    1 root     root            0 Jan  1  1970 ./
drwxr-xr-x    1 root     root            0 Jan  1  1970 ../
brw-rw-rw-    1 root     root      31,   0 Jan  1  1970 0
brw-rw-rw-    1 root     root      31,   1 Jan  1  1970 1
brw-rw-rw-    1 root     root      31,   2 Jan  1  1970 2
brw-rw-rw-    1 root     root      31,   3 Jan  1  1970 3
brw-rw-rw-    1 root     root      31,   4 Jan  1  1970 4
brw-rw-rw-    1 root     root      31,   5 Jan  1  1970 5
brw-rw-rw-    1 root     root      31,   6 Jan  1  1970 6
brw-rw-rw-    1 root     root      31,   7 Jan  1  1970 7
brw-rw-rw-    1 root     root      31,   8 Jan  1  1970 8
brw-rw-rw-    1 root     root      31,   9 Jan  1  1970 9
brw-rw-rw-    1 root     root      31,  10 Jan  1  1970 :
brw-rw-rw-    1 root     root      31,  11 Jan  1  1970 ;

solution (assuming number of partitions does not exceed 99!):

--- drivers/mtd/mtd_blkdevs-24.c.orig   2004-12-06 13:29:21.568417264 +1100
+++ drivers/mtd/mtd_blkdevs-24.c        2004-12-06 13:35:25.443099904 +1100
@@ -476,10 +476,9 @@
         }
  #ifdef CONFIG_DEVFS_FS
         if (!tr->part_bits) {
-               char name[2];
+               char name[3];

-               name[0] = '0' + new->devnum;
-               name[1] = 0;
+               sprintf( name, "%d", new->devnum );

                 new->blkcore_priv =
                         devfs_register(tr->blkcore_priv->devfs_dir_handle,

regards,

Aras Vaichas




More information about the linux-mtd mailing list