Merge branch 'for-linus-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/mason...
[firefly-linux-kernel-4.4.55.git] / fs / cifs / dir.c
index 6cbd9c688cfe818a773a2a7f42c64ce59d693de1..338d56936f6af694b7085284a38e7b751ba7eb66 100644 (file)
@@ -461,8 +461,8 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry,
 
        xid = get_xid();
 
-       cifs_dbg(FYI, "parent inode = 0x%p name is: %s and dentry = 0x%p\n",
-                inode, direntry->d_name.name, direntry);
+       cifs_dbg(FYI, "parent inode = 0x%p name is: %pd and dentry = 0x%p\n",
+                inode, direntry, direntry);
 
        tlink = cifs_sb_tlink(CIFS_SB(inode->i_sb));
        if (IS_ERR(tlink)) {
@@ -540,8 +540,8 @@ int cifs_create(struct inode *inode, struct dentry *direntry, umode_t mode,
        struct cifs_fid fid;
        __u32 oplock;
 
-       cifs_dbg(FYI, "cifs_create parent inode = 0x%p name is: %s and dentry = 0x%p\n",
-                inode, direntry->d_name.name, direntry);
+       cifs_dbg(FYI, "cifs_create parent inode = 0x%p name is: %pd and dentry = 0x%p\n",
+                inode, direntry, direntry);
 
        tlink = cifs_sb_tlink(CIFS_SB(inode->i_sb));
        rc = PTR_ERR(tlink);
@@ -577,12 +577,13 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, umode_t mode,
        struct cifs_io_parms io_parms;
        char *full_path = NULL;
        struct inode *newinode = NULL;
-       int oplock = 0;
+       __u32 oplock = 0;
        struct cifs_fid fid;
        struct cifs_open_parms oparms;
        FILE_ALL_INFO *buf = NULL;
        unsigned int bytes_written;
        struct win_dev *pdev;
+       struct kvec iov[2];
 
        if (!old_valid_dev(device_number))
                return -EINVAL;
@@ -658,7 +659,11 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, umode_t mode,
        oparms.fid = &fid;
        oparms.reconnect = false;
 
-       rc = CIFS_open(xid, &oparms, &oplock, buf);
+       if (tcon->ses->server->oplocks)
+               oplock = REQ_OPLOCK;
+       else
+               oplock = 0;
+       rc = tcon->ses->server->ops->open(xid, &oparms, &oplock, buf);
        if (rc)
                goto mknod_out;
 
@@ -668,25 +673,26 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, umode_t mode,
         */
 
        pdev = (struct win_dev *)buf;
-       io_parms.netfid = fid.netfid;
        io_parms.pid = current->tgid;
        io_parms.tcon = tcon;
        io_parms.offset = 0;
        io_parms.length = sizeof(struct win_dev);
+       iov[1].iov_base = buf;
+       iov[1].iov_len = sizeof(struct win_dev);
        if (S_ISCHR(mode)) {
                memcpy(pdev->type, "IntxCHR", 8);
                pdev->major = cpu_to_le64(MAJOR(device_number));
                pdev->minor = cpu_to_le64(MINOR(device_number));
-               rc = CIFSSMBWrite(xid, &io_parms, &bytes_written, (char *)pdev,
-                                 NULL, 0);
+               rc = tcon->ses->server->ops->sync_write(xid, &fid, &io_parms,
+                                                       &bytes_written, iov, 1);
        } else if (S_ISBLK(mode)) {
                memcpy(pdev->type, "IntxBLK", 8);
                pdev->major = cpu_to_le64(MAJOR(device_number));
                pdev->minor = cpu_to_le64(MINOR(device_number));
-               rc = CIFSSMBWrite(xid, &io_parms, &bytes_written, (char *)pdev,
-                                 NULL, 0);
+               rc = tcon->ses->server->ops->sync_write(xid, &fid, &io_parms,
+                                                       &bytes_written, iov, 1);
        } /* else if (S_ISFIFO) */
-       CIFSSMBClose(xid, tcon, fid.netfid);
+       tcon->ses->server->ops->close(xid, tcon, &fid);
        d_drop(direntry);
 
        /* FIXME: add code here to set EAs */
@@ -713,8 +719,8 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
 
        xid = get_xid();
 
-       cifs_dbg(FYI, "parent inode = 0x%p name is: %s and dentry = 0x%p\n",
-                parent_dir_inode, direntry->d_name.name, direntry);
+       cifs_dbg(FYI, "parent inode = 0x%p name is: %pd and dentry = 0x%p\n",
+                parent_dir_inode, direntry, direntry);
 
        /* check whether path exists */
 
@@ -739,13 +745,13 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
                goto lookup_out;
        }
 
-       if (direntry->d_inode != NULL) {
+       if (d_really_is_positive(direntry)) {
                cifs_dbg(FYI, "non-NULL inode in lookup\n");
        } else {
                cifs_dbg(FYI, "NULL inode in lookup\n");
        }
        cifs_dbg(FYI, "Full path: %s inode = 0x%p\n",
-                full_path, direntry->d_inode);
+                full_path, d_inode(direntry));
 
        if (pTcon->unix_ext) {
                rc = cifs_get_inode_info_unix(&newInode, full_path,
@@ -786,7 +792,7 @@ cifs_d_revalidate(struct dentry *direntry, unsigned int flags)
        if (flags & LOOKUP_RCU)
                return -ECHILD;
 
-       if (direntry->d_inode) {
+       if (d_really_is_positive(direntry)) {
                if (cifs_revalidate_dentry(direntry))
                        return 0;
                else {
@@ -797,7 +803,7 @@ cifs_d_revalidate(struct dentry *direntry, unsigned int flags)
                         * attributes will have been updated by
                         * cifs_revalidate_dentry().
                         */
-                       if (IS_AUTOMOUNT(direntry->d_inode) &&
+                       if (IS_AUTOMOUNT(d_inode(direntry)) &&
                           !(direntry->d_flags & DCACHE_NEED_AUTOMOUNT)) {
                                spin_lock(&direntry->d_lock);
                                direntry->d_flags |= DCACHE_NEED_AUTOMOUNT;
@@ -833,7 +839,7 @@ cifs_d_revalidate(struct dentry *direntry, unsigned int flags)
 {
        int rc = 0;
 
-       cifs_dbg(FYI, "In cifs d_delete, name = %s\n", direntry->d_name.name);
+       cifs_dbg(FYI, "In cifs d_delete, name = %pd\n", direntry);
 
        return rc;
 }     */