Listing 4. The file_operations Structure
struct file_operations {
int (*lseek) (struct inode *, struct file *,
off_t, int);
int (*read) (struct inode *, struct file *,
char *, int);
int (*write) (struct inode *, struct file *,
const char *, int);
int (*readdir) (struct inode *, struct file *,
void *, filldir_t);
int (*select) (struct inode *, struct file *,
int, select_table *);
int (*ioctl) (struct inode *, struct file *,
unsigned int, unsigned long);
int (*mmap) (struct inode *, struct file *,
struct vm_area_struct *);
int (*open) (struct inode *, struct file *);
void (*release) (struct inode *,
struct file *);
int (*fsync) (struct inode *, struct file *);
int (*fasync) (struct inode *, struct file *,
int);
int (*check_media_change) (kdev_t dev);
int (*revalidate) (kdev_t dev);
};
Copyright © 1994 - 2019 Linux Journal. All rights reserved.