📄 hashfile.h
字号:
/*************************************************************************** * Copyright (C) 2004 by root * * root@simplemepis * * * * This program 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 of the License, or * * (at your option) any later version. * * * * This program 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 this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/#include <unistd.h>#define COLLISIONFACTOR 0.5struct HashFileHeader{ int sig;//file signature int reclen;//record length int total_rec_num;//total record num; int current_rec_num;//current record num,if current_record_num<total_rec_num,there are free record};struct CFTag{ char collision;//collision count char free;//free tag,0 is free,1 is occupied};int hashfile_creat(const char *filename,mode_t mode,int reclen,int recnum);//int hashfile_open(const char *filename,int flags);int hashfile_open(const char *filename,int flags, mode_t mode);int hashfile_close(int fd);int hashfile_read(int fd,int keyoffset,int keylen,void *buf);int hashfile_write(int fd,int keyoffset,int keylen,void *buf);int hashfile_delrec(int fd,int keyoffset,int keylen,void *buf);int hashfile_findrec(int fd,int keyoffset,int keylen,void *buf);int hashfile_saverec(int fd,int keyoffset,int keylen,void *buf);int hash(int keyoffset,int keylen,void *buf,int recnum);int checkHashFileFull(int fd);int readHashFileHeader(int fd,struct HashFileHeader *hfh );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -