changeset 1237:867f9c964f3e

New toy fsfreeze, from Isaac Dunham, plus minor cleanups.
author Rob Landley <rob@landley.net>
date Tue, 01 Apr 2014 18:20:00 -0500
parents 1f4a56212c83
children 1aa9b7f39e4a
files toys/other/fsfreeze.c
diffstat 1 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/toys/other/fsfreeze.c	Tue Apr 01 18:20:00 2014 -0500
@@ -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);
+}