The k project

File system


You will have to implement a basic file system in order to read data from the ROM.

The file system used in K is not KFS anymore. Now we use the file format commonly used in optical discs. Commonly referred to as ISO. In K, we assume all file systems are read-only.

To read this filesystem, you will first have to implement an ATAPI driver.

Syscall interface

    open, read, seek, close - manipulate the filesystem
    int open(const char *pathname, int flags);
    ssize_t read(int fd, void *buf, size_t count);
    off_t seek(int fd, off_t offset, int whence);
    int close(int fd);
    Given a pathname for a file, open() returns a file descriptor for use in
    subsequent system calls (read, seek, close). The parameter flags must be
    set to O RDONLY to open the file in read-only mode (the only one mode

    read() attempts to read up to count bytes from file descriptor fd into
    the buffer starting at buf.

    seek() repositions the reading cursor of the open file associated with
    the file descriptor filedes to the argument offset according to the
    directive whence as follow:
       SEEK SET: the cursor is set to offset bytes.
       SEEK CUR: the cursor is set to its current location plus offset
       SEEK END: the cursor is set to the size of the file plus offset

    close() closes the file descriptor fd, so that it no longer refers to
    any file.
    open() returns the new unique file descriptor, or -1 if an error
    read() returns the number of bytes read, or -1 if an error occured.
    seek() returns the new resulting offset location as measured in bytes
    from the beginning of the file. Otherwise, a value of (off t)-1 on
    error.  close() returns 0 on success, or -1 on error.
    There are no standard file descriptors like STDIN FILENO.
    Useful constants are defined in k/kstd.h