亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? file.c

?? Linux內(nèi)核自帶的cifs模塊
?? C
?? 第 1 頁(yè) / 共 5 頁(yè)
字號(hào):
/* *   fs/cifs/file.c * *   vfs operations that deal with files * *   Copyright (C) International Business Machines  Corp., 2002,2007 *   Author(s): Steve French (sfrench@us.ibm.com) *              Jeremy Allison (jra@samba.org) * *   This library is free software; you can redistribute it and/or modify *   it under the terms of the GNU Lesser General Public License as published *   by the Free Software Foundation; either version 2.1 of the License, or *   (at your option) any later version. * *   This library is distributed in the hope that it will be useful, *   but WITHOUT ANY WARRANTY; without even the implied warranty of *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See *   the GNU Lesser General Public License for more details. * *   You should have received a copy of the GNU Lesser General Public License *   along with this library; if not, write to the Free Software *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */#include <linux/fs.h>#include <linux/stat.h>#include <linux/fcntl.h>#include <linux/pagemap.h>#include <linux/delay.h>#include <asm/div64.h>#include "cifsfs.h"#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)#include <linux/backing-dev.h>#include <linux/mpage.h>#include <linux/pagevec.h>#include <linux/writeback.h>#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 19)#include <linux/task_io_accounting_ops.h>#endif /* 2.6.19 */#endif#include <asm/uaccess.h>#ifndef FL_SLEEP#define FL_SLEEP 0#endif#include "cifspdu.h"#include "cifsglob.h"#include "cifsproto.h"#include "cifs_unicode.h"#include "cifs_debug.h"#include "cifs_fs_sb.h"static inline struct cifsFileInfo *cifs_init_private(	struct cifsFileInfo *private_data, struct inode *inode,	struct file *file, __u16 netfid){	memset(private_data, 0, sizeof(struct cifsFileInfo));	private_data->netfid = netfid;	private_data->pid = current->tgid;	init_MUTEX(&private_data->fh_sem);#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)	mutex_init(&private_data->lock_mutex);#else	init_MUTEX(&private_data->lock_mutex);#endif	INIT_LIST_HEAD(&private_data->llist);	private_data->pfile = file; /* needed for writepage */	private_data->pInode = inode;	private_data->invalidHandle = FALSE;	private_data->closePend = FALSE;	/* we have to track num writers to the inode, since writepages	does not tell us which handle the write is for so there can	be a close (overlapping with write) of the filehandle that	cifs_writepages chose to use */	atomic_set(&private_data->wrtPending, 0);	return private_data;}static inline int cifs_convert_flags(unsigned int flags){	if ((flags & O_ACCMODE) == O_RDONLY)		return GENERIC_READ;	else if ((flags & O_ACCMODE) == O_WRONLY)		return GENERIC_WRITE;	else if ((flags & O_ACCMODE) == O_RDWR) {		/* GENERIC_ALL is too much permission to request		   can cause unnecessary access denied on create */		/* return GENERIC_ALL; */		return (GENERIC_READ | GENERIC_WRITE);	}	return 0x20197;}static inline int cifs_get_disposition(unsigned int flags){	if ((flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)		return FILE_CREATE;#else		return FILE_OPEN_IF;#endif	else if ((flags & (O_CREAT | O_TRUNC)) == (O_CREAT | O_TRUNC))		return FILE_OVERWRITE_IF;	else if ((flags & O_CREAT) == O_CREAT)		return FILE_OPEN_IF;	else if ((flags & O_TRUNC) == O_TRUNC)		return FILE_OVERWRITE;	else		return FILE_OPEN;}/* all arguments to this function must be checked for validity in caller */static inline int cifs_open_inode_helper(struct inode *inode, struct file *file,	struct cifsInodeInfo *pCifsInode, struct cifsFileInfo *pCifsFile,	struct cifsTconInfo *pTcon, int *oplock, FILE_ALL_INFO *buf,	char *full_path, int xid){#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)	struct timespec temp;#else	time_t temp;#endif	int rc;	/* want handles we can use to read with first	   in the list so we do not have to walk the	   list to search for one in prepare_write */	if ((file->f_flags & O_ACCMODE) == O_WRONLY) {		list_add_tail(&pCifsFile->flist,			      &pCifsInode->openFileList);	} else {		list_add(&pCifsFile->flist,			 &pCifsInode->openFileList);	}	write_unlock(&GlobalSMBSeslock);	if (pCifsInode->clientCanCacheRead) {		/* we have the inode open somewhere else		   no need to discard cache data */		goto client_can_cache;	}	/* BB need same check in cifs_create too? */	/* if not oplocked, invalidate inode pages if mtime or file	   size changed */	temp = cifs_NTtimeToUnix(le64_to_cpu(buf->LastWriteTime));#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)	if (timespec_equal(&file->f_dentry->d_inode->i_mtime, &temp) &&			   (file->f_dentry->d_inode->i_size ==			    (loff_t)le64_to_cpu(buf->EndOfFile))) {		cFYI(1, ("inode unchanged on server"));	} else {		if (file->f_dentry->d_inode->i_mapping) {#else	if (timespec_equal(&file->f_path.dentry->d_inode->i_mtime, &temp) &&			   (file->f_path.dentry->d_inode->i_size ==			    (loff_t)le64_to_cpu(buf->EndOfFile))) {		cFYI(1, ("inode unchanged on server"));	} else {		if (file->f_path.dentry->d_inode->i_mapping) {#endif		/* BB no need to lock inode until after invalidate		   since namei code should already have it locked? */#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 19)			filemap_write_and_wait(file->f_path.dentry->d_inode->i_mapping);		   #elif LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 15)			filemap_write_and_wait(file->f_dentry->d_inode->i_mapping);#else			filemap_fdatawrite(file->f_dentry->d_inode->i_mapping);			filemap_fdatawait(file->f_dentry->d_inode->i_mapping);#endif		}		cFYI(1, ("invalidating remote inode since open detected it "			 "changed"));#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)		invalidate_remote_inode(file->f_dentry->d_inode);#else			 		invalidate_remote_inode(file->f_path.dentry->d_inode);#endif	}client_can_cache:	if (pTcon->unix_ext)#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)		rc = cifs_get_inode_info_unix(&file->f_dentry->d_inode,#else			rc = cifs_get_inode_info_unix(&file->f_path.dentry->d_inode,#endif			full_path, inode->i_sb, xid);#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)		rc = cifs_get_inode_info(&file->f_dentry->d_inode,#else		rc = cifs_get_inode_info(&file->f_path.dentry->d_inode,#endif			full_path, buf, inode->i_sb, xid);	if ((*oplock & 0xF) == OPLOCK_EXCLUSIVE) {		pCifsInode->clientCanCacheAll = TRUE;		pCifsInode->clientCanCacheRead = TRUE;#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)		cFYI(1, ("Exclusive Oplock granted on inode %p",			 file->f_dentry->d_inode));#else		cFYI(1, ("Exclusive Oplock granted on inode %p",			 file->f_path.dentry->d_inode));#endif	} else if ((*oplock & 0xF) == OPLOCK_READ)		pCifsInode->clientCanCacheRead = TRUE;	return rc;}int cifs_open(struct inode *inode, struct file *file){	int rc = -EACCES;	int xid, oplock;	struct cifs_sb_info *cifs_sb;	struct cifsTconInfo *pTcon;	struct cifsFileInfo *pCifsFile;	struct cifsInodeInfo *pCifsInode;	struct list_head *tmp;	char *full_path = NULL;	int desiredAccess;	int disposition;	__u16 netfid;	FILE_ALL_INFO *buf = NULL;	xid = GetXid();	cifs_sb = CIFS_SB(inode->i_sb);	pTcon = cifs_sb->tcon;	if (file->f_flags & O_CREAT) {		/* search inode for this file and fill in file->private_data */#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)		pCifsInode = CIFS_I(file->f_dentry->d_inode);#else		pCifsInode = CIFS_I(file->f_path.dentry->d_inode);#endif		read_lock(&GlobalSMBSeslock);		list_for_each(tmp, &pCifsInode->openFileList) {			pCifsFile = list_entry(tmp, struct cifsFileInfo,					       flist);			if ((pCifsFile->pfile == NULL) &&			    (pCifsFile->pid == current->tgid)) {				/* mode set in cifs_create */				/* needed for writepage */				pCifsFile->pfile = file;				file->private_data = pCifsFile;				break;			}		}		read_unlock(&GlobalSMBSeslock);		if (file->private_data != NULL) {			rc = 0;			FreeXid(xid);			return rc;		} else {			if (file->f_flags & O_EXCL)				cERROR(1, ("could not find file instance for "					   "new file %p", file));		}	}#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)	full_path = build_path_from_dentry(file->f_dentry);#else	full_path = build_path_from_dentry(file->f_path.dentry);#endif	if (full_path == NULL) {		FreeXid(xid);		return -ENOMEM;	}	cFYI(1, ("inode = 0x%p file flags are 0x%x for %s",		 inode, file->f_flags, full_path));	desiredAccess = cifs_convert_flags(file->f_flags);/********************************************************************* *  open flag mapping table: * *	POSIX Flag            CIFS Disposition *	----------            ---------------- *	O_CREAT               FILE_OPEN_IF *	O_CREAT | O_EXCL      FILE_CREATE *	O_CREAT | O_TRUNC     FILE_OVERWRITE_IF *	O_TRUNC               FILE_OVERWRITE *	none of the above     FILE_OPEN * *	Note that there is not a direct match between disposition *	FILE_SUPERSEDE (ie create whether or not file exists although *	O_CREAT | O_TRUNC is similar but truncates the existing *	file rather than creating a new file as FILE_SUPERSEDE does *	(which uses the attributes / metadata passed in on open call) *? *?  O_SYNC is a reasonable match to CIFS writethrough flag *?  and the read write flags match reasonably.  O_LARGEFILE *?  is irrelevant because largefile support is always used *?  by this client. Flags O_APPEND, O_DIRECT, O_DIRECTORY, *	 O_FASYNC, O_NOFOLLOW, O_NONBLOCK need further investigation *********************************************************************/	disposition = cifs_get_disposition(file->f_flags);	if (oplockEnabled)		oplock = REQ_OPLOCK;	else		oplock = FALSE;	/* BB pass O_SYNC flag through on file attributes .. BB */	/* Also refresh inode by passing in file_info buf returned by SMBOpen	   and calling get_inode_info with returned buf (at least helps	   non-Unix server case) */	/* BB we can not do this if this is the second open of a file	   and the first handle has writebehind data, we might be	   able to simply do a filemap_fdatawrite/filemap_fdatawait first */	buf = kmalloc(sizeof(FILE_ALL_INFO), GFP_KERNEL);	if (!buf) {		rc = -ENOMEM;		goto out;	}	if (cifs_sb->tcon->ses->capabilities & CAP_NT_SMBS)		rc = CIFSSMBOpen(xid, pTcon, full_path, disposition,			 desiredAccess, CREATE_NOT_DIR, &netfid, &oplock, buf,			 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags				 & CIFS_MOUNT_MAP_SPECIAL_CHR);	else		rc = -EIO; /* no NT SMB support fall into legacy open below */	if (rc == -EIO) {		/* Old server, try legacy style OpenX */		rc = SMBLegacyOpen(xid, pTcon, full_path, disposition,			desiredAccess, CREATE_NOT_DIR, &netfid, &oplock, buf,			cifs_sb->local_nls, cifs_sb->mnt_cifs_flags				& CIFS_MOUNT_MAP_SPECIAL_CHR);	}	if (rc) {		cFYI(1, ("cifs_open returned 0x%x", rc));		goto out;	}	file->private_data =		kmalloc(sizeof(struct cifsFileInfo), GFP_KERNEL);	if (file->private_data == NULL) {		rc = -ENOMEM;		goto out;	}	pCifsFile = cifs_init_private(file->private_data, inode, file, netfid);	write_lock(&GlobalSMBSeslock);	list_add(&pCifsFile->tlist, &pTcon->openFileList);#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)	pCifsInode = CIFS_I(file->f_dentry->d_inode);#else	pCifsInode = CIFS_I(file->f_path.dentry->d_inode);#endif	if (pCifsInode) {		rc = cifs_open_inode_helper(inode, file, pCifsInode,					    pCifsFile, pTcon,					    &oplock, buf, full_path, xid);	} else {		write_unlock(&GlobalSMBSeslock);	}	if (oplock & CIFS_CREATE_ACTION) {		/* time to set mode which we can not set earlier due to		   problems creating new read-only files */		if (pTcon->unix_ext) {			CIFSSMBUnixSetPerms(xid, pTcon, full_path,					    inode->i_mode,					    (__u64)-1, (__u64)-1, 0 /* dev */,					    cifs_sb->local_nls,					    cifs_sb->mnt_cifs_flags &						CIFS_MOUNT_MAP_SPECIAL_CHR);		} else {			/* BB implement via Windows security descriptors eg			   CIFSSMBWinSetPerms(xid, pTcon, full_path, mode,					      -1, -1, local_nls);			   in the meantime could set r/o dos attribute when			   perms are eg: mode & 0222 == 0 */		}	}out:	kfree(buf);	kfree(full_path);	FreeXid(xid);	return rc;}/* Try to reacquire byte range locks that were released when session *//* to server was lost */static int cifs_relock_file(struct cifsFileInfo *cifsFile){	int rc = 0;/* BB list all locks open on this file and relock */	return rc;}static int cifs_reopen_file(struct file *file, int can_flush){	int rc = -EACCES;	int xid, oplock;	struct cifs_sb_info *cifs_sb;	struct cifsTconInfo *pTcon;	struct cifsFileInfo *pCifsFile;	struct cifsInodeInfo *pCifsInode;	struct inode *inode;	char *full_path = NULL;	int desiredAccess;	int disposition = FILE_OPEN;	__u16 netfid;	if (file->private_data) {		pCifsFile = (struct cifsFileInfo *)file->private_data;	} else		return -EBADF;	xid = GetXid();	down(&pCifsFile->fh_sem);	if (pCifsFile->invalidHandle == FALSE) {		up(&pCifsFile->fh_sem);		FreeXid(xid);		return 0;	}#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)	if (file->f_dentry == NULL) {		cERROR(1, ("no valid name if dentry freed"));		dump_stack();		rc = -EBADF;		goto reopen_error_exit;	}	inode = file->f_dentry->d_inode;	if (inode == NULL) {		cERROR(1, ("inode not valid"));		dump_stack();		rc = -EBADF;		goto reopen_error_exit;	}	cifs_sb = CIFS_SB(inode->i_sb);	pTcon = cifs_sb->tcon;/* can not grab rename sem here because various ops, including   those that already have the rename sem can end up causing writepage   to get called and if the server was down that means we end up here,   and we can never tell if the caller already has the rename_sem */	full_path = build_path_from_dentry(file->f_dentry);#else	if (file->f_path.dentry == NULL) {		cERROR(1, ("no valid name if dentry freed"));		dump_stack();		rc = -EBADF;		goto reopen_error_exit;	}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色噜噜狠狠色综合欧洲selulu| 一本一道波多野结衣一区二区| 蜜桃久久精品一区二区| 久久精品久久99精品久久| 国产一区二区三区久久久| www.日韩av| 欧亚一区二区三区| 欧美白人最猛性xxxxx69交| 久久久久久麻豆| 最新国产成人在线观看| 亚洲高清不卡在线| 韩国av一区二区三区四区| 99久久er热在这里只有精品15| 欧美老女人在线| 久久精品一区二区三区不卡| 亚洲免费色视频| 狂野欧美性猛交blacked| bt欧美亚洲午夜电影天堂| 欧美午夜一区二区三区| 久久午夜色播影院免费高清 | 水蜜桃久久夜色精品一区的特点| 精品一区二区免费看| 成人免费精品视频| 3d成人h动漫网站入口| 日本一区二区三区dvd视频在线| 亚洲国产综合91精品麻豆| 国产中文字幕一区| 欧美三级日韩三级国产三级| 久久精品视频在线免费观看| 亚洲午夜日本在线观看| 国产超碰在线一区| 欧美一区二区成人6969| 亚洲欧美日韩精品久久久久| 激情综合色丁香一区二区| 在线日韩国产精品| 日本一区二区三区久久久久久久久不 | 久久久天堂av| 亚洲国产精品久久人人爱| 国产成人免费9x9x人网站视频| 欧美伦理视频网站| 中文字幕一区二区三区在线播放| 美腿丝袜一区二区三区| 色婷婷综合久久久久中文一区二区 | 精品国产91久久久久久久妲己| 亚洲人123区| 国产精品影视在线| 日韩欧美123| 五月婷婷激情综合网| 91麻豆免费看| 丝瓜av网站精品一区二区| 91碰在线视频| 欧美激情一区二区| 激情伊人五月天久久综合| 欧美日本不卡视频| 亚洲国产日韩av| 一本久久综合亚洲鲁鲁五月天| 中文字幕国产一区| 国产最新精品精品你懂的| 日韩一区二区免费在线电影| 亚洲国产精品久久一线不卡| 91极品美女在线| 亚洲欧美日韩国产中文在线| 成人精品视频一区二区三区尤物| 久久亚洲精品小早川怜子| 久久国产剧场电影| 日韩一卡二卡三卡四卡| 日韩av不卡在线观看| 欧美日本免费一区二区三区| 一区二区不卡在线视频 午夜欧美不卡在| 成人免费三级在线| 国产精品国产三级国产aⅴ原创| 国产成人在线网站| 亚洲国产电影在线观看| 国产成人午夜精品影院观看视频 | 久久国产精品72免费观看| 在线成人免费观看| 日本不卡在线视频| 日韩欧美国产1| 久久国产乱子精品免费女| 精品成人在线观看| 国产在线视频一区二区三区| 久久美女高清视频| 丁香一区二区三区| 国产精品不卡在线观看| 91丨九色丨国产丨porny| 5566中文字幕一区二区电影| 日本欧美大码aⅴ在线播放| 日韩欧美一级二级| 国产在线观看免费一区| 国产网红主播福利一区二区| 成人久久视频在线观看| 午夜精品久久久久久不卡8050| 国产福利精品一区二区| 国产亚洲精品超碰| 成人精品一区二区三区四区| 最好看的中文字幕久久| 日本久久一区二区三区| 午夜久久久久久| 欧美一区二区精美| 亚洲一级电影视频| 欧美一区二区成人| 国产精品伊人色| 专区另类欧美日韩| 欧美三级电影在线观看| 蜜桃av噜噜一区| 国产欧美日韩卡一| 色综合色综合色综合色综合色综合| 亚洲综合一二三区| 日韩欧美国产1| 成人国产精品视频| 亚洲综合网站在线观看| 欧美xxxxx牲另类人与| 不卡的av电影| 视频一区视频二区在线观看| 久久一夜天堂av一区二区三区| jiyouzz国产精品久久| 亚洲最大成人综合| 精品国产免费一区二区三区四区 | 久久精品视频在线看| av爱爱亚洲一区| 亚洲国产欧美在线| 精品奇米国产一区二区三区| 99久久精品国产毛片| 午夜精品久久一牛影视| 久久精品男人天堂av| 欧美日韩在线三区| 国产成人小视频| 天天综合天天综合色| 国产精品网站导航| 制服丝袜一区二区三区| 成人18精品视频| 奇米影视7777精品一区二区| 国产精品久久久久久户外露出| 欧美日韩国产高清一区二区三区| 国产原创一区二区| 亚洲第一成年网| 亚洲国产精品成人久久综合一区| 欧美日韩欧美一区二区| 国产成人一区在线| 无码av免费一区二区三区试看 | 国产一区二区久久| 亚洲一区在线看| 香蕉影视欧美成人| 91在线国产福利| 蜜臀av性久久久久蜜臀aⅴ| 福利一区福利二区| 99精品偷自拍| 26uuu另类欧美亚洲曰本| 亚洲另类在线一区| 国产又黄又大久久| 久久蜜桃av一区二区天堂| 日韩精品乱码免费| 欧洲一区二区三区在线| 乱一区二区av| 亚洲色欲色欲www| 亚洲精品一区二区三区精华液| 91电影在线观看| www.66久久| 国产精品一二一区| 麻豆精品一区二区av白丝在线| 一区二区三区四区不卡在线| 国产精品二区一区二区aⅴ污介绍| 精品久久人人做人人爰| 欧美电影一区二区| 色综合激情五月| 成人av在线一区二区三区| 国产在线不卡一卡二卡三卡四卡| 婷婷成人激情在线网| 一区二区三区中文在线观看| 国产精品丝袜久久久久久app| xfplay精品久久| 欧美成人三级在线| 欧美一区二区久久| 日韩欧美中文字幕一区| 这里只有精品99re| 欧美精品一卡两卡| 欧美日韩三级一区二区| 欧美日韩综合在线| 欧美三级视频在线| 欧美三级蜜桃2在线观看| 欧美日韩中文字幕一区二区| 91小视频在线| 亚洲日本中文字幕区| 日韩欧美一卡二卡| 日韩精品福利网| 精品国偷自产国产一区| 欧美视频中文字幕| 日韩av一二三| 亚洲精品免费电影| 911精品国产一区二区在线| 日韩精品电影一区亚洲| 欧美三级在线播放| 日韩影院免费视频| 精品电影一区二区| 91香蕉国产在线观看软件| 亚洲色图欧洲色图婷婷| 欧美午夜理伦三级在线观看| 裸体一区二区三区| 日韩专区欧美专区| 91精品国产色综合久久ai换脸|