Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a0016ff2 authored by Fabian Frederick's avatar Fabian Frederick Committed by Linus Torvalds
Browse files

fs/affs: use AFFS_MOUNT prefix for mount options



Currently, affs still uses direct access on mount_options.  This patch
prepares to use affs_clear/set/test_opt() like other filesystems.

Signed-off-by: default avatarFabian Frederick <fabf@skynet.be>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b7964106
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -106,18 +106,18 @@ struct affs_sb_info {
	spinlock_t work_lock;		/* protects sb_work and work_queued */
};

#define SF_INTL		0x0001		/* International filesystem. */
#define SF_BM_VALID	0x0002		/* Bitmap is valid. */
#define SF_IMMUTABLE	0x0004		/* Protection bits cannot be changed */
#define SF_QUIET	0x0008		/* chmod errors will be not reported */
#define SF_SETUID	0x0010		/* Ignore Amiga uid */
#define SF_SETGID	0x0020		/* Ignore Amiga gid */
#define SF_SETMODE	0x0040		/* Ignore Amiga protection bits */
#define SF_MUFS		0x0100		/* Use MUFS uid/gid mapping */
#define SF_OFS		0x0200		/* Old filesystem */
#define SF_PREFIX	0x0400		/* Buffer for prefix is allocated */
#define SF_VERBOSE	0x0800		/* Talk about fs when mounting */
#define SF_NO_TRUNCATE	0x1000		/* Don't truncate filenames */
#define AFFS_MOUNT_SF_INTL		0x0001 /* International filesystem. */
#define AFFS_MOUNT_SF_BM_VALID		0x0002 /* Bitmap is valid. */
#define AFFS_MOUNT_SF_IMMUTABLE		0x0004 /* Protection bits cannot be changed */
#define AFFS_MOUNT_SF_QUIET		0x0008 /* chmod errors will be not reported */
#define AFFS_MOUNT_SF_SETUID		0x0010 /* Ignore Amiga uid */
#define AFFS_MOUNT_SF_SETGID		0x0020 /* Ignore Amiga gid */
#define AFFS_MOUNT_SF_SETMODE		0x0040 /* Ignore Amiga protection bits */
#define AFFS_MOUNT_SF_MUFS		0x0100 /* Use MUFS uid/gid mapping */
#define AFFS_MOUNT_SF_OFS		0x0200 /* Old filesystem */
#define AFFS_MOUNT_SF_PREFIX		0x0400 /* Buffer for prefix is allocated */
#define AFFS_MOUNT_SF_VERBOSE		0x0800 /* Talk about fs when mounting */
#define AFFS_MOUNT_SF_NO_TRUNCATE	0x1000 /* Don't truncate filenames */

/* short cut to get to the affs specific sb data */
static inline struct affs_sb_info *AFFS_SB(struct super_block *sb)
+1 −1
Original line number Diff line number Diff line
@@ -472,7 +472,7 @@ bool
affs_nofilenametruncate(const struct dentry *dentry)
{
	struct inode *inode = dentry->d_inode;
	return AFFS_SB(inode->i_sb)->s_flags & SF_NO_TRUNCATE;
	return AFFS_SB(inode->i_sb)->s_flags & AFFS_MOUNT_SF_NO_TRUNCATE;

}

