Hello. When I discovered, that I have to call "blockdev --rereadpt device" after dd-ing image containing MBR to flash, I recognized that at upgrade phase of the router that I develop I should call blockdev too, but there is a lack of blockdev in busybox and fdisk performs rereading only after altering of MBR. Moreover, fdisk is unneeded in busybox for me if I have prepared image with MBR at host machine. I have tried to find out whether partition table rereading could be performed with sysctl applet, but, as I understand, it couldn't. So I wrote little blockdev applet and I want to ask whether I can contribute to busybox with it?
Standard utility conformance: Standard blockdev (from util-linux-ng package) has -q -v and -V for quiet, verbose and Version. This flags are removed. Also I removed --report command (with output similar to "fdisk -l") - I think it is not so nessesary at an embedded system, --setra, --getra, --setfra, --getfra - I do not know the goal of these flags so I cant test it properly => they are removed. I think they could be easily added if someone explains their purpose and use cases. Standard blockdev allows to perform multiple commands on multiple devices by blockdev --cmd1 --cmd2 ... --cmdM dev1 ... devN, but I have never used this feature before so I think that it is not so nessesary. Only "blockdev --cmd [CMDARG] dev" format supported. Code: Code of applet is exported from original blockdev and then slightly reworked: 1. I have deleted some fields from structure for ioctl variants, so static array of structures is slightly smaller. 2. There was some ioctl variants in this array which absent in the manual and couldn't be executed => they were deleted. 2. Help is moved from source to usage.src.h. Size: Applet adds 200 bytes to stripped busybox footprint, and less than 300 bytes to unstripped variant in case of the default config. Source code of the applet is three times smaller than one of the original utility. Testing: I wrote this applet yesterday and today, and, although I have tested it, some additional testing should be performed, I think. But I want to ask you if my applet is coded in busybox style and how I can improve it. .diff file with applet for busybox-1.17.2 is attached and can be installed with patch -p1. By the way, I cant delete busybox.html with doc-clean along with usage.h, applets.h and NUM_applets.h with clean and distclean. Is it correct? Sergey Naumov.
bb-blockdev.diff
Description: Binary data
_______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
