VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   35 Branches   59 Tags
b24413180f560 (Greg Kroah-Hartman 2017-11-01 15:07:57 +0100   1) // SPDX-License-Identifier: GPL-2.0
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700   2) /*
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700   3)  *  linux/fs/hfsplus/options.c
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700   4)  *
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700   5)  * Copyright (C) 2001
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700   6)  * Brad Boyer (flar@allandria.com)
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700   7)  * (C) 2003 Ardis Technologies <roman@ardistech.com>
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700   8)  *
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700   9)  * Option parsing
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  10)  */
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  11) 
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  12) #include <linux/string.h>
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  13) #include <linux/kernel.h>
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  14) #include <linux/sched.h>
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  15) #include <linux/parser.h>
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  16) #include <linux/nls.h>
717dd80e999cd (Roman Zippel       2005-09-06 15:18:48 -0700  17) #include <linux/mount.h>
717dd80e999cd (Roman Zippel       2005-09-06 15:18:48 -0700  18) #include <linux/seq_file.h>
5a0e3ad6af866 (Tejun Heo          2010-03-24 17:04:11 +0900  19) #include <linux/slab.h>
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  20) #include "hfsplus_fs.h"
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  21) 
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  22) enum {
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  23) 	opt_creator, opt_type,
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  24) 	opt_umask, opt_uid, opt_gid,
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  25) 	opt_part, opt_session, opt_nls,
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  26) 	opt_nodecompose, opt_decompose,
34a2d313c51f4 (Christoph Hellwig  2010-11-23 14:38:21 +0100  27) 	opt_barrier, opt_nobarrier,
b0b623c3b22d5 (Roman Zippel       2005-11-29 19:34:41 -0800  28) 	opt_force, opt_err
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  29) };
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  30) 
a447c0932445f (Steven Whitehouse  2008-10-13 10:46:57 +0100  31) static const match_table_t tokens = {
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  32) 	{ opt_creator, "creator=%s" },
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  33) 	{ opt_type, "type=%s" },
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  34) 	{ opt_umask, "umask=%o" },
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  35) 	{ opt_uid, "uid=%u" },
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  36) 	{ opt_gid, "gid=%u" },
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  37) 	{ opt_part, "part=%u" },
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  38) 	{ opt_session, "session=%u" },
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  39) 	{ opt_nls, "nls=%s" },
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  40) 	{ opt_decompose, "decompose" },
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  41) 	{ opt_nodecompose, "nodecompose" },
34a2d313c51f4 (Christoph Hellwig  2010-11-23 14:38:21 +0100  42) 	{ opt_barrier, "barrier" },
34a2d313c51f4 (Christoph Hellwig  2010-11-23 14:38:21 +0100  43) 	{ opt_nobarrier, "nobarrier" },
b0b623c3b22d5 (Roman Zippel       2005-11-29 19:34:41 -0800  44) 	{ opt_force, "force" },
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  45) 	{ opt_err, NULL }
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  46) };
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  47) 
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  48) /* Initialize an options object to reasonable defaults */
717dd80e999cd (Roman Zippel       2005-09-06 15:18:48 -0700  49) void hfsplus_fill_defaults(struct hfsplus_sb_info *opts)
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  50) {
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  51) 	if (!opts)
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  52) 		return;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  53) 
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  54) 	opts->creator = HFSPLUS_DEF_CR_TYPE;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  55) 	opts->type = HFSPLUS_DEF_CR_TYPE;
ce3b0f8d5c220 (Al Viro            2009-03-29 19:08:22 -0400  56) 	opts->umask = current_umask();
4ac8489a7294d (David Howells      2008-11-14 10:38:54 +1100  57) 	opts->uid = current_uid();
4ac8489a7294d (David Howells      2008-11-14 10:38:54 +1100  58) 	opts->gid = current_gid();
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  59) 	opts->part = -1;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  60) 	opts->session = -1;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  61) }
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  62) 
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  63) /* convert a "four byte character" to a 32 bit int with error checks */
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  64) static inline int match_fourchar(substring_t *arg, u32 *result)
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  65) {
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  66) 	if (arg->to - arg->from != 4)
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  67) 		return -EINVAL;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  68) 	memcpy(result, arg->from, 4);
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  69) 	return 0;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  70) }
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  71) 
6f80dfe55fcbd (Christoph Hellwig  2010-11-07 23:01:17 +0100  72) int hfsplus_parse_options_remount(char *input, int *force)
6f80dfe55fcbd (Christoph Hellwig  2010-11-07 23:01:17 +0100  73) {
6f80dfe55fcbd (Christoph Hellwig  2010-11-07 23:01:17 +0100  74) 	char *p;
6f80dfe55fcbd (Christoph Hellwig  2010-11-07 23:01:17 +0100  75) 	substring_t args[MAX_OPT_ARGS];
6f80dfe55fcbd (Christoph Hellwig  2010-11-07 23:01:17 +0100  76) 	int token;
6f80dfe55fcbd (Christoph Hellwig  2010-11-07 23:01:17 +0100  77) 
6f80dfe55fcbd (Christoph Hellwig  2010-11-07 23:01:17 +0100  78) 	if (!input)
bd2c00353286d (Vyacheslav Dubeyko 2014-03-03 15:38:35 -0800  79) 		return 1;
6f80dfe55fcbd (Christoph Hellwig  2010-11-07 23:01:17 +0100  80) 
6f80dfe55fcbd (Christoph Hellwig  2010-11-07 23:01:17 +0100  81) 	while ((p = strsep(&input, ",")) != NULL) {
6f80dfe55fcbd (Christoph Hellwig  2010-11-07 23:01:17 +0100  82) 		if (!*p)
6f80dfe55fcbd (Christoph Hellwig  2010-11-07 23:01:17 +0100  83) 			continue;
6f80dfe55fcbd (Christoph Hellwig  2010-11-07 23:01:17 +0100  84) 
6f80dfe55fcbd (Christoph Hellwig  2010-11-07 23:01:17 +0100  85) 		token = match_token(p, tokens, args);
6f80dfe55fcbd (Christoph Hellwig  2010-11-07 23:01:17 +0100  86) 		switch (token) {
6f80dfe55fcbd (Christoph Hellwig  2010-11-07 23:01:17 +0100  87) 		case opt_force:
6f80dfe55fcbd (Christoph Hellwig  2010-11-07 23:01:17 +0100  88) 			*force = 1;
6f80dfe55fcbd (Christoph Hellwig  2010-11-07 23:01:17 +0100  89) 			break;
6f80dfe55fcbd (Christoph Hellwig  2010-11-07 23:01:17 +0100  90) 		default:
6f80dfe55fcbd (Christoph Hellwig  2010-11-07 23:01:17 +0100  91) 			break;
6f80dfe55fcbd (Christoph Hellwig  2010-11-07 23:01:17 +0100  92) 		}
6f80dfe55fcbd (Christoph Hellwig  2010-11-07 23:01:17 +0100  93) 	}
6f80dfe55fcbd (Christoph Hellwig  2010-11-07 23:01:17 +0100  94) 
6f80dfe55fcbd (Christoph Hellwig  2010-11-07 23:01:17 +0100  95) 	return 1;
6f80dfe55fcbd (Christoph Hellwig  2010-11-07 23:01:17 +0100  96) }
6f80dfe55fcbd (Christoph Hellwig  2010-11-07 23:01:17 +0100  97) 
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  98) /* Parse options from mount. Returns 0 on failure */
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700  99) /* input is the options passed to mount() as a string */
717dd80e999cd (Roman Zippel       2005-09-06 15:18:48 -0700 100) int hfsplus_parse_options(char *input, struct hfsplus_sb_info *sbi)
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 101) {
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 102) 	char *p;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 103) 	substring_t args[MAX_OPT_ARGS];
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 104) 	int tmp, token;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 105) 
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 106) 	if (!input)
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 107) 		goto done;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 108) 
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 109) 	while ((p = strsep(&input, ",")) != NULL) {
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 110) 		if (!*p)
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 111) 			continue;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 112) 
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 113) 		token = match_token(p, tokens, args);
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 114) 		switch (token) {
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 115) 		case opt_creator:
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 116) 			if (match_fourchar(&args[0], &sbi->creator)) {
d614267329f2b (Joe Perches        2013-04-30 15:27:55 -0700 117) 				pr_err("creator requires a 4 character value\n");
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 118) 				return 0;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 119) 			}
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 120) 			break;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 121) 		case opt_type:
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 122) 			if (match_fourchar(&args[0], &sbi->type)) {
d614267329f2b (Joe Perches        2013-04-30 15:27:55 -0700 123) 				pr_err("type requires a 4 character value\n");
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 124) 				return 0;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 125) 			}
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 126) 			break;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 127) 		case opt_umask:
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 128) 			if (match_octal(&args[0], &tmp)) {
d614267329f2b (Joe Perches        2013-04-30 15:27:55 -0700 129) 				pr_err("umask requires a value\n");
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 130) 				return 0;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 131) 			}
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 132) 			sbi->umask = (umode_t)tmp;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 133) 			break;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 134) 		case opt_uid:
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 135) 			if (match_int(&args[0], &tmp)) {
d614267329f2b (Joe Perches        2013-04-30 15:27:55 -0700 136) 				pr_err("uid requires an argument\n");
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 137) 				return 0;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 138) 			}
16525e3f146fb (Eric W. Biederman  2012-02-07 16:27:17 -0800 139) 			sbi->uid = make_kuid(current_user_ns(), (uid_t)tmp);
16525e3f146fb (Eric W. Biederman  2012-02-07 16:27:17 -0800 140) 			if (!uid_valid(sbi->uid)) {
d614267329f2b (Joe Perches        2013-04-30 15:27:55 -0700 141) 				pr_err("invalid uid specified\n");
16525e3f146fb (Eric W. Biederman  2012-02-07 16:27:17 -0800 142) 				return 0;
16525e3f146fb (Eric W. Biederman  2012-02-07 16:27:17 -0800 143) 			}
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 144) 			break;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 145) 		case opt_gid:
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 146) 			if (match_int(&args[0], &tmp)) {
d614267329f2b (Joe Perches        2013-04-30 15:27:55 -0700 147) 				pr_err("gid requires an argument\n");
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 148) 				return 0;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 149) 			}
16525e3f146fb (Eric W. Biederman  2012-02-07 16:27:17 -0800 150) 			sbi->gid = make_kgid(current_user_ns(), (gid_t)tmp);
16525e3f146fb (Eric W. Biederman  2012-02-07 16:27:17 -0800 151) 			if (!gid_valid(sbi->gid)) {
d614267329f2b (Joe Perches        2013-04-30 15:27:55 -0700 152) 				pr_err("invalid gid specified\n");
16525e3f146fb (Eric W. Biederman  2012-02-07 16:27:17 -0800 153) 				return 0;
16525e3f146fb (Eric W. Biederman  2012-02-07 16:27:17 -0800 154) 			}
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 155) 			break;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 156) 		case opt_part:
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 157) 			if (match_int(&args[0], &sbi->part)) {
d614267329f2b (Joe Perches        2013-04-30 15:27:55 -0700 158) 				pr_err("part requires an argument\n");
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 159) 				return 0;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 160) 			}
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 161) 			break;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 162) 		case opt_session:
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 163) 			if (match_int(&args[0], &sbi->session)) {
d614267329f2b (Joe Perches        2013-04-30 15:27:55 -0700 164) 				pr_err("session requires an argument\n");
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 165) 				return 0;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 166) 			}
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 167) 			break;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 168) 		case opt_nls:
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 169) 			if (sbi->nls) {
d614267329f2b (Joe Perches        2013-04-30 15:27:55 -0700 170) 				pr_err("unable to change nls mapping\n");
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 171) 				return 0;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 172) 			}
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 173) 			p = match_strdup(&args[0]);
cd6fda36089cf (Jim Meyering       2008-04-29 00:59:08 -0700 174) 			if (p)
cd6fda36089cf (Jim Meyering       2008-04-29 00:59:08 -0700 175) 				sbi->nls = load_nls(p);
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 176) 			if (!sbi->nls) {
d8983ca0aa86c (Fabian Frederick   2014-06-06 14:36:26 -0700 177) 				pr_err("unable to load nls mapping \"%s\"\n",
d8983ca0aa86c (Fabian Frederick   2014-06-06 14:36:26 -0700 178) 				       p);
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 179) 				kfree(p);
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 180) 				return 0;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 181) 			}
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 182) 			kfree(p);
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 183) 			break;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 184) 		case opt_decompose:
84adede31267a (Christoph Hellwig  2010-10-01 05:45:20 +0200 185) 			clear_bit(HFSPLUS_SB_NODECOMPOSE, &sbi->flags);
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 186) 			break;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 187) 		case opt_nodecompose:
84adede31267a (Christoph Hellwig  2010-10-01 05:45:20 +0200 188) 			set_bit(HFSPLUS_SB_NODECOMPOSE, &sbi->flags);
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 189) 			break;
34a2d313c51f4 (Christoph Hellwig  2010-11-23 14:38:21 +0100 190) 		case opt_barrier:
34a2d313c51f4 (Christoph Hellwig  2010-11-23 14:38:21 +0100 191) 			clear_bit(HFSPLUS_SB_NOBARRIER, &sbi->flags);
34a2d313c51f4 (Christoph Hellwig  2010-11-23 14:38:21 +0100 192) 			break;
34a2d313c51f4 (Christoph Hellwig  2010-11-23 14:38:21 +0100 193) 		case opt_nobarrier:
34a2d313c51f4 (Christoph Hellwig  2010-11-23 14:38:21 +0100 194) 			set_bit(HFSPLUS_SB_NOBARRIER, &sbi->flags);
34a2d313c51f4 (Christoph Hellwig  2010-11-23 14:38:21 +0100 195) 			break;
b0b623c3b22d5 (Roman Zippel       2005-11-29 19:34:41 -0800 196) 		case opt_force:
84adede31267a (Christoph Hellwig  2010-10-01 05:45:20 +0200 197) 			set_bit(HFSPLUS_SB_FORCE, &sbi->flags);
b0b623c3b22d5 (Roman Zippel       2005-11-29 19:34:41 -0800 198) 			break;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 199) 		default:
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 200) 			return 0;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 201) 		}
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 202) 	}
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 203) 
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 204) done:
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 205) 	if (!sbi->nls) {
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 206) 		/* try utf8 first, as this is the old default behaviour */
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 207) 		sbi->nls = load_nls("utf8");
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 208) 		if (!sbi->nls)
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 209) 			sbi->nls = load_nls_default();
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 210) 		if (!sbi->nls)
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 211) 			return 0;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 212) 	}
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 213) 
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 214) 	return 1;
^1da177e4c3f4 (Linus Torvalds     2005-04-16 15:20:36 -0700 215) }
717dd80e999cd (Roman Zippel       2005-09-06 15:18:48 -0700 216) 
34c80b1d93e6e (Al Viro            2011-12-08 21:32:45 -0500 217) int hfsplus_show_options(struct seq_file *seq, struct dentry *root)
717dd80e999cd (Roman Zippel       2005-09-06 15:18:48 -0700 218) {
34c80b1d93e6e (Al Viro            2011-12-08 21:32:45 -0500 219) 	struct hfsplus_sb_info *sbi = HFSPLUS_SB(root->d_sb);
717dd80e999cd (Roman Zippel       2005-09-06 15:18:48 -0700 220) 
717dd80e999cd (Roman Zippel       2005-09-06 15:18:48 -0700 221) 	if (sbi->creator != HFSPLUS_DEF_CR_TYPE)
a068acf2ee776 (Kees Cook          2015-09-04 15:44:57 -0700 222) 		seq_show_option_n(seq, "creator", (char *)&sbi->creator, 4);
717dd80e999cd (Roman Zippel       2005-09-06 15:18:48 -0700 223) 	if (sbi->type != HFSPLUS_DEF_CR_TYPE)
a068acf2ee776 (Kees Cook          2015-09-04 15:44:57 -0700 224) 		seq_show_option_n(seq, "type", (char *)&sbi->type, 4);
2753cc281c9a0 (Anton Salikhmetov  2010-12-16 18:08:38 +0200 225) 	seq_printf(seq, ",umask=%o,uid=%u,gid=%u", sbi->umask,
16525e3f146fb (Eric W. Biederman  2012-02-07 16:27:17 -0800 226) 			from_kuid_munged(&init_user_ns, sbi->uid),
16525e3f146fb (Eric W. Biederman  2012-02-07 16:27:17 -0800 227) 			from_kgid_munged(&init_user_ns, sbi->gid));
717dd80e999cd (Roman Zippel       2005-09-06 15:18:48 -0700 228) 	if (sbi->part >= 0)
717dd80e999cd (Roman Zippel       2005-09-06 15:18:48 -0700 229) 		seq_printf(seq, ",part=%u", sbi->part);
717dd80e999cd (Roman Zippel       2005-09-06 15:18:48 -0700 230) 	if (sbi->session >= 0)
717dd80e999cd (Roman Zippel       2005-09-06 15:18:48 -0700 231) 		seq_printf(seq, ",session=%u", sbi->session);
717dd80e999cd (Roman Zippel       2005-09-06 15:18:48 -0700 232) 	if (sbi->nls)
717dd80e999cd (Roman Zippel       2005-09-06 15:18:48 -0700 233) 		seq_printf(seq, ",nls=%s", sbi->nls->charset);
84adede31267a (Christoph Hellwig  2010-10-01 05:45:20 +0200 234) 	if (test_bit(HFSPLUS_SB_NODECOMPOSE, &sbi->flags))
d8983ca0aa86c (Fabian Frederick   2014-06-06 14:36:26 -0700 235) 		seq_puts(seq, ",nodecompose");
34a2d313c51f4 (Christoph Hellwig  2010-11-23 14:38:21 +0100 236) 	if (test_bit(HFSPLUS_SB_NOBARRIER, &sbi->flags))
d8983ca0aa86c (Fabian Frederick   2014-06-06 14:36:26 -0700 237) 		seq_puts(seq, ",nobarrier");
717dd80e999cd (Roman Zippel       2005-09-06 15:18:48 -0700 238) 	return 0;
717dd80e999cd (Roman Zippel       2005-09-06 15:18:48 -0700 239) }