Mercurial > hg > toybox
comparison toys/pending/freeramdisk.c @ 1215:4eaac3e63fa7 draft
Cleanup freeramdisk: tabs to 2 spaces, square brackets for option name, do optional cleanup under if (CFG_TOYBOX_FREE) guard.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sun, 09 Mar 2014 14:38:51 -0500 |
parents | a31d747b0017 |
children |
comparison
equal
deleted
inserted
replaced
1214:a31d747b0017 | 1215:4eaac3e63fa7 |
---|---|
8 | 8 |
9 config FREERAMDISK | 9 config FREERAMDISK |
10 bool "freeramdisk" | 10 bool "freeramdisk" |
11 default n | 11 default n |
12 help | 12 help |
13 usage: freeramdisk <RAM device> | 13 usage: freeramdisk [RAM device] |
14 | 14 |
15 Free all memory allocated to specified ramdisk | 15 Free all memory allocated to specified ramdisk |
16 */ | 16 */ |
17 | 17 |
18 #include "toys.h" | 18 #include "toys.h" |
19 | 19 |
20 void freeramdisk_main(void) | 20 void freeramdisk_main(void) |
21 { | 21 { |
22 int fd; | 22 int fd; |
23 | 23 |
24 fd = xopen(toys.optargs[0], O_RDWR); | 24 fd = xopen(toys.optargs[0], O_RDWR); |
25 xioctl(fd, BLKFLSBUF, toys.optargs[0]); | 25 xioctl(fd, BLKFLSBUF, toys.optargs[0]); |
26 xclose(fd); | 26 if (CFG_TOYBOX_FREE) xclose(fd); |
27 } | 27 } |