Changeset 8c20b26 in mainline


Ignore:
Timestamp:
2007-09-26T22:05:22Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5d4e90f0
Parents:
01f5e17
Message:

VFS work.
Introduce basic types representing a file system node and an open file.

File:
1 edited

Legend:

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

    r01f5e17 r8c20b26  
    3636#include <ipc/ipc.h>
    3737#include <libadt/list.h>
     38#include <atomic.h>
     39#include <types.h>
    3840
    3941#define dprintf(...)    printf(__VA_ARGS__)
     
    4244
    4345#define IPC_METHOD_TO_VFS_OP(m) ((m) - VFS_FIRST)       
     46
     47typedef int64_t off_t;
    4448
    4549typedef enum {
     
    8589} vfs_info_t;
    8690
     91/**
     92 * A structure like this will be allocated for each registered file system.
     93 */
    8794typedef struct {
    8895        link_t fs_link;
     
    9097        ipcarg_t phone;
    9198} fs_info_t;
     99
     100/**
     101 * Instances of this type represent a file system node (e.g. directory, file).
     102 * They are abstracted away from any file system implementation and contain just
     103 * enough bits to uniquely identify the object in its file system instance.
     104 *
     105 * @note        fs_handle, dev_handle and index are meant to be returned in one
     106 *              IPC reply.
     107 */
     108typedef struct {
     109        int fs_handle;          /**< Global file system ID. */
     110        int dev_handle;         /**< Global mount device devno. */
     111        uint64_t index;         /**< Index of the node on its file system. */
     112} vfs_node_t;
     113
     114/**
     115 * Instances of this type represent an open file. If the file is opened by more
     116 * than one task, there will be a separate structure allocated for each task.
     117 */
     118typedef struct {
     119        vfs_node_t *node;
     120       
     121        /** Number of file handles referencing this file. */
     122        atomic_t refcnt;
     123
     124        /** Current position in the file. */
     125        off_t pos;
     126} vfs_file_t;
    92127
    93128extern link_t fs_head;
Note: See TracChangeset for help on using the changeset viewer.