erase.c

Alice Hennessy ahennessy at mvista.com
Mon Mar 12 17:53:12 EST 2001


Kári Davíðsson wrote:

> Hi,
>
> In the intel chip that we are using here all sectors seem to be locked
> by default.
> So in the erase utility I propose the following patch.
>
> Maybe it is ambigous to do force unlocking of sectors like this.
> Should we maybe have a separate utility to lock/unlock sectors?
>
> K.D.
>
> --- ../mtd/util/erase.c Thu Sep 21 22:00:07 2000
> +++ util/erase.c        Mon Mar 12 14:58:58 2001
> @@ -51,6 +51,12 @@
>                  erase.length, erase.start);
>           fflush(stdout);
>
> +         if(ioctl(Fd, MEMUNLOCK, &erase) != 0)
> +         {
> +                 perror("\nMTD Unlock failure");
> +                 close(Fd);
> +                 return 8;

>
> +                }
>           if (ioctl(Fd,MEMERASE,&erase) != 0)
>               {
>                   perror("\nMTD Erase failure");
>
> To unsubscribe, send "unsubscribe mtd" to majordomo at infradead.org

I have tests for both lock and unlock that can easily become the
utilities if desired.


lock.c: locks num sectors at ofs or all sectors
USAGE: %s <mtd device> <ofs> <num of sectors or -1 for all sectors>

unlock.c: unlocks all sectors since that's what Intel chips do
USAGE: %s <mtd device>

Alice



To unsubscribe, send "unsubscribe mtd" to majordomo at infradead.org



More information about the linux-mtd mailing list