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

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

?? fatfs.c

?? 這是DOS操作系統(tǒng)啟動的源代碼 里面是匯編語言 包括了部分的驅(qū)動程序
?? C
?? 第 1 頁 / 共 4 頁
字號:
/****************************************************************/
/*                                                              */
/*                          fatfs.c                             */
/*                           DOS-C                              */
/*                                                              */
/*                 FAT File System I/O Functions                */
/*                                                              */
/*                      Copyright (c) 1995                      */
/*                      Pasquale J. Villani                     */
/*                      All Rights Reserved                     */
/*                                                              */
/* This file is part of DOS-C.                                  */
/*                                                              */
/* DOS-C is free software; you can redistribute it and/or       */
/* modify it under the terms of the GNU General Public License  */
/* as published by the Free Software Foundation; either version */
/* 2, or (at your option) any later version.                    */
/*                                                              */
/* DOS-C 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 General Public License for more details.             */
/*                                                              */
/* You should have received a copy of the GNU General Public    */
/* License along with DOS-C; see the file COPYING.  If not,     */
/* write to the Free Software Foundation, 675 Mass Ave,         */
/* Cambridge, MA 02139, USA.                                    */
/****************************************************************/

#include "../../hdr/portab.h"
#include "globals.h"


#ifdef VERSION_STRINGS
BYTE *RcsId = "$Header:   C:/dos-c/src/fs/fatfs.c_v   1.12   03 Feb 1998 11:28:04   patv  $";
#endif

/* $Log:   C:/dos-c/src/fs/fatfs.c_v  $
 * 
 *    Rev 1.12   03 Feb 1998 11:28:04   patv
 * Fixed lseek bug.
 * 
 *    Rev 1.11   22 Jan 1998  5:38:08   patv
 * Corrected remaining file name and extension copies that did not
 * account for far file nodes due to allocated FILES= spec.
 * 
 *    Rev 1.10   22 Jan 1998  4:09:00   patv
 * Fixed pointer problems affecting SDA
 * 
 *    Rev 1.9   04 Jan 1998 23:14:40   patv
 * Changed Log for strip utility
 * 
 *    Rev 1.8   04 Jan 1998 17:24:14   patv
 * Corrected subdirectory bug
 * 
 *    Rev 1.7   03 Jan 1998  8:36:04   patv
 * Converted data area to SDA format
 * 
 *    Rev 1.6   22 Jan 1997 13:00:30   patv
 * pre-0.92 bug fixes
 * 
 *    Rev 1.5   16 Jan 1997 12:46:24   patv
 * pre-Release 0.92 feature additions
 * 
 *    Rev 1.4   29 May 1996 21:15:16   patv
 * bug fixes for v0.91a
 * 
 *    Rev 1.3   19 Feb 1996  3:20:10   patv
 * Added NLS, int2f and config.sys processing
 * 
 *    Rev 1.2   01 Sep 1995 17:48:40   patv
 * First GPL release.
 * 
 *    Rev 1.1   30 Jul 1995 20:50:24   patv
 * Eliminated version strings in ipl
 * 
 *    Rev 1.0   02 Jul 1995  8:04:46   patv
 * Initial revision.
 */
/* $EndLog$ */


/*                                                                      */
/*      function prototypes                                             */
/*                                                                      */
struct f_node FAR *xlt_fd(COUNT);
COUNT xlt_fnp(struct f_node FAR *);
struct f_node FAR *split_path(BYTE FAR *, BYTE *, BYTE *, BYTE *);
BOOL find_fname(struct f_node FAR *, BYTE *, BYTE *);
date dos_getdate(VOID);
time dos_gettime(VOID);
BOOL find_free(struct f_node FAR *);
UWORD find_fat_free(struct f_node FAR *);
VOID wipe_out(struct f_node FAR *);
BOOL last_link(struct f_node FAR *);
BOOL extend(struct f_node FAR *);
COUNT extend_dir(struct f_node FAR *);
BOOL first_fat(struct f_node FAR *);
COUNT map_cluster(struct f_node FAR *, COUNT);


/************************************************************************/
/*                                                                      */
/*      Internal file handlers - open, create, read, write, close, etc. */
/*                                                                      */
/************************************************************************/

/* Open a file given the path. Flags is 0 for read, 1 for write and 2   */
/* for update.                                                          */
/* Returns an integer file desriptor or a negative error code           */

