MEMGETREGIONCOUNT ioctl

Gavin Lambert gavinl at compacsort.com
Wed Apr 4 03:11:58 EDT 2007


I'm a bit of an MTD newbie myself, so I could be wrong about some of
this, but:

Quoth Jitendra Jain [jitendra.jain at einfochips.com]:
> As per the driver, the MEMGETREGIONCOUNT returns the
> parameter numeraseregions, which is meant to signify if the
> flash erase size is same throughout or whether it has
> variable sized sectors (which is found on NOR flash devices).
> Why does the util denote that number as number of erase regions ??

Because that's sort of what it is.  If your driver doesn't support the
ioctl at all then callers assume the erase size is constant as given in
the erasesize field of MEMGETINFO.  If it does support the ioctl, then
callers expect it to return the number of erase block size-change
thresholds (since a region can cover multiple erase blocks, provided
they're contiguous and of the same size).

> Next, the MEMGETREGIONINFO seems to copy arguments from User
> to the kernel which I dont understand. This is meant to give
> the User information so, it ought to be copy_to_user.

It's bidirectional.  It has to first copy to the kernel so that the
kernel can read the regionindex field and find out which region the user
wants to know about.  Then once it's filled in the rest of the
kernel-side structure it needs to copy that back to userspace.





More information about the linux-mtd mailing list