How does the Unix kernel convert a file offset? How does the Unix kernel convert a file offset? unix unix

How does the Unix kernel convert a file offset?


I unfortunately can't help you with the original implementation of UNIX; but the job of mapping the high-level directory hierarchy to an on-disk representation, and for assigning ranges on the bare block device to files normally falls to one or more file systems. The POSIX spec makes some high-level demands on the file system, but what actually ends up on disk is completely specific to each file system.

The ext2 file system is comparatively simple, but a detailed explanation of it still fills an entire chapter of a book - one such book is Understanding the Linux Kernel by Daniel P. Bovet and Marco Cesati.

A more brief, higher-level introductory text comes with the Linux kernel itself, and can also be found here. That directory also contains documentation on other Linux file systems and also the "VFS" layer, which handles a lot of the higher-level aspects which are common to all or most file systems. Wikipedia's ext2 article also covers it at a high level. It also provides some links to more detailed online descriptions.

This is unfortunately not a topic that will fit in a SO answer, but I hope the above pointers help to get you started.