]> git.hungrycats.org Git - linux/commitdiff
[PATCH] kAFS automount support
authorDavid Howells <dhowells@redhat.com>
Sun, 11 Jul 2004 02:30:22 +0000 (19:30 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sun, 11 Jul 2004 02:30:22 +0000 (19:30 -0700)
Here's a patch to allow the kAFS filesystem to use the automount facility
patch presented in a previous email.

It allows me to mount an AFS root volume on /afs and then just walk through
the directory structure causing referenced volumes to be automounted and
autoumounted.

For instance, if I do:

[root@andromeda root]# mount -t afs \#root.afs. /afs
[root@andromeda root]# ls /afs
asd  cambridge  cambridge.redhat.com  grand.central.org
[root@andromeda root]# ls /afs/cambridge
afsdoc
[root@andromeda root]# ls /afs/cambridge/afsdoc/
ChangeLog  html  LICENSE  pdf  RELNOTES-1.2.2

And then look in the mountpoint catalogue, I see:

[root@andromeda root]# cat /proc/mounts
...
#root.afs. /afs afs rw 0 0
#root.cell. /afs/cambridge.redhat.com afs rw 0 0
#afsdoc. /afs/cambridge.redhat.com/afsdoc afs rw 0 0

Then after waiting a few minutes:

[root@andromeda root]# cat /proc/mounts
...
#root.afs. /afs afs rw 0 0

Is all that remains.

Signed-Off-By: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/afs/cmservice.c
fs/afs/internal.h
fs/afs/mntpt.c
fs/afs/super.c

index 289489da3ca242eeb36daaf3cddf4b5ed5ba0793..1f968366e6517c90879b1c566bd7a942ab17a3b7 100644 (file)
@@ -307,10 +307,8 @@ int afscm_start(void)
                if (ret < 0)
                        goto kill;
 
-#ifdef AFS_AUTOMOUNT_SUPPORT
                afs_kafstimod_add_timer(&afs_mntpt_expiry_timer,
                                        afs_mntpt_expiry_timeout * HZ);
-#endif
        }
 
        afscm_usage++;
@@ -392,9 +390,7 @@ void afscm_stop(void)
                }
                spin_unlock(&kafscmd_attention_lock);
 
-#ifdef AFS_AUTOMOUNT_SUPPORT
                afs_kafstimod_del_timer(&afs_mntpt_expiry_timer);
-#endif
        }
 
        up_write(&afscm_sem);
index 11ef8c5568b2be19ac3cf755ab8fa2cc6c5fb9c2..f09860b45c1a303e9f0702bf2ab9636f6a26689d 100644 (file)
@@ -107,11 +107,9 @@ extern struct cachefs_netfs afs_cache_netfs;
  */
 extern struct inode_operations afs_mntpt_inode_operations;
 extern struct file_operations afs_mntpt_file_operations;
-#ifdef AFS_AUTOMOUNT_SUPPORT
 extern struct afs_timer afs_mntpt_expiry_timer;
 extern struct afs_timer_ops afs_mntpt_expiry_timer_ops;
 extern unsigned long afs_mntpt_expiry_timeout;
-#endif
 
 extern int afs_mntpt_check_symlink(struct afs_vnode *vnode);
 
index 3a36a3ca5e39653f825ba167d8f4e1f52a6f5e0f..aab380e7e6dba28682db9d548c0992f3cf1041c5 100644 (file)
@@ -30,10 +30,7 @@ static struct dentry *afs_mntpt_lookup(struct inode *dir,
                                       struct dentry *dentry,
                                       struct nameidata *nd);
 static int afs_mntpt_open(struct inode *inode, struct file *file);
-
-#ifdef AFS_AUTOMOUNT_SUPPORT
 static int afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd);
-#endif
 
 struct file_operations afs_mntpt_file_operations = {
        .open           = afs_mntpt_open,
@@ -41,14 +38,11 @@ struct file_operations afs_mntpt_file_operations = {
 
 struct inode_operations afs_mntpt_inode_operations = {
        .lookup         = afs_mntpt_lookup,
-#ifdef AFS_AUTOMOUNT_SUPPORT
        .follow_link    = afs_mntpt_follow_link,
-#endif
        .readlink       = page_readlink,
        .getattr        = afs_inode_getattr,
 };
 
-#ifdef AFS_AUTOMOUNT_SUPPORT
 static LIST_HEAD(afs_vfsmounts);
 
 static void afs_mntpt_expiry_timed_out(struct afs_timer *timer);
@@ -60,7 +54,6 @@ struct afs_timer_ops afs_mntpt_expiry_timer_ops = {
 struct afs_timer afs_mntpt_expiry_timer;
 
 unsigned long afs_mntpt_expiry_timeout = 20;
-#endif
 
 /*****************************************************************************/
 /*
@@ -156,7 +149,6 @@ static int afs_mntpt_open(struct inode *inode, struct file *file)
        return -EREMOTE;
 } /* end afs_mntpt_open() */
 
-#ifdef AFS_AUTOMOUNT_SUPPORT
 /*****************************************************************************/
 /*
  * create a vfsmount to be automounted
@@ -168,6 +160,7 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt)
        struct page *page = NULL;
        size_t size;
        char *buf, *devname = NULL, *options = NULL;
+       filler_t *filler;
        int ret;
 
        kenter("{%s}", mntpt->d_name.name);
@@ -189,7 +182,7 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt)
                goto error;
 
        /* read the contents of the AFS special symlink */
-       filler_t *filler = mntpt->d_inode->i_mapping->a_ops->readpage;
+       filler = mntpt->d_inode->i_mapping->a_ops->readpage;
 
        page = read_cache_page(mntpt->d_inode->i_mapping, 0, filler, NULL);
        if (IS_ERR(page)) {
@@ -288,4 +281,3 @@ static void afs_mntpt_expiry_timed_out(struct afs_timer *timer)
 
        kleave("");
 } /* end afs_mntpt_expiry_timed_out() */
-#endif
index bdf830191f6242365da5a988152764b84302e641..d6fa8e5999df9a71b0b4c17a0090cba087e3532b 100644 (file)
@@ -78,9 +78,7 @@ int __init afs_fs_init(void)
 
        _enter("");
 
-#ifdef AFS_AUTOMOUNT_SUPPORT
        afs_timer_init(&afs_mntpt_expiry_timer, &afs_mntpt_expiry_timer_ops);
-#endif
 
        /* create ourselves an inode cache */
        atomic_set(&afs_count_active_inodes, 0);