• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (C) 2010 Hajime Taira <htaira@redhat.com>
4  *                    Masatake Yamato <yamato@redhat.com>
5  * Copyright (c) 2023 Petr Vorel <pvorel@suse.cz>
6  *
7  * Based on fsfreeze from util-linux.
8  */
9 
10 #include <linux/fs.h>
11 #include <stdio.h>
12 
13 #define TST_NO_DEFAULT_MAIN
14 #include "tst_test.h"
15 #include "tst_safe_macros.h"
16 
help(void)17 static void help(void)
18 {
19 	printf("Freeze and unfreeze the device.\n");
20 	printf("Usage: tst_fsfreeze device\n");
21 }
22 
main(int argc,char * argv[])23 int main(int argc, char *argv[])
24 {
25 	int fd;
26 
27 	if (argc < 2) {
28 		help();
29 		return 1;
30 	}
31 
32 	fd = SAFE_OPEN(argv[1], O_RDONLY);
33 	SAFE_IOCTL(fd, FIFREEZE, 0);
34 	SAFE_IOCTL(fd, FITHAW, 0);
35 	SAFE_CLOSE(fd);
36 
37 	return 0;
38 }
39