代码拉取完成,页面将自动刷新
/*
* extmem.h
* Zhaonian Zou
* Harbin Institute of Technology
* Jun 22, 2011
*/
#ifndef EXTMEM_H
#define EXTMEM_H
#define BLOCK_AVAILABLE 0
#define BLOCK_UNAVAILABLE 1
typedef struct tagBuffer {
unsigned long numIO; // 外存 I/O 次数
size_t bufSize; // 缓冲区大小(单位:字节)
size_t blkSize; // 块的大小(单位:字节)
size_t numAllBlk; // 缓冲区内可存放的最多块数
size_t numFreeBlk; // 缓冲区内可用的块数
unsigned char *data; // 缓冲区内存区域
} Buffer;
/* Initialize a buffer with the specified buffer size and block size.
* If the initialization fails, the return value is NULL;
* otherwise the pointer to the buffer.
*/
Buffer *initBuffer(size_t bufSize, size_t blkSize, Buffer *buf);
/* Free the memory used by a buffer. */
void freeBuffer(Buffer *buf);
/* Apply for a new block from a buffer.
* If no free blocks are available in the buffer,
* then the return value is NULL; otherwise the pointer to the block.
*/
unsigned char *getNewBlockInBuffer(Buffer *buf);
/* Set a block in a buffer to be available. */
void freeBlockInBuffer(unsigned char *blk, Buffer *buf);
/* Drop a block on the disk */
int dropBlockOnDisk(unsigned int addr);
/* Read a block from the hard disk to the buffer by the address of the block. */
unsigned char *readBlockFromDisk(unsigned int addr, Buffer *buf);
/* Read a block in the buffer to the hard disk by the address of the block. */
int writeBlockToDisk(unsigned char *blkPtr, unsigned int addr, Buffer *buf);
#endif // EXTMEM_H
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。