COUNT 
dos_open (BYTE FAR *path, COUNT flag)
{
	REG struct f_node FAR *fnp;
	COUNT i;
	BYTE FAR *fnamep;

	/* First test the flag to see if the user has passed a valid    */
	/* file mode...                                                 */
	if(flag < 0 || flag > 2)
		return DE_INVLDACC;

	/* first split the passed dir into comopnents (i.e. - path to   */
	/* new directory and name of new directory.                     */
	if((fnp = split_path(path, szDirName, szFileName, szFileExt)) == NULL)
	{
		dir_close(fnp);
		return DE_PATHNOTFND;
	}

	/* Look for the file. If we can't find it, just return a not    */
	/* found error.                                                 */
	if(!find_fname(fnp, szFileName, szFileExt))
	{
		dir_close(fnp);
		return DE_FILENOTFND;
	}

	/* Set the fnode to the desired mode                            */
	fnp -> f_mode = flag;

	/* Initialize the rest of the fnode.                            */
	fnp -> f_offset = 0l;
	fnp -> f_highwater = fnp -> f_dir.dir_size;

	fnp -> f_back = LONG_LAST_CLUSTER;
	fnp -> f_cluster = fnp -> f_dir.dir_start;

	fnp -> f_flags.f_dmod = FALSE;
	fnp -> f_flags.f_dnew = FALSE;
	fnp -> f_flags.f_ddir = FALSE;

	return xlt_fnp(fnp);
}


#ifndef IPL
BOOL fcmp(s1, s2, n)
BYTE FAR *s1, FAR *s2;
COUNT n;
{
	while(n--)
		if(*s1++ != *s2++)
			return FALSE;
	return TRUE;
}


BOOL fcmp_wild(s1, s2, n)
BYTE FAR *s1, FAR *s2;
COUNT n;
{
	while(n--)
	{
		if(*s1 == '?')
		{
			++s1, ++s2;
			continue;
		}
		if(*s1++ != *s2++)
			return FALSE;
	}
	return TRUE;
}
#endif


COUNT 
dos_close (COUNT fd)
{
	struct f_node FAR *fnp;

	/* Translate the fd into a useful pointer                       */
	fnp = xlt_fd(fd);

	/* If the fd was invalid because it was out of range or the     */
	/* requested file was not open, tell the caller and exit        */
	/* note: an invalid fd is indicated by a 0 return               */
	if(fnp == (struct f_node FAR *)0 || fnp -> f_count <= 0)
		return DE_INVLDHNDL;
	if(fnp -> f_mode != RDONLY)
	{
		fnp -> f_dir.dir_size = fnp -> f_highwater;
		fnp -> f_flags.f_dmod = TRUE;
	}
	fnp -> f_flags.f_ddir = TRUE;
	
	dir_close(fnp);
	return SUCCESS;
}


/*                                                                      */
/* split a path into it's component directory and file name             */
/*                                                                      */
static struct f_node FAR *
split_path (BYTE FAR *path, BYTE *dname, BYTE *fname, BYTE *fext)
{
	REG struct f_node FAR *fnp;
	COUNT nDrive;
	struct dpb *dpbp;
	

	/* Start off by parsing out the components.			*/
	ParseDosName(adjust_far(path), &nDrive, &dname[2], fname, fext);
	if(nDrive < 0)
		nDrive = default_drive;
	dname[0] = 'A' + nDrive;
	dname[1] = ':';

	/* Add trailing spaces to the file name and extension		*/
	SpacePad(fname, FNAME_SIZE);
	SpacePad(fext, FEXT_SIZE);
	
	/* If the path is null, we to default to the current            */
	/* directory...                                                 */
	if(!dname[2])
	{
		dpbp = &blk_devices[nDrive];
		fsncopy((BYTE FAR *)dpbp -> dpb_path,
		        (BYTE FAR *)&dname[2],
		        PARSE_MAX);
	}

	/* Translate the path into a useful pointer                     */
	fnp = dir_open((BYTE FAR *)dname);

	/* If the fd was invalid because it was out of range or the     */
	/* requested file was not open, tell the caller and exit...     */
	/* note: an invalid fd is indicated by a 0 return               */
	if(fnp == (struct f_node FAR *)0 || fnp -> f_count <= 0)
	{
		dir_close(fnp);
		return (struct f_node FAR *)0;
	}

	/* Convert the name into an absolute name for comparison...     */
	upMem((BYTE FAR *)dname, strlen(dname));
	upMem((BYTE FAR *)fname, FNAME_SIZE);
	upMem((BYTE FAR *)fext, FEXT_SIZE);

	return fnp;
}



