ULOS Manual Pages - filesystem(2) | Back

NAME
  filesystem - filesystem API

DESCRIPTION
  filesystem is the Cynosure-provided method of accessing any filesystem mounted to the filesystem tree.  It is similar in design to lfs, though it is not exactly the same.  Some filesystem information can be had from the sysfs.

  All functions will return nil and an error message on failure.  All file paths must be absolute - see path(3) for some helper functions related to path manipulation in general.

FUNCTIONS
  open(file:string[, mode:string]): table
    Attempts to open the provided file using mode.  On success, returns a table with read, write, seek, and close methods.

  stat(file:string): table
    Returns a table of information about the provided file:

      {
        permissions  = number,
        type         = number,
        isDirectory  = boolean,
        owner        = number,
        group        = number,
        lastModified = number,
        size         = number
      }

    isDirectory is primarily kept for convenience's sake and some degree of backwards compatibility.

  touch(file:string[, ftype:number]): boolean
    Creates the provided file, if it does not exist.  If ftype is specified, the file will be of the specified type if supported by the filesystem.

  list(path:string): table
    Returns a list of all files under the specified path.
  
  remove(file:string): boolean
    Tries to remove the specified file from the filesystem.  Will not be able to remove directories on most filesystems.

  mount(node:string or table, fstype:number, path:string): boolean
    Mounts the provided node at path.

    If fstype is filesystem.types.RAW, then mount will try to automatically determine how it should tread node.  If fstype is filesystem.types.NODE, mount will treat it as a filesystem node able to be directly mounted - see docs/fsapi.txt for details.  Finally, if fstype is filesystem.types.OVERLAY, then the directory at node will become available at path.

  umount(path:string): boolean
    Attempts to remove the node at path from the filesystem mount tree.

  mounts(): table
    Returns a list of all currently mounted filesystems, in the following format:
      
      {
        [path:string] = fsname:string,
        ...
      }

TABLES
  filesystem.types = {
    RAW = number,
    NODE = number,
    OVERLAY = number
  }
    Contains all supported filesystem types.

COPYRIGHT
  Cynosure kernel copyright (c) 2021 Ocawesome101 under the DSLv2.

REPORTING BUGS
  Bugs should be reported at https://github.com/ocawesome101/oc-cynosure/issues.