[PATCH] ubimkvol: add -m option to create volume of maximum size
Mike Frysinger
vapier at gentoo.org
Fri May 31 23:31:22 UTC 2013
On Tuesday 28 May 2013 17:35:29 Paul B. Henson wrote:
> + if (sscanf(ubi_ctrl, "/dev/ubi%u", &ubinum) != 1)
> + bb_error_msg_and_die("%s device node not in correct
format", "UBI");
seems like all of these sscanf would be better off using the existing xstrtou()
helpers ?
> + sprintf(buf, "/sys/class/ubi/ubi%d/avail_eraseblocks", ubinum);
you sprintf the same string at the start of buf every time. this would
probably be smaller code:
char buf[100];
char path[...existing sizeof() logic...];
char *p;
p = path + sprintf(path, "/sys/class/ubi/ubi%d/", ubinum);
strcpy(p, "avail_eraseblocks");
if (open_read_close(path, buf, sizeof(buf)) <= 0)
bb_error_msg_and_die(...);
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20130531/d029a3d9/attachment.asc>
More information about the busybox
mailing list