2006-01-16 11:50:04 -05:00
|
|
|
/*
|
|
|
|
* Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
|
2006-05-18 15:09:15 -04:00
|
|
|
* Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
|
2006-01-16 11:50:04 -05:00
|
|
|
*
|
|
|
|
* This copyrighted material is made available to anyone wishing to use,
|
|
|
|
* modify, copy, or redistribute it subject to the terms and conditions
|
2006-09-01 11:05:15 -04:00
|
|
|
* of the GNU General Public License version 2.
|
2006-01-16 11:50:04 -05:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/spinlock.h>
|
|
|
|
#include <linux/completion.h>
|
|
|
|
#include <linux/buffer_head.h>
|
2006-02-27 17:23:27 -05:00
|
|
|
#include <linux/gfs2_ondisk.h>
|
2007-04-23 11:55:39 -04:00
|
|
|
#include <linux/parser.h>
|
2006-01-16 11:50:04 -05:00
|
|
|
|
|
|
|
#include "gfs2.h"
|
2006-02-27 17:23:27 -05:00
|
|
|
#include "incore.h"
|
2009-01-06 06:52:25 -05:00
|
|
|
#include "super.h"
|
2006-01-16 11:50:04 -05:00
|
|
|
#include "sys.h"
|
2006-02-27 17:23:27 -05:00
|
|
|
#include "util.h"
|
2006-01-16 11:50:04 -05:00
|
|
|
|
2007-04-23 11:55:39 -04:00
|
|
|
enum {
|
|
|
|
Opt_lockproto,
|
|
|
|
Opt_locktable,
|
|
|
|
Opt_hostdata,
|
|
|
|
Opt_spectator,
|
|
|
|
Opt_ignore_local_fs,
|
|
|
|
Opt_localflocks,
|
|
|
|
Opt_localcaching,
|
|
|
|
Opt_debug,
|
|
|
|
Opt_nodebug,
|
|
|
|
Opt_upgrade,
|
|
|
|
Opt_acl,
|
|
|
|
Opt_noacl,
|
|
|
|
Opt_quota_off,
|
|
|
|
Opt_quota_account,
|
|
|
|
Opt_quota_on,
|
2009-02-19 05:32:35 -05:00
|
|
|
Opt_quota,
|
|
|
|
Opt_noquota,
|
2007-04-23 11:55:39 -04:00
|
|
|
Opt_suiddir,
|
|
|
|
Opt_nosuiddir,
|
|
|
|
Opt_data_writeback,
|
|
|
|
Opt_data_ordered,
|
2008-08-08 08:45:13 -04:00
|
|
|
Opt_meta,
|
2009-02-09 04:25:01 -05:00
|
|
|
Opt_discard,
|
|
|
|
Opt_nodiscard,
|
2007-08-17 21:22:07 -04:00
|
|
|
Opt_err,
|
2007-04-23 11:55:39 -04:00
|
|
|
};
|
|
|
|
|
2008-10-13 05:46:57 -04:00
|
|
|
static const match_table_t tokens = {
|
2007-04-23 11:55:39 -04:00
|
|
|
{Opt_lockproto, "lockproto=%s"},
|
|
|
|
{Opt_locktable, "locktable=%s"},
|
|
|
|
{Opt_hostdata, "hostdata=%s"},
|
|
|
|
{Opt_spectator, "spectator"},
|
|
|
|
{Opt_ignore_local_fs, "ignore_local_fs"},
|
|
|
|
{Opt_localflocks, "localflocks"},
|
|
|
|
{Opt_localcaching, "localcaching"},
|
|
|
|
{Opt_debug, "debug"},
|
|
|
|
{Opt_nodebug, "nodebug"},
|
|
|
|
{Opt_upgrade, "upgrade"},
|
|
|
|
{Opt_acl, "acl"},
|
|
|
|
{Opt_noacl, "noacl"},
|
|
|
|
{Opt_quota_off, "quota=off"},
|
|
|
|
{Opt_quota_account, "quota=account"},
|
|
|
|
{Opt_quota_on, "quota=on"},
|
2009-02-19 05:32:35 -05:00
|
|
|
{Opt_quota, "quota"},
|
|
|
|
{Opt_noquota, "noquota"},
|
2007-04-23 11:55:39 -04:00
|
|
|
{Opt_suiddir, "suiddir"},
|
|
|
|
{Opt_nosuiddir, "nosuiddir"},
|
|
|
|
{Opt_data_writeback, "data=writeback"},
|
2007-08-17 21:22:07 -04:00
|
|
|
{Opt_data_ordered, "data=ordered"},
|
2008-08-08 08:45:13 -04:00
|
|
|
{Opt_meta, "meta"},
|
2009-02-09 04:25:01 -05:00
|
|
|
{Opt_discard, "discard"},
|
|
|
|
{Opt_nodiscard, "nodiscard"},
|
2007-08-17 21:22:07 -04:00
|
|
|
{Opt_err, NULL}
|
2007-04-23 11:55:39 -04:00
|
|
|
};
|
|
|
|
|
2006-01-16 11:50:04 -05:00
|
|
|
/**
|
|
|
|
* gfs2_mount_args - Parse mount options
|
|
|
|
* @sdp:
|
|
|
|
* @data:
|
|
|
|
*
|
|
|
|
* Return: errno
|
|
|
|
*/
|
|
|
|
|
2009-01-06 06:52:25 -05:00
|
|
|
int gfs2_mount_args(struct gfs2_sbd *sdp, struct gfs2_args *args, char *options)
|
2006-01-16 11:50:04 -05:00
|
|
|
{
|
2009-01-06 06:52:25 -05:00
|
|
|
char *o;
|
|
|
|
int token;
|
|
|
|
substring_t tmp[MAX_OPT_ARGS];
|
2006-01-16 11:50:04 -05:00
|
|
|
|
|
|
|
/* Split the options into tokens with the "," character and
|
|
|
|
process them */
|
|
|
|
|
2009-01-06 06:52:25 -05:00
|
|
|
while (1) {
|
|
|
|
o = strsep(&options, ",");
|
|
|
|
if (o == NULL)
|
|
|
|
break;
|
|
|
|
if (*o == '\0')
|
2006-01-16 11:50:04 -05:00
|
|
|
continue;
|
|
|
|
|
2007-04-23 11:55:39 -04:00
|
|
|
token = match_token(o, tokens, tmp);
|
|
|
|
switch (token) {
|
|
|
|
case Opt_lockproto:
|
2009-01-06 06:52:25 -05:00
|
|
|
match_strlcpy(args->ar_lockproto, &tmp[0],
|
|
|
|
GFS2_LOCKNAME_LEN);
|
2007-04-23 11:55:39 -04:00
|
|
|
break;
|
|
|
|
case Opt_locktable:
|
2009-01-06 06:52:25 -05:00
|
|
|
match_strlcpy(args->ar_locktable, &tmp[0],
|
|
|
|
GFS2_LOCKNAME_LEN);
|
2007-04-23 11:55:39 -04:00
|
|
|
break;
|
|
|
|
case Opt_hostdata:
|
2009-01-06 06:52:25 -05:00
|
|
|
match_strlcpy(args->ar_hostdata, &tmp[0],
|
|
|
|
GFS2_LOCKNAME_LEN);
|
2007-04-23 11:55:39 -04:00
|
|
|
break;
|
|
|
|
case Opt_spectator:
|
2006-01-16 11:50:04 -05:00
|
|
|
args->ar_spectator = 1;
|
2007-04-23 11:55:39 -04:00
|
|
|
break;
|
|
|
|
case Opt_ignore_local_fs:
|
2006-01-16 11:50:04 -05:00
|
|
|
args->ar_ignore_local_fs = 1;
|
2007-04-23 11:55:39 -04:00
|
|
|
break;
|
|
|
|
case Opt_localflocks:
|
2006-01-16 11:50:04 -05:00
|
|
|
args->ar_localflocks = 1;
|
2007-04-23 11:55:39 -04:00
|
|
|
break;
|
|
|
|
case Opt_localcaching:
|
2006-01-16 11:50:04 -05:00
|
|
|
args->ar_localcaching = 1;
|
2007-04-23 11:55:39 -04:00
|
|
|
break;
|
|
|
|
case Opt_debug:
|
2006-01-16 11:50:04 -05:00
|
|
|
args->ar_debug = 1;
|
2007-04-23 11:55:39 -04:00
|
|
|
break;
|
|
|
|
case Opt_nodebug:
|
2006-01-16 11:50:04 -05:00
|
|
|
args->ar_debug = 0;
|
2007-04-23 11:55:39 -04:00
|
|
|
break;
|
|
|
|
case Opt_upgrade:
|
2006-01-16 11:50:04 -05:00
|
|
|
args->ar_upgrade = 1;
|
2007-04-23 11:55:39 -04:00
|
|
|
break;
|
|
|
|
case Opt_acl:
|
2006-01-16 11:50:04 -05:00
|
|
|
args->ar_posix_acl = 1;
|
2007-04-23 11:55:39 -04:00
|
|
|
break;
|
|
|
|
case Opt_noacl:
|
2006-01-16 11:50:04 -05:00
|
|
|
args->ar_posix_acl = 0;
|
2007-04-23 11:55:39 -04:00
|
|
|
break;
|
|
|
|
case Opt_quota_off:
|
2009-02-19 05:32:35 -05:00
|
|
|
case Opt_noquota:
|
2007-04-23 11:55:39 -04:00
|
|
|
args->ar_quota = GFS2_QUOTA_OFF;
|
|
|
|
break;
|
|
|
|
case Opt_quota_account:
|
|
|
|
args->ar_quota = GFS2_QUOTA_ACCOUNT;
|
|
|
|
break;
|
|
|
|
case Opt_quota_on:
|
2009-02-19 05:32:35 -05:00
|
|
|
case Opt_quota:
|
2007-04-23 11:55:39 -04:00
|
|
|
args->ar_quota = GFS2_QUOTA_ON;
|
|
|
|
break;
|
|
|
|
case Opt_suiddir:
|
2006-01-16 11:50:04 -05:00
|
|
|
args->ar_suiddir = 1;
|
2007-04-23 11:55:39 -04:00
|
|
|
break;
|
|
|
|
case Opt_nosuiddir:
|
2006-01-16 11:50:04 -05:00
|
|
|
args->ar_suiddir = 0;
|
2007-04-23 11:55:39 -04:00
|
|
|
break;
|
|
|
|
case Opt_data_writeback:
|
|
|
|
args->ar_data = GFS2_DATA_WRITEBACK;
|
|
|
|
break;
|
|
|
|
case Opt_data_ordered:
|
|
|
|
args->ar_data = GFS2_DATA_ORDERED;
|
|
|
|
break;
|
2008-08-08 08:45:13 -04:00
|
|
|
case Opt_meta:
|
|
|
|
args->ar_meta = 1;
|
|
|
|
break;
|
2009-02-09 04:25:01 -05:00
|
|
|
case Opt_discard:
|
|
|
|
args->ar_discard = 1;
|
|
|
|
break;
|
|
|
|
case Opt_nodiscard:
|
|
|
|
args->ar_discard = 0;
|
|
|
|
break;
|
2007-08-17 21:22:07 -04:00
|
|
|
case Opt_err:
|
2007-04-23 11:55:39 -04:00
|
|
|
default:
|
2009-01-06 06:52:25 -05:00
|
|
|
fs_info(sdp, "invalid mount option: %s\n", o);
|
|
|
|
return -EINVAL;
|
2006-01-16 11:50:04 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-06 06:52:25 -05:00
|
|
|
return 0;
|
2006-01-16 11:50:04 -05:00
|
|
|
}
|
|
|
|
|