2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions
7 * of the GNU General Public License version 2.
10 #include <linux/slab.h>
11 #include <linux/spinlock.h>
12 #include <linux/completion.h>
13 #include <linux/buffer_head.h>
14 #include <linux/gfs2_ondisk.h>
15 #include <linux/parser.h>
51 static const match_table_t tokens = {
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"},
60 {Opt_nodebug, "nodebug"},
61 {Opt_upgrade, "upgrade"},
64 {Opt_quota_off, "quota=off"},
65 {Opt_quota_account, "quota=account"},
66 {Opt_quota_on, "quota=on"},
68 {Opt_noquota, "noquota"},
69 {Opt_suiddir, "suiddir"},
70 {Opt_nosuiddir, "nosuiddir"},
71 {Opt_data_writeback, "data=writeback"},
72 {Opt_data_ordered, "data=ordered"},
74 {Opt_discard, "discard"},
75 {Opt_nodiscard, "nodiscard"},
80 * gfs2_mount_args - Parse mount options
87 int gfs2_mount_args(struct gfs2_sbd *sdp, struct gfs2_args *args, char *options)
91 substring_t tmp[MAX_OPT_ARGS];
93 /* Split the options into tokens with the "," character and
97 o = strsep(&options, ",");
103 token = match_token(o, tokens, tmp);
106 match_strlcpy(args->ar_lockproto, &tmp[0],
110 match_strlcpy(args->ar_locktable, &tmp[0],
114 match_strlcpy(args->ar_hostdata, &tmp[0],
118 args->ar_spectator = 1;
120 case Opt_ignore_local_fs:
121 args->ar_ignore_local_fs = 1;
123 case Opt_localflocks:
124 args->ar_localflocks = 1;
126 case Opt_localcaching:
127 args->ar_localcaching = 1;
136 args->ar_upgrade = 1;
139 args->ar_posix_acl = 1;
142 args->ar_posix_acl = 0;
146 args->ar_quota = GFS2_QUOTA_OFF;
148 case Opt_quota_account:
149 args->ar_quota = GFS2_QUOTA_ACCOUNT;
153 args->ar_quota = GFS2_QUOTA_ON;
156 args->ar_suiddir = 1;
159 args->ar_suiddir = 0;
161 case Opt_data_writeback:
162 args->ar_data = GFS2_DATA_WRITEBACK;
164 case Opt_data_ordered:
165 args->ar_data = GFS2_DATA_ORDERED;
171 args->ar_discard = 1;
174 args->ar_discard = 0;
178 fs_info(sdp, "invalid mount option: %s\n", o);