当前位置: 技术问答>linux和unix
关于qmail源码中的cdb_seek函数问题
来源: 互联网 发布时间:2016-02-11
本文导语: 这个函数我始终看不懂它要实现一个什么功能,请高手帮忙解答下 这个函数我始终看不懂它要实现一个什么功能,请高手帮忙解答 int cdb_seek(fd,key,len,dlen) int fd; char *key; unsigned int len; uint32 *dlen; { char packbuf[8]; ...
这个函数我始终看不懂它要实现一个什么功能,请高手帮忙解答下
这个函数我始终看不懂它要实现一个什么功能,请高手帮忙解答
int cdb_seek(fd,key,len,dlen)
int fd;
char *key;
unsigned int len;
uint32 *dlen;
{
char packbuf[8];
uint32 pos;
uint32 h;
uint32 lenhash;
uint32 h2;
uint32 loop;
uint32 poskd;
h = cdb_hash(key,len);
pos = 8 * (h & 255);
if (lseek(fd,(off_t) pos,SEEK_SET) == -1) return -1;
if (cdb_bread(fd,packbuf,8) == -1) return -1;
pos = cdb_unpack(packbuf);
lenhash = cdb_unpack(packbuf + 4);
if (!lenhash) return 0;
h2 = (h >> 8) % lenhash;
for (loop = 0;loop
这个函数我始终看不懂它要实现一个什么功能,请高手帮忙解答
int cdb_seek(fd,key,len,dlen)
int fd;
char *key;
unsigned int len;
uint32 *dlen;
{
char packbuf[8];
uint32 pos;
uint32 h;
uint32 lenhash;
uint32 h2;
uint32 loop;
uint32 poskd;
h = cdb_hash(key,len);
pos = 8 * (h & 255);
if (lseek(fd,(off_t) pos,SEEK_SET) == -1) return -1;
if (cdb_bread(fd,packbuf,8) == -1) return -1;
pos = cdb_unpack(packbuf);
lenhash = cdb_unpack(packbuf + 4);
if (!lenhash) return 0;
h2 = (h >> 8) % lenhash;
for (loop = 0;loop