[RFC] sysfs support for mtd

Siddharth Choudhuri siddh_c at yahoo.com
Wed Jul 18 14:45:54 EDT 2007


Hi,

I have added a sysfs support for mtd. There was an
earlier discussion some time back
(http://lists.infradead.org/pipermail/linux-mtd/2006-December/016952.html)
about adding sysfs support for mtd.

Here's the design:
o Each mtd partition appears as a directory under 
/sys/devices/mtd/ 
o The following fields from struct mtd_info are
exported as files - eccsize, ecctype, erasesize,
numeraseregions, oobsize, size, type, writesize. 

--------------
Eg: 
# ls -l /sys/devices/mtd
drwxr-xr-x    2 root     root            0 Jan  1
00:00 mtd0
drwxr-xr-x    2 root     root            0 Jan  1
00:00 mtd1
drwxr-xr-x    2 root     root            0 Jan  1
00:00 mtd2
drwxr-xr-x    2 root     root            0 Jan  1
00:00 mtd3
# ls -l /sys/devices/mtd/mtd0/
-r--r--r--    1 root     root         4096 Jan  1
00:00 bbt
-r--r--r--    1 root     root         4096 Jan  1
00:00 eccsize
-r--r--r--    1 root     root         4096 Jan  1
00:00 ecctype
-r--r--r--    1 root     root         4096 Jan  1
00:00 erasesize
-r--r--r--    1 root     root         4096 Jan  1
00:00 numeraseregions
-r--r--r--    1 root     root         4096 Jan  1
00:00 oobsize
-r--r--r--    1 root     root         4096 Jan  1
00:00 size
-r--r--r--    1 root     root         4096 Jan  1
00:00 type
-r--r--r--    1 root     root         4096 Jan  1
00:00  writesize
# cat /sys/devices/mtd/mtd0/oobsize 
64
-----------

I would like to get some suggestions from the group
before sending out a patch:
o Currently the fields type, ecctype are integers.
Should these be converted into appropriate strings as
per #defines from mtd-abi.h
Eg: cat /sys/devices/mtd/mtd0/type 
shows 4. Should this show MTD_NANDFLASH instead ? 

o I am not sure where an additional link from bus to
mtd should be added in the sysfs hierarchy. Should it
be /sys/bus/platform/devices -> ../../../devices/mtd
-OR-
/sys/bus/platform/ -> ../../devices/mtd 

o Any other comments/suggestions. 

thanks,
-sid












       
____________________________________________________________________________________
Get the Yahoo! toolbar and be alerted to new email wherever you're surfing.
http://new.toolbar.yahoo.com/toolbar/features/mail/index.php



More information about the linux-mtd mailing list