Commit 561c5cf9 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Greg Kroah-Hartman
Browse files

staging: Remove autofs3



autofs3 was moved to staging in 2.6.37, so we can
remove it in the 2.6.39 merge window. If we have
a reason to bring it back after that, this patch
can get reverted.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
About-fscking-timed-by: default avatarH. Peter Anvin <hpa@zytor.com>
Cc: Ian Kent <raven@themaw.net>
Cc: autofs@linux.kernel.org
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 8aea5882
......@@ -3559,12 +3559,6 @@ W: http://lse.sourceforge.net/kdump/
S: Maintained
F: Documentation/kdump/
KERNEL AUTOMOUNTER (AUTOFS)
M: "H. Peter Anvin" <hpa@zytor.com>
L: autofs@linux.kernel.org
S: Obsolete
F: drivers/staging/autofs/
KERNEL AUTOMOUNTER v4 (AUTOFS4)
M: Ian Kent <raven@themaw.net>
L: autofs@linux.kernel.org
......
......@@ -93,8 +93,6 @@ source "drivers/staging/frontier/Kconfig"
source "drivers/staging/pohmelfs/Kconfig"
source "drivers/staging/autofs/Kconfig"
source "drivers/staging/phison/Kconfig"
source "drivers/staging/line6/Kconfig"
......
......@@ -31,7 +31,6 @@ obj-$(CONFIG_RTS_PSTOR) += rts_pstor/
obj-$(CONFIG_SPECTRA) += spectra/
obj-$(CONFIG_TRANZPORT) += frontier/
obj-$(CONFIG_POHMELFS) += pohmelfs/
obj-$(CONFIG_AUTOFS_FS) += autofs/
obj-$(CONFIG_IDE_PHISON) += phison/
obj-$(CONFIG_LINE6_USB) += line6/
obj-$(CONFIG_USB_SERIAL_QUATECH2) += serqt_usb2/
......
config AUTOFS_FS
tristate "Kernel automounter support"
depends on BKL # unfixable, just use autofs4
help
The automounter is a tool to automatically mount remote file systems
on demand. This implementation is partially kernel-based to reduce
overhead in the already-mounted case; this is unlike the BSD
automounter (amd), which is a pure user space daemon.
To use the automounter you need the user-space tools from the autofs
package; you can find the location in <file:Documentation/Changes>.
You also want to answer Y to "NFS file system support", below.
If you want to use the newer version of the automounter with more
features, say N here and say Y to "Kernel automounter v4 support",
below.
To compile this support as a module, choose M here: the module will be
called autofs.
If you are not a part of a fairly large, distributed network, you
probably do not need an automounter, and can say N here.
#
# Makefile for the linux autofs-filesystem routines.
#
obj-$(CONFIG_AUTOFS_FS) += autofs.o
autofs-y := dirhash.o init.o inode.o root.o symlink.o waitq.o
autofs version 3 is on its way out of the kernel,
It has been replaced by autofs4 several years ago.
The autofs3 code uses the big kernel lock which
is getting deprecated.
Users that find autofs3 to work but not autofs4
should talk to Ian Kent <raven@themaw.net>.
/* -*- linux-c -*- ------------------------------------------------------- *
*
* drivers/staging/autofs/autofs_i.h
*
* Copyright 1997-1998 Transmeta Corporation - All Rights Reserved
*
* This file is part of the Linux kernel and is made available under
* the terms of the GNU General Public License, version 2, or at your
* option, any later version, incorporated herein by reference.
*
* ----------------------------------------------------------------------- */
/* Internal header file for autofs */
#include <linux/auto_fs.h>
/* This is the range of ioctl() numbers we claim as ours */
#define AUTOFS_IOC_FIRST AUTOFS_IOC_READY
#define AUTOFS_IOC_COUNT 32
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/time.h>
#include <linux/string.h>
#include <linux/wait.h>
#include <linux/dcache.h>
#include <linux/namei.h>
#include <linux/mount.h>
#include <linux/sched.h>
#include <asm/current.h>
#include <asm/uaccess.h>
#ifdef DEBUG
#define DPRINTK(D) (printk D)
#else
#define DPRINTK(D) ((void)0)
#endif
/*
* If the daemon returns a negative response (AUTOFS_IOC_FAIL) then the
* kernel will keep the negative response cached for up to the time given
* here, although the time can be shorter if the kernel throws the dcache
* entry away. This probably should be settable from user space.
*/
#define AUTOFS_NEGATIVE_TIMEOUT (60*HZ) /* 1 minute */
/* Structures associated with the root directory hash table */
#define AUTOFS_HASH_SIZE 67
struct autofs_dir_ent {
int hash;
char *name;
int len;
ino_t ino;
struct dentry *dentry;
/* Linked list of entries */
struct autofs_dir_ent *next;
struct autofs_dir_ent **back;
/* The following entries are for the expiry system */
unsigned long last_usage;
struct list_head exp;
};
struct autofs_dirhash {
struct autofs_dir_ent *h[AUTOFS_HASH_SIZE];
struct list_head expiry_head;
};
struct autofs_wait_queue {
wait_queue_head_t queue;
struct autofs_wait_queue *next;
autofs_wqt_t wait_queue_token;
/* We use the following to see what we are waiting for */
int hash;
int len;
char *name;
/* This is for status reporting upon return */
int status;
int wait_ctr;
};
struct autofs_symlink {
char *data;
int len;
time_t mtime;
};
#define AUTOFS_MAX_SYMLINKS 256
#define AUTOFS_ROOT_INO 1
#define AUTOFS_FIRST_SYMLINK 2
#define AUTOFS_FIRST_DIR_INO (AUTOFS_FIRST_SYMLINK+AUTOFS_MAX_SYMLINKS)
#define AUTOFS_SYMLINK_BITMAP_LEN \
((AUTOFS_MAX_SYMLINKS+((sizeof(long)*1)-1))/(sizeof(long)*8))
#define AUTOFS_SBI_MAGIC 0x6d4a556d
struct autofs_sb_info {
u32 magic;
struct file *pipe;
struct pid *oz_pgrp;
int catatonic;
struct super_block *sb;
unsigned long exp_timeout;
ino_t next_dir_ino;
struct autofs_wait_queue *queues; /* Wait queue pointer */
struct autofs_dirhash dirhash; /* Root directory hash */
struct autofs_symlink symlink[AUTOFS_MAX_SYMLINKS];
unsigned long symlink_bitmap[AUTOFS_SYMLINK_BITMAP_LEN];
};
static inline struct autofs_sb_info *autofs_sbi(struct super_block *sb)
{
return (struct autofs_sb_info *)(sb->s_fs_info);
}
/* autofs_oz_mode(): do we see the man behind the curtain? (The
processes which do manipulations for us in user space sees the raw
filesystem without "magic".) */
static inline int autofs_oz_mode(struct autofs_sb_info *sbi) {
return sbi->catatonic || task_pgrp(current) == sbi->oz_pgrp;
}
/* Hash operations */
void autofs_initialize_hash(struct autofs_dirhash *);
struct autofs_dir_ent *autofs_hash_lookup(const struct autofs_dirhash *,struct qstr *);
void autofs_hash_insert(struct autofs_dirhash *,struct autofs_dir_ent *);
void autofs_hash_delete(struct autofs_dir_ent *);
struct autofs_dir_ent *autofs_hash_enum(const struct autofs_dirhash *,off_t *,struct autofs_dir_ent *);
void autofs_hash_dputall(struct autofs_dirhash *);
void autofs_hash_nuke(struct autofs_sb_info *);
/* Expiration-handling functions */
void autofs_update_usage(struct autofs_dirhash *,struct autofs_dir_ent *);
struct autofs_dir_ent *autofs_expire(struct super_block *,struct autofs_sb_info *, struct vfsmount *mnt);
/* Operations structures */
extern const struct inode_operations autofs_root_inode_operations;
extern const struct inode_operations autofs_symlink_inode_operations;
extern const struct file_operations autofs_root_operations;
/* Initializing function */
int autofs_fill_super(struct super_block *, void *, int);
void autofs_kill_sb(struct super_block *sb);
struct inode *autofs_iget(struct super_block *, unsigned long);
/* Queue management functions */
int autofs_wait(struct autofs_sb_info *,struct qstr *);
int autofs_wait_release(struct autofs_sb_info *,autofs_wqt_t,int);
void autofs_catatonic_mode(struct autofs_sb_info *);
#ifdef DEBUG
void autofs_say(const char *name, int len);
#else
#define autofs_say(n,l) ((void)0)
#endif
/* -*- linux-c -*- --------------------------------------------------------- *
*
* drivers/staging/autofs/dirhash.c
*
* Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved
*
* This file is part of the Linux kernel and is made available under
* the terms of the GNU General Public License, version 2, or at your
* option, any later version, incorporated herein by reference.
*
* ------------------------------------------------------------------------- */
#include "autofs_i.h"
/* Functions for maintenance of expiry queue */
static void autofs_init_usage(struct autofs_dirhash *dh,
struct autofs_dir_ent *ent)
{
list_add_tail(&ent->exp, &dh->expiry_head);
ent->last_usage = jiffies;
}
static void autofs_delete_usage(struct autofs_dir_ent *ent)
{
list_del(&ent->exp);
}
void autofs_update_usage(struct autofs_dirhash *dh,
struct autofs_dir_ent *ent)
{
autofs_delete_usage(ent); /* Unlink from current position */
autofs_init_usage(dh, ent); /* Relink at queue tail */
}
struct autofs_dir_ent *autofs_expire(struct super_block *sb,
struct autofs_sb_info *sbi,
struct vfsmount *mnt)
{
struct autofs_dirhash *dh = &sbi->dirhash;
struct autofs_dir_ent *ent;
unsigned long timeout = sbi->exp_timeout;
while (1) {
struct path path;
int umount_ok;
if (list_empty(&dh->expiry_head) || sbi->catatonic)
return NULL; /* No entries */
/* We keep the list sorted by last_usage and want old stuff */
ent = list_entry(dh->expiry_head.next,
struct autofs_dir_ent, exp);
if (jiffies - ent->last_usage < timeout)
break;
/* Move to end of list in case expiry isn't desirable */
autofs_update_usage(dh, ent);
/* Check to see that entry is expirable */
if (ent->ino < AUTOFS_FIRST_DIR_INO)
return ent; /* Symlinks are always expirable */
/* Get the dentry for the autofs subdirectory */
path.dentry = ent->dentry;
if (!path.dentry) {
/* Should only happen in catatonic mode */
printk(KERN_DEBUG "autofs: dentry == NULL but inode \
range is directory, entry %s\n", ent->name);
autofs_delete_usage(ent);
continue;
}
if (!path.dentry->d_inode) {
dput(path.dentry);
printk(KERN_DEBUG "autofs: negative dentry on expiry queue: %s\n",
ent->name);
autofs_delete_usage(ent);
continue;
}
/* Make sure entry is mounted and unused; note that dentry will
point to the mounted-on-top root. */
if (!S_ISDIR(path.dentry->d_inode->i_mode) ||
!d_mountpoint(path.dentry)) {
DPRINTK(("autofs: not expirable \
(not a mounted directory): %s\n", ent->name));
continue;
}
path.mnt = mnt;
path_get(&path);
if (!follow_down_one(&path)) {
path_put(&path);
DPRINTK(("autofs: not expirable\
(not a mounted directory): %s\n", ent->name));
continue;
}
follow_down(&path, false); // TODO: need to check error
umount_ok = may_umount(path.mnt);
path_put(&path);
if (umount_ok) {
DPRINTK(("autofs: signaling expire on %s\n",
ent->name));
return ent; /* Expirable! */
}
DPRINTK(("autofs: didn't expire due to may_umount: %s\n",
ent->name));
}
return NULL; /* No expirable entries */
}
void autofs_initialize_hash(struct autofs_dirhash *dh)
{
memset(&dh->h, 0, AUTOFS_HASH_SIZE*sizeof(struct autofs_dir_ent *));
INIT_LIST_HEAD(&dh->expiry_head);
}
struct autofs_dir_ent *autofs_hash_lookup(const struct autofs_dirhash *dh,
struct qstr *name)
{
struct autofs_dir_ent *dhn;
DPRINTK(("autofs_hash_lookup: hash = 0x%08x, name = ", name->hash));
autofs_say(name->name, name->len);
for (dhn = dh->h[(unsigned) name->hash % AUTOFS_HASH_SIZE];
dhn;
dhn = dhn->next) {
if (name->hash == dhn->hash &&
name->len == dhn->len &&
!memcmp(name->name, dhn->name, name->len))
break;
}
return dhn;
}
void autofs_hash_insert(struct autofs_dirhash *dh, struct autofs_dir_ent *ent)
{
struct autofs_dir_ent **dhnp;
DPRINTK(("autofs_hash_insert: hash = 0x%08x, name = ", ent->hash));
autofs_say(ent->name, ent->len);
autofs_init_usage(dh, ent);
if (ent->dentry)
dget(ent->dentry);
dhnp = &dh->h[(unsigned) ent->hash % AUTOFS_HASH_SIZE];
ent->next = *dhnp;
ent->back = dhnp;
*dhnp = ent;
if (ent->next)
ent->next->back = &(ent->next);
}
void autofs_hash_delete(struct autofs_dir_ent *ent)
{
*(ent->back) = ent->next;
if (ent->next)
ent->next->back = ent->back;
autofs_delete_usage(ent);
if (ent->dentry)
dput(ent->dentry);
kfree(ent->name);
kfree(ent);
}
/*
* Used by readdir(). We must validate "ptr", so we can't simply make it
* a pointer. Values below 0xffff are reserved; calling with any value
* <= 0x10000 will return the first entry found.
*
* "last" can be NULL or the value returned by the last search *if* we
* want the next sequential entry.
*/
struct autofs_dir_ent *autofs_hash_enum(const struct autofs_dirhash *dh,
off_t *ptr, struct autofs_dir_ent *last)
{
int bucket, ecount, i;
struct autofs_dir_ent *ent;
bucket = (*ptr >> 16) - 1;
ecount = *ptr & 0xffff;
if (bucket < 0)
bucket = ecount = 0;
DPRINTK(("autofs_hash_enum: bucket %d, entry %d\n", bucket, ecount));
ent = last ? last->next : NULL;
if (ent) {
ecount++;
} else {
while (bucket < AUTOFS_HASH_SIZE) {
ent = dh->h[bucket];
for (i = ecount ; ent && i ; i--)
ent = ent->next;
if (ent) {
ecount++; /* Point to *next* entry */
break;
}
bucket++; ecount = 0;
}
}
#ifdef DEBUG
if (!ent)
printk(KERN_DEBUG "autofs_hash_enum: nothing found\n");
else {
printk(KERN_DEBUG "autofs_hash_enum: found hash %08x, name",
ent->hash);
autofs_say(ent->name, ent->len);
}
#endif
*ptr = ((bucket+1) << 16) + ecount;
return ent;
}
/* Iterate over all the ents, and remove all dentry pointers. Used on
entering catatonic mode, in order to make the filesystem unmountable. */
void autofs_hash_dputall(struct autofs_dirhash *dh)
{
int i;
struct autofs_dir_ent *ent;
for (i = 0 ; i < AUTOFS_HASH_SIZE ; i++) {
for (ent = dh->h[i] ; ent ; ent = ent->next) {
if (ent->dentry) {
dput(ent->dentry);
ent->dentry = NULL;
}
}
}
}
/* Delete everything. This is used on filesystem destruction, so we
make no attempt to keep the pointers valid */
void autofs_hash_nuke(struct autofs_sb_info *sbi)
{
int i;
struct autofs_dir_ent *ent, *nent;
for (i = 0 ; i < AUTOFS_HASH_SIZE ; i++) {
for (ent = sbi->dirhash.h[i] ; ent ; ent = nent) {
nent = ent->next;
if (ent->dentry)
dput(ent->dentry);
kfree(ent->name);
kfree(ent);
}
}
}
/* -*- linux-c -*- --------------------------------------------------------- *
*
* drivers/staging/autofs/init.c
*
* Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved
*
* This file is part of the Linux kernel and is made available under
* the terms of the GNU General Public License, version 2, or at your
* option, any later version, incorporated herein by reference.
*
* ------------------------------------------------------------------------- */
#include <linux/module.h>
#include <linux/init.h>
#include "autofs_i.h"
static struct dentry *autofs_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data)
{
return mount_nodev(fs_type, flags, data, autofs_fill_super);
}
static struct file_system_type autofs_fs_type = {
.owner = THIS_MODULE,
.name = "autofs",
.mount = autofs_mount,
.kill_sb = autofs_kill_sb,
};
static int __init init_autofs_fs(void)
{
return register_filesystem(&autofs_fs_type);
}
static void __exit exit_autofs_fs(void)
{
unregister_filesystem(&autofs_fs_type);
}
module_init(init_autofs_fs);
module_exit(exit_autofs_fs);
#ifdef DEBUG
void autofs_say(const char *name, int len)
{
printk("(%d: ", len);
while ( len-- )
printk("%c", *name++);
printk(")\n");
}
#endif
MODULE_LICENSE("GPL");
/* -*- linux-c -*- --------------------------------------------------------- *
*
* drivers/staging/autofs/inode.c
*
* Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved
*
* This file is part of the Linux kernel and is made available under
* the terms of the GNU General Public License, version 2, or at your
* option, any later version, incorporated herein by reference.
*
* ------------------------------------------------------------------------- */
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/file.h>
#include <linux/parser.h>
#include <linux/bitops.h>
#include <linux/magic.h>
#include "autofs_i.h"
#include <linux/module.h>
void autofs_kill_sb(struct super_block *sb)
{
struct autofs_sb_info *sbi = autofs_sbi(sb);
unsigned int n;
/*
* In the event of a failure in get_sb_nodev the superblock
* info is not present so nothing else has been setup, so
* just call kill_anon_super when we are called from
* deactivate_super.
*/
if (!sbi)
goto out_kill_sb;
if (!sbi->catatonic)
autofs_catatonic_mode(sbi); /* Free wait queues, close pipe */
put_pid(sbi->oz_pgrp);
autofs_hash_nuke(sbi);
for (n = 0; n < AUTOFS_MAX_SYMLINKS; n++) {
if (test_bit(n, sbi->symlink_bitmap))
kfree(sbi->symlink[n].data);
}
kfree(sb->s_fs_info);
out_kill_sb:
DPRINTK(("autofs: shutting down\n"));
kill_anon_super(sb);
}
static const struct super_operations autofs_sops = {
.statfs = simple_statfs,
.show_options = generic_show_options,
};
enum {Opt_err, Opt_fd, Opt_uid, Opt_gid, Opt_pgrp, Opt_minproto, Opt_maxproto};
static const match_table_t autofs_tokens = {
{Opt_fd, "fd=%u"},
{Opt_uid, "uid=%u"},
{Opt_gid, "gid=%u"},
{Opt_pgrp, "pgrp=%u"},