新闻中心

EEPW首页 > 嵌入式系统 > 设计应用 > file_operations下函数详解

file_operations下函数详解

作者: 时间:2011-06-21 来源:网络 收藏


// 刷新待处理的数据,如果驱动程序没有实现,fsync调用将返回-EINVAL

int (*aio_fsync) (struct kiocb *, int datasync);

// 异步fsync

int (*fasync) (int, struct file *, int);

// 通知设备FASYNC标志发生变化,如果设备不支持异步通知,该字段可以为NULL

int (*lock) (struct file *, int, struct file_lock *);

// 实现文件锁,设备驱动常不去实现此lock

ssize_t (*readv) (struct file *, const struct iovec *, unsigned long, loff_t *);

ssize_t (*writev) (struct file *, const struct iovec *, unsigned long, loff_t *);

// readv和writev 分散/聚集型的读写操作,实现进行涉及多个内存区域的单次读或写操作。

ssize_t (*sendfile) (struct file *, loff_t *, size_t, read_actor_t, void *);

// 实现sendfile调用的读取部分,将数据从一个文件描述符移到另一个,设备驱动通常将其设置为 NULL

ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);

// 实现sendfile调用的另一部分,内核调用将其数据发送到对应文件,每次一个数据页,设备驱动通常将其设置为NULL

unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned

long);

// 在进程地址空间找到一个合适的位置,以便将底层设备中的内存段映射到该位置。大部分驱动可将其设置为NULL

int (*check_flags)(int);

// 允许模块检查传递给fcntl(F_SETEL…)调用的标志

int (*dir_notify)(struct file *filp, unsigned long arg);

// 应用程序使用fcntl来请求目录改变通知时,调用该方法。仅对文件系统有效,驱动程序不必实现。

int (*flock) (struct file *, int, struct file_lock *);

// 实现文件锁

};

本文引用地址:https://www.eepw.com.cn/article/150582.htm

上一页 1 2 下一页

评论


相关推荐

技术专区

关闭