[PATCH][MTD] CORE: sysfs support for mtd
Alexander Schmidt
alexs at linux.vnet.ibm.com
Fri Jul 27 09:30:07 EDT 2007
Hi Siddharth,
On Wednesday 25 July 2007, sid at ics.uci.edu wrote:
>
> This patch adds sysfs support for mtd. It exports some of the members of the mtd_info structure
> into the user space via sysfs. The idea is to use sysfs as an alternative to using mtd ioctl().
> The following information from mtd_info struct [mtd.h] is exported as files:
>
> - size : Partition size
> - erasesize : Size of erase block
> - writesize : Page size
> - type : On of the following -> Absent, RAM, ROM, NOR Flash, NAND Flash, Data flash
> - bbt : List of bad blocks from device specific block_isbad() function
> - numeraseregions : Number of erase regions
>
> The master mtd partition appears as a directory under sysfs as /sys/devices/mtd. For each mtd
> partition (i.e., for each slave mtd found in mtdpart.c), a file under /sys/devices/mtd directory
> by name mtdN (N = partition number) is generated. A struct kobject kobj is added as member of
> struct mtd_info mtd [mtd.h] to enable mtd_info to become part of the kobjects hierarchy. The
> attributes to be exported are added as struct mtd_attr [mtdpart.c]. A soft link from
> /sys/bus/platform/devices/mtd points to /sys/deevices/mtd. Additional attributes can be added by
> adding an entry to the mtd_default_attrs[] structure [mtdpart.c]
>
> It would be nice if the patch could be tested. I have tested it on a MIPS based board with NAND
> flash. (Please bear with me if the patch does not appear correctly. This is my first patch to the
> list and I have tested by sending the patch to myself as per the FAQs).
I have applied this patch to my tree and tried to compile it, but I get
lots of compile errors. Maybe you created it on an outdated kernel?!
/home/schmidta/git/ubi-2.6/drivers/mtd/mtdpart.c: In function `mtd_sysfs_rd_ecctype':
/home/schmidta/git/ubi-2.6/drivers/mtd/mtdpart.c:111: error: structure has no member named `ecctype'
/home/schmidta/git/ubi-2.6/drivers/mtd/mtdpart.c:112: error: `MTD_ECC_NONE' undeclared (first use in this function)
/home/schmidta/git/ubi-2.6/drivers/mtd/mtdpart.c:112: error: (Each undeclared identifier is reported only once
/home/schmidta/git/ubi-2.6/drivers/mtd/mtdpart.c:112: error: for each function it appears in.)
/home/schmidta/git/ubi-2.6/drivers/mtd/mtdpart.c:113: error: `MTD_ECC_RS_DiskOnChip' undeclared (first use in this function)
/home/schmidta/git/ubi-2.6/drivers/mtd/mtdpart.c:114: error: `MTD_ECC_SW' undeclared (first use in this function)
/home/schmidta/git/ubi-2.6/drivers/mtd/mtdpart.c:116: error: structure has no member named `ecctype'
/home/schmidta/git/ubi-2.6/drivers/mtd/mtdpart.c: In function `mtd_sysfs_rd_eccsize':
/home/schmidta/git/ubi-2.6/drivers/mtd/mtdpart.c:122: error: structure has no member named `eccsize'
/home/schmidta/git/ubi-2.6/drivers/mtd/mtdpart.c: In function `add_mtd_partitions':
/home/schmidta/git/ubi-2.6/drivers/mtd/mtdpart.c:510: warning: assignment from incompatible pointer type
/home/schmidta/git/ubi-2.6/drivers/mtd/mtdpart.c:511: error: invalid use of undefined type `struct subsystem'
Regards,
Alex
More information about the linux-mtd
mailing list