]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - io/shutdown.c
Portability changes to get xfs_quota to compile on IRIX as well.
[thirdparty/xfsprogs-dev.git] / io / shutdown.c
CommitLineData
48c46ee3
NS
1/*
2 * Copyright (c) 2004 Silicon Graphics, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 *
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
14 * or the like. Any license provided herein, whether implied or
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */
32
33#include <xfs/libxfs.h>
0717a7db
NS
34#include <xfs/command.h>
35#include <xfs/input.h>
48c46ee3
NS
36#include "init.h"
37#include "io.h"
38
39static cmdinfo_t shutdown_cmd;
40
41static int
42shutdown_f(
43 int argc,
44 char **argv)
45{
46 int c, flag = XFS_FSOP_GOING_FLAGS_NOLOGFLUSH;
47
48 while ((c = getopt(argc, argv, "fv")) != -1) {
49 switch (c) {
50 case 'f':
51 flag = XFS_FSOP_GOING_FLAGS_LOGFLUSH;
52 break;
53 default:
54 return command_usage(&shutdown_cmd);
55 }
56 }
57
58 if ((xfsctl(file->name, file->fd, XFS_IOC_GOINGDOWN, &flag)) < 0) {
59 perror("XFS_IOC_GOINGDOWN");
60 return 0;
61 }
62 return 0;
63}
64
65void
66shutdown_init(void)
67{
68 shutdown_cmd.name = _("shutdown");
69 shutdown_cmd.cfunc = shutdown_f;
70 shutdown_cmd.argmin = 0;
71 shutdown_cmd.argmax = 1;
72 shutdown_cmd.flags = CMD_NOMAP_OK;
73 shutdown_cmd.args = _("[-f]");
74 shutdown_cmd.oneline =
75 _("shuts down the filesystem where the current file resides");
76
77 if (expert)
78 add_command(&shutdown_cmd);
79}