(转)loff_t *ppos是什么东东

ssize_t generic_file_read(struct file * filp, char * buf, size_t count, loff_t *ppos


这是一个文件读函数 
我们很容易看出输入参数中 
filp 是文件 
buf 是文件要读到什么地方去,用户buf 
count是要读多少东西 
那么ppos是什么东东,是当前文件的偏移量嘛?? 
但是当前文件的偏移量在filp中有定义呀。struct file { 
struct list_head f_list; 
struct dentry *f_dentry; 
struct vfsmount *f_vfsmnt; 
struct file_operations *f_op; 
atomic_t f_count; 
unsigned int f_flags; 
mode_t f_mode; 
loff_t f_pos;//这个就是当前文件的偏移量,我认为 



struct file 中的f_pos是最后一次文件操作以后的当前读写位置。而ppos是这次对文件进行操作的起始位置,这两个值不一定相等。


原文地址:https://www.cnblogs.com/lihaiping/p/loff_t.html