diff options
author | Jeff Layton | 2010-10-15 15:34:02 -0400 |
---|---|---|
committer | Steve French | 2010-10-18 01:07:31 +0000 |
commit | 15ecb436c00fcb13b6dc32bdcbb9f75fc9b7613e (patch) | |
tree | 983bd08a195f701b3bffdb495fcf4e6f0e3b42cc /fs/cifs | |
parent | 2e396b83f6087b78dac5a18d6d0cf9f8426a00b3 (diff) |
cifs: move cifs_new_fileinfo to file.c
It's currently in dir.c which makes little sense...
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Suresh Jayaraman <sjayaraman@suse.de>
Acked-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/dir.c | 48 | ||||
-rw-r--r-- | fs/cifs/file.c | 47 |
2 files changed, 47 insertions, 48 deletions
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 600eac18cb21..3840eddbfb7a 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c @@ -130,54 +130,6 @@ cifs_bp_rename_retry: return full_path; } -struct cifsFileInfo * -cifs_new_fileinfo(__u16 fileHandle, struct file *file, - struct tcon_link *tlink, __u32 oplock) -{ - struct dentry *dentry = file->f_path.dentry; - struct inode *inode = dentry->d_inode; - struct cifsInodeInfo *pCifsInode = CIFS_I(inode); - struct cifsFileInfo *pCifsFile; - - pCifsFile = kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); - if (pCifsFile == NULL) - return pCifsFile; - - pCifsFile->netfid = fileHandle; - pCifsFile->pid = current->tgid; - pCifsFile->uid = current_fsuid(); - pCifsFile->dentry = dget(dentry); - pCifsFile->f_flags = file->f_flags; - pCifsFile->invalidHandle = false; - pCifsFile->closePend = false; - pCifsFile->tlink = cifs_get_tlink(tlink); - mutex_init(&pCifsFile->fh_mutex); - mutex_init(&pCifsFile->lock_mutex); - INIT_LIST_HEAD(&pCifsFile->llist); - atomic_set(&pCifsFile->count, 1); - INIT_WORK(&pCifsFile->oplock_break, cifs_oplock_break); - - write_lock(&GlobalSMBSeslock); - list_add(&pCifsFile->tlist, &(tlink_tcon(tlink)->openFileList)); - /* if readable file instance put first in list*/ - if (file->f_mode & FMODE_READ) - list_add(&pCifsFile->flist, &pCifsInode->openFileList); - else - list_add_tail(&pCifsFile->flist, &pCifsInode->openFileList); - write_unlock(&GlobalSMBSeslock); - - if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { - pCifsInode->clientCanCacheAll = true; - pCifsInode->clientCanCacheRead = true; - cFYI(1, "Exclusive Oplock inode %p", inode); - } else if ((oplock & 0xF) == OPLOCK_READ) - pCifsInode->clientCanCacheRead = true; - - file->private_data = pCifsFile; - - return pCifsFile; -} - static void setup_cifs_dentry(struct cifsTconInfo *tcon, struct dentry *direntry, struct inode *newinode) diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 7935816fa111..293e9b767621 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -219,6 +219,53 @@ posix_open_ret: return rc; } +struct cifsFileInfo * +cifs_new_fileinfo(__u16 fileHandle, struct file *file, + struct tcon_link *tlink, __u32 oplock) +{ + struct dentry *dentry = file->f_path.dentry; + struct inode *inode = dentry->d_inode; + struct cifsInodeInfo *pCifsInode = CIFS_I(inode); + struct cifsFileInfo *pCifsFile; + + pCifsFile = kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); + if (pCifsFile == NULL) + return pCifsFile; + + pCifsFile->netfid = fileHandle; + pCifsFile->pid = current->tgid; + pCifsFile->uid = current_fsuid(); + pCifsFile->dentry = dget(dentry); + pCifsFile->f_flags = file->f_flags; + pCifsFile->invalidHandle = false; + pCifsFile->closePend = false; + pCifsFile->tlink = cifs_get_tlink(tlink); + mutex_init(&pCifsFile->fh_mutex); + mutex_init(&pCifsFile->lock_mutex); + INIT_LIST_HEAD(&pCifsFile->llist); + atomic_set(&pCifsFile->count, 1); + INIT_WORK(&pCifsFile->oplock_break, cifs_oplock_break); + + write_lock(&GlobalSMBSeslock); + list_add(&pCifsFile->tlist, &(tlink_tcon(tlink)->openFileList)); + /* if readable file instance put first in list*/ + if (file->f_mode & FMODE_READ) + list_add(&pCifsFile->flist, &pCifsInode->openFileList); + else + list_add_tail(&pCifsFile->flist, &pCifsInode->openFileList); + write_unlock(&GlobalSMBSeslock); + + if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { + pCifsInode->clientCanCacheAll = true; + pCifsInode->clientCanCacheRead = true; + cFYI(1, "Exclusive Oplock inode %p", inode); + } else if ((oplock & 0xF) == OPLOCK_READ) + pCifsInode->clientCanCacheRead = true; + + file->private_data = pCifsFile; + return pCifsFile; +} + int cifs_open(struct inode *inode, struct file *file) { int rc = -EACCES; |