[Toybox] [Patch] - freeramdisk, openvt & deallocvt
Isaac Dunham
ibid.ag at gmail.com
Wed Feb 5 11:08:11 PST 2014
On Wed, Feb 05, 2014 at 06:49:03PM +0530, Vivek Bhagat wrote:
> Hi List,
>
> This is my first post on ToyBox community.
>
Welcome!
I'm sorry I can't do inline comments this time, between the mime types and
the editor I'm using; but I'll try to comment.
And thanks for breaking them out into separate patches.
Anyhow, first there are some smaller details that apply to all of them:
1. It would be nice if in the future new toys were submitted by
attaching the source code, rather than a patch (eg, freeramdisk.c,
openvt.c, and deallocvt.c)
2. Rob puts submissions into toys/pending first and sets them to "default n"
3. For toybox, the standard indentation is 2 spaces for every level.
4. I note that the NEWTOY line has more options than TOYFLAG_USR & TOYFLAG_BIN:
All of these should have TOYFLAG_NEEDROOT, and freeramdisk really belongs in
/sbin (TOYFLAG_SBIN)
> Please find the patches attached herewith for adding 3 new commands -
> 1. freeramdisk - If we unmount or detach the RAM disk based file system the
> Linux Kernel
> will not free the allocated memory associated with the RAM device. This
> can be useful if
> one wants to mount this device again: All data will be preserved.
> If we need to free the memory back to the Kernel, one can use the
> command: "toybox freeramdisk <RAM device>".
This one looked pretty good.
>
> 2. openvt - Successfully opens a new virtual terminal as mentioned with -c
> option
> otherwise search and open next available VT.
> with -s option it switches to new VT
> with -s -w option, it switch back successfully to originating VT.
A couple of smaller details...
This bit:
>+ vt_fd = open(toybuf, O_RDWR);
>+ if (vt_fd < 0) perror_exit("failed to open /dev/tty%d", TT.vt_num);
could be replaced with
vt_fd = xopen(toybuf, O_RDWR);
Also, full POSIX conformance requires STDIN_FILENO to be 0,
and toybox relies on this quite heavily.
> 3. deallocvt - Deallocate specified virtual teminal.
> if no virtual terminal is specified, it deallocates all unused VT.
>
Uses find_console_fd() from openvt.c, and does not depend on openvt.
The options are:
-add "depends on openvt" to the kconfig entry
-move find_console_fd() to lib/
-put deallocvt in openvt.c
> Please find the test log attached here for above 3 commands.
> Your inputs are welcome.
>
> Thanks.
> Vivek
Thank you,
Isaac Dunham
1391627291.0
More information about the Toybox
mailing list