Ai
1 Star 0 Fork 0

收拾旧河山/ extmem-c-database-query-processing

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
extmem.h 1.61 KB
一键复制 编辑 原始数据 按行查看 历史
收拾旧河山 提交于 2022-12-26 20:38 +08:00 . done
/*
* 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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Hmount/extmem-c-database-query-processing.git
git@gitee.com:Hmount/extmem-c-database-query-processing.git
Hmount
extmem-c-database-query-processing
extmem-c-database-query-processing
master

搜索帮助