aboutsummaryrefslogtreecommitdiff
path: root/toys/other
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-04-01 18:20:00 -0500
committerRob Landley <rob@landley.net>2014-04-01 18:20:00 -0500
commit2b0b548381c2872cc1d6ea0603632c0ee7cad211 (patch)
tree188e7e5faee0f5d53b666dea4c1a0ae56f8f4a21 /toys/other
parent52ab00b60863baf995522da1a638df4d6e9b0e8b (diff)
downloadtoybox-2b0b548381c2872cc1d6ea0603632c0ee7cad211.tar.gz
New toy fsfreeze, from Isaac Dunham, plus minor cleanups.
Diffstat (limited to 'toys/other')
-rw-r--r--toys/other/fsfreeze.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/toys/other/fsfreeze.c b/toys/other/fsfreeze.c
new file mode 100644
index 00000000..f7b8a946
--- /dev/null
+++ b/toys/other/fsfreeze.c
@@ -0,0 +1,30 @@
+/* fsfreeze.c - freeze or thaw filesystem
+ *
+ * No standard.
+
+USE_FSFREEZE(NEWTOY(fsfreeze, "<1>1f|u|[!fu]", TOYFLAG_USR|TOYFLAG_SBIN))
+
+config FSFREEZE
+ bool "fsfreeze"
+ default y
+ help
+ usage: fsfreeze {-f | -u} MOUNTPOINT
+
+ Freeze or unfreeze a filesystem.
+
+ -f freeze
+ -u unfreeze
+*/
+
+#define FOR_fsfreeze
+#include "toys.h"
+#include <linux/fs.h>
+
+void fsfreeze_main(void)
+{
+ int fd = xopen(*toys.optargs, O_RDONLY);
+ long p = 1;
+
+ xioctl(fd, (toys.optflags & FLAG_f) ? FIFREEZE : FITHAW, &p);
+ xclose(fd);
+}