Changeset 4d21cf8 in mainline for uspace/srv/vfs/vfs.h


Ignore:
Timestamp:
2007-11-03T14:23:57Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
20614d0
Parents:
fa23560
Message:

VFS work.
Introduce the notion of VFS_PAIR which corresponds to a file system instance,
and VFS_TRIPLET, which corresponds to a file system node. Separate vfs_triplet_t
and vfs_node_t as the former one is the stateless counterpart of the latter.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/vfs/vfs.h

    rfa23560 r4d21cf8  
    100100
    101101/**
    102  * Instances of this type represent a file system node (e.g. directory, file).
    103  * They are abstracted away from any file system implementation and contain just
    104  * enough bits to uniquely identify the object in its file system instance.
     102 * VFS_PAIR uniquely represents a file system instance.
     103 */
     104#define VFS_PAIR        \
     105        int fs_handle;  \
     106        int dev_handle;
     107
     108/**
     109 * VFS_TRIPLET uniquely identifies a file system node (e.g. directory, file) but
     110 * doesn't contain any state. For a stateful structure, see vfs_node_t.
    105111 *
    106112 * @note        fs_handle, dev_handle and index are meant to be returned in one
    107113 *              IPC reply.
    108114 */
     115#define VFS_TRIPLET     \
     116        VFS_PAIR;       \
     117        uint64_t index;
     118
    109119typedef struct {
    110         int fs_handle;          /**< Global file system ID. */
    111         int dev_handle;         /**< Global mount device devno. */
    112         uint64_t index;         /**< Index of the node on its file system. */
     120        VFS_PAIR;
     121} vfs_pair_t;
     122
     123typedef struct {
     124        VFS_TRIPLET;
     125} vfs_triplet_t;
     126
     127/**
     128 * Instances of this type represent an active, in-memory VFS node and any state
     129 * which may be associated with it.
     130 */
     131typedef struct {
     132        VFS_TRIPLET;            /**< Identity of the node. */
     133        atomic_t refcnt;        /**< Usage counter. */
    113134} vfs_node_t;
    114135
     
    129150extern link_t fs_head;          /**< List of registered file systems. */
    130151
    131 extern vfs_node_t rootfs;       /**< Root node of the root file system. */
     152extern vfs_triplet_t rootfs;    /**< Root node of the root file system. */
    132153
    133154#define MAX_PATH_LEN            (64 * 1024)
     
    151172extern int fs_name_to_handle(char *, bool);
    152173
    153 extern int vfs_lookup_internal(char *, size_t, vfs_node_t *, vfs_node_t *);
     174extern int vfs_lookup_internal(char *, size_t, vfs_triplet_t *, vfs_pair_t *);
    154175
    155176#define MAX_OPEN_FILES  128     
Note: See TracChangeset for help on using the changeset viewer.