static BOOL 
find_fname (struct f_node FAR *fnp, BYTE *fname, BYTE *fext)
{
	BOOL found = FALSE;

	while(dir_read(fnp) == DIRENT_SIZE)
	{
		if(fnp -> f_dir.dir_name[0] != '\0')
		{
			if(fnp -> f_dir.dir_name[0] == DELETED)
				continue;
			if(fcmp((BYTE FAR *)fname, (BYTE FAR *)fnp -> f_dir.dir_name, FNAME_SIZE)
			&& fcmp((BYTE FAR *)fext, (BYTE FAR *)fnp -> f_dir.dir_ext, FEXT_SIZE))
			{
				found = TRUE;
				break;
			}
		}
	}
	return found;
}


#ifndef IPL
COUNT 
dos_creat (BYTE FAR *path, COUNT attrib)
{
	REG struct f_node FAR *fnp;

	/* first split the passed dir into comopnents (i.e. -   */
	/* path to new directory and name of new directory      */
	if((fnp = split_path(path, szDirName, szFileName, szFileExt)) == NULL)
	{
		dir_close(fnp);
		return DE_PATHNOTFND;
	}

	/* Check that we don't have a duplicate name, so if we  */
	/* find one, truncate it.                               */
	if(find_fname(fnp, szFileName, szFileExt))
	{
		/* The only permissable attribute is archive,   */
		/* check for any other bit set. If it is, give  */
		/* an access error.                             */
		if((fnp -> f_dir.dir_attrib & (D_RDONLY | D_DIR | D_VOLID))
		   || (fnp -> f_dir.dir_attrib & ~D_ARCHIVE & ~attrib))
		{
			dir_close(fnp);
			return DE_ACCESS;
		}

		/* Release the existing files FAT and set the   */
		/* length to zero, effectively truncating the   */
		/* file to zero.                                */
		wipe_out(fnp);

	}
	else
	{
		BOOL is_free;
		REG COUNT idx;
		struct buffer FAR *bp;
		BYTE FAR *p;

		/* Reset the directory by a close followed by   */
		/* an open                                      */
		fnp -> f_flags.f_dmod = FALSE;
		dir_close(fnp);
		fnp = dir_open((BYTE FAR *)szDirName);

		/* Get a free f_node pointer so that we can use */
		/* it in building the new file.                 */
		/* Note that if we're in the root and we don't  */
		/* find an empty slot, we need to abort.        */
		if(!(is_free = find_free(fnp)) && (fnp -> f_flags.f_droot))
		{
			fnp -> f_flags.f_dmod = FALSE;
			dir_close(fnp);
			return DE_TOOMANY;
		}

		/* Otherwise just expand the directory          */
		else if(!is_free && !(fnp -> f_flags.f_droot))
		{
			COUNT ret;

			if((ret = extend_dir(fnp)) != SUCCESS)
				return ret;
		}

		/* put the fnode's name into the directory.             */
		fbcopy((BYTE FAR *)szFileName,
		 (BYTE FAR *)fnp -> f_dir.dir_name, FNAME_SIZE);
		fbcopy((BYTE FAR *)szFileExt,
		 (BYTE FAR *)fnp -> f_dir.dir_ext, FEXT_SIZE);
	}
	/* Set the fnode to the desired mode                    */
	/* Updating the directory entry first.                  */
	fnp -> f_mode = RDWR;

	fnp -> f_dir.dir_size = 0l;
	fnp -> f_dir.dir_start = FREE;
	fnp -> f_dir.dir_attrib = attrib | D_ARCHIVE;
	fnp -> f_dir.dir_time = dos_gettime();
	fnp -> f_dir.dir_date = dos_getdate();

	fnp -> f_flags.f_dmod = TRUE;
	fnp -> f_flags.f_dnew = FALSE;
	fnp -> f_flags.f_ddir = TRUE;
	if(dir_write(fnp) != DIRENT_SIZE)
	{
		release_f_node(fnp);
		return DE_ACCESS;
	}

	/* Now change to file                                   */
	fnp -> f_offset = 0l;
	fnp -> f_highwater = 0l;

	fnp -> f_back = LONG_LAST_CLUSTER;
	fnp -> f_cluster = fnp -> f_dir.dir_start = FREE;
	fnp -> f_flags.f_dmod = TRUE;
	fnp -> f_flags.f_dnew = FALSE;
	fnp -> f_flags.f_ddir = FALSE;

	return xlt_fnp(fnp);
}


