David van Moolenbroek 89c9de7d09 Add libfsdriver: a library to drive file systems
This library provides new abstractions for the upper (VFS) side of
file system services, and should be used for all file system service
implementations from now on.  It provides the following functionality:

  - a function call table abstraction, hiding the details of the
    VFS-FS protocol with simple parameters;
  - a (currently limited) number of per-function steps required for
    all file system implementations, such as copying in and out path
    names and result buffers;
  - a default implementation for multicomponent path lookups, such
    that the file system merely has to implement resolution of single
    components at a time;
  - an abstraction for copying data from and to the file system, which
    allows transparent intraprocess copying as required for the lookup
    implementation;
  - a set of functions to simplify getdents implementations.

The message loop provided by the library is currently for use by
single-threaded file system implementations only.  Multithreaded file
system services may use the more low-level message processing
functionality.

Protocol-level optimizations such as including names in protocol
messages may be hidden entirely in this library.  In addition, in the
future, the lookup implementation may be replaced by a single-
component lookup VFS/FS protocol request as part of a VFS name cache
implementation; this, too, can be hidden entirely in this library.

Change-Id: Ib34f0d0e021dfa3426ce8826efcf3eaa94d3ef3e
2014-09-18 12:46:23 +00:00

84 lines
4.1 KiB
C

#ifndef _LIBFSDRIVER_FSDRIVER_H
#define _LIBFSDRIVER_FSDRIVER_H
#include <minix/drivers.h>
#include <minix/fsdriver.h>
#include <minix/vfsif.h>
#define ROOT_UID 0 /* user ID of superuser */
extern int fsdriver_putnode(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_slink(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_trunc(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_chown(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_chmod(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_inhibread(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_stat(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_utime(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_statvfs(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_bread(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_bwrite(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_unlink(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_rmdir(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_unmount(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_sync(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_newdriver(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_flush(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_read(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_write(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_mknod(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_mkdir(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_create(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_link(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_rename(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_lookup(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_mountpoint(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_readsuper(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_newnode(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_rdlink(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_getdents(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_peek(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_bpeek(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
extern int fsdriver_getname(endpoint_t endpt, cp_grant_id_t grant, size_t len,
char *name, size_t size, int not_empty);
extern ino_t fsdriver_root;
extern int fsdriver_mounted;
extern int (*fsdriver_callvec[])(const struct fsdriver * __restrict,
const message * __restrict, message * __restrict);
#endif /* !_LIBFSDRIVER_FSDRIVER_H */