]>
Commit | Line | Data |
---|---|---|
48c46ee3 | 1 | /* |
da23017d NS |
2 | * Copyright (c) 2001-2005 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | |
48c46ee3 | 4 | * |
da23017d NS |
5 | * This program is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU General Public License as | |
48c46ee3 NS |
7 | * published by the Free Software Foundation. |
8 | * | |
da23017d NS |
9 | * This program is distributed in the hope that it would be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
48c46ee3 | 13 | * |
da23017d NS |
14 | * You should have received a copy of the GNU General Public License |
15 | * along with this program; if not, write the Free Software Foundation, | |
16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
48c46ee3 NS |
17 | */ |
18 | ||
2a1888c5 | 19 | #include <xfs/xfs.h> |
0717a7db NS |
20 | #include <xfs/command.h> |
21 | #include <xfs/input.h> | |
48c46ee3 NS |
22 | #include "init.h" |
23 | #include "io.h" | |
24 | ||
25 | static cmdinfo_t freeze_cmd; | |
26 | static cmdinfo_t thaw_cmd; | |
27 | ||
28 | int | |
29 | freeze_f( | |
30 | int argc, | |
31 | char **argv) | |
32 | { | |
33 | int level = 1; | |
34 | ||
35 | if (xfsctl(file->name, file->fd, XFS_IOC_FREEZE, &level) < 0) { | |
36 | fprintf(stderr, | |
37 | _("%s: cannot freeze filesystem at %s: %s\n"), | |
38 | progname, file->name, strerror(errno)); | |
39 | exitcode = 1; | |
40 | return 0; | |
41 | } | |
42 | return 0; | |
43 | } | |
44 | ||
45 | int | |
46 | thaw_f( | |
47 | int argc, | |
48 | char **argv) | |
49 | { | |
50 | int level = 1; | |
51 | ||
52 | if (xfsctl(file->name, file->fd, XFS_IOC_THAW, &level) < 0) { | |
53 | fprintf(stderr, | |
54 | _("%s: cannot unfreeze filesystem mounted at %s: %s\n"), | |
55 | progname, file->name, strerror(errno)); | |
56 | exitcode = 1; | |
57 | return 0; | |
58 | } | |
59 | return 0; | |
60 | } | |
61 | ||
62 | void | |
63 | freeze_init(void) | |
64 | { | |
65 | freeze_cmd.name = _("freeze"); | |
66 | freeze_cmd.cfunc = freeze_f; | |
67 | freeze_cmd.argmin = 0; | |
68 | freeze_cmd.argmax = 0; | |
cd67dabb | 69 | freeze_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK; |
48c46ee3 NS |
70 | freeze_cmd.oneline = _("freeze filesystem of current file"); |
71 | ||
72 | thaw_cmd.name = _("thaw"); | |
73 | thaw_cmd.cfunc = thaw_f; | |
74 | thaw_cmd.argmin = 0; | |
75 | thaw_cmd.argmax = 0; | |
cd67dabb | 76 | thaw_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK; |
48c46ee3 NS |
77 | thaw_cmd.oneline = _("unfreeze filesystem of current file"); |
78 | ||
79 | if (expert) { | |
80 | add_command(&freeze_cmd); | |
81 | add_command(&thaw_cmd); | |
82 | } | |
83 | } |