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

📄 dskblk.h

📁 PDA上的CF CARD 文件系统的建立程式
💻 H
字号:
/**************************************************************
;*                                                            *
;*	      INSTUTITE FOR INFORMATION INDUSTRY              *
;*             DISK BLOCK HEADER -- RAMDISK 4.0		      *
;*		       November 01, 1999                      *
;*                                                            *
;*************************************************************/
#ifndef _DISK_BLOCK_H
#define _DISK_BLOCK_H


/*************************************************************
Function: initBlock
Description:
	initialize the RAMDisk memory pool
Input:
	size - the size of the memory pool
Output:
**************************************************************/
//void initBlock(unsigned long size);


/*************************************************************
Function: RD_getBlock
Description:
	get a disk block of specified size from the RAMDisk memory pool
Input:
	size - the required size
Output:
	NON NULL - the pointer to the allocated disk block
	NULL	 - allocation failed
**************************************************************/
void *RD_getBlock(unsigned long wantSize);
void *RD_getBlock_r(unsigned long wantSize);


/*************************************************************
Function: RD_freeBlock
Description:
	release a disk block back to the RAMDisk memory pool
Input:
	block - the block that is going to be released
Output:
**************************************************************/
void RD_freeBlock(void *block);
void RD_freeBlock_r(void *block);


/*************************************************************
Function: readBlock
Description:
	read a file block from RAMDisk to buffer
Input:
	block - the target block
	buffer - the specific buffer
	compress - 1: compression on; 0: compression off
Output:
	the size of the uncompressed data read
	-1 - read failure
Notes:

**************************************************************/
//long readBlock(struct diskBlock *block, unsigned char *buffer, int compress);



/*************************************************************
Function: writeBlock
Description:
	write a file block from buffer to RAMDisk
Input:
	block - the specific block
	buffer - the target buffer
	size - the amount of data to be written
	compress -  1: compression on; 0: compression off
Output:
	the size of the uncompressed data written
	-1 - write failure
Notes:
	the buffer content will become compressed after writing.
	Make sure that the buffer information in the file handle
	is set to invalid.
**************************************************************/
//struct diskBlock *writeBlock(struct diskBlock *block, unsigned char *buffer, long size, int compress);



/*************************************************************
Function: RD_freeBlockLink
Description:
	free all blocks in a file block link
Input:
	startBlock - the starting block in the link
Output:
	NONE
**************************************************************/
void RD_freeBlockLink(struct diskBlock *startBlock);



/*************************************************************
Function: RD_truncateBlock
Description:
	truncate a block
Input:
	block - the target block
	newSize - the new size of the block
Output:
	NONE
**************************************************************/
struct diskBlock *RD_truncateBlock(struct diskBlock *block, unsigned long newSize);
struct diskBlock *RD_truncateBlock_r(struct diskBlock *block, unsigned long newSize);



/*************************************************************
Function: RD_checkBlockLocation
Description:
	check if the starting address of a block is valid
Input:
	targetBlock - the starting address of the target block
Output:
	 0 - the location is valid
	-1 - the location is invalid
**************************************************************/
int RD_checkBlockLocation(struct diskBlock *targetBlock);


/*************************************************************
Fuction : RD_writeBlockChecksum
	write a check sum for a block
Input:
	block - the block which will be filled with a checksum
Output:
        0: no error is found
       -1: error
**************************************************************/
int RD_writeBlockChecksum(struct diskBlock* blk);

/*************************************************************
Function : RD_checkBlockChecksum
	write a check sum for a block
Input:
	block - the block which will be filled with a checksum
Output:
        0: no error is found
       -1: error
**************************************************************/
int RD_checkBlockChecksum(struct diskBlock* blk);


/**** added by chilong 01/31/2002 ****/
/*************************************************************
Function: RD_freeUnusedMemory
Description:
	check if the file is being opened
Input:
	pfile
Output:
	1: open
	0: not open
**************************************************************/
void RD_freeUnusedMemory();
/**** added by chilong 01/31/2002 ****/

#endif

⌨️ 快捷键说明

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