|
fb_write()是FrameBuffer设备的其中一个用户接口函数,搞不懂它的参数定义,google了一天,都没找到。我把源码贴出来,各位高人帮我看看。谢谢!
static ssize_t
fb_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
{
unsigned long p = *ppos;
struct inode *inode = file->f_dentry->d_inode;
int fbidx = GET_FB_IDX(inode->i_rdev);
struct fb_info *info = registered_fb[fbidx];
struct fb_ops *fb = info->fbops;
struct fb_fix_screeninfo fix;
int err;
if (! fb || ! info->disp)
return -ENODEV;
fb->fb_get_fix(&fix, PROC_CONSOLE(info), info);
if (p > fix.smem_len)
return -ENOSPC;
if (count >= fix.smem_len)
count = fix.smem_len;
err = 0;
if (count + p > fix.smem_len) {
count = fix.smem_len - p;
err = -ENOSPC;
}
if (count) {
char *base_addr;
base_addr = info->disp->screen_base;
count -= copy_from_user(base_addr+p, buf, count);
*ppos += count;
err = -EFAULT;
}
if (count)
return count;
return err;
}
|
|