COUNT 
dos_delete (BYTE FAR *path)
{
	REG struct f_node FAR *fnp;

	/* first split the passed dir into components (i.e. -	*/
	/* path to new directory and name of new directory	*/
	if((fnp = split_path(path, szDirName, szFileName, szFileExt)) == NULL)
	{
		dir_close(fnp);
		return DE_PATHNOTFND;
	}

	/* Check that we don't have a duplicate name, so if we  */
	/* find one, it's an error.                             */
	if(find_fname(fnp, szFileName, szFileExt))
	{
		/* The only permissable attribute is archive,   */
		/* check for any other bit set. If it is, give  */
		/* an access error.                             */
		if(fnp -> f_dir.dir_attrib & ~D_ARCHIVE)
		{
			dir_close(fnp);
			return DE_ACCESS;
		}

		/* Ok, so we can delete. Start out by           */
		/* clobbering all FAT entries for this file     */
		/* (or, in English, truncate the FAT).          */
		wipe_out(fnp);
		fnp -> f_dir.dir_size = 0l;
		*(fnp -> f_dir.dir_name) = DELETED;

		/* The directory has been modified, so set the  */
		/* bit before closing it, allowing it to be     */
		/* updated                                      */
		fnp -> f_flags.f_dmod = TRUE;
		dir_close(fnp);

		/* SUCCESSful completion, return it             */
		return SUCCESS;
	}
	else
	{
		/* No such file, return the error               */ 
		dir_close(fnp);
		return DE_FILENOTFND;
	}
}


