|
以前看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;
- }
复制代码 |
|