xref: /third_party/toybox/toys/other/fsfreeze.c (revision 0f66f451)
1/* fsfreeze.c - freeze or thaw filesystem
2 *
3 * No standard.
4
5USE_FSFREEZE(NEWTOY(fsfreeze, "<1>1f|u|[!fu]", TOYFLAG_USR|TOYFLAG_SBIN))
6
7config 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
24void fsfreeze_main(void)
25{
26  int fd = xopenro(*toys.optargs);
27  long p = 1;
28
29  xioctl(fd, (toys.optflags & FLAG_f) ? FIFREEZE : FITHAW, &p);
30  xclose(fd);
31}
32