+ -
当前位置:首页 → 问答吧 → 程序代码中的cb是什么意思?

程序代码中的cb是什么意思?

时间:2009-10-05

来源:互联网

以前看eog、epdfview的时候经常看到某个函数是以cb结尾的,今天找epoll例子的时候也发现其中有些函数是以cb结尾的,请问这个cb是什么意思呀!

代码:
int file_notify_addcb(struct file *filep,
 void (*cbproc)(struct file *, void *, unsigned long *, long *), void *data)
{
 unsigned long flags;
 struct fcb_struct *fcbp;

 if (!(fcbp = (struct fcb_struct *) kmalloc(sizeof(struct fcb_struct), GFP_KERNEL)))
 return -ENOMEM;
 memset(fcbp, 0, sizeof(struct fcb_struct));
 fcbp->cbproc = cbproc;
 fcbp->data = data;
 fcblist_write_lock(filep, flags);
 list_add_tail(&fcbp->lnk, &filep->f_cblist);
 fcblist_write_unlock(filep, flags);
 return 0;
}

int file_notify_delcb(struct file *filep,
 void (*cbproc)(struct file *, void *, unsigned long *, long *))
{
 unsigned long flags;
 struct list_head *lnk;

 fcblist_write_lock(filep, flags);
 list_for_each(lnk, &filep->f_cblist) {
 struct fcb_struct *fcbp = list_entry(lnk, struct fcb_struct, lnk);

 if (fcbp->cbproc == cbproc) {
 list_del(lnk);
 fcblist_write_unlock(filep, flags);
 kfree(fcbp);
 return 0;
 }
 }
 fcblist_write_unlock(filep, flags);
 return -ENOENT;
}

作者: jqxl0205   发布时间: 2009-10-05

cb == control block?

作者: javarchator   发布时间: 2009-10-06

callback

作者: ibear   发布时间: 2009-10-06

嗯,callback有道理。

作者: jqxl0205   发布时间: 2009-10-06