Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 126360
b: refs/heads/master
c: a92daf6
h: refs/heads/master
v: v3
  • Loading branch information
Ian Kent authored and Linus Torvalds committed Jan 6, 2009
1 parent 546ebe2 commit 5bf1623
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 41cfef2eb87694a8d64105c059b39f7bd6b7d4fe
refs/heads/master: a92daf6ba1f9ace8584edc8eb557a77aa7c2c71d
2 changes: 0 additions & 2 deletions trunk/fs/autofs4/autofs_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
#define AUTOFS_DEV_IOCTL_IOC_FIRST (AUTOFS_DEV_IOCTL_VERSION)
#define AUTOFS_DEV_IOCTL_IOC_COUNT (AUTOFS_IOC_COUNT - 11)

#define AUTOFS_TYPE_TRIGGER (AUTOFS_TYPE_DIRECT|AUTOFS_TYPE_OFFSET)

#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/time.h>
Expand Down
4 changes: 2 additions & 2 deletions trunk/fs/autofs4/dev-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ static int autofs_dev_ioctl_expire(struct file *fp,
how = param->expire.how;
mnt = fp->f_path.mnt;

if (sbi->type & AUTOFS_TYPE_TRIGGER)
if (autofs_type_trigger(sbi->type))
dentry = autofs4_expire_direct(sbi->sb, mnt, sbi, how);
else
dentry = autofs4_expire_indirect(sbi->sb, mnt, sbi, how);
Expand Down Expand Up @@ -615,7 +615,7 @@ static int autofs_dev_ioctl_ismountpoint(struct file *fp,
param->ismountpoint.out.magic = magic = 0;

if (!fp || param->ioctlfd == -1) {
if (type == AUTOFS_TYPE_ANY) {
if (autofs_type_any(type)) {
struct super_block *sb;

err = path_lookup(path, LOOKUP_FOLLOW, &nd);
Expand Down
4 changes: 2 additions & 2 deletions trunk/fs/autofs4/expire.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static int autofs4_mount_busy(struct vfsmount *mnt, struct dentry *dentry)
struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);

/* This is an autofs submount, we can't expire it */
if (sbi->type == AUTOFS_TYPE_INDIRECT)
if (autofs_type_indirect(sbi->type))
goto done;

/*
Expand Down Expand Up @@ -490,7 +490,7 @@ int autofs4_expire_multi(struct super_block *sb, struct vfsmount *mnt,
if (arg && get_user(do_now, arg))
return -EFAULT;

if (sbi->type & AUTOFS_TYPE_TRIGGER)
if (autofs_type_trigger(sbi->type))
dentry = autofs4_expire_direct(sb, mnt, sbi, do_now);
else
dentry = autofs4_expire_indirect(sb, mnt, sbi, do_now);
Expand Down
14 changes: 7 additions & 7 deletions trunk/fs/autofs4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ static int autofs4_show_options(struct seq_file *m, struct vfsmount *mnt)
seq_printf(m, ",minproto=%d", sbi->min_proto);
seq_printf(m, ",maxproto=%d", sbi->max_proto);

if (sbi->type & AUTOFS_TYPE_OFFSET)
if (autofs_type_offset(sbi->type))
seq_printf(m, ",offset");
else if (sbi->type & AUTOFS_TYPE_DIRECT)
else if (autofs_type_direct(sbi->type))
seq_printf(m, ",direct");
else
seq_printf(m, ",indirect");
Expand Down Expand Up @@ -284,13 +284,13 @@ static int parse_options(char *options, int *pipefd, uid_t *uid, gid_t *gid,
*maxproto = option;
break;
case Opt_indirect:
*type = AUTOFS_TYPE_INDIRECT;
set_autofs_type_indirect(type);
break;
case Opt_direct:
*type = AUTOFS_TYPE_DIRECT;
set_autofs_type_direct(type);
break;
case Opt_offset:
*type = AUTOFS_TYPE_OFFSET;
set_autofs_type_offset(type);
break;
default:
return 1;
Expand Down Expand Up @@ -338,7 +338,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
sbi->sb = s;
sbi->version = 0;
sbi->sub_version = 0;
sbi->type = AUTOFS_TYPE_INDIRECT;
set_autofs_type_indirect(&sbi->type);
sbi->min_proto = 0;
sbi->max_proto = 0;
mutex_init(&sbi->wq_mutex);
Expand Down Expand Up @@ -380,7 +380,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
}

root_inode->i_fop = &autofs4_root_operations;
root_inode->i_op = sbi->type & AUTOFS_TYPE_TRIGGER ?
root_inode->i_op = autofs_type_trigger(sbi->type) ?
&autofs4_direct_root_inode_operations :
&autofs4_indirect_root_inode_operations;

Expand Down
8 changes: 4 additions & 4 deletions trunk/fs/autofs4/waitq.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
* is very similar for indirect mounts except only dentrys
* in the root of the autofs file system may be negative.
*/
if (sbi->type & AUTOFS_TYPE_TRIGGER)
if (autofs_type_trigger(sbi->type))
return -ENOENT;
else if (!IS_ROOT(dentry->d_parent))
return -ENOENT;
Expand All @@ -348,7 +348,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
return -ENOMEM;

/* If this is a direct mount request create a dummy name */
if (IS_ROOT(dentry) && sbi->type & AUTOFS_TYPE_TRIGGER)
if (IS_ROOT(dentry) && autofs_type_trigger(sbi->type))
qstr.len = sprintf(name, "%p", dentry);
else {
qstr.len = autofs4_getpath(sbi, dentry, &name);
Expand Down Expand Up @@ -406,11 +406,11 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
type = autofs_ptype_expire_multi;
} else {
if (notify == NFY_MOUNT)
type = (sbi->type & AUTOFS_TYPE_TRIGGER) ?
type = autofs_type_trigger(sbi->type) ?
autofs_ptype_missing_direct :
autofs_ptype_missing_indirect;
else
type = (sbi->type & AUTOFS_TYPE_TRIGGER) ?
type = autofs_type_trigger(sbi->type) ?
autofs_ptype_expire_direct :
autofs_ptype_expire_indirect;
}
Expand Down
62 changes: 58 additions & 4 deletions trunk/include/linux/auto_fs4.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,64 @@
#define AUTOFS_EXP_IMMEDIATE 1
#define AUTOFS_EXP_LEAVES 2

#define AUTOFS_TYPE_ANY 0x0000
#define AUTOFS_TYPE_INDIRECT 0x0001
#define AUTOFS_TYPE_DIRECT 0x0002
#define AUTOFS_TYPE_OFFSET 0x0004
#define AUTOFS_TYPE_ANY 0U
#define AUTOFS_TYPE_INDIRECT 1U
#define AUTOFS_TYPE_DIRECT 2U
#define AUTOFS_TYPE_OFFSET 4U

static inline void set_autofs_type_indirect(unsigned int *type)
{
*type = AUTOFS_TYPE_INDIRECT;
return;
}

static inline unsigned int autofs_type_indirect(unsigned int type)
{
return (type == AUTOFS_TYPE_INDIRECT);
}

static inline void set_autofs_type_direct(unsigned int *type)
{
*type = AUTOFS_TYPE_DIRECT;
return;
}

static inline unsigned int autofs_type_direct(unsigned int type)
{
return (type == AUTOFS_TYPE_DIRECT);
}

static inline void set_autofs_type_offset(unsigned int *type)
{
*type = AUTOFS_TYPE_OFFSET;
return;
}

static inline unsigned int autofs_type_offset(unsigned int type)
{
return (type == AUTOFS_TYPE_OFFSET);
}

static inline unsigned int autofs_type_trigger(unsigned int type)
{
return (type == AUTOFS_TYPE_DIRECT || type == AUTOFS_TYPE_OFFSET);
}

/*
* This isn't really a type as we use it to say "no type set" to
* indicate we want to search for "any" mount in the
* autofs_dev_ioctl_ismountpoint() device ioctl function.
*/
static inline void set_autofs_type_any(unsigned int *type)
{
*type = AUTOFS_TYPE_ANY;
return;
}

static inline unsigned int autofs_type_any(unsigned int type)
{
return (type == AUTOFS_TYPE_ANY);
}

/* Daemon notification packet types */
enum autofs_notify {
Expand Down

0 comments on commit 5bf1623

Please sign in to comment.