+1 −1
Original line number Diff line number Diff line
@@ -915,7 +915,7 @@ affs_truncate(struct inode *inode)
	if (inode->i_size) {
		AFFS_I(inode)->i_blkcnt = last_blk + 1;
		AFFS_I(inode)->i_extcnt = ext + 1;
		if (AFFS_SB(sb)->s_flags & SF_OFS) {
		if (AFFS_SB(sb)->s_flags & AFFS_MOUNT_SF_OFS) {
			struct buffer_head *bh = affs_bread_ino(inode, last_blk, 0);
			u32 tmp;
			if (IS_ERR(bh)) {
+18 −14
Original line number Diff line number Diff line
@@ -66,23 +66,23 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino)
	AFFS_I(inode)->i_lastalloc = 0;
	AFFS_I(inode)->i_pa_cnt = 0;

	if (sbi->s_flags & SF_SETMODE)
	if (sbi->s_flags & AFFS_MOUNT_SF_SETMODE)
		inode->i_mode = sbi->s_mode;
	else
		inode->i_mode = prot_to_mode(prot);

	id = be16_to_cpu(tail->uid);
	if (id == 0 || sbi->s_flags & SF_SETUID)
	if (id == 0 || sbi->s_flags & AFFS_MOUNT_SF_SETUID)
		inode->i_uid = sbi->s_uid;
	else if (id == 0xFFFF && sbi->s_flags & SF_MUFS)
	else if (id == 0xFFFF && sbi->s_flags & AFFS_MOUNT_SF_MUFS)
		i_uid_write(inode, 0);
	else
		i_uid_write(inode, id);

	id = be16_to_cpu(tail->gid);
	if (id == 0 || sbi->s_flags & SF_SETGID)
	if (id == 0 || sbi->s_flags & AFFS_MOUNT_SF_SETGID)
		inode->i_gid = sbi->s_gid;
	else if (id == 0xFFFF && sbi->s_flags & SF_MUFS)
	else if (id == 0xFFFF && sbi->s_flags & AFFS_MOUNT_SF_MUFS)
		i_gid_write(inode, 0);
	else
		i_gid_write(inode, id);
@@ -94,7 +94,7 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino)
		/* fall through */
	case ST_USERDIR:
		if (be32_to_cpu(tail->stype) == ST_USERDIR ||
		    sbi->s_flags & SF_SETMODE) {
		    sbi->s_flags & AFFS_MOUNT_SF_SETMODE) {
			if (inode->i_mode & S_IRUSR)
				inode->i_mode |= S_IXUSR;
			if (inode->i_mode & S_IRGRP)
@@ -133,7 +133,8 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino)
		}
		if (tail->link_chain)
			set_nlink(inode, 2);
		inode->i_mapping->a_ops = (sbi->s_flags & SF_OFS) ? &affs_aops_ofs : &affs_aops;
		inode->i_mapping->a_ops = (sbi->s_flags & AFFS_MOUNT_SF_OFS) ?
					  &affs_aops_ofs : &affs_aops;
		inode->i_op = &affs_file_inode_operations;
		inode->i_fop = &affs_file_operations;
		break;
@@ -190,15 +191,15 @@ affs_write_inode(struct inode *inode, struct writeback_control *wbc)
		if (!(inode->i_ino == AFFS_SB(sb)->s_root_block)) {
			uid = i_uid_read(inode);
			gid = i_gid_read(inode);
			if (AFFS_SB(sb)->s_flags & SF_MUFS) {
			if (AFFS_SB(sb)->s_flags & AFFS_MOUNT_SF_MUFS) {
				if (uid == 0 || uid == 0xFFFF)
					uid = uid ^ ~0;
				if (gid == 0 || gid == 0xFFFF)
					gid = gid ^ ~0;
			}
			if (!(AFFS_SB(sb)->s_flags & SF_SETUID))
			if (!(AFFS_SB(sb)->s_flags & AFFS_MOUNT_SF_SETUID))
				tail->uid = cpu_to_be16(uid);
			if (!(AFFS_SB(sb)->s_flags & SF_SETGID))
			if (!(AFFS_SB(sb)->s_flags & AFFS_MOUNT_SF_SETGID))
				tail->gid = cpu_to_be16(gid);
		}
	}
@@ -221,11 +222,14 @@ affs_notify_change(struct dentry *dentry, struct iattr *attr)
	if (error)
		goto out;

	if (((attr->ia_valid & ATTR_UID) && (AFFS_SB(inode->i_sb)->s_flags & SF_SETUID)) ||
	    ((attr->ia_valid & ATTR_GID) && (AFFS_SB(inode->i_sb)->s_flags & SF_SETGID)) ||
	if (((attr->ia_valid & ATTR_UID) &&
	     (AFFS_SB(inode->i_sb)->s_flags & AFFS_MOUNT_SF_SETUID)) ||
	    ((attr->ia_valid & ATTR_GID) &&
	     (AFFS_SB(inode->i_sb)->s_flags & AFFS_MOUNT_SF_SETGID)) ||
	    ((attr->ia_valid & ATTR_MODE) &&
	     (AFFS_SB(inode->i_sb)->s_flags & (SF_SETMODE | SF_IMMUTABLE)))) {
		if (!(AFFS_SB(inode->i_sb)->s_flags & SF_QUIET))
	     (AFFS_SB(inode->i_sb)->s_flags &
	      (AFFS_MOUNT_SF_SETMODE | AFFS_MOUNT_SF_IMMUTABLE)))) {
		if (!(AFFS_SB(inode->i_sb)->s_flags & AFFS_MOUNT_SF_QUIET))
			error = -EPERM;
		goto out;
	}
+4 −2
Original line number Diff line number Diff line
@@ -53,7 +53,8 @@ affs_intl_toupper(int ch)
static inline toupper_t
affs_get_toupper(struct super_block *sb)
{
	return AFFS_SB(sb)->s_flags & SF_INTL ? affs_intl_toupper : affs_toupper;
	return AFFS_SB(sb)->s_flags & AFFS_MOUNT_SF_INTL ?
				      affs_intl_toupper : affs_toupper;
}

/*
@@ -275,7 +276,8 @@ affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl)

	inode->i_op = &affs_file_inode_operations;
	inode->i_fop = &affs_file_operations;
	inode->i_mapping->a_ops = (AFFS_SB(sb)->s_flags & SF_OFS) ? &affs_aops_ofs : &affs_aops;
	inode->i_mapping->a_ops = (AFFS_SB(sb)->s_flags & AFFS_MOUNT_SF_OFS) ?
				  &affs_aops_ofs : &affs_aops;
	error = affs_add_entry(dir, inode, dentry, ST_FILE);
	if (error) {
		clear_nlink(inode);
Loading