Re: [RFC] sysfs support for mtd

Artem Bityutskiy
2007-07-19T07:03:05Z

On Wed, 2007-07-18 at 11:45 -0700, Siddharth Choudhuri wrote:
> 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.
I doubt OOB-related stuff has to be exposed. We see many new flash
controllers which do not let you access OOB. It is better to avoid OOB
usage altogether, so I would not even exposed that stuff in sysfs.

> 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 ?
I think yes, it should be something like "NAND", "OneNAND", "NOR",
"DataFlash", etc.

> 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
No idea, but I've always thought sysfs core automatically puts these
links. All you have to do is to define your bus object which is
"platform" bus, and the stuff will appear. Although I am not sure.

--
Best regards,
Artem Bityutskiy (Битюцкий Артём)