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

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

?? dir.c

?? linux環境下基于FAT的文件系統的通用代碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* *  linux/fs/fat/dir.c * *  directory handling functions for fat-based filesystems * *  Written 1992,1993 by Werner Almesberger * *  Hidden files 1995 by Albert Cahalan <albert@ccs.neu.edu> <adc@coe.neu.edu> * *  VFAT extensions by Gordon Chaffee <chaffee@plateau.cs.berkeley.edu> *  Merged with msdos fs by Henrik Storner <storner@osiris.ping.dk> *  Rewritten for constant inumbers. Plugged buffer overrun in readdir(). AV *  Short name translation 1999, 2001 by Wolfram Pienkoss <wp@bszh.de> */#include <linux/module.h>#include <linux/slab.h>#include <linux/time.h>#include <linux/smp_lock.h>#include <linux/buffer_head.h>#include <linux/compat.h>#include <asm/uaccess.h>#include "fat.h"static inline loff_t fat_make_i_pos(struct super_block *sb,				    struct buffer_head *bh,				    struct msdos_dir_entry *de){	return ((loff_t)bh->b_blocknr << MSDOS_SB(sb)->dir_per_block_bits)		| (de - (struct msdos_dir_entry *)bh->b_data);}static inline void fat_dir_readahead(struct inode *dir, sector_t iblock,				     sector_t phys){	struct super_block *sb = dir->i_sb;	struct msdos_sb_info *sbi = MSDOS_SB(sb);	struct buffer_head *bh;	int sec;	/* This is not a first sector of cluster, or sec_per_clus == 1 */	if ((iblock & (sbi->sec_per_clus - 1)) || sbi->sec_per_clus == 1)		return;	/* root dir of FAT12/FAT16 */	if ((sbi->fat_bits != 32) && (dir->i_ino == MSDOS_ROOT_INO))		return;	bh = sb_find_get_block(sb, phys);	if (bh == NULL || !buffer_uptodate(bh)) {		for (sec = 0; sec < sbi->sec_per_clus; sec++)			sb_breadahead(sb, phys + sec);	}	brelse(bh);}/* Returns the inode number of the directory entry at offset pos. If bh is   non-NULL, it is brelse'd before. Pos is incremented. The buffer header is   returned in bh.   AV. Most often we do it item-by-item. Makes sense to optimize.   AV. OK, there we go: if both bh and de are non-NULL we assume that we just   AV. want the next entry (took one explicit de=NULL in vfat/namei.c).   AV. It's done in fat_get_entry() (inlined), here the slow case lives.   AV. Additionally, when we return -1 (i.e. reached the end of directory)   AV. we make bh NULL. */static int fat__get_entry(struct inode *dir, loff_t *pos,			  struct buffer_head **bh, struct msdos_dir_entry **de){	struct super_block *sb = dir->i_sb;	sector_t phys, iblock;	unsigned long mapped_blocks;	int err, offset;next:	if (*bh)		brelse(*bh);	*bh = NULL;	iblock = *pos >> sb->s_blocksize_bits;	err = fat_bmap(dir, iblock, &phys, &mapped_blocks, 0);	if (err || !phys)		return -1;	/* beyond EOF or error */	fat_dir_readahead(dir, iblock, phys);	*bh = sb_bread(sb, phys);	if (*bh == NULL) {		printk(KERN_ERR "FAT: Directory bread(block %llu) failed\n",		       (llu)phys);		/* skip this block */		*pos = (iblock + 1) << sb->s_blocksize_bits;		goto next;	}	offset = *pos & (sb->s_blocksize - 1);	*pos += sizeof(struct msdos_dir_entry);	*de = (struct msdos_dir_entry *)((*bh)->b_data + offset);	return 0;}static inline int fat_get_entry(struct inode *dir, loff_t *pos,				struct buffer_head **bh,				struct msdos_dir_entry **de){	/* Fast stuff first */	if (*bh && *de &&	    (*de - (struct msdos_dir_entry *)(*bh)->b_data) < MSDOS_SB(dir->i_sb)->dir_per_block - 1) {		*pos += sizeof(struct msdos_dir_entry);		(*de)++;		return 0;	}	return fat__get_entry(dir, pos, bh, de);}/* * Convert Unicode 16 to UTF-8, translated Unicode, or ASCII. * If uni_xlate is enabled and we can't get a 1:1 conversion, use a * colon as an escape character since it is normally invalid on the vfat * filesystem. The following four characters are the hexadecimal digits * of Unicode value. This lets us do a full dump and restore of Unicode * filenames. We could get into some trouble with long Unicode names, * but ignore that right now. * Ahem... Stack smashing in ring 0 isn't fun. Fixed. */static int uni16_to_x8(unsigned char *ascii, const wchar_t *uni, int len,		       int uni_xlate, struct nls_table *nls){	const wchar_t *ip;	wchar_t ec;	unsigned char *op, nc;	int charlen;	int k;	ip = uni;	op = ascii;	while (*ip && ((len - NLS_MAX_CHARSET_SIZE) > 0)) {		ec = *ip++;		if ( (charlen = nls->uni2char(ec, op, NLS_MAX_CHARSET_SIZE)) > 0) {			op += charlen;			len -= charlen;		} else {			if (uni_xlate == 1) {				*op = ':';				for (k = 4; k > 0; k--) {					nc = ec & 0xF;					op[k] = nc > 9	? nc + ('a' - 10)							: nc + '0';					ec >>= 4;				}				op += 5;				len -= 5;			} else {				*op++ = '?';				len--;			}		}	}	if (unlikely(*ip)) {		printk(KERN_WARNING "FAT: filename was truncated while "		       "converting.");	}	*op = 0;	return (op - ascii);}static inline int fat_uni_to_x8(struct msdos_sb_info *sbi, const wchar_t *uni,				unsigned char *buf, int size){	if (sbi->options.utf8)		return utf8_wcstombs(buf, uni, size);	else		return uni16_to_x8(buf, uni, size, sbi->options.unicode_xlate,				   sbi->nls_io);}static inline intfat_short2uni(struct nls_table *t, unsigned char *c, int clen, wchar_t *uni){	int charlen;	charlen = t->char2uni(c, clen, uni);	if (charlen < 0) {		*uni = 0x003f;	/* a question mark */		charlen = 1;	}	return charlen;}static inline intfat_short2lower_uni(struct nls_table *t, unsigned char *c, int clen, wchar_t *uni){	int charlen;	wchar_t wc;	charlen = t->char2uni(c, clen, &wc);	if (charlen < 0) {		*uni = 0x003f;	/* a question mark */		charlen = 1;	} else if (charlen <= 1) {		unsigned char nc = t->charset2lower[*c];		if (!nc)			nc = *c;		if ( (charlen = t->char2uni(&nc, 1, uni)) < 0) {			*uni = 0x003f;	/* a question mark */			charlen = 1;		}	} else		*uni = wc;	return charlen;}static inline intfat_shortname2uni(struct nls_table *nls, unsigned char *buf, int buf_size,		  wchar_t *uni_buf, unsigned short opt, int lower){	int len = 0;	if (opt & VFAT_SFN_DISPLAY_LOWER)		len =  fat_short2lower_uni(nls, buf, buf_size, uni_buf);	else if (opt & VFAT_SFN_DISPLAY_WIN95)		len = fat_short2uni(nls, buf, buf_size, uni_buf);	else if (opt & VFAT_SFN_DISPLAY_WINNT) {		if (lower)			len = fat_short2lower_uni(nls, buf, buf_size, uni_buf);		else			len = fat_short2uni(nls, buf, buf_size, uni_buf);	} else		len = fat_short2uni(nls, buf, buf_size, uni_buf);	return len;}static inline int fat_name_match(struct msdos_sb_info *sbi,				 const unsigned char *a, int a_len,				 const unsigned char *b, int b_len){	if (a_len != b_len)		return 0;	if (sbi->options.name_check != 's')		return !nls_strnicmp(sbi->nls_io, a, b, a_len);	else		return !memcmp(a, b, a_len);}enum { PARSE_INVALID = 1, PARSE_NOT_LONGNAME, PARSE_EOF, };/** * fat_parse_long - Parse extended directory entry. * * This function returns zero on success, negative value on error, or one of * the following: * * %PARSE_INVALID - Directory entry is invalid. * %PARSE_NOT_LONGNAME - Directory entry does not contain longname. * %PARSE_EOF - Directory has no more entries. */static int fat_parse_long(struct inode *dir, loff_t *pos,			  struct buffer_head **bh, struct msdos_dir_entry **de,			  wchar_t **unicode, unsigned char *nr_slots){	struct msdos_dir_slot *ds;	unsigned char id, slot, slots, alias_checksum;	if (!*unicode) {		*unicode = __getname();		if (!*unicode) {			brelse(*bh);			return -ENOMEM;		}	}parse_long:	slots = 0;	ds = (struct msdos_dir_slot *)*de;	id = ds->id;	if (!(id & 0x40))		return PARSE_INVALID;	slots = id & ~0x40;	if (slots > 20 || !slots)	/* ceil(256 * 2 / 26) */		return PARSE_INVALID;	*nr_slots = slots;	alias_checksum = ds->alias_checksum;	slot = slots;	while (1) {		int offset;		slot--;		offset = slot * 13;		fat16_towchar(*unicode + offset, ds->name0_4, 5);		fat16_towchar(*unicode + offset + 5, ds->name5_10, 6);		fat16_towchar(*unicode + offset + 11, ds->name11_12, 2);		if (ds->id & 0x40)			(*unicode)[offset + 13] = 0;		if (fat_get_entry(dir, pos, bh, de) < 0)			return PARSE_EOF;		if (slot == 0)			break;		ds = (struct msdos_dir_slot *)*de;		if (ds->attr != ATTR_EXT)			return PARSE_NOT_LONGNAME;		if ((ds->id & ~0x40) != slot)			goto parse_long;		if (ds->alias_checksum != alias_checksum)			goto parse_long;	}	if ((*de)->name[0] == DELETED_FLAG)		return PARSE_INVALID;	if ((*de)->attr == ATTR_EXT)		goto parse_long;	if (IS_FREE((*de)->name) || ((*de)->attr & ATTR_VOLUME))		return PARSE_INVALID;	if (fat_checksum((*de)->name) != alias_checksum)		*nr_slots = 0;	return 0;}/* * Maximum buffer size of short name. * [(MSDOS_NAME + '.') * max one char + nul] * For msdos style, ['.' (hidden) + MSDOS_NAME + '.' + nul] */#define FAT_MAX_SHORT_SIZE	((MSDOS_NAME + 1) * NLS_MAX_CHARSET_SIZE + 1)/* * Maximum buffer size of unicode chars from slots. * [(max longname slots * 13 (size in a slot) + nul) * sizeof(wchar_t)] */#define FAT_MAX_UNI_CHARS	((MSDOS_SLOTS - 1) * 13 + 1)#define FAT_MAX_UNI_SIZE	(FAT_MAX_UNI_CHARS * sizeof(wchar_t))/* * Return values: negative -> error, 0 -> not found, positive -> found, * value is the total amount of slots, including the shortname entry. */int fat_search_long(struct inode *inode, const unsigned char *name,		    int name_len, struct fat_slot_info *sinfo){	struct super_block *sb = inode->i_sb;	struct msdos_sb_info *sbi = MSDOS_SB(sb);	struct buffer_head *bh = NULL;	struct msdos_dir_entry *de;	struct nls_table *nls_disk = sbi->nls_disk;	unsigned char nr_slots;	wchar_t bufuname[14];	wchar_t *unicode = NULL;	unsigned char work[MSDOS_NAME];	unsigned char bufname[FAT_MAX_SHORT_SIZE];	unsigned short opt_shortname = sbi->options.shortname;	loff_t cpos = 0;	int chl, i, j, last_u, err, len;	err = -ENOENT;	while (1) {		if (fat_get_entry(inode, &cpos, &bh, &de) == -1)			goto end_of_dir;parse_record:		nr_slots = 0;		if (de->name[0] == DELETED_FLAG)			continue;		if (de->attr != ATTR_EXT && (de->attr & ATTR_VOLUME))			continue;		if (de->attr != ATTR_EXT && IS_FREE(de->name))			continue;		if (de->attr == ATTR_EXT) {			int status = fat_parse_long(inode, &cpos, &bh, &de,						    &unicode, &nr_slots);			if (status < 0) {				err = status;				goto end_of_dir;			} else if (status == PARSE_INVALID)				continue;			else if (status == PARSE_NOT_LONGNAME)				goto parse_record;			else if (status == PARSE_EOF)				goto end_of_dir;		}		memcpy(work, de->name, sizeof(de->name));		/* see namei.c, msdos_format_name */		if (work[0] == 0x05)			work[0] = 0xE5;		for (i = 0, j = 0, last_u = 0; i < 8;) {			if (!work[i])				break;			chl = fat_shortname2uni(nls_disk, &work[i], 8 - i,						&bufuname[j++], opt_shortname,						de->lcase & CASE_LOWER_BASE);			if (chl <= 1) {				if (work[i] != ' ')					last_u = j;			} else {				last_u = j;			}			i += chl;		}		j = last_u;		fat_short2uni(nls_disk, ".", 1, &bufuname[j++]);		for (i = 8; i < MSDOS_NAME;) {			if (!work[i])				break;			chl = fat_shortname2uni(nls_disk, &work[i],						MSDOS_NAME - i,						&bufuname[j++], opt_shortname,						de->lcase & CASE_LOWER_EXT);			if (chl <= 1) {				if (work[i] != ' ')					last_u = j;			} else {				last_u = j;			}			i += chl;		}		if (!last_u)			continue;		/* Compare shortname */		bufuname[last_u] = 0x0000;		len = fat_uni_to_x8(sbi, bufuname, bufname, sizeof(bufname));		if (fat_name_match(sbi, name, name_len, bufname, len))			goto found;		if (nr_slots) {			void *longname = unicode + FAT_MAX_UNI_CHARS;			int size = PATH_MAX - FAT_MAX_UNI_SIZE;			/* Compare longname */			len = fat_uni_to_x8(sbi, unicode, longname, size);			if (fat_name_match(sbi, name, name_len, longname, len))				goto found;		}	}found:	nr_slots++;	/* include the de */	sinfo->slot_off = cpos - nr_slots * sizeof(*de);	sinfo->nr_slots = nr_slots;	sinfo->de = de;	sinfo->bh = bh;	sinfo->i_pos = fat_make_i_pos(sb, sinfo->bh, sinfo->de);	err = 0;end_of_dir:	if (unicode)		__putname(unicode);	return err;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
激情综合网av| 亚洲成a人片在线不卡一二三区| 欧美在线999| 成人网在线免费视频| 香蕉久久夜色精品国产使用方法 | 日韩三级视频在线观看| 欧美午夜精品理论片a级按摩| 成人永久aaa| 成人毛片在线观看| 国产一区二区久久| 国内偷窥港台综合视频在线播放| 日韩精品福利网| 免费观看在线综合| 免费欧美高清视频| 久久国产精品72免费观看| 天堂一区二区在线免费观看| 亚洲bt欧美bt精品777| 依依成人精品视频| 亚洲成av人片一区二区| 亚洲国产精品视频| 奇米色777欧美一区二区| 日韩和欧美一区二区| 丝袜美腿成人在线| 日本中文字幕一区二区视频| 免费黄网站欧美| 国内精品伊人久久久久av影院| 韩国一区二区视频| 国产精品亚洲一区二区三区妖精| 精品一区二区精品| 成人av在线一区二区三区| 波多野洁衣一区| 欧美三级乱人伦电影| 欧美一区二区三区在线视频| 欧美大片国产精品| 欧美极品另类videosde| 亚洲欧美日韩国产另类专区 | 亚洲国产精品精华液2区45| 国产精品天干天干在线综合| 一区二区三区中文在线观看| 亚洲大型综合色站| 国产精品影视天天线| 色综合咪咪久久| 在线电影欧美成精品| 国产视频在线观看一区二区三区| 国产精品欧美精品| 日产精品久久久久久久性色| 激情六月婷婷久久| 在线精品国精品国产尤物884a| 99精品欧美一区| 欧美电影免费观看高清完整版在线观看 | 国产精品久久久久9999吃药| 亚洲免费av网站| 久久er99热精品一区二区| 成人av电影在线观看| 91精品在线观看入口| 欧美激情中文不卡| 裸体一区二区三区| 99精品黄色片免费大全| 91精品国产综合久久久久久久| 欧美激情一区二区三区在线| 石原莉奈一区二区三区在线观看| 国产精品白丝jk黑袜喷水| 欧美日韩国产中文| 中文字幕日本不卡| 国产一区二区三区黄视频| 欧美日韩精品一区二区三区蜜桃 | 国内精品在线播放| 日本乱人伦一区| 国产清纯在线一区二区www| 午夜精品成人在线视频| 91麻豆精品在线观看| 国产视频一区在线播放| 久久er99热精品一区二区| 欧美视频精品在线观看| 亚洲天堂免费看| 国产 日韩 欧美大片| 精品久久国产老人久久综合| 亚洲成人资源在线| 欧美午夜寂寞影院| 一级精品视频在线观看宜春院| 粉嫩av一区二区三区在线播放| 精品免费国产一区二区三区四区| 亚洲6080在线| 欧美一区二区私人影院日本| 亚洲线精品一区二区三区八戒| 99国内精品久久| 亚洲欧美一区二区三区孕妇| 成人国产电影网| 中文文精品字幕一区二区| 高清国产午夜精品久久久久久| 精品99一区二区| 韩国av一区二区三区在线观看| 日韩一区二区精品葵司在线| 日韩成人一级片| 日韩欧美在线123| 黑人精品欧美一区二区蜜桃| 日韩美女视频在线| 99久久免费视频.com| 国产精品久久久久久久岛一牛影视 | 韩国成人精品a∨在线观看| 欧美一区二区视频在线观看| 久久99在线观看| 国产午夜精品美女毛片视频| 国产91高潮流白浆在线麻豆 | 成人黄色av网站在线| 国产精品超碰97尤物18| 在线观看日韩精品| 丝袜美腿亚洲色图| 国产香蕉久久精品综合网| 不卡一区中文字幕| 亚洲综合久久久| 欧美一区二区三区日韩视频| 国模娜娜一区二区三区| 国产精品毛片a∨一区二区三区| 成人av集中营| 日本欧美大码aⅴ在线播放| 久久亚洲免费视频| 在线视频亚洲一区| 狠狠色综合色综合网络| 成人免费小视频| 日韩一卡二卡三卡| 色综合久久久久久久久| 日本美女一区二区三区| 国产欧美一区二区在线观看| 欧美自拍丝袜亚洲| 国产美女视频一区| 亚洲一区二区欧美日韩| 久久伊人蜜桃av一区二区| 91麻豆成人久久精品二区三区| 亚洲第一综合色| 国产女同互慰高潮91漫画| 欧美肥妇毛茸茸| 波多野结衣中文一区| 亚洲激情网站免费观看| 日韩欧美精品在线| 91天堂素人约啪| 麻豆精品视频在线观看视频| 亚洲丰满少妇videoshd| 久久久综合九色合综国产精品| 欧美在线色视频| 另类小说色综合网站| 国产女人aaa级久久久级| 色婷婷综合久久久久中文 | 欧美国产日韩在线观看| 91亚洲午夜精品久久久久久| 久99久精品视频免费观看| 一卡二卡三卡日韩欧美| 国产精品免费视频观看| 久久久久久久久一| 日韩欧美国产午夜精品| 欧美四级电影在线观看| av高清久久久| 成人免费视频播放| 国产在线不卡一区| 美美哒免费高清在线观看视频一区二区| 日韩理论片在线| 国产欧美日本一区二区三区| 日韩一区二区三区精品视频| 在线观看91精品国产入口| 成人精品鲁一区一区二区| 国产美女主播视频一区| 极品美女销魂一区二区三区 | 欧美乱妇20p| 欧美日韩精品一区视频| 欧美日韩1区2区| 欧美精品第1页| 日韩一级片在线观看| 日韩三级伦理片妻子的秘密按摩| 欧美精品xxxxbbbb| 欧美成人艳星乳罩| 精品国产乱码久久久久久免费| 欧美少妇xxx| 91精品一区二区三区久久久久久| 欧美久久久久久久久中文字幕| 欧美日韩精品一区二区| 欧美精品久久天天躁| 91精品国产黑色紧身裤美女| 制服丝袜亚洲色图| 日韩久久免费av| 国产午夜一区二区三区| 最新热久久免费视频| 亚洲黄色小视频| 亚瑟在线精品视频| 久久疯狂做爰流白浆xx| 日韩在线一区二区三区| 日韩电影免费在线| 亚洲一区二区在线免费看| 免费观看一级欧美片| 免费在线视频一区| 久久精品国产第一区二区三区| 国产亚洲视频系列| 亚洲欧美日韩一区二区 | 日本道精品一区二区三区| 欧美日韩在线观看一区二区 | 欧美日韩国产综合视频在线观看| 在线视频一区二区三| 欧美电视剧在线观看完整版| 欧美日韩日本视频| 久久久久88色偷偷免费| 最新国产の精品合集bt伙计|