1 /* fsfreeze.c - freeze or thaw filesystem
2  *
3  * No standard.
4 
5 USE_FSFREEZE(NEWTOY(fsfreeze, "<1>1f|u|[!fu]", TOYFLAG_USR|TOYFLAG_SBIN))
6 
7 config FSFREEZE
8   bool "fsfreeze"
9   default y
10   depends on TOYBOX_FIFREEZE
11   help
12     usage: fsfreeze {-f | -u} MOUNTPOINT
13 
14     Freeze or unfreeze a filesystem.
15 
16     -f	freeze
17     -u	unfreeze
18 */
19 
20 #define FOR_fsfreeze
21 #include "toys.h"
22 #include <linux/fs.h>
23 
fsfreeze_main(void)24 void fsfreeze_main(void)
25 {
26   int fd = xopen(*toys.optargs, O_RDONLY);
27   long p = 1;
28 
29   xioctl(fd, (toys.optflags & FLAG_f) ? FIFREEZE : FITHAW, &p);
30   xclose(fd);
31 }
32