Commit 2d24104e authored by Steve French's avatar Steve French Committed by Steve French

Open / Create lookup intents part one

parent f19706b3
This module, cifs, is a filesystem that implements the SMB/CIFS This is the client VFS module for the Common Internet File System
protocol, which is the protocol used by Windows based operating systems (CIFS) protocol which is the successor to the Server Message Block
(including Windows 2000 and its successors) as well as Samba, OS/2 and (SMB) protocol, the native file sharing mechanism for most early
many others operating systems and network file server appliances. The PC operating systems. CIFS is fully supported by current network
Cifs VFS filesystem module is designed to work well with servers that file servers such as Windows 2000, Windows 2003 (including
implement the newer versions (dialects) of the SMB/CIFS protocol such as Windows XP) as well by Samba (which provides excellent CIFS
Samba, the program written by Andrew Tridgell that turns any Unix host server support for Linux and many other operating systems), so
into a file server for DOS or Windows clients, as well as Windows NT, this network filesystem client can mount to a wide variety of
Windows 2000 and its successors. It is not designed to handle older smb servers. The smbfs module should be used instead of this cifs module
servers well, those that implement older versions of the dialect (such for mounting to older SMB servers such as OS/2. The smbfs and cifs
as OS/2 or Windows 95), for this purpose use smbfs. modules can coexist and do not conflict. The CIFS VFS filesystem
module is designed to work well with servers that implement the
This module can support mounting without a mount helper program. The newer versions (dialects) of the SMB/CIFS protocol such as Samba,
mount syntax is: the program written by Andrew Tridgell that turns any Unix host
mount //server_ip/share_name /mnt -o user=username,password=your_password into a SMB/CIFS file server.
where "username", "your_password" and "server_ip" and "share_name" The intent of this module is to provide the most advanced network
should be replaced with specific values (supplied by the user) e.g. file system function for CIFS compliant servers, including better
mount //9.53.216.16/public /mnt -o user=jsmith,password=openup POSIX compliance, secure per-user session establishment, high
performance safe distributed caching (oplock), optional packet
This cifs implementation is designed to handle network caching (safely) signing, large files, Unicode support and other internationalization
as well as to implement locking, large file (64 bit access), distributed improvements. Since both Samba server and this filesystem client support
file system ("dfs") and other advanced protocol features. It also the CIFS Unix extensions, the combination can provide a reasonable
implements the SNIA standard for Unix extensions to CIFS (when alternative to NFSv4 for fileserving in some Linux to Linux environments,
communicating with servers such as Samba 2.2.3 or later which support it). not just in Linux to Windows environments.
For more information contact sfrench@us.ibm.com This filesystem has an optional mount utility (mount.cifs) that can
be obtained from the project page and installed in the path in the same
Cifs is an SMB client (or gateway). For more info on the SMB/CIFS directory with the other mount helpers (such as mount.smbfs).
protocol and Samba, including documentation, please go to Mounting using the cifs filesystem without installing the mount helper
http://www.samba.org/ and then on to your nearest mirror. For more requires specifying the server's ip address.
information about the cifs vfs, go to the project page at:
For Linux 2.4:
mount //anything/here /mnt_target -o
user=username,pass=password,unc=//ip_address_of_server/sharename
For Linux 2.5:
mount //ip_address_of_server/sharename /mnt_target -o user=username, pass=password
For more information on the module see the project page at
http://us1.samba.org/samba/Linux_CIFS_client.html http://us1.samba.org/samba/Linux_CIFS_client.html
For more information on CIFS see:
http://www.snia.org/tech_activities/CIFS
or the Samba site:
http://www.samba.org
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/stat.h> #include <linux/stat.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/namei.h>
#include "cifsfs.h" #include "cifsfs.h"
#include "cifspdu.h" #include "cifspdu.h"
#include "cifsglob.h" #include "cifsglob.h"
...@@ -125,6 +126,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, ...@@ -125,6 +126,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
int rc = -ENOENT; int rc = -ENOENT;
int xid; int xid;
int oplock = REQ_OPLOCK; int oplock = REQ_OPLOCK;
int desiredAccess = GENERIC_ALL;
__u16 fileHandle; __u16 fileHandle;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct cifsTconInfo *pTcon; struct cifsTconInfo *pTcon;
...@@ -138,10 +140,23 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, ...@@ -138,10 +140,23 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
full_path = build_path_from_dentry(direntry); full_path = build_path_from_dentry(direntry);
if(nd) {
cFYI(1,("In create nd flags = 0x%x for %s",nd->flags,full_path));
cFYI(1,("Intent flags: 0x%x", nd->intent.open.flags));
if ((nd->intent.open.flags & O_ACCMODE) == O_RDONLY)
desiredAccess = GENERIC_READ;
else if ((nd->intent.open.flags & O_ACCMODE) == O_WRONLY)
desiredAccess = GENERIC_WRITE;
else if ((nd->intent.open.flags & O_ACCMODE) == O_RDWR)
desiredAccess = GENERIC_ALL;
}
/* BB add processing for setting the equivalent of mode - e.g. via CreateX with ACLs */ /* BB add processing for setting the equivalent of mode - e.g. via CreateX with ACLs */
rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OVERWRITE_IF, GENERIC_ALL rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OVERWRITE_IF,
/* 0x20197 was used previously */ , CREATE_NOT_DIR, desiredAccess, CREATE_NOT_DIR,
&fileHandle, &oplock, cifs_sb->local_nls); &fileHandle, &oplock, cifs_sb->local_nls);
if (rc) { if (rc) {
cFYI(1, ("cifs_create returned 0x%x ", rc)); cFYI(1, ("cifs_create returned 0x%x ", rc));
...@@ -208,6 +223,13 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, struct name ...@@ -208,6 +223,13 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, struct name
} }
cFYI(1, cFYI(1,
(" Full path: %s inode = 0x%p", full_path, direntry->d_inode)); (" Full path: %s inode = 0x%p", full_path, direntry->d_inode));
if(nd) { /* BB remove begin */
cFYI(1,("In lookup nd flags = 0x%x",nd->flags));
cFYI(1,("Intent flags: 0x%x", nd->intent.open.flags));
}
/* BB remove end BB */
if (pTcon->ses->capabilities & CAP_UNIX) if (pTcon->ses->capabilities & CAP_UNIX)
rc = cifs_get_inode_info_unix(&newInode, full_path, rc = cifs_get_inode_info_unix(&newInode, full_path,
parent_dir_inode->i_sb); parent_dir_inode->i_sb);
...@@ -269,6 +291,12 @@ cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd) ...@@ -269,6 +291,12 @@ cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd)
/* lock_kernel(); *//* surely we do not want to lock the kernel for a whole network round trip which could take seconds */ /* lock_kernel(); *//* surely we do not want to lock the kernel for a whole network round trip which could take seconds */
if(nd) { /* BB remove begin */
cFYI(1,("In d_revalidate nd flags = 0x%x",nd->flags));
cFYI(1,("Intent flags: 0x%x", nd->intent.open.flags));
}
/* BB remove end BB */
if (direntry->d_inode) { if (direntry->d_inode) {
if (cifs_revalidate(direntry)) { if (cifs_revalidate(direntry)) {
/* unlock_kernel(); */ /* unlock_kernel(); */
......
...@@ -52,12 +52,12 @@ cifs_open(struct inode *inode, struct file *file) ...@@ -52,12 +52,12 @@ cifs_open(struct inode *inode, struct file *file)
xid = GetXid(); xid = GetXid();
cFYI(1, (" inode = 0x%p file flags are %x", inode, file->f_flags));
cifs_sb = CIFS_SB(inode->i_sb); cifs_sb = CIFS_SB(inode->i_sb);
pTcon = cifs_sb->tcon; pTcon = cifs_sb->tcon;
full_path = build_path_from_dentry(file->f_dentry); full_path = build_path_from_dentry(file->f_dentry);
cFYI(1, (" inode = 0x%p file flags are %x for %s", inode, file->f_flags,full_path));
if ((file->f_flags & O_ACCMODE) == O_RDONLY) if ((file->f_flags & O_ACCMODE) == O_RDONLY)
desiredAccess = GENERIC_READ; desiredAccess = GENERIC_READ;
else if ((file->f_flags & O_ACCMODE) == O_WRONLY) else if ((file->f_flags & O_ACCMODE) == O_WRONLY)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment