Rev 2766 | Rev 2821 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2766 | Rev 2770 | ||
|---|---|---|---|
| Line 44... | Line 44... | ||
| 44 | 44 | ||
| 45 | #define VFS_FIRST IPC_FIRST_USER_METHOD |
45 | #define VFS_FIRST IPC_FIRST_USER_METHOD |
| 46 | 46 | ||
| 47 | #define IPC_METHOD_TO_VFS_OP(m) ((m) - VFS_FIRST) |
47 | #define IPC_METHOD_TO_VFS_OP(m) ((m) - VFS_FIRST) |
| 48 | 48 | ||
| - | 49 | /* Basic types. */ |
|
| - | 50 | typedef int16_t fs_handle_t; |
|
| - | 51 | typedef int16_t dev_handle_t; |
|
| - | 52 | typedef uint32_t fs_index_t; |
|
| - | 53 | ||
| 49 | typedef enum { |
54 | typedef enum { |
| 50 | VFS_READ = VFS_FIRST, |
55 | VFS_READ = VFS_FIRST, |
| 51 | VFS_WRITE, |
56 | VFS_WRITE, |
| 52 | VFS_TRUNCATE, |
57 | VFS_TRUNCATE, |
| 53 | VFS_MOUNT, |
58 | VFS_MOUNT, |
| Line 104... | Line 109... | ||
| 104 | * A structure like this will be allocated for each registered file system. |
109 | * A structure like this will be allocated for each registered file system. |
| 105 | */ |
110 | */ |
| 106 | typedef struct { |
111 | typedef struct { |
| 107 | link_t fs_link; |
112 | link_t fs_link; |
| 108 | vfs_info_t vfs_info; |
113 | vfs_info_t vfs_info; |
| 109 | int fs_handle; |
114 | fs_handle_t fs_handle; |
| 110 | futex_t phone_futex; /**< Phone serializing futex. */ |
115 | futex_t phone_futex; /**< Phone serializing futex. */ |
| 111 | ipcarg_t phone; |
116 | ipcarg_t phone; |
| 112 | } fs_info_t; |
117 | } fs_info_t; |
| 113 | 118 | ||
| 114 | /** |
119 | /** |
| 115 | * VFS_PAIR uniquely represents a file system instance. |
120 | * VFS_PAIR uniquely represents a file system instance. |
| 116 | */ |
121 | */ |
| 117 | #define VFS_PAIR \ |
122 | #define VFS_PAIR \ |
| 118 | int fs_handle; \ |
123 | fs_handle_t fs_handle; \ |
| 119 | int dev_handle; |
124 | dev_handle_t dev_handle; |
| 120 | 125 | ||
| 121 | /** |
126 | /** |
| 122 | * VFS_TRIPLET uniquely identifies a file system node (e.g. directory, file) but |
127 | * VFS_TRIPLET uniquely identifies a file system node (e.g. directory, file) but |
| 123 | * doesn't contain any state. For a stateful structure, see vfs_node_t. |
128 | * doesn't contain any state. For a stateful structure, see vfs_node_t. |
| 124 | * |
129 | * |
| 125 | * @note fs_handle, dev_handle and index are meant to be returned in one |
130 | * @note fs_handle, dev_handle and index are meant to be returned in one |
| 126 | * IPC reply. |
131 | * IPC reply. |
| 127 | */ |
132 | */ |
| 128 | #define VFS_TRIPLET \ |
133 | #define VFS_TRIPLET \ |
| 129 | VFS_PAIR; \ |
134 | VFS_PAIR; \ |
| 130 | uint64_t index; |
135 | fs_index_t index; |
| 131 | 136 | ||
| 132 | typedef struct { |
137 | typedef struct { |
| 133 | VFS_PAIR; |
138 | VFS_PAIR; |
| 134 | } vfs_pair_t; |
139 | } vfs_pair_t; |
| 135 | 140 | ||
| Line 254... | Line 259... | ||
| 254 | extern link_t plb_head; /**< List of active PLB entries. */ |
259 | extern link_t plb_head; /**< List of active PLB entries. */ |
| 255 | 260 | ||
| 256 | /** Holding this rwlock prevents changes in file system namespace. */ |
261 | /** Holding this rwlock prevents changes in file system namespace. */ |
| 257 | extern rwlock_t namespace_rwlock; |
262 | extern rwlock_t namespace_rwlock; |
| 258 | 263 | ||
| 259 | extern int vfs_grab_phone(int); |
264 | extern int vfs_grab_phone(fs_handle_t); |
| 260 | extern void vfs_release_phone(int); |
265 | extern void vfs_release_phone(int); |
| 261 | 266 | ||
| 262 | extern int fs_name_to_handle(char *, bool); |
267 | extern fs_handle_t fs_name_to_handle(char *, bool); |
| 263 | 268 | ||
| 264 | extern int vfs_lookup_internal(char *, int, vfs_lookup_res_t *, vfs_pair_t *, |
269 | extern int vfs_lookup_internal(char *, int, vfs_lookup_res_t *, vfs_pair_t *, |
| 265 | ...); |
270 | ...); |
| 266 | 271 | ||
| 267 | extern bool vfs_nodes_init(void); |
272 | extern bool vfs_nodes_init(void); |