]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - io/freeze.c
xfsprogs: make static things static
[thirdparty/xfsprogs-dev.git] / io / freeze.c
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Copyright (c) 2001-2005 Silicon Graphics, Inc.
4 * All Rights Reserved.
5 */
6
7 #include "command.h"
8 #include "input.h"
9 #include "init.h"
10 #include "io.h"
11
12 static cmdinfo_t freeze_cmd;
13 static cmdinfo_t thaw_cmd;
14
15 static int
16 freeze_f(
17 int argc,
18 char **argv)
19 {
20 int level = 1;
21
22 if (xfsctl(file->name, file->fd, XFS_IOC_FREEZE, &level) < 0) {
23 fprintf(stderr,
24 _("%s: cannot freeze filesystem at %s: %s\n"),
25 progname, file->name, strerror(errno));
26 exitcode = 1;
27 return 0;
28 }
29 return 0;
30 }
31
32 static int
33 thaw_f(
34 int argc,
35 char **argv)
36 {
37 int level = 1;
38
39 if (xfsctl(file->name, file->fd, XFS_IOC_THAW, &level) < 0) {
40 fprintf(stderr,
41 _("%s: cannot unfreeze filesystem mounted at %s: %s\n"),
42 progname, file->name, strerror(errno));
43 exitcode = 1;
44 return 0;
45 }
46 return 0;
47 }
48
49 void
50 freeze_init(void)
51 {
52 freeze_cmd.name = "freeze";
53 freeze_cmd.cfunc = freeze_f;
54 freeze_cmd.argmin = 0;
55 freeze_cmd.argmax = 0;
56 freeze_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK | CMD_FLAG_ONESHOT;
57 freeze_cmd.oneline = _("freeze filesystem of current file");
58
59 thaw_cmd.name = "thaw";
60 thaw_cmd.cfunc = thaw_f;
61 thaw_cmd.argmin = 0;
62 thaw_cmd.argmax = 0;
63 thaw_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK | CMD_FLAG_ONESHOT;
64 thaw_cmd.oneline = _("unfreeze filesystem of current file");
65
66 if (expert) {
67 add_command(&freeze_cmd);
68 add_command(&thaw_cmd);
69 }
70 }