⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vfs.h

📁 凌阳SPCE3200 系统开发板随机自带源程序。共安排了32个子目录
💻 H
字号:
#ifndef __VFS_H__
#define __VFS_H__
#define	UFAT_VERSION		0x100

typedef struct fmt_t
{
	tFatType fat_type;
	BOOL force_mbr;
	/* 1:force to format MBR mode; 0: normal format mode; */
	INT8 SecPerClusVal; /* 1 ~ 64 , -1 for Microsoft default */
	INT32 hidden_sectors; /* hidden , -1 for default */
} st_fmt;

/* interface function names list */
#if POSIX_NAME
#define ufat_open			open
#define ufat_read			read
#define ufat_write			write
#define ufat_lseek			lseek
#define ufat_tell			tell
#define ufat_close			close
#define ufat_move			rename
#define ufat_stat			stat
#define ufat_unlink			unlink
#define ufat_chdir			chdir
#define ufat_mkdir			mkdir1
#define ufat_rmdir			rmdir
#define ufat_getcwd			getcwd
#endif

/* posix interface api */
int ufat_open (char * path, int open_flag, ...);
int ufat_read(int fd, void *buf,int size);
int ufat_write(int fd,void *buf, int size); 
long ufat_lseek(int fd, long offset, int fromwhere);
long ufat_tell(int fd);
int ufat_close(int fd);
int ufat_move(char *oldname, char *newname);
int ufat_stat( char *filename, struct ufat3_stat *statbuf); 
int ufat_fstat (int fd, struct ufat3_stat * buf)	;
int ufat_unlink(char *filename);
int ufat_chdir(char *path);
int ufat_mkdir(char *pathname);
int ufat_rmdir(char *pathname);
char *ufat_getcwd( char *buffer, int maxlen );
//int ufat_format(unsigned char, st_fmt *);
int ufat_format (unsigned char drv, unsigned char fstype)	;
int ufat_getfserrcode(void);
/* other ufat api function name list */
#if OLD_API_NAME
#define ufat_mount				mount
#define ufat_unmount			unmount
#define ufat_clsfserrcode		_clsfserrcode
#define ufat_ctime				_ctime
#define ufat_deleteall			_deleteall
#define ufat_deviceinfoget		_deviceinfoget
#define ufat_findfirst			_findfirst
#define ufat_findnext			_findnext
#define ufat_format				_format
#define ufat_fsinit				_fsinit
#define ufat_fstat				_fstat
#define ufat_getdiskfree		_getdiskfree
#define ufat_getfserrcode		_getfserrcode
#define ufat_getfstat			_getfstat
#endif	/* function name switch list end */

int ufat_findfirst (char * name, struct f_info * f_info, char attr);
int ufat_findnext (struct f_info * f_info);

int ufat_mount(unsigned char dsk);
int ufat_unmount(unsigned char dsk);
void ufat_clsfserrcode(void);
//ufat_ctime
int ufat_deleteall(char *pathname);
long vfsFreeSpace(unsigned char driver);
void dosSimDir(void);
void unixSimls(void); 
int ufat_copy(char *path1,char *path2); 
int dma_copy(char *path1,char *path2); 
int fs_openByID(struct file_id* pf_id, int open_flag, unsigned attrib);
int fs_cdByID(struct file_id* pf_id);

struct _diskfree_t {
	unsigned long total_clusters;
	unsigned long avail_clusters;
	unsigned long sectors_per_cluster;
	unsigned long bytes_per_sector;
};

#define FORMAT_MBR		0x10
#define FORMAT_FAT32	0x02
#define FORMAT_FAT16	0x01

#define SEEK_SET     0 /* offset from beginning of the file*/
#define SEEK_CUR     1 /* offset from current location     */
#define SEEK_END     2 /* offset from eof  */
/*-----------------  open flags (the 3rd parameter) --------------------*/
#define	_S_IREAD	0x0400	/* Read by owner.  */
#define	_S_IWRITE	0x0200	/* Write by owner.  */

#endif
/*-----------------------------------------------------*/
/* File attribute constants for _findfirst() */

#define _A_NORMAL       0x00    /* Normal file - No read/write restrictions */
#define _A_RDONLY       0x01    /* Read only file */
#define _A_HIDDEN       0x02    /* Hidden file */
#define _A_SYSTEM       0x04    /* System file */
#define _A_SUBDIR       0x10    /* Subdirectory */
#define _A_ARCH         0x20    /* Archive file */

//----------------------------------

//----------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -