From fde18a7915bd310aa3068c05e2dbf3e956d003cf Mon Sep 17 00:00:00 2001
From: Vivek Kumar Bhagat <vivek.bhagat89@gmail.com>
Date: Wed, 5 Feb 2014 18:04:55 +0530
Subject: [PATCH 1/3] Added freeramdisk command

---
 toys/other/freeramdisk.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)
 create mode 100644 toys/other/freeramdisk.c

diff --git a/toys/other/freeramdisk.c b/toys/other/freeramdisk.c
new file mode 100644
index 0000000..baee5f3
--- /dev/null
+++ b/toys/other/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_USR|TOYFLAG_BIN))
+
+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]);
+	xclose(fd);
+}
-- 
1.7.0.4

