First page Back Continue Last page Overview Graphics
open() and release()
int foo_open (struct inode *i, struct file *f)
- Called when user-space opens the device file.
- inode is a structure that uniquely represent a file in the system (be it a regular file, a directory, a symbolic link, a character or block device)
- file is a structure created every time a file is opened. Several file structures can point to the same inode structure.
- Contains informations like the current position, the opening mode, etc.
- Has a void *private_data pointer that one can freely use.
- A pointer to the file structure is passed to all other operations
int foo_release(struct inode *i, struct file *f)
- Called when user-space closes the file.