]>
Commit | Line | Data |
---|---|---|
959ef981 | 1 | // SPDX-License-Identifier: GPL-2.0 |
48c46ee3 | 2 | /* |
da23017d NS |
3 | * Copyright (c) 2001-2005 Silicon Graphics, Inc. |
4 | * All Rights Reserved. | |
48c46ee3 NS |
5 | */ |
6 | ||
6b803e5a CH |
7 | #include "command.h" |
8 | #include "input.h" | |
48c46ee3 NS |
9 | #include "init.h" |
10 | #include "io.h" | |
11 | ||
12 | static cmdinfo_t freeze_cmd; | |
13 | static cmdinfo_t thaw_cmd; | |
14 | ||
00ff2b10 | 15 | static int |
48c46ee3 NS |
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 | ||
00ff2b10 | 32 | static int |
48c46ee3 NS |
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 | { | |
ad765595 | 52 | freeze_cmd.name = "freeze"; |
48c46ee3 NS |
53 | freeze_cmd.cfunc = freeze_f; |
54 | freeze_cmd.argmin = 0; | |
55 | freeze_cmd.argmax = 0; | |
16bf0464 | 56 | freeze_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK | CMD_FLAG_ONESHOT; |
48c46ee3 NS |
57 | freeze_cmd.oneline = _("freeze filesystem of current file"); |
58 | ||
ad765595 | 59 | thaw_cmd.name = "thaw"; |
48c46ee3 NS |
60 | thaw_cmd.cfunc = thaw_f; |
61 | thaw_cmd.argmin = 0; | |
62 | thaw_cmd.argmax = 0; | |
16bf0464 | 63 | thaw_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK | CMD_FLAG_ONESHOT; |
48c46ee3 NS |
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 | } |