aboutsummaryrefslogtreecommitdiff
path: root/toys/other/fsfreeze.c
blob: dfe17fb9aae6362d7f9c689e8af414d2b6b266cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* 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
  depends on TOYBOX_FIFREEZE
  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 = xopenro(*toys.optargs); 
  long p = 1;

  xioctl(fd, (toys.optflags & FLAG_f) ? FIFREEZE : FITHAW, &p);
  xclose(fd);
}