]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/cifs/cifs_dfs_ref.c
convert remaining ->clear_inode() to ->evict_inode()
[karo-tx-linux.git] / fs / cifs / cifs_dfs_ref.c
index 78e4d2a3a68b7b3ef49921fba13d1475f4e9b5b3..dc1ed50ea06e2ad7b23e7a547e793b1f48718b21 100644 (file)
@@ -85,8 +85,8 @@ static char *cifs_get_share_name(const char *node_name)
        /* find server name end */
        pSep = memchr(UNC+2, '\\', len-2);
        if (!pSep) {
-               cERROR(1, ("%s: no server name end in node name: %s",
-                       __func__, node_name));
+               cERROR(1, "%s: no server name end in node name: %s",
+                       __func__, node_name);
                kfree(UNC);
                return ERR_PTR(-EINVAL);
        }
@@ -142,8 +142,8 @@ char *cifs_compose_mount_options(const char *sb_mountdata,
 
        rc = dns_resolve_server_name_to_ip(*devname, &srvIP);
        if (rc != 0) {
-               cERROR(1, ("%s: Failed to resolve server part of %s to IP: %d",
-                         __func__, *devname, rc));
+               cERROR(1, "%s: Failed to resolve server part of %s to IP: %d",
+                         __func__, *devname, rc);
                goto compose_mount_options_err;
        }
        /* md_len = strlen(...) + 12 for 'sep+prefixpath='
@@ -217,8 +217,8 @@ char *cifs_compose_mount_options(const char *sb_mountdata,
                strcat(mountdata, fullpath + ref->path_consumed);
        }
 
-       /*cFYI(1,("%s: parent mountdata: %s", __func__,sb_mountdata));*/
-       /*cFYI(1, ("%s: submount mountdata: %s", __func__, mountdata ));*/
+       /*cFYI(1, "%s: parent mountdata: %s", __func__,sb_mountdata);*/
+       /*cFYI(1, "%s: submount mountdata: %s", __func__, mountdata );*/
 
 compose_mount_options_out:
        kfree(srvIP);
@@ -230,28 +230,22 @@ compose_mount_options_err:
        goto compose_mount_options_out;
 }
 
-
-static struct vfsmount *cifs_dfs_do_refmount(const struct vfsmount *mnt_parent,
-               struct dentry *dentry, const struct dfs_info3_param *ref)
+/**
+ * cifs_dfs_do_refmount - mounts specified path using provided refferal
+ * @cifs_sb:           parent/root superblock
+ * @fullpath:          full path in UNC format
+ * @ref:               server's referral
+ */
+static struct vfsmount *cifs_dfs_do_refmount(struct cifs_sb_info *cifs_sb,
+               const char *fullpath, const struct dfs_info3_param *ref)
 {
-       struct cifs_sb_info *cifs_sb;
        struct vfsmount *mnt;
        char *mountdata;
        char *devname = NULL;
-       char *fullpath;
-
-       cifs_sb = CIFS_SB(dentry->d_inode->i_sb);
-       /*
-        * this function gives us a path with a double backslash prefix. We
-        * require a single backslash for DFS.
-        */
-       fullpath = build_path_from_dentry(dentry);
-       if (!fullpath)
-               return ERR_PTR(-ENOMEM);
 
+       /* strip first '\' from fullpath */
        mountdata = cifs_compose_mount_options(cifs_sb->mountdata,
                        fullpath + 1, ref, &devname);
-       kfree(fullpath);
 
        if (IS_ERR(mountdata))
                return (struct vfsmount *)mountdata;
@@ -294,11 +288,11 @@ static int add_mount_helper(struct vfsmount *newmnt, struct nameidata *nd,
 
 static void dump_referral(const struct dfs_info3_param *ref)
 {
-       cFYI(1, ("DFS: ref path: %s", ref->path_name));
-       cFYI(1, ("DFS: node path: %s", ref->node_name));
-       cFYI(1, ("DFS: fl: %hd, srv_type: %hd", ref->flags, ref->server_type));
-       cFYI(1, ("DFS: ref_flags: %hd, path_consumed: %hd", ref->ref_flag,
-                               ref->path_consumed));
+       cFYI(1, "DFS: ref path: %s", ref->path_name);
+       cFYI(1, "DFS: node path: %s", ref->node_name);
+       cFYI(1, "DFS: fl: %hd, srv_type: %hd", ref->flags, ref->server_type);
+       cFYI(1, "DFS: ref_flags: %hd, path_consumed: %hd", ref->ref_flag,
+                               ref->path_consumed);
 }
 
 
@@ -314,7 +308,7 @@ cifs_dfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
        int rc = 0;
        struct vfsmount *mnt = ERR_PTR(-ENOENT);
 
-       cFYI(1, ("in %s", __func__));
+       cFYI(1, "in %s", __func__);
        BUG_ON(IS_ROOT(dentry));
 
        xid = GetXid();
@@ -352,15 +346,15 @@ cifs_dfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
                /* connect to a node */
                len = strlen(referrals[i].node_name);
                if (len < 2) {
-                       cERROR(1, ("%s: Net Address path too short: %s",
-                                       __func__, referrals[i].node_name));
+                       cERROR(1, "%s: Net Address path too short: %s",
+                                       __func__, referrals[i].node_name);
                        rc = -EINVAL;
                        goto out_err;
                }
-               mnt = cifs_dfs_do_refmount(nd->path.mnt,
-                               nd->path.dentry, referrals + i);
-               cFYI(1, ("%s: cifs_dfs_do_refmount:%s , mnt:%p", __func__,
-                                       referrals[i].node_name, mnt));
+               mnt = cifs_dfs_do_refmount(cifs_sb,
+                               full_path, referrals + i);
+               cFYI(1, "%s: cifs_dfs_do_refmount:%s , mnt:%p", __func__,
+                                       referrals[i].node_name, mnt);
 
                /* complete mount procedure if we accured submount */
                if (!IS_ERR(mnt))
@@ -378,7 +372,7 @@ out:
        FreeXid(xid);
        free_dfs_info_array(referrals, num_referrals);
        kfree(full_path);
-       cFYI(1, ("leaving %s" , __func__));
+       cFYI(1, "leaving %s" , __func__);
        return ERR_PTR(rc);
 out_err:
        path_put(&nd->path);