cifs_sb->local_nls); 
cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); 
cifs_create(struct inode *inode, struct dentry *direntry, int mode,		struct nameidata *nd){	int rc = -ENOENT;	int xid;	int oplock = 0;	int desiredAccess = GENERIC_READ | GENERIC_WRITE;	__u16 fileHandle;	struct cifs_sb_info *cifs_sb;	struct cifsTconInfo *pTcon;	char *full_path = NULL;	FILE_ALL_INFO * buf = NULL;	struct inode *newinode = NULL;	struct cifsFileInfo * pCifsFile = NULL;	struct cifsInodeInfo * pCifsInode;	int disposition = FILE_OVERWRITE_IF;	int write_only = FALSE;	xid = GetXid();	cifs_sb = CIFS_SB(inode->i_sb);	pTcon = cifs_sb->tcon;	down(&direntry->d_sb->s_vfs_rename_sem);	full_path = build_path_from_dentry(direntry);	up(&direntry->d_sb->s_vfs_rename_sem);	if(full_path == NULL) {		FreeXid(xid);		return -ENOMEM;	}	if(nd) {		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;			write_only = TRUE;		} else if ((nd->intent.open.flags & O_ACCMODE) == O_RDWR) {			/* GENERIC_ALL is too much permission to request */			/* can cause unnecessary access denied on create */			/* desiredAccess = GENERIC_ALL; */			desiredAccess = GENERIC_READ | GENERIC_WRITE;		}		if((nd->intent.open.flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))			disposition = FILE_CREATE;		else if((nd->intent.open.flags & (O_CREAT | O_TRUNC)) == (O_CREAT | O_TRUNC))			disposition = FILE_OVERWRITE_IF;		else if((nd->intent.open.flags & O_CREAT) == O_CREAT)			disposition = FILE_OPEN_IF;		else {			cFYI(1,("Create flag not set in create function"));		}	}	/* BB add processing to set equivalent of mode - e.g. via CreateX with ACLs */	if (oplockEnabled)		oplock = REQ_OPLOCK;	buf = kmalloc(sizeof(FILE_ALL_INFO),GFP_KERNEL);	if(buf == NULL) {		kfree(full_path);		FreeXid(xid);		return -ENOMEM;	}	rc = CIFSSMBOpen(xid, pTcon, full_path, disposition,			 desiredAccess, CREATE_NOT_DIR,			 &fileHandle, &oplock, buf, cifs_sb->local_nls);	if (rc) {		cFYI(1, ("cifs_create returned 0x%x ", rc));	} else {		/* If Open reported that we actually created a file		then we now have to set the mode if possible */		if ((cifs_sb->tcon->ses->capabilities & CAP_UNIX) &&			(oplock & CIFS_CREATE_ACTION))			if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {				CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode,					(__u64)current->euid,					(__u64)current->egid,					0 /* dev */,					cifs_sb->local_nls);			} else {				CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode,					(__u64)-1,					(__u64)-1,					0 /* dev */,					cifs_sb->local_nls);			}		else {			/* BB implement via Windows security descriptors */			/* eg CIFSSMBWinSetPerms(xid,pTcon,full_path,mode,-1,-1,local_nls);*/			/* could set r/o dos attribute if mode & 0222 == 0 */		}	/* BB server might mask mode so we have to query for Unix case*/		if (pTcon->ses->capabilities & CAP_UNIX)			rc = cifs_get_inode_info_unix(&newinode, full_path,						 inode->i_sb,xid);		else {			rc = cifs_get_inode_info(&newinode, full_path,						 buf, inode->i_sb,xid);			if(newinode)				newinode->i_mode = mode;		}		if (rc != 0) {			cFYI(1,("Create worked but get_inode_info failed with rc = %d",			      rc));		} else {			direntry->d_op = &cifs_dentry_ops;			d_instantiate(direntry, newinode);		}		if((nd->flags & LOOKUP_OPEN) == FALSE) {			/* mknod case - do not leave file open */			CIFSSMBClose(xid, pTcon, fileHandle);		} else if(newinode) {			pCifsFile =			   kmalloc(sizeof (struct cifsFileInfo), GFP_KERNEL);						if(pCifsFile == NULL)				goto cifs_create_out;			memset((char *)pCifsFile, 0,			       sizeof (struct cifsFileInfo));			pCifsFile->netfid = fileHandle;			pCifsFile->pid = current->tgid;			pCifsFile->pInode = newinode;			pCifsFile->invalidHandle = FALSE;			pCifsFile->closePend     = FALSE;			init_MUTEX(&pCifsFile->fh_sem);			/* set the following in open now 				pCifsFile->pfile = file; */			write_lock(&GlobalSMBSeslock);			list_add(&pCifsFile->tlist,&pTcon->openFileList);			pCifsInode = CIFS_I(newinode);			if(pCifsInode) {				/* if readable file instance put first in list*/				if (write_only == TRUE) {                                       	list_add_tail(&pCifsFile->flist,						&pCifsInode->openFileList);				} else {					list_add(&pCifsFile->flist,						&pCifsInode->openFileList);				}				if((oplock & 0xF) == OPLOCK_EXCLUSIVE) {					pCifsInode->clientCanCacheAll = TRUE;					pCifsInode->clientCanCacheRead = TRUE;					cFYI(1,("Exclusive Oplock for inode %p",						newinode));				} else if((oplock & 0xF) == OPLOCK_READ)					pCifsInode->clientCanCacheRead = TRUE;			}			write_unlock(&GlobalSMBSeslock);		}	} cifs_create_out:	kfree(buf);	kfree(full_path);	FreeXid(xid);	return rc;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/737b758c965a9b223ac1243ab38d9e507ac86c64/dir.c/buggy/fs/cifs/dir.c