|
My Kernel v0.1.0
|
Operations that can be performed on an opened file.
#include <file.h>
Data Fields | |
| error_t(* | open )(struct file *) |
| Filesystem-specific open function (optional). More... | |
| void(* | close )(struct file *) |
| Called when closing a file (optional). More... | |
| ssize_t(* | write )(struct file *, const char *, size_t) |
| Write a buffer to the file at the current position. | |
| ssize_t(* | read )(struct file *, char *, size_t) |
| Read the content at the current position in the file. | |
| size_t(* | size )(struct file *) |
| Compute the file's total size in memory. | |
| error_t(* | bind )(struct file *, struct sockaddr *addr, size_t len) |
| Associate a socket with a local address. | |
| error_t(* | connect )(struct file *, struct sockaddr *addr, size_t len) |
| Connect to a remote host. | |
| ssize_t(* | sendmsg )(struct file *, const struct msghdr *, int flags) |
| Send a message through an endpoint (socket) | |
| ssize_t(* | recvmsg )(struct file *, struct msghdr *, int flags) |
| Send a message through an endpoint (socket) | |
| off_t(* | seek )(struct file *, off_t, int whence) |
| Reposition the open file description offset. More... | |
| void(* file_operations::close) (struct file *) |
If present, it should release any memory allocated by the driver to keep trace of the file's internal state.
| error_t(* file_operations::open) (struct file *) |
If present it is called when opening a new file, and can be used to initialize the file's priv field.
| off_t(* file_operations::seek) (struct file *, off_t, int whence) |