diff options
author | Josh Boyer <jwboyer@gmail.com> | 2006-05-27 10:10:03 -0500 |
---|---|---|
committer | Josh Boyer <jwboyer@gmail.com> | 2006-05-27 10:10:03 -0500 |
commit | 69358f79c0523f40001aebb6e43b2401b3a3e070 (patch) | |
tree | 4c5b382d02870a6a30a67a75d49ebd916e52ec6d /docfdisk.c | |
parent | a96ff574c24dab891c4061d2103815e34aeb78f8 (diff) | |
parent | c712b2344e47101df11f46997508bf96b9f4e24e (diff) |
Merge git://git.infradead.org/users/joern/utils
Diffstat (limited to 'docfdisk.c')
-rw-r--r-- | docfdisk.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -194,7 +194,7 @@ int main(int argc, char **argv) meminfo.size, meminfo.erasesize); buf = malloc(meminfo.erasesize); - oobbuf = malloc((meminfo.erasesize / meminfo.oobblock) * meminfo.oobsize); + oobbuf = malloc((meminfo.erasesize / meminfo.writesize) * meminfo.oobsize); if (!buf || !oobbuf) { printf("Can't malloc block buffer\n"); return 1; @@ -227,12 +227,12 @@ int main(int argc, char **argv) oob.ptr = oobbuf; oob.start = mhoffs; - for (i = 0; i < meminfo.erasesize; i += meminfo.oobblock) { + for (i = 0; i < meminfo.erasesize; i += meminfo.writesize) { if (ioctl(fd, MEMREADOOB, &oob)) { perror("ioctl(MEMREADOOB)"); return 1; } - oob.start += meminfo.oobblock; + oob.start += meminfo.writesize; oob.ptr += meminfo.oobsize; } @@ -292,27 +292,27 @@ int main(int argc, char **argv) oob.ptr = oobbuf; oob.start = mhoffs; - for (i = 0; i < meminfo.erasesize; i += meminfo.oobblock) { + for (i = 0; i < meminfo.erasesize; i += meminfo.writesize) { memset(oob.ptr, 0xff, 6); // clear ECC. if (ioctl(fd, MEMWRITEOOB, &oob)) { perror("ioctl(MEMWRITEOOB)"); printf("Your MediaHeader may be hosed. UHOH!\n"); return 1; } - if ((ret = pwrite(fd, buf, meminfo.oobblock, oob.start)) < 0) { + if ((ret = pwrite(fd, buf, meminfo.writesize, oob.start)) < 0) { perror("Write page"); printf("Your MediaHeader may be hosed. UHOH!\n"); return 1; } - if (ret != meminfo.oobblock) { + if (ret != meminfo.writesize) { printf("Short write!\n"); printf("Your MediaHeader may be hosed. UHOH!\n"); return 1; } - oob.start += meminfo.oobblock; + oob.start += meminfo.writesize; oob.ptr += meminfo.oobsize; - buf += meminfo.oobblock; + buf += meminfo.writesize; } printf("Success. REBOOT or unload the diskonchip module to update partitions!\n"); |