patch-2.3.99-pre6 linux/fs/autofs4/inode.c
Next file: linux/fs/autofs4/inohash.c
Previous file: linux/fs/autofs4/init.c
Back to the patch index
Back to the overall index
- Lines: 248
- Date:
Mon Apr 24 18:56:32 2000
- Orig file:
v2.3.99-pre5/linux/fs/autofs4/inode.c
- Orig date:
Fri Mar 10 16:40:46 2000
diff -u --recursive --new-file v2.3.99-pre5/linux/fs/autofs4/inode.c linux/fs/autofs4/inode.c
@@ -1,4 +1,4 @@
-/* -*- linux-c -*- --------------------------------------------------------- *
+/* -*- c -*- --------------------------------------------------------------- *
*
* linux/fs/autofs/inode.c
*
@@ -41,7 +41,6 @@
return NULL;
ino->flags = 0;
- ino->ino = sbi->next_ino++;
ino->mode = mode;
ino->inode = NULL;
ino->dentry = NULL;
@@ -50,7 +49,6 @@
ino->last_used = jiffies;
ino->sbi = sbi;
- INIT_LIST_HEAD(&ino->ino_hash);
if (reinit && ino->free)
(ino->free)(ino);
@@ -67,7 +65,6 @@
void autofs4_free_ino(struct autofs_info *ino)
{
- autofs4_ihash_delete(ino);
if (ino->dentry) {
ino->dentry->d_fsdata = NULL;
if (ino->dentry->d_inode)
@@ -79,18 +76,6 @@
kfree(ino);
}
-/*
- * Dummy functions - do we ever actually want to do
- * something here?
- */
-static void autofs4_put_inode(struct inode *inode)
-{
-}
-
-static void autofs4_clear_inode(struct inode *inode)
-{
-}
-
static void autofs4_put_super(struct super_block *sb)
{
struct autofs_sb_info *sbi = autofs4_sbi(sb);
@@ -105,26 +90,11 @@
DPRINTK(("autofs: shutting down\n"));
}
-static void autofs4_umount_begin(struct super_block *sb)
-{
- struct autofs_sb_info *sbi = autofs4_sbi(sb);
-
- if (!sbi->catatonic)
- autofs4_catatonic_mode(sbi);
-}
-
static int autofs4_statfs(struct super_block *sb, struct statfs *buf);
-static void autofs4_read_inode(struct inode *inode);
-static void autofs4_write_inode(struct inode *inode);
static struct super_operations autofs4_sops = {
- read_inode: autofs4_read_inode,
- write_inode: autofs4_write_inode,
- put_inode: autofs4_put_inode,
- clear_inode: autofs4_clear_inode,
put_super: autofs4_put_super,
statfs: autofs4_statfs,
- umount_begin: autofs4_umount_begin,
};
static int parse_options(char *options, int *pipefd, uid_t *uid, gid_t *gid,
@@ -200,8 +170,6 @@
if (!ino)
return NULL;
- ino->ino = AUTOFS_ROOT_INO;
-
return ino;
}
@@ -215,10 +183,6 @@
struct autofs_sb_info *sbi;
int minproto, maxproto;
- /* Super block already completed? */
- if (s->s_root)
- goto out_unlock;
-
sbi = (struct autofs_sb_info *) kmalloc(sizeof(*sbi), GFP_KERNEL);
if ( !sbi )
goto fail_unlock;
@@ -233,30 +197,21 @@
sbi->oz_pgrp = current->pgrp;
sbi->sb = s;
sbi->version = 0;
- autofs4_init_ihash(&sbi->ihash);
sbi->queues = NULL;
- sbi->next_ino = AUTOFS_FIRST_INO;
s->s_blocksize = 1024;
s->s_blocksize_bits = 10;
s->s_magic = AUTOFS_SUPER_MAGIC;
s->s_op = &autofs4_sops;
- s->s_root = NULL;
/*
* Get the root inode and dentry, but defer checking for errors.
*/
- autofs4_ihash_insert(&sbi->ihash, autofs4_mkroot(sbi));
-
- root_inode = iget(s, AUTOFS_ROOT_INO);
+ root_inode = autofs4_get_inode(s, autofs4_mkroot(sbi));
+ root_inode->i_op = &autofs4_root_inode_operations;
+ root_inode->i_fop = &autofs4_root_operations;
root = d_alloc_root(root_inode);
pipe = NULL;
- /*
- * Check whether somebody else completed the super block.
- */
- if (s->s_root)
- goto out_dput;
-
if (!root)
goto fail_iput;
@@ -283,11 +238,6 @@
DPRINTK(("autofs: pipe fd = %d, pgrp = %u\n", pipefd, sbi->oz_pgrp));
pipe = fget(pipefd);
- /*
- * Check whether somebody else completed the super block.
- */
- if (s->s_root)
- goto out_fput;
if ( !pipe ) {
printk("autofs: could not open pipe file descriptor\n");
@@ -302,25 +252,9 @@
*/
s->s_root = root;
return s;
-
- /*
- * Success ... somebody else completed the super block for us.
- */
-out_unlock:
- goto out_dec;
-out_fput:
- if (pipe)
- fput(pipe);
-out_dput:
- if (root)
- dput(root);
- else
- iput(root_inode);
-out_dec:
- return s;
/*
- * Failure ... clear the s_dev slot and clean up.
+ * Failure ... clean up.
*/
fail_fput:
printk("autofs: pipe file descriptor does not contain proper ops\n");
@@ -351,55 +285,44 @@
{
buf->f_type = AUTOFS_SUPER_MAGIC;
buf->f_bsize = 1024;
- buf->f_bfree = 0;
- buf->f_bavail = 0;
- buf->f_ffree = 0;
buf->f_namelen = NAME_MAX;
return 0;
}
-static void autofs4_read_inode(struct inode *inode)
+struct inode *autofs4_get_inode(struct super_block *sb,
+ struct autofs_info *inf)
{
- struct autofs_sb_info *sbi = autofs4_sbi(inode->i_sb);
- struct autofs_info *inf;
+ struct inode *inode = get_empty_inode();
- inf = autofs4_ihash_find(&sbi->ihash, inode->i_ino);
-
- if (inf == NULL || inf->inode != NULL)
- return;
+ if (inode == NULL)
+ return NULL;
+ inf->inode = inode;
+ inode->i_sb = sb;
+ inode->i_dev = sb->s_dev;
inode->i_mode = inf->mode;
- inode->i_mtime = inode->i_ctime = inode->i_atime = CURRENT_TIME;
- inode->i_size = inf->size;
-
- inode->i_blocks = 0;
- inode->i_blksize = 0;
- inode->i_nlink = 1;
-
- if (inode->i_sb->s_root) {
- inode->i_uid = inode->i_sb->s_root->d_inode->i_uid;
- inode->i_gid = inode->i_sb->s_root->d_inode->i_gid;
+ if (sb->s_root) {
+ inode->i_uid = sb->s_root->d_inode->i_uid;
+ inode->i_gid = sb->s_root->d_inode->i_gid;
} else {
inode->i_uid = 0;
inode->i_gid = 0;
}
-
- inf->inode = inode;
+ inode->i_size = 0;
+ inode->i_blksize = PAGE_CACHE_SIZE;
+ inode->i_blocks = 0;
+ inode->i_rdev = 0;
+ inode->i_nlink = 1;
+ inode->i_op = NULL;
+ inode->i_fop = NULL;
+ inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
if (S_ISDIR(inf->mode)) {
inode->i_nlink = 2;
- if (inode->i_ino == AUTOFS_ROOT_INO) {
- inode->i_op = &autofs4_root_inode_operations;
- inode->i_fop = &autofs4_root_operations;
- } else {
- inode->i_op = &autofs4_dir_inode_operations;
- inode->i_fop = &autofs4_dir_operations;
- }
- } else if (S_ISLNK(inf->mode)) {
+ inode->i_op = &autofs4_dir_inode_operations;
+ inode->i_fop = &autofs4_dir_operations;
+ } else if (S_ISLNK(inf->mode))
inode->i_op = &autofs4_symlink_inode_operations;
- }
-}
-static void autofs4_write_inode(struct inode *inode)
-{
+ return inode;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)