You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
548 B
28 lines
548 B
7 months ago
|
/* freeramdisk.c - Free all memory allocated to ramdisk
|
||
|
*
|
||
|
* Copyright 2014 Vivek Kumar Bhagat <vivek.bhagat89@gmail.com>
|
||
|
*
|
||
|
* No Standard
|
||
|
|
||
|
USE_FREERAMDISK(NEWTOY(freeramdisk, "<1>1", TOYFLAG_SBIN|TOYFLAG_NEEDROOT))
|
||
|
|
||
|
config FREERAMDISK
|
||
|
bool "freeramdisk"
|
||
|
default y
|
||
|
help
|
||
|
usage: freeramdisk [RAM device]
|
||
|
|
||
|
Free all memory allocated to specified ramdisk
|
||
|
*/
|
||
|
|
||
|
#include "toys.h"
|
||
|
|
||
|
void freeramdisk_main(void)
|
||
|
{
|
||
|
int fd;
|
||
|
|
||
|
fd = xopen(toys.optargs[0], O_RDWR);
|
||
|
xioctl(fd, BLKFLSBUF, toys.optargs[0]);
|
||
|
if (CFG_TOYBOX_FREE) xclose(fd);
|
||
|
}
|