file_operations下函數詳解
// 刷新待處理的數據,如果驅動(dòng)程序沒(méi)有實(shí)現,fsync調用將返回-EINVAL
int (*aio_fsync) (struct kiocb *, int datasync);
// 異步fsync
int (*fasync) (int, struct file *, int);
// 通知設備FASYNC標志發(fā)生變化,如果設備不支持異步通知,該字段可以為NULL
int (*lock) (struct file *, int, struct file_lock *);
// 實(shí)現文件鎖,設備驅動(dòng)常不去實(shí)現此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 分散/聚集型的讀寫(xiě)操作,實(shí)現進(jìn)行涉及多個(gè)內存區域的單次讀或寫(xiě)操作。
ssize_t (*sendfile) (struct file *, loff_t *, size_t, read_actor_t, void *);
// 實(shí)現sendfile調用的讀取部分,將數據從一個(gè)文件描述符移到另一個(gè),設備驅動(dòng)通常將其設置為 NULL
ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
// 實(shí)現sendfile調用的另一部分,內核調用將其數據發(fā)送到對應文件,每次一個(gè)數據頁(yè),設備驅動(dòng)通常將其設置為NULL
unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned
long);
// 在進(jìn)程地址空間找到一個(gè)合適的位置,以便將底層設備中的內存段映射到該位置。大部分驅動(dòng)可將其設置為NULL
int (*check_flags)(int);
// 允許模塊檢查傳遞給fcntl(F_SETEL…)調用的標志
int (*dir_notify)(struct file *filp, unsigned long arg);
// 應用程序使用fcntl來(lái)請求目錄改變通知時(shí),調用該方法。僅對文件系統有效,驅動(dòng)程序不必實(shí)現。
int (*flock) (struct file *, int, struct file_lock *);
// 實(shí)現文件鎖
};本文引用地址:http://dyxdggzs.com/article/150582.htm
評論