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
protocol, which is the protocol used by Windows based operating systems
(including Windows 2000 and its successors) as well as Samba, OS/2 and
many others operating systems and network file server appliances. The
Cifs VFS filesystem module is designed to work well with servers that
implement the newer versions (dialects) of the SMB/CIFS protocol such as
Samba, the program written by Andrew Tridgell that turns any Unix host
into a file server for DOS or Windows clients, as well as Windows NT,
Windows 2000 and its successors. It is not designed to handle older smb
servers well, those that implement older versions of the dialect (such
as OS/2 or Windows 95), for this purpose use smbfs.
This module can support mounting without a mount helper program. The
mount syntax is:
mount //server_ip/share_name /mnt -o user=username,password=your_password
where "username", "your_password" and "server_ip" and "share_name"
should be replaced with specific values (supplied by the user) e.g.
mount //9.53.216.16/public /mnt -o user=jsmith,password=openup
This cifs implementation is designed to handle network caching (safely)
as well as to implement locking, large file (64 bit access), distributed
file system ("dfs") and other advanced protocol features. It also
implements the SNIA standard for Unix extensions to CIFS (when
communicating with servers such as Samba 2.2.3 or later which support it).
For more information contact sfrench@us.ibm.com
Cifs is an SMB client (or gateway). For more info on the SMB/CIFS
protocol and Samba, including documentation, please go to
http://www.samba.org/ and then on to your nearest mirror. For more
information about the cifs vfs, go to the project page at:
This is the client VFS module for the Common Internet File System
(CIFS) protocol which is the successor to the Server Message Block
(SMB) protocol, the native file sharing mechanism for most early
PC operating systems. CIFS is fully supported by current network
file servers such as Windows 2000, Windows 2003 (including
Windows XP) as well by Samba (which provides excellent CIFS
server support for Linux and many other operating systems), so
this network filesystem client can mount to a wide variety of
servers. The smbfs module should be used instead of this cifs module
for mounting to older SMB servers such as OS/2. The smbfs and cifs
modules can coexist and do not conflict. The CIFS VFS filesystem
module is designed to work well with servers that implement the
newer versions (dialects) of the SMB/CIFS protocol such as Samba,
the program written by Andrew Tridgell that turns any Unix host
into a SMB/CIFS file server.
The intent of this module is to provide the most advanced network
file system function for CIFS compliant servers, including better
POSIX compliance, secure per-user session establishment, high
performance safe distributed caching (oplock), optional packet
signing, large files, Unicode support and other internationalization
improvements. Since both Samba server and this filesystem client support
the CIFS Unix extensions, the combination can provide a reasonable
alternative to NFSv4 for fileserving in some Linux to Linux environments,
not just in Linux to Windows environments.
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
directory with the other mount helpers (such as mount.smbfs).
Mounting using the cifs filesystem without installing the mount helper
requires specifying the server's ip address.
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
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 @@
#include <linux/fs.h>
#include <linux/stat.h>
#include <linux/slab.h>
#include <linux/namei.h>
#include "cifsfs.h"
#include "cifspdu.h"
#include "cifsglob.h"
......@@ -125,6 +126,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
int rc = -ENOENT;
int xid;
int oplock = REQ_OPLOCK;
int desiredAccess = GENERIC_ALL;
__u16 fileHandle;
struct cifs_sb_info *cifs_sb;
struct cifsTconInfo *pTcon;
......@@ -138,10 +140,23 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
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 */
rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OVERWRITE_IF, GENERIC_ALL
/* 0x20197 was used previously */ , CREATE_NOT_DIR,
rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OVERWRITE_IF,
desiredAccess, CREATE_NOT_DIR,
&fileHandle, &oplock, cifs_sb->local_nls);
if (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
}
cFYI(1,
(" 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)
rc = cifs_get_inode_info_unix(&newInode, full_path,
parent_dir_inode->i_sb);
......@@ -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 */
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 (cifs_revalidate(direntry)) {
/* unlock_kernel(); */
......
......@@ -52,12 +52,12 @@ cifs_open(struct inode *inode, struct file *file)
xid = GetXid();
cFYI(1, (" inode = 0x%p file flags are %x", inode, file->f_flags));
cifs_sb = CIFS_SB(inode->i_sb);
pTcon = cifs_sb->tcon;
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)
desiredAccess = GENERIC_READ;
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