aboutsummaryrefslogtreecommitdiff
path: root/toys/pending/freeramdisk.c
diff options
context:
space:
mode:
Diffstat (limited to 'toys/pending/freeramdisk.c')
-rw-r--r--toys/pending/freeramdisk.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/toys/pending/freeramdisk.c b/toys/pending/freeramdisk.c
new file mode 100644
index 00000000..8ff4e75c
--- /dev/null
+++ b/toys/pending/freeramdisk.c
@@ -0,0 +1,27 @@
+/* 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]);
+ xclose(fd);
+}