The Logical File System services (also known as the fp_services) allow processes running in kernel mode to open and manipulate files in the same way that user-mode processes do. Data access limitations make it unreasonable to accomplish these tasks with system calls, so a subset of the file system calls has been provided with an alternate kernel-only interface.
The Logical File System services are one component of the logical file system, which provides the functions required to map system call requests to virtual file system requests. The logical file system is responsible for resolution of file names and file descriptors. It tracks all open files in the system using the file table. The Logical File System services are lower level entry points into the system call support within the logical file system.
Routines in the kernel that must access data stored in files or that must set up paths to devices are the primary users of these services. This occurs most commonly in device drivers, where a lower level device driver must be accessed or where the device requires microcode to be downloaded. Use of the Logical File System services is not, however, restricted to these cases.
A process can use the Logical File System services to establish access to a file or device by calling:
These three services return a file pointer that is needed to call the other Logical File System services. The other services provide the functions that are provided by the corresponding system calls.
The Logical File System services are available only in the process environment.
In addition, calling the fp_open service at certain times can cause a deadlock. The lookup on the file name must acquire file system locks. If the process is already holding any lock on a component of the path, the process will be deadlocked. Therefore, do not use the fp_open service when the process is already executing an operation that holds file system locks on the requested path. The operations most likely to cause this condition are those that create files.
These are the Logical File System kernel services:
|fp_access||Checks for access permission to an open file.|
|fp_close||Closes a file.|
|fp_fstat||Gets the attributes of an open file.|
|fp_getdevno||Gets the device number or channel number for a device.|
|fp_getf||Retrieves a pointer to a file structure.|
|fp_hold||Increments the open count for a specified file pointer.|
|fp_ioctl||Issues a control command to an open device or file.|
|fp_lseek||Changes the current offset in an open file.|
|fp_llseek||Changes the current offset in an open file. Used to access offsets beyond 2GB.|
|fp_open||Opens a regular file or directory.|
|fp_opendev||Opens a device special file.|
|fp_poll||Checks the I/O status of multiple file pointers/descriptors and message queues.|
|fp_read||Performs a read on an open file with arguments passed.|
|fp_readv||Performs a read operation on an open file with arguments passed in iovec elements.|
|fp_rwuio||Performs read or write on an open file with arguments passed in a uio structure.|
|fp_select||Provides for cascaded, or redirected, support of the select or poll request.|
|fp_write||Performs a write operation on an open file with arguments passed.|
|fp_writev||Performs a write operation on an open file with arguments passed in iovec elements.|