COUNT 
dos_rmdir (BYTE FAR *path)
{
	REG struct f_node FAR *fnp;
	REG struct f_node FAR *fnp1;
	BOOL found;

	/* first split the passed dir into comopnents (i.e. -   */
	/* path to new directory and name of new directory      */
	if((fnp = split_path(path, szDirName, szFileName, szFileExt)) == NULL)
	{
		dir_close(fnp);
		return DE_PATHNOTFND;
	}

	/* Check that we're not trying to remove the root!      */
	if((path[0] == '\\') && (path[1] == NULL))
	{
		dir_close(fnp);
		return DE_ACCESS;
	}

	/* Check that we don't have a duplicate name, so if we  */
	/* find one, it's an error.                             */
	if(find_fname(fnp, szFileName, szFileExt))
	{
		/* The only permissable attribute is directory, */
		/* check for any other bit set. If it is, give  */
		/* an access error.                             */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久成人免费网站| 欧美三级视频在线| 91麻豆国产在线观看| 欧美精品国产精品| 日本一区二区在线不卡| 日韩av不卡一区二区| 一本大道久久精品懂色aⅴ| 欧美v亚洲v综合ⅴ国产v| 亚洲自拍另类综合| 岛国精品一区二区| 欧美变态tickling挠脚心| 亚洲国产视频a| 99国内精品久久| 久久亚洲综合av| 午夜精品久久久久影视| 97se亚洲国产综合在线| 26uuu亚洲综合色欧美 | 午夜av电影一区| 不卡在线视频中文字幕| 精品免费国产二区三区| 三级亚洲高清视频| 欧美综合欧美视频| 亚洲日穴在线视频| aaa亚洲精品| 国产精品高潮久久久久无| 国产精品123| 国产女同性恋一区二区| 国模冰冰炮一区二区| 日韩一级完整毛片| 日韩av在线免费观看不卡| 欧美日韩一区高清| 亚洲超碰精品一区二区| 欧美成va人片在线观看| 日韩精彩视频在线观看| 欧美日韩国产区一| 午夜精品在线看| 欧美一区二区三区视频免费 | jlzzjlzz亚洲日本少妇| 国产欧美日韩亚州综合| 成人妖精视频yjsp地址| 久久久美女毛片| 成人黄色av电影| 国产精品狼人久久影院观看方式| 成人精品电影在线观看| 国产精品欧美经典| 成人综合日日夜夜| 国产精品成人一区二区艾草| 91在线观看美女| 一区二区不卡在线视频 午夜欧美不卡在| 成人激情免费视频| 亚洲另类在线一区| 欧美性猛交xxxxxx富婆| 午夜精品福利久久久| 日韩一区二区在线播放| 经典三级在线一区| 国产精品色在线观看| 91玉足脚交白嫩脚丫在线播放| 亚洲色图欧洲色图| 这里是久久伊人| 国产精品白丝jk黑袜喷水| 欧美激情一区二区三区| 91色综合久久久久婷婷| 亚洲电影在线免费观看| 欧美电影免费观看高清完整版在 | 亚洲天天做日日做天天谢日日欢| 99热这里都是精品| 亚洲成人777| 久久天天做天天爱综合色| 91在线播放网址| 久久精品国产99久久6| 国产精品福利电影一区二区三区四区 | 日韩欧美一区在线观看| 国产91精品一区二区| 一个色在线综合| 欧美r级在线观看| 91蝌蚪porny九色| 精品一区二区在线播放| 亚洲精品五月天| 久久久亚洲午夜电影| 在线观看亚洲专区| 国产成人一区在线| 日本三级韩国三级欧美三级| 中文字幕视频一区| 欧美一区二区免费观在线| 99久久er热在这里只有精品66| 奇米精品一区二区三区在线观看一| 国产女人18水真多18精品一级做| 久久久不卡网国产精品二区| 成人av网站免费| 韩国成人在线视频| 亚洲v中文字幕| 国产精品国产三级国产普通话蜜臀 | 国产精品久久久久毛片软件| 欧美精品丝袜中出| 99精品视频中文字幕| 国产揄拍国内精品对白| 亚洲国产成人高清精品| 国产精品国产三级国产aⅴ入口 | 欧美视频精品在线| 成人激情图片网| 国产在线精品一区二区夜色| 午夜欧美大尺度福利影院在线看| 欧美国产禁国产网站cc| 久久先锋影音av| 精品嫩草影院久久| 欧美一卡2卡3卡4卡| 欧美三级在线视频| 一本色道久久综合精品竹菊| www.66久久| 国产91丝袜在线播放| 国产一区二区三区免费看| 精品一区二区在线视频| 美女视频一区二区| 蜜桃av一区二区三区电影| 三级在线观看一区二区| 天天色图综合网| 日韩激情一区二区| 免费观看久久久4p| 老司机精品视频线观看86| 婷婷久久综合九色综合绿巨人 | 91九色02白丝porn| 欧美亚州韩日在线看免费版国语版| 成人av第一页| 91视频免费观看| 91久久久免费一区二区| 在线亚洲免费视频| 欧美在线观看视频在线| 欧美亚洲愉拍一区二区| 欧美一区二区三区性视频| 日韩午夜精品电影| 久久婷婷久久一区二区三区| 国产三级一区二区| 亚洲欧美怡红院| 亚洲高清久久久| 青青草成人在线观看| 国内精品伊人久久久久av一坑| 国产一区二区三区视频在线播放 | 捆绑调教美女网站视频一区| 图片区小说区区亚洲影院| 人禽交欧美网站| 国产精品456| 99国产一区二区三精品乱码| 欧美无砖专区一中文字| 日韩一区二区三区高清免费看看 | 久久精品国产精品亚洲综合| 韩国v欧美v亚洲v日本v| 91尤物视频在线观看| 欧美精品v日韩精品v韩国精品v| 日韩一区二区三区在线视频| 欧美激情一区二区三区不卡| 久久99国产乱子伦精品免费| 国产不卡视频一区二区三区| 色综合天天在线| 在线综合+亚洲+欧美中文字幕| 久久精品一区二区三区四区| 亚洲精品中文在线| 韩国一区二区三区| 色呦呦日韩精品| 欧美精品一区男女天堂| 亚洲色欲色欲www| 蜜臀99久久精品久久久久久软件| 春色校园综合激情亚洲| 在线播放中文一区| 国产精品久久久久一区| 亚洲视频中文字幕| 久久精品国产亚洲高清剧情介绍| 成年人午夜久久久| 欧美电视剧在线看免费| 亚洲欧美日韩久久精品| 国产精品影音先锋| 69av一区二区三区| 亚洲免费观看高清| 国产精品123| 精品欧美一区二区三区精品久久| 一区二区三区在线不卡| 国产福利一区二区三区视频在线| 欧美日韩黄色一区二区| 国产精品免费视频一区| 国精产品一区一区三区mba桃花| 欧洲一区二区三区免费视频| 亚洲国产精品传媒在线观看| 蜜臀精品久久久久久蜜臀| 色成年激情久久综合| 久久影院午夜论| 久久不见久久见免费视频7| 欧美日韩一二区| 亚洲精品videosex极品| k8久久久一区二区三区| 国产精品水嫩水嫩| 国产激情视频一区二区在线观看 | 亚洲欧美综合另类在线卡通| 国产乱码精品一区二区三区忘忧草 | 欧美久久一二区| 一区二区欧美在线观看| av一区二区三区四区| 国产精品麻豆欧美日韩ww| 国产91丝袜在线播放0| 国产女主播一区| 不卡大黄网站免费看| 亚洲欧洲日产国码二区|