• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* freeramdisk.c - Free all memory allocated to ramdisk
2  *
3  * Copyright 2014 Vivek Kumar Bhagat <vivek.bhagat89@gmail.com>
4  *
5  * No Standard
6 
7 USE_FREERAMDISK(NEWTOY(freeramdisk, "<1>1", TOYFLAG_SBIN|TOYFLAG_NEEDROOT))
8 
9 config FREERAMDISK
10   bool "freeramdisk"
11   default y
12   help
13     usage: freeramdisk [RAM device]
14 
15     Free all memory allocated to specified ramdisk
16 */
17 
18 #include "toys.h"
19 
freeramdisk_main(void)20 void freeramdisk_main(void)
21 {
22   int fd;
23 
24   fd = xopen(toys.optargs[0], O_RDWR);
25   xioctl(fd, BLKFLSBUF, toys.optargs[0]);
26   if (CFG_TOYBOX_FREE) xclose(fd);
27 }
28