Mercurial > hg > toybox
view 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 |
line wrap: on
line source
/* 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 n 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); }