]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - fs/9p/vfs_super.c
Pull platform-drivers into test branch
[mv-sheeva.git] / fs / 9p / vfs_super.c
index 82c5b00840796d5f82bd6810a92f783b11e953d1..63320d4e15d260fc0e7800d2bc0d2a54141666ff 100644 (file)
@@ -8,9 +8,8 @@
  *  Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,7 +25,6 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/fs.h>
@@ -44,7 +42,6 @@
 #include "v9fs.h"
 #include "9p.h"
 #include "v9fs_vfs.h"
-#include "conv.h"
 #include "fid.h"
 
 static void v9fs_clear_inode(struct inode *);
@@ -92,7 +89,7 @@ v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses,
        sb->s_op = &v9fs_super_ops;
 
        sb->s_flags = flags | MS_ACTIVE | MS_SYNCHRONOUS | MS_DIRSYNC |
-           MS_NODIRATIME | MS_NOATIME;
+           MS_NOATIME;
 }
 
 /**
@@ -101,12 +98,13 @@ v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses,
  * @flags: mount flags
  * @dev_name: device name that was mounted
  * @data: mount options
+ * @mnt: mountpoint record to be instantiated
  *
  */
 
-static struct super_block *v9fs_get_sb(struct file_system_type
-                                      *fs_type, int flags,
-                                      const char *dev_name, void *data)
+static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
+                      const char *dev_name, void *data,
+                      struct vfsmount *mnt)
 {
        struct super_block *sb = NULL;
        struct v9fs_fcall *fcall = NULL;
@@ -123,17 +121,21 @@ static struct super_block *v9fs_get_sb(struct file_system_type
 
        dprintk(DEBUG_VFS, " \n");
 
-       v9ses = kcalloc(1, sizeof(struct v9fs_session_info), GFP_KERNEL);
+       v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL);
        if (!v9ses)
-               return ERR_PTR(-ENOMEM);
+               return -ENOMEM;
 
        if ((newfid = v9fs_session_init(v9ses, dev_name, data)) < 0) {
                dprintk(DEBUG_ERROR, "problem initiating session\n");
-               return ERR_PTR(newfid);
+               retval = newfid;
+               goto out_free_session;
        }
 
        sb = sget(fs_type, NULL, v9fs_set_super, v9ses);
-
+       if (IS_ERR(sb)) {
+               retval = PTR_ERR(sb);
+               goto out_close_session;
+       }
        v9fs_fill_super(sb, v9ses, flags);
 
        inode = v9fs_get_inode(sb, S_IFDIR | mode);
@@ -146,7 +148,6 @@ static struct super_block *v9fs_get_sb(struct file_system_type
        inode->i_gid = gid;
 
        root = d_alloc_root(inode);
-
        if (!root) {
                retval = -ENOMEM;
                goto put_back_sb;
@@ -157,20 +158,25 @@ static struct super_block *v9fs_get_sb(struct file_system_type
        stat_result = v9fs_t_stat(v9ses, newfid, &fcall);
        if (stat_result < 0) {
                dprintk(DEBUG_ERROR, "stat error\n");
-               v9fs_t_clunk(v9ses, newfid, NULL);
-               v9fs_put_idpool(newfid, &v9ses->fidpool);
+               v9fs_t_clunk(v9ses, newfid);
        } else {
                /* Setup the Root Inode */
-               root_fid = v9fs_fid_create(root, v9ses, newfid, 0);
+               root_fid = v9fs_fid_create(v9ses, newfid);
                if (root_fid == NULL) {
                        retval = -ENOMEM;
                        goto put_back_sb;
                }
 
-               root_fid->qid = fcall->params.rstat.stat->qid;
+               retval = v9fs_fid_insert(root_fid, root);
+               if (retval < 0) {
+                       kfree(fcall);
+                       goto put_back_sb;
+               }
+
+               root_fid->qid = fcall->params.rstat.stat.qid;
                root->d_inode->i_ino =
-                   v9fs_qid2ino(&fcall->params.rstat.stat->qid);
-               v9fs_mistat2inode(fcall->params.rstat.stat, root->d_inode, sb);
+                   v9fs_qid2ino(&fcall->params.rstat.stat.qid);
+               v9fs_stat2inode(&fcall->params.rstat.stat, root->d_inode, sb);
        }
 
        kfree(fcall);
@@ -180,13 +186,19 @@ static struct super_block *v9fs_get_sb(struct file_system_type
                goto put_back_sb;
        }
 
-       return sb;
+       return simple_set_mnt(mnt, sb);
+
+out_close_session:
+       v9fs_session_close(v9ses);
+out_free_session:
+       kfree(v9ses);
+       return retval;
 
 put_back_sb:
        /* deactivate_super calls v9fs_kill_super which will frees the rest */
        up_write(&sb->s_umount);
        deactivate_super(sb);
-       return ERR_PTR(retval);
+       return retval;
 }
 
 /**
@@ -243,11 +255,12 @@ static int v9fs_show_options(struct seq_file *m, struct vfsmount *mnt)
 }
 
 static void
-v9fs_umount_begin(struct super_block *sb)
+v9fs_umount_begin(struct vfsmount *vfsmnt, int flags)
 {
-       struct v9fs_session_info *v9ses = sb->s_fs_info;
+       struct v9fs_session_info *v9ses = vfsmnt->mnt_sb->s_fs_info;
 
-       v9fs_session_cancel(v9ses);
+       if (flags & MNT_FORCE)
+               v9fs_session_cancel(v9ses);
 }
 
 static struct super_operations v9fs_super_ops = {
@@ -258,7 +271,7 @@ static struct super_operations v9fs_super_ops = {
 };
 
 struct file_system_type v9fs_fs_type = {
-       .name = "9P",
+       .name = "9p",
        .get_sb = v9fs_get_sb,
        .kill_sb = v9fs_kill_super,
        .owner = THIS_MODULE,