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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? fs.c

?? NTFS(NT文件系統) for Linux的一個實現源碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* *  fs.c *  NTFS driver for Linux 2.1 * *  Copyright (C) 1995-1997, 1999 Martin von L鰓is *  Copyright (C) 1996 Richard Russon *  Copyright (C) 1996-1997 R間is Duchesne */#ifdef HAVE_CONFIG_H#include "config.h"#endif#ifdef NTFS_IN_LINUX_KERNEL#include <linux/config.h>#endif#include "ntfstypes.h"#include "struct.h"#include "util.h"#include "inode.h"#include "super.h"#include "dir.h"#include "support.h"#include "macros.h"#include "sysctl.h"#include <linux/module.h>#include <asm/uaccess.h>#include <linux/nls.h>#include <linux/locks.h>#include <linux/init.h>/* Forward declarations */static struct inode_operations ntfs_dir_inode_operations;#define ITEM_SIZE 2040/* io functions to user space */static void ntfs_putuser(ntfs_io* dest,void *src,ntfs_size_t len){	copy_to_user(dest->param,src,len);	dest->param+=len;}#ifdef CONFIG_NTFS_RWstruct ntfs_getuser_update_vm_s{	const char *user;	struct inode *ino;	loff_t off;};static void ntfs_getuser_update_vm (void *dest, ntfs_io *src, ntfs_size_t len){	struct ntfs_getuser_update_vm_s *p = src->param;	copy_from_user (dest, p->user, len);	update_vm_cache (p->ino, p->off, dest, len);	p->user += len;	p->off += len;}#endifstatic ssize_tntfs_read(struct file * filp, char *buf, size_t count, loff_t *off){	int error;	ntfs_io io;	ntfs_inode *ino=NTFS_LINO2NINO(filp->f_dentry->d_inode);	/* inode is not properly initialized */	if(!ino)return -EINVAL;	ntfs_debug(DEBUG_OTHER, "ntfs_read %x,%x,%x ->",		   (unsigned)ino->i_number,(unsigned)*off,(unsigned)count);	/* inode has no unnamed data attribute */	if(!ntfs_find_attr(ino,ino->vol->at_data,NULL))		return -EINVAL;		/* read the data */	io.fn_put=ntfs_putuser;	io.fn_get=0;	io.param=buf;	io.size=count;	error=ntfs_read_attr(ino,ino->vol->at_data,NULL,*off,&io);	if(error)return -error;		*off+=io.size;	return io.size;}#ifdef CONFIG_NTFS_RWstatic ssize_tntfs_write(struct file *filp,const char* buf,size_t count,loff_t *pos){	int ret;	ntfs_io io;	struct inode *inode = filp->f_dentry->d_inode;	ntfs_inode *ino = NTFS_LINO2NINO(inode);	struct ntfs_getuser_update_vm_s param;	if (!ino)		return -EINVAL;	ntfs_debug (DEBUG_LINUX, "ntfs_write %x,%x,%x ->\n",	       (unsigned)ino->i_number, (unsigned)*pos, (unsigned)count);	/* Allows to lock fs ro at any time */	if (inode->i_sb->s_flags & MS_RDONLY)		return -ENOSPC;	if (!ntfs_find_attr(ino,ino->vol->at_data,NULL))		return -EINVAL;	/* Evaluating O_APPEND is the file system's job... */	if (filp->f_flags & O_APPEND)		*pos = inode->i_size;	param.user = buf;	param.ino = inode;	param.off = *pos;	io.fn_put = 0;	io.fn_get = ntfs_getuser_update_vm;	io.param = &param;	io.size = count;	ret = ntfs_write_attr (ino, ino->vol->at_data, NULL, *pos, &io);	ntfs_debug (DEBUG_LINUX, "write -> %x\n", ret);	if(ret<0)		return -EINVAL;	*pos += io.size;	if (*pos > inode->i_size)		inode->i_size = *pos;	mark_inode_dirty (filp->f_dentry->d_inode);	return io.size;}#endifstruct ntfs_filldir{	struct inode *dir;	filldir_t filldir;	unsigned int type;	ntfs_u32 ph,pl;	void *dirent;	char *name;	int namelen;};	static int ntfs_printcb(ntfs_u8 *entry,void *param){	struct ntfs_filldir* nf=param;	int flags=NTFS_GETU8(entry+0x51);	int show_hidden=0;	int length=NTFS_GETU8(entry+0x50);	int inum=NTFS_GETU32(entry);	int error;#ifdef NTFS_NGT_NT_DOES_LOWER	int i,to_lower=0;#endif	switch(nf->type){	case ngt_dos:		/* Don't display long names */		if((flags & 2)==0)			return 0;		break;	case ngt_nt:		/* Don't display short-only names */		switch(flags&3){		case 2: return 0;#ifdef NTFS_NGT_NT_DOES_LOWER		case 3: to_lower=1;#endif		}		break;	case ngt_posix:		break;	case ngt_full:		show_hidden=1;		break;	}	if(!show_hidden && ((NTFS_GETU8(entry+0x48) & 2)==2)){		ntfs_debug(DEBUG_OTHER,"Skipping hidden file\n");		return 0;	}	nf->name=0;	if(ntfs_encodeuni(NTFS_INO2VOL(nf->dir),(ntfs_u16*)(entry+0x52),			  length,&nf->name,&nf->namelen)){		ntfs_debug(DEBUG_OTHER,"Skipping unrepresentable file\n");		if(nf->name)ntfs_free(nf->name);		return 0;	}	/* Do not return ".", as this is faked */	if(length==1 && *nf->name=='.')		return 0;#ifdef NTFS_NGT_NT_DOES_LOWER	if(to_lower)		for(i=0;i<nf->namelen;i++)			/* This supports ASCII only. Since only DOS-only			   names get converted, and since those are restricted			   to ASCII, this should be correct */			if(nf->name[i]>='A' && nf->name[i]<='Z')				nf->name[i]+='a'-'A';#endif	nf->name[nf->namelen]=0;	ntfs_debug(DEBUG_OTHER, "readdir got %s,len %d\n",nf->name,nf->namelen);	/* filldir expects an off_t rather than an loff_t.	   Hope we don't have more than 65535 index records */	error=nf->filldir(nf->dirent,nf->name,nf->namelen,			(nf->ph<<16)|nf->pl,inum);	ntfs_free(nf->name);	/* Linux filldir errors are negative, other errors positive */	return error;}/* readdir returns '..', then '.', then the directory entries in sequence   As the root directory contains a entry for itself, '.' is not emulated   for the root directory */static int ntfs_readdir(struct file* filp, void *dirent, filldir_t filldir){	struct ntfs_filldir cb;	int error;	struct inode *dir=filp->f_dentry->d_inode;	ntfs_debug(DEBUG_OTHER, "ntfs_readdir ino %x mode %x\n",	       (unsigned)dir->i_ino,(unsigned int)dir->i_mode);	if(!dir || (dir->i_ino==0) || !S_ISDIR(dir->i_mode))return -EBADF;	ntfs_debug(DEBUG_OTHER, "readdir: Looking for file %x dircount %d\n",	       (unsigned)filp->f_pos,dir->i_count);	cb.pl=filp->f_pos & 0xFFFF;	cb.ph=filp->f_pos >> 16;	/* end of directory */	if(cb.ph==0xFFFF){		/* FIXME: Maybe we can return those with the previous call */		switch(cb.pl){		case 0: filldir(dirent,".",1,filp->f_pos,dir->i_ino);			filp->f_pos=0xFFFF0001;			return 0;			/* FIXME: parent directory */		case 1: filldir(dirent,"..",2,filp->f_pos,0);			filp->f_pos=0xFFFF0002;			return 0;		}		ntfs_debug(DEBUG_OTHER, "readdir: EOD\n");		return 0;	}	cb.dir=dir;	cb.filldir=filldir;	cb.dirent=dirent;	cb.type=NTFS_INO2VOL(dir)->ngt;	do{		ntfs_debug(DEBUG_OTHER,"looking for next file\n");		error=ntfs_getdir_unsorted(NTFS_LINO2NINO(dir),&cb.ph,&cb.pl,				   ntfs_printcb,&cb);	}while(!error && cb.ph!=0xFFFFFFFF);	filp->f_pos=(cb.ph<<16)|cb.pl;	ntfs_debug(DEBUG_OTHER, "new position %x\n",(unsigned)filp->f_pos);        /* -EINVAL is on user buffer full. This is not considered 	   as an error by sys_getdents */	if(error<0) 		error=0;	/* Otherwise (device error, inconsistent data), switch the sign */	return -error;}/* Copied from vfat driver */static int simple_getbool(char *s, int *setval){	if (s) {		if (!strcmp(s,"1") || !strcmp(s,"yes") || !strcmp(s,"true")) {			*setval = 1;		} else if (!strcmp(s,"0") || !strcmp(s,"no") || !strcmp(s,"false")) {			*setval = 0;		} else {			return 0;		}	} else {		*setval = 1;	}	return 1;}/* Parse the (re)mount options */static int parse_options(ntfs_volume* vol,char *opt){	char *value;	vol->uid=vol->gid=0;	vol->umask=0077;	vol->ngt=ngt_nt;	vol->nls_map=0;	vol->nct=0;	if(!opt)goto done;	for(opt = strtok(opt,",");opt;opt=strtok(NULL,","))	{		if ((value = strchr(opt, '=')) != NULL)			*value++='\0';		if(strcmp(opt,"uid")==0)		{			if(!value || !*value)goto needs_arg;			vol->uid=simple_strtoul(value,&value,0);			if(*value){				printk(KERN_ERR "NTFS: uid invalid argument\n");				return 0;			}		}else if(strcmp(opt, "gid") == 0)		{			if(!value || !*value)goto needs_arg;			vol->gid=simple_strtoul(value,&value,0);			if(*value){				printk(KERN_ERR "gid invalid argument\n");				return 0;			}		}else if(strcmp(opt, "umask") == 0)		{			if(!value || !*value)goto needs_arg;			vol->umask=simple_strtoul(value,&value,0);			if(*value){				printk(KERN_ERR "umask invalid argument\n");				return 0;			}		}else if(strcmp(opt, "iocharset") == 0){			if(!value || !*value)goto needs_arg;			vol->nls_map=load_nls(value);			vol->nct |= nct_map;			if(!vol->nls_map){				printk(KERN_ERR "NTFS: charset not found");				return 0;			}		}else if(strcmp(opt, "posix") == 0){			int val;			if(!value || !*value)goto needs_arg;			if(!simple_getbool(value,&val))				goto needs_bool;			vol->ngt=val?ngt_posix:ngt_nt;		}else if(strcmp(opt,"utf8") == 0){			int val=0;			if(!value || !*value)				val=1;			else if(!simple_getbool(value,&val))				goto needs_bool;			if(val)				vol->nct|=nct_utf8;		}else if(strcmp(opt,"uni_xlate") == 0){			int val=0;			/* no argument: uni_vfat.			   boolean argument: uni_vfat.			   "2": uni.			*/			if(!value || !*value)				val=1;			else if(strcmp(value,"2")==0)				vol->nct |= nct_uni_xlate;			else if(!simple_getbool(value,&val))				goto needs_bool;			if(val)				vol->nct |= nct_uni_xlate_vfat | nct_uni_xlate;		}else{			printk(KERN_ERR "NTFS: unkown option '%s'\n", opt);			return 0;		}	}	if(vol->nct & nct_utf8 & (nct_map | nct_uni_xlate)){		printk(KERN_ERR "utf8 cannot be combined with iocharset or uni_xlate\n");		return 0;	} done:	if((vol->nct & (nct_uni_xlate | nct_map | nct_utf8))==0)		/* default to UTF-8 */		vol->nct=nct_utf8;	if(!vol->nls_map)		vol->nls_map=load_nls_default();	return 1; needs_arg:	printk(KERN_ERR "NTFS: %s needs an argument",opt);	return 0; needs_bool:	printk(KERN_ERR "NTFS: %s needs boolean argument",opt);	return 0;}			static int ntfs_lookup(struct inode *dir, struct dentry *d){	struct inode *res=0;	char *item=0;	ntfs_iterate_s walk;	int error;	ntfs_debug(DEBUG_NAME1, "Looking up %s in %x\n",d->d_name.name,		   (unsigned)dir->i_ino);	/* convert to wide string */	error=ntfs_decodeuni(NTFS_INO2VOL(dir),(char*)d->d_name.name,			     d->d_name.len,&walk.name,&walk.namelen);	if(error)		return error;	item=ntfs_malloc(ITEM_SIZE);	if( !item )		return ENOMEM;	/* ntfs_getdir will place the directory entry into item,	   and the first long long is the MFT record number */	walk.type=BY_NAME;	walk.dir=NTFS_LINO2NINO(dir);	walk.result=item;	if(ntfs_getdir_byname(&walk))	{		res=iget(dir->i_sb,NTFS_GETU32(item));	}	d_add(d,res);	ntfs_free(item);	ntfs_free(walk.name);	/* Always return success, the dcache will handle negative entries. */	return 0;}static struct file_operations ntfs_file_operations_nommap = {	NULL, /* lseek */	ntfs_read,#ifdef CONFIG_NTFS_RW	ntfs_write,#else	NULL,#endif	NULL, /* readdir */	NULL, /* select */	NULL, /* ioctl */	NULL, /* mmap */	NULL, /* open */	NULL, /* flush */	NULL, /* release */	NULL, /* fsync */	NULL, /* fasync */	NULL, /* check_media_change */	NULL, /* revalidate */	NULL, /* lock */};static struct inode_operations ntfs_inode_operations_nobmap = {	&ntfs_file_operations_nommap,	NULL, /* create */	NULL, /* lookup */	NULL, /* link */	NULL, /* unlink */	NULL, /* symlink */	NULL, /* mkdir */	NULL, /* rmdir */	NULL, /* mknod */	NULL, /* rename */	NULL, /* readlink */	NULL, /* follow_link */	NULL, /* readpage */	NULL, /* writepage */	NULL, /* bmap */	NULL, /* truncate */	NULL, /* permission */	NULL, /* smap */	NULL, /* updatepage */	NULL, /* revalidate */};#ifdef CONFIG_NTFS_RWstatic intntfs_create(struct inode* dir,struct dentry *d,int mode){	struct inode *r=0;	ntfs_inode *ino=0;	ntfs_volume *vol;	int error=0;	ntfs_attribute *si;	r=get_empty_inode();	if(!r){		error=ENOMEM;		goto fail;	}	ntfs_debug(DEBUG_OTHER, "ntfs_create %s\n",d->d_name.name);	vol=NTFS_INO2VOL(dir);#ifdef NTFS_IN_LINUX_KERNEL	ino=NTFS_LINO2NINO(r);#else	ino=ntfs_malloc(sizeof(ntfs_inode));	if(!ino){		error=ENOMEM;		goto fail;	}	r->u.generic_ip=ino;#endif	error=ntfs_alloc_file(NTFS_LINO2NINO(dir),ino,(char*)d->d_name.name,			       d->d_name.len);	if(error)goto fail;	error=ntfs_update_inode(ino);	if(error)goto fail;	error=ntfs_update_inode(NTFS_LINO2NINO(dir));	if(error)goto fail;	r->i_uid=vol->uid;	r->i_gid=vol->gid;	r->i_nlink=1;	r->i_sb=dir->i_sb;	/* FIXME: dirty? dev? */	/* get the file modification times from the standard information */	si=ntfs_find_attr(ino,vol->at_standard_information,NULL);	if(si){		char *attr=si->d.data;		r->i_atime=ntfs_ntutc2unixutc(NTFS_GETU64(attr+0x18));		r->i_ctime=ntfs_ntutc2unixutc(NTFS_GETU64(attr));		r->i_mtime=ntfs_ntutc2unixutc(NTFS_GETU64(attr+8));	}	/* It's not a directory */	r->i_op=&ntfs_inode_operations_nobmap;	r->i_mode=S_IFREG|S_IRUGO;#ifdef CONFIG_NTFS_RW	r->i_mode|=S_IWUGO;#endif	r->i_mode &= ~vol->umask;	insert_inode_hash(r);	d_instantiate(d,r);	return 0; fail:	#ifndef NTFS_IN_LINUX_KERNEL	if(ino)ntfs_free(ino);	#endif	if(r)iput(r);	return -error;}static int_linux_ntfs_mkdir(struct inode *dir, struct dentry* d, int mode){	int error;	struct inode *r = 0;	ntfs_volume *vol;	ntfs_inode *ino;	ntfs_attribute *si;	ntfs_debug (DEBUG_DIR1, "mkdir %s in %x\n",d->d_name.name, dir->i_ino);	error = ENAMETOOLONG;	if (d->d_name.len > /* FIXME */255)		goto out;	error = EIO;	r = get_empty_inode();	if (!r)		goto out;		vol = NTFS_INO2VOL(dir);#ifdef NTFS_IN_LINUX_KERNEL	ino = NTFS_LINO2NINO(r);#else	ino = ntfs_malloc(sizeof(ntfs_inode));	error = ENOMEM;	if(!ino)		goto out;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美亚洲动漫精品| 国产精品一区二区在线看| 在线视频一区二区三区| 亚洲精品视频观看| 色www精品视频在线观看| 亚洲韩国一区二区三区| 欧美精品成人一区二区三区四区| 亚洲大片免费看| 日韩精品一区国产麻豆| 粉嫩av一区二区三区粉嫩| 亚洲美女视频在线观看| 欧美日韩高清一区二区三区| 麻豆精品一二三| 国产精品久线观看视频| 精品视频资源站| 狠狠久久亚洲欧美| 亚洲欧美电影一区二区| 7777精品久久久大香线蕉| 韩国视频一区二区| 亚洲精品视频在线看| 91精品免费在线| 成人一区二区视频| 亚洲第一激情av| 久久久久久久久久久黄色| 色噜噜狠狠色综合欧洲selulu| 一区二区三区国产豹纹内裤在线| 欧美一区二区不卡视频| aa级大片欧美| 激情综合色丁香一区二区| 亚洲欧洲综合另类| 久久综合九色综合欧美就去吻| 不卡av电影在线播放| 美女尤物国产一区| 一区二区三区精品视频| 久久久国产综合精品女国产盗摄| 欧美在线免费观看视频| 国产在线精品一区在线观看麻豆| 一区二区三区四区视频精品免费| 久久久久久夜精品精品免费| 在线观看亚洲一区| 成人午夜av在线| 日本一道高清亚洲日美韩| 亚洲欧美福利一区二区| 久久久99精品免费观看不卡| 欧美一区二区三区成人| 99精品在线免费| 国产精品影视天天线| 亚洲成a人在线观看| 国产精品久久久久7777按摩| 精品88久久久久88久久久| 欧美在线短视频| 91在线免费视频观看| 国产一区久久久| 奇米精品一区二区三区四区 | 精品一区二区三区在线观看| 亚洲色图视频网| 久久久久久久久蜜桃| 日韩欧美国产电影| 欧美日韩国产经典色站一区二区三区 | 国产酒店精品激情| 日本最新不卡在线| 婷婷久久综合九色综合伊人色| 亚洲色欲色欲www在线观看| 中文在线一区二区| 亚洲精品在线三区| 欧美一区二区三区影视| 欧美日韩小视频| 欧美在线三级电影| 综合分类小说区另类春色亚洲小说欧美 | 99热精品一区二区| 成人手机在线视频| 福利视频网站一区二区三区| 国产精品乡下勾搭老头1| 精品在线免费视频| 精品一区二区三区av| 美女mm1313爽爽久久久蜜臀| 美腿丝袜亚洲综合| 韩国视频一区二区| 国产99精品视频| 91在线视频免费91| 日本乱人伦aⅴ精品| 色噜噜久久综合| 欧美日韩一区二区三区在线| 欧美综合天天夜夜久久| 欧美精品色一区二区三区| 欧美丝袜自拍制服另类| 欧美乱熟臀69xxxxxx| 日韩一区国产二区欧美三区| 精品粉嫩超白一线天av| 欧美激情综合在线| 亚洲精品免费播放| 香蕉影视欧美成人| 另类小说色综合网站| 国产99久久久国产精品免费看| 波多野结衣亚洲| 欧美伊人久久大香线蕉综合69| 欧美男生操女生| 亚洲精品在线免费播放| 国产精品久久久久aaaa樱花| 亚洲综合色在线| 久久国产夜色精品鲁鲁99| 成人免费视频播放| 欧美在线小视频| 日韩精品一区二区三区视频播放| 久久久99久久| 亚洲一区二区3| 国产在线不卡一区| 91碰在线视频| 日韩三级视频在线观看| 欧美国产欧美综合| 亚洲第一福利一区| 国产美女在线精品| 色诱视频网站一区| 精品国产免费一区二区三区香蕉 | 大尺度一区二区| 欧美日韩亚洲另类| 中文字幕欧美国产| 午夜精品久久久久久久99水蜜桃| 麻豆一区二区三区| 91久久国产综合久久| 26uuuu精品一区二区| 亚洲成人在线观看视频| 国产呦萝稀缺另类资源| 国产精品久久久久久福利一牛影视 | 国产在线国偷精品免费看| 欧洲生活片亚洲生活在线观看| wwwwxxxxx欧美| 亚洲国产美女搞黄色| 国产盗摄女厕一区二区三区 | 欧美一二三四在线| 伊人色综合久久天天| 国模一区二区三区白浆| 欧美日精品一区视频| 国产精品久久久久久久久果冻传媒 | 亚洲综合一区二区三区| 国产精品一线二线三线精华| 欧美综合一区二区| 中文字幕亚洲综合久久菠萝蜜| 美国av一区二区| 欧美日韩大陆一区二区| 中文字幕字幕中文在线中不卡视频| 另类人妖一区二区av| 欧美日本韩国一区二区三区视频| 1024成人网| fc2成人免费人成在线观看播放| 日韩精品中文字幕在线一区| 亚洲成人av资源| 色综合久久久久综合体| 国产精品情趣视频| 国产传媒久久文化传媒| 精品免费视频.| 久久精品国产亚洲5555| 91精品国产高清一区二区三区| 一区二区三区成人| 色88888久久久久久影院按摩 | 久久久久久久久久美女| 极品少妇xxxx精品少妇| 日韩西西人体444www| 日本美女一区二区三区视频| 欧美精品在线观看播放| 午夜精品123| 欧美乱妇23p| 奇米888四色在线精品| 欧美一区二区三区视频在线观看 | 国内精品视频666| 精品国产伦一区二区三区观看方式| 奇米综合一区二区三区精品视频| 欧美酷刑日本凌虐凌虐| 日韩黄色片在线观看| 一本大道av一区二区在线播放| 国产精品精品国产色婷婷| 成人国产免费视频| 国产精品激情偷乱一区二区∴| 成人国产精品免费观看视频| 国产精品成人免费在线| 91亚洲大成网污www| 亚洲已满18点击进入久久| 欧美视频一区二区三区在线观看| 亚洲成精国产精品女| 制服视频三区第一页精品| 美腿丝袜一区二区三区| 久久先锋影音av鲁色资源网| 粉嫩嫩av羞羞动漫久久久| 国产精品久久久久久久久免费桃花| 91在线视频播放| 天天综合色天天| 精品成人在线观看| 99国产精品久| 天天综合色天天| 久久九九久精品国产免费直播| www.成人在线| 亚洲电影视频在线| 2023国产精品| 一本大道久久a久久精二百 | 久久嫩草精品久久久久| 99re免费视频精品全部| 日韩成人伦理电影在线观看| 久久伊99综合婷婷久久伊| 91国偷自产一区二区三区观看| 日韩在线一二三区|