[PATCH]: add ubiupdatevol applet (version 2)
Denys Vlasenko
vda.linux at googlemail.com
Tue Apr 26 01:39:19 UTC 2011
On Monday 04 April 2011 00:58, Reuben Dowle wrote:
> This patch adds the ubiupdatevol applet (from mtd-utils) to busybox. Incorporates changes as suggested by Baruch Siach.
>
> This version of ubiupdatevol makes some assumptions about the naming of ubi device nodes, to avoid the complexity of scanning and probing devices nodes as libubi does in the full version of ubiupdatevol.
>
> Signed-off-by: Reuben Dowle <reuben.dowle at navico.com>
> xioctl(fd, UBI_IOCRSVOL, &req);
> + } else
> + if (do_update) {
> + struct stat st;
> + int ubinum, volnum;
> + char buf[40];
> + int sysfs_fd;
> + int input_fd;
> + int leb_size;
> + ssize_t len;
> + long long bytes;
> + char *input_data;
> +
> + if (opts & OPTION_t)
> + {
> + // truncate the volume by starting an update for size 0
> + bytes = 0;
> + xioctl(fd, UBI_IOCVOLUP, &bytes);
> + }
> + else
> + {
> + // Make assumption that device not is in normal format. Removes need for scanning sysfs tree as full libubi does
> + if (sscanf(ubi_ctrl, "/dev/ubi%d_%d", &ubinum, &volnum) != 2)
> + bb_error_msg_and_die("%s volume node not in correct format", "UBI");
> +
> + snprintf(buf, sizeof(buf), "/sys/class/ubi/ubi%d_%d/usable_eb_size", ubinum, volnum);
> + sysfs_fd = xopen(buf, O_RDONLY);
> + bb_error_msg_and_die("%s sysfs not accessible", "UBI");
This bb_error_msg_and_die call seems to be out of place.
--
vda
More information about the busybox
mailing list