偷得浮生半桶水(半日闲), 好记性不如抄下来(烂笔头). 信息爆炸的时代, 学习是一项持续的工作.
全部博文(1750)
分类: LINUX
2010-11-23 14:23:16
struct scull_dev *dev = filp->private_data; loff_t newpos; switch (whence) { case 0: /*SEEK_SET*/ newpos = off; break; case 1: /*SEEK_CUR*/ newpos = filep->f_pos + off; break; case 2: /*SEEK_END*/ newpos = dev->size + off; break; default: /*error*/ return -EINVAL; } if (newpos < 0) return -EINVAL; filp->f_pos = newpos; return newpos;
|