powerpc/pmac: Update PowerMac 32-bit defconfig
[deliverable/linux.git] / fs / gfs2 / mount.c
CommitLineData
b3b94faa
DT
1/*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3a8a9a10 3 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
b3b94faa
DT
4 *
5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions
e9fc2aa0 7 * of the GNU General Public License version 2.
b3b94faa
DT
8 */
9
b3b94faa
DT
10#include <linux/slab.h>
11#include <linux/spinlock.h>
12#include <linux/completion.h>
13#include <linux/buffer_head.h>
5c676f6d 14#include <linux/gfs2_ondisk.h>
476c006b 15#include <linux/parser.h>
b3b94faa
DT
16
17#include "gfs2.h"
5c676f6d 18#include "incore.h"
6f04c1c7 19#include "super.h"
b3b94faa 20#include "sys.h"
5c676f6d 21#include "util.h"
b3b94faa 22
476c006b
JB
23enum {
24 Opt_lockproto,
25 Opt_locktable,
26 Opt_hostdata,
27 Opt_spectator,
28 Opt_ignore_local_fs,
29 Opt_localflocks,
30 Opt_localcaching,
31 Opt_debug,
32 Opt_nodebug,
33 Opt_upgrade,
476c006b
JB
34 Opt_acl,
35 Opt_noacl,
36 Opt_quota_off,
37 Opt_quota_account,
38 Opt_quota_on,
b9a96945
SW
39 Opt_quota,
40 Opt_noquota,
476c006b
JB
41 Opt_suiddir,
42 Opt_nosuiddir,
43 Opt_data_writeback,
44 Opt_data_ordered,
9b8df98f 45 Opt_meta,
f15ab561
SW
46 Opt_discard,
47 Opt_nodiscard,
9a5ad138 48 Opt_err,
476c006b
JB
49};
50
a447c093 51static const match_table_t tokens = {
476c006b
JB
52 {Opt_lockproto, "lockproto=%s"},
53 {Opt_locktable, "locktable=%s"},
54 {Opt_hostdata, "hostdata=%s"},
55 {Opt_spectator, "spectator"},
56 {Opt_ignore_local_fs, "ignore_local_fs"},
57 {Opt_localflocks, "localflocks"},
58 {Opt_localcaching, "localcaching"},
59 {Opt_debug, "debug"},
60 {Opt_nodebug, "nodebug"},
61 {Opt_upgrade, "upgrade"},
476c006b
JB
62 {Opt_acl, "acl"},
63 {Opt_noacl, "noacl"},
64 {Opt_quota_off, "quota=off"},
65 {Opt_quota_account, "quota=account"},
66 {Opt_quota_on, "quota=on"},
b9a96945
SW
67 {Opt_quota, "quota"},
68 {Opt_noquota, "noquota"},
476c006b
JB
69 {Opt_suiddir, "suiddir"},
70 {Opt_nosuiddir, "nosuiddir"},
71 {Opt_data_writeback, "data=writeback"},
9a5ad138 72 {Opt_data_ordered, "data=ordered"},
9b8df98f 73 {Opt_meta, "meta"},
f15ab561
SW
74 {Opt_discard, "discard"},
75 {Opt_nodiscard, "nodiscard"},
9a5ad138 76 {Opt_err, NULL}
476c006b
JB
77};
78
b3b94faa
DT
79/**
80 * gfs2_mount_args - Parse mount options
81 * @sdp:
82 * @data:
83 *
84 * Return: errno
85 */
86
6f04c1c7 87int gfs2_mount_args(struct gfs2_sbd *sdp, struct gfs2_args *args, char *options)
b3b94faa 88{
6f04c1c7
SW
89 char *o;
90 int token;
91 substring_t tmp[MAX_OPT_ARGS];
b3b94faa
DT
92
93 /* Split the options into tokens with the "," character and
94 process them */
95
6f04c1c7
SW
96 while (1) {
97 o = strsep(&options, ",");
98 if (o == NULL)
99 break;
100 if (*o == '\0')
b3b94faa
DT
101 continue;
102
476c006b
JB
103 token = match_token(o, tokens, tmp);
104 switch (token) {
105 case Opt_lockproto:
6f04c1c7
SW
106 match_strlcpy(args->ar_lockproto, &tmp[0],
107 GFS2_LOCKNAME_LEN);
476c006b
JB
108 break;
109 case Opt_locktable:
6f04c1c7
SW
110 match_strlcpy(args->ar_locktable, &tmp[0],
111 GFS2_LOCKNAME_LEN);
476c006b
JB
112 break;
113 case Opt_hostdata:
6f04c1c7
SW
114 match_strlcpy(args->ar_hostdata, &tmp[0],
115 GFS2_LOCKNAME_LEN);
476c006b
JB
116 break;
117 case Opt_spectator:
b3b94faa 118 args->ar_spectator = 1;
476c006b
JB
119 break;
120 case Opt_ignore_local_fs:
b3b94faa 121 args->ar_ignore_local_fs = 1;
476c006b
JB
122 break;
123 case Opt_localflocks:
b3b94faa 124 args->ar_localflocks = 1;
476c006b
JB
125 break;
126 case Opt_localcaching:
b3b94faa 127 args->ar_localcaching = 1;
476c006b
JB
128 break;
129 case Opt_debug:
b3b94faa 130 args->ar_debug = 1;
476c006b
JB
131 break;
132 case Opt_nodebug:
b3b94faa 133 args->ar_debug = 0;
476c006b
JB
134 break;
135 case Opt_upgrade:
b3b94faa 136 args->ar_upgrade = 1;
476c006b 137 break;
476c006b 138 case Opt_acl:
b3b94faa 139 args->ar_posix_acl = 1;
476c006b
JB
140 break;
141 case Opt_noacl:
b3b94faa 142 args->ar_posix_acl = 0;
476c006b
JB
143 break;
144 case Opt_quota_off:
b9a96945 145 case Opt_noquota:
476c006b
JB
146 args->ar_quota = GFS2_QUOTA_OFF;
147 break;
148 case Opt_quota_account:
149 args->ar_quota = GFS2_QUOTA_ACCOUNT;
150 break;
151 case Opt_quota_on:
b9a96945 152 case Opt_quota:
476c006b
JB
153 args->ar_quota = GFS2_QUOTA_ON;
154 break;
155 case Opt_suiddir:
b3b94faa 156 args->ar_suiddir = 1;
476c006b
JB
157 break;
158 case Opt_nosuiddir:
b3b94faa 159 args->ar_suiddir = 0;
476c006b
JB
160 break;
161 case Opt_data_writeback:
162 args->ar_data = GFS2_DATA_WRITEBACK;
163 break;
164 case Opt_data_ordered:
165 args->ar_data = GFS2_DATA_ORDERED;
166 break;
9b8df98f 167 case Opt_meta:
9b8df98f
SW
168 args->ar_meta = 1;
169 break;
f15ab561
SW
170 case Opt_discard:
171 args->ar_discard = 1;
172 break;
173 case Opt_nodiscard:
174 args->ar_discard = 0;
175 break;
9a5ad138 176 case Opt_err:
476c006b 177 default:
6f04c1c7
SW
178 fs_info(sdp, "invalid mount option: %s\n", o);
179 return -EINVAL;
b3b94faa
DT
180 }
181 }
182
6f04c1c7 183 return 0;
b3b94faa
DT
184}
185
This page took 0.268255 seconds and 5 git commands to generate.