]> Pileus Git - ~andy/linux/blobdiff - fs/cifs/dir.c
cifs: Modify struct cifs_unix_set_info_args to hold a kuid_t and a kgid_t
[~andy/linux] / fs / cifs / dir.c
index d3671f2acb29bd313779cf8022efe4c41e9987ef..1cd0162174486dcce77a56e9970d7b1f1154eda4 100644 (file)
@@ -44,6 +44,38 @@ renew_parental_timestamps(struct dentry *direntry)
        } while (!IS_ROOT(direntry));
 }
 
+char *
+cifs_build_path_to_root(struct smb_vol *vol, struct cifs_sb_info *cifs_sb,
+                       struct cifs_tcon *tcon)
+{
+       int pplen = vol->prepath ? strlen(vol->prepath) + 1 : 0;
+       int dfsplen;
+       char *full_path = NULL;
+
+       /* if no prefix path, simply set path to the root of share to "" */
+       if (pplen == 0) {
+               full_path = kzalloc(1, GFP_KERNEL);
+               return full_path;
+       }
+
+       if (tcon->Flags & SMB_SHARE_IS_IN_DFS)
+               dfsplen = strnlen(tcon->treeName, MAX_TREE_SIZE + 1);
+       else
+               dfsplen = 0;
+
+       full_path = kmalloc(dfsplen + pplen + 1, GFP_KERNEL);
+       if (full_path == NULL)
+               return full_path;
+
+       if (dfsplen)
+               strncpy(full_path, tcon->treeName, dfsplen);
+       full_path[dfsplen] = CIFS_DIR_SEP(cifs_sb);
+       strncpy(full_path + dfsplen + 1, vol->prepath, pplen);
+       convert_delimiter(full_path, CIFS_DIR_SEP(cifs_sb));
+       full_path[dfsplen + pplen] = 0; /* add trailing null */
+       return full_path;
+}
+
 /* Note: caller must free return buffer */
 char *
 build_path_from_dentry(struct dentry *direntry)
@@ -310,14 +342,14 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid,
 
                *created |= FILE_CREATED;
                if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
-                       args.uid = (__u64) current_fsuid();
+                       args.uid = current_fsuid();
                        if (inode->i_mode & S_ISGID)
-                               args.gid = (__u64) inode->i_gid;
+                               args.gid = inode->i_gid;
                        else
-                               args.gid = (__u64) current_fsgid();
+                               args.gid = current_fsgid();
                } else {
-                       args.uid = NO_CHANGE_64;
-                       args.gid = NO_CHANGE_64;
+                       args.uid = INVALID_UID; /* no change */
+                       args.gid = INVALID_GID; /* no change */
                }
                CIFSSMBUnixSetFileInfo(xid, tcon, &args, fid->netfid,
                                       current->tgid);
@@ -556,11 +588,11 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, umode_t mode,
                        .device = device_number,
                };
                if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
-                       args.uid = (__u64) current_fsuid();
-                       args.gid = (__u64) current_fsgid();
+                       args.uid = current_fsuid();
+                       args.gid = current_fsgid();
                } else {
-                       args.uid = NO_CHANGE_64;
-                       args.gid = NO_CHANGE_64;
+                       args.uid = INVALID_UID; /* no change */
+                       args.gid = INVALID_GID; /* no change */
                }
                rc = CIFSSMBUnixSetPathInfo(xid, pTcon, full_path, &args,
                                            cifs_sb->local_nls,