CVS commit: src/usr.sbin/flashctl
Module Name:src Committed By: joerg Date: Tue May 24 13:01:53 UTC 2011 Modified Files: src/usr.sbin/flashctl: flashctl.c Log Message: Properly use format strings To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/flashctl/flashctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/flashctl/flashctl.c diff -u src/usr.sbin/flashctl/flashctl.c:1.3 src/usr.sbin/flashctl/flashctl.c:1.4 --- src/usr.sbin/flashctl/flashctl.c:1.3 Mon Apr 4 18:30:07 2011 +++ src/usr.sbin/flashctl/flashctl.c Tue May 24 13:01:53 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: flashctl.c,v 1.3 2011/04/04 18:30:07 ahoka Exp $ */ +/* $NetBSD: flashctl.c,v 1.4 2011/05/24 13:01:53 joerg Exp $ */ /*- * Copyright (c) 2010 Department of Software Engineering, @@ -85,7 +85,7 @@ if (argc == 2) { error = to_intmax(&n, argv[0]); if (error) { -warnx(strerror(error)); +warnx("%s", strerror(error)); goto out; } ep.ep_addr = n; @@ -95,7 +95,7 @@ } else { error = to_intmax(&n, argv[1]); if (error) { - warnx(strerror(error)); + warnx("%s", strerror(error)); goto out; } ep.ep_len = n; @@ -198,7 +198,7 @@ error = to_intmax(&n, argv[0]); if (error) { - warnx(strerror(error)); + warnx("%s", strerror(error)); goto out; }
CVS commit: src/usr.sbin/flashctl
Module Name:src Committed By: wiz Date: Sun Feb 27 23:28:13 UTC 2011 Modified Files: src/usr.sbin/flashctl: flashctl.8 Log Message: Fix a typo, sort commands. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/flashctl/flashctl.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/flashctl/flashctl.8 diff -u src/usr.sbin/flashctl/flashctl.8:1.1 src/usr.sbin/flashctl/flashctl.8:1.2 --- src/usr.sbin/flashctl/flashctl.8:1.1 Sun Feb 27 17:51:45 2011 +++ src/usr.sbin/flashctl/flashctl.8 Sun Feb 27 23:28:12 2011 @@ -1,4 +1,4 @@ -.\" $NetBSD: flashctl.8,v 1.1 2011/02/27 17:51:45 ahoka Exp $ +.\" $NetBSD: flashctl.8,v 1.2 2011/02/27 23:28:12 wiz Exp $ .\" .\" Copyright (c) 2011 Department of Software Engineering, .\" University of Szeged, Hungary @@ -51,24 +51,23 @@ .Sh DEVICE COMMANDS The following commands may be used on flash devices: .Bl -tag -width erase_offset_size -.It Cm identify -Identify the specified device, displaying the device's vendor, product -strings, and the device's capabilities. +.It Cm badblocks +List the bad blocks on the device. .It Cm erase Ar offset Ar size Erase .Ar size -ammount of flash memory from +amount of flash memory from .Ar offset . Size could be .Ar all , which means the rest of the flash after .Ar offset -will be -erased. -.It Cm badblocks -List the bad blocks on the device. +will be erased. +.It Cm identify +Identify the specified device, displaying the device's vendor, product +strings, and the device's capabilities. .It Cm markbad Ar offset -Mark the block given by it's +Mark the block given by its .Ar offset as bad. .El @@ -82,4 +81,5 @@ .Sh AUTHORS The .Nm -command was written by Adam Hoka. +command was written by +.An Adam Hoka .
CVS commit: src/usr.sbin/flashctl
Module Name:src Committed By: ahoka Date: Sun Mar 20 06:10:27 UTC 2011 Modified Files: src/usr.sbin/flashctl: flashctl.c Log Message: Fix markbad command To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/flashctl/flashctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/flashctl/flashctl.c diff -u src/usr.sbin/flashctl/flashctl.c:1.1 src/usr.sbin/flashctl/flashctl.c:1.2 --- src/usr.sbin/flashctl/flashctl.c:1.1 Sat Feb 26 18:07:32 2011 +++ src/usr.sbin/flashctl/flashctl.c Sun Mar 20 06:10:27 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: flashctl.c,v 1.1 2011/02/26 18:07:32 ahoka Exp $ */ +/* $NetBSD: flashctl.c,v 1.2 2011/03/20 06:10:27 ahoka Exp $ */ /*- * Copyright (c) 2010 Department of Software Engineering, @@ -57,8 +57,10 @@ setprogname(argv[0]); - if (argc < 3) + if (argc < 3) { usage(); + exit(1); + } device = argv[1]; command = argv[2]; @@ -66,8 +68,9 @@ argv += 3; fd = open(device, O_RDWR, 0); - if (fd == -1) + if (fd == -1) { err(EXIT_FAILURE, "can't open flash device"); + } if (!strcmp("erase", command)) { struct flash_info_params ip; @@ -176,14 +179,24 @@ addr += ip.ip_erase_size; } - if (hasbad) + if (hasbad) { printf("Done.\n"); - else + } else { printf("No bad blocks found.\n"); + } } else if (!strcmp("markbad", command)) { flash_addr_t address; + + /* TODO: maybe we should let the user specify + * multiple blocks? + */ + if (argc != 1) { + warnx("invalid number of arguments"); + error = 1; + goto out; + } - error = to_intmax(&n, argv[1]); + error = to_intmax(&n, argv[0]); if (error) { warnx(strerror(error)); goto out; @@ -244,6 +257,4 @@ getprogname()); fprintf(stderr, " %s device markbad \n", getprogname()); - - exit(1); }
CVS commit: src/usr.sbin/flashctl
Module Name:src Committed By: ahoka Date: Mon Apr 4 18:30:07 UTC 2011 Modified Files: src/usr.sbin/flashctl: flashctl.c Log Message: fix one more flash_addr_t fallout To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/flashctl/flashctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/flashctl/flashctl.c diff -u src/usr.sbin/flashctl/flashctl.c:1.2 src/usr.sbin/flashctl/flashctl.c:1.3 --- src/usr.sbin/flashctl/flashctl.c:1.2 Sun Mar 20 06:10:27 2011 +++ src/usr.sbin/flashctl/flashctl.c Mon Apr 4 18:30:07 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: flashctl.c,v 1.2 2011/03/20 06:10:27 ahoka Exp $ */ +/* $NetBSD: flashctl.c,v 1.3 2011/04/04 18:30:07 ahoka Exp $ */ /*- * Copyright (c) 2010 Department of Software Engineering, @@ -137,10 +137,10 @@ printf("\n"); /* TODO: humanize */ - printf("Capacity %jd Mbytes, %jd pages, %zu bytes/page\n", + printf("Capacity %jd Mbytes, %jd pages, %ju bytes/page\n", (intmax_t )ip.ip_flash_size / 1024 / 1024, (intmax_t )ip.ip_flash_size / ip.ip_page_size, - ip.ip_page_size); + (intmax_t )ip.ip_page_size); if (ip.ip_flash_type == FLASH_TYPE_NAND) { printf("Block size %jd Kbytes, %jd pages/block\n", @@ -150,7 +150,7 @@ } else if (!strcmp("badblocks", command)) { struct flash_info_params ip; struct flash_badblock_params bbp; - flash_addr_t addr; + flash_off_t addr; bool hasbad = false; error = ioctl(fd, FLASH_GET_INFO, &ip); @@ -185,7 +185,7 @@ printf("No bad blocks found.\n"); } } else if (!strcmp("markbad", command)) { - flash_addr_t address; + flash_off_t address; /* TODO: maybe we should let the user specify * multiple blocks?