source: mainline/uspace/lib/c/include/ipc/vfs.h@ 9bfa8c8

Last change on this file since 9bfa8c8 was d7f7a4a, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 3 years ago

Replace some license headers with SPDX identifier

Headers are replaced using tools/transorm-copyright.sh only
when it can be matched verbatim with the license header used
throughout most of the codebase.

  • Property mode set to 100644
File size: 3.4 KB
Line 
1/*
2 * SPDX-FileCopyrightText: 2009 Martin Decky
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7/** @addtogroup libcipc
8 * @{
9 */
10/** @file
11 */
12
13#ifndef _LIBC_IPC_VFS_H_
14#define _LIBC_IPC_VFS_H_
15
16#include <ipc/common.h>
17#include <stdint.h>
18#include <stdbool.h>
19
20#define FS_NAME_MAXLEN 20
21#define FS_LABEL_MAXLEN 256
22#define FS_VUID_MAXLEN 128
23#define MAX_PATH_LEN (32 * 1024)
24#define MAX_MNTOPTS_LEN 256
25#define PLB_SIZE (2 * MAX_PATH_LEN)
26
27/* Basic types. */
28typedef int16_t fs_handle_t;
29typedef uint32_t fs_index_t;
30
31/**
32 * A structure like this is passed to VFS by each individual FS upon its
33 * registration. It assosiates a human-readable identifier with each
34 * registered FS.
35 */
36typedef struct {
37 /** Unique identifier of the fs. */
38 char name[FS_NAME_MAXLEN + 1];
39 unsigned int instance;
40 bool concurrent_read_write;
41 bool write_retains_size;
42} vfs_info_t;
43
44/** Data returned by filesystem probe regarding a specific volume. */
45typedef struct {
46 char label[FS_LABEL_MAXLEN + 1];
47 char vuid[FS_VUID_MAXLEN + 1];
48} vfs_fs_probe_info_t;
49
50typedef enum {
51 VFS_IN_CLONE = IPC_FIRST_USER_METHOD,
52 VFS_IN_FSPROBE,
53 VFS_IN_FSTYPES,
54 VFS_IN_MOUNT,
55 VFS_IN_OPEN,
56 VFS_IN_PUT,
57 VFS_IN_READ,
58 VFS_IN_REGISTER,
59 VFS_IN_RENAME,
60 VFS_IN_RESIZE,
61 VFS_IN_STAT,
62 VFS_IN_STATFS,
63 VFS_IN_SYNC,
64 VFS_IN_UNLINK,
65 VFS_IN_UNMOUNT,
66 VFS_IN_WAIT_HANDLE,
67 VFS_IN_WALK,
68 VFS_IN_WRITE,
69} vfs_in_request_t;
70
71typedef enum {
72 VFS_OUT_CLOSE = IPC_FIRST_USER_METHOD,
73 VFS_OUT_DESTROY,
74 VFS_OUT_FSPROBE,
75 VFS_OUT_IS_EMPTY,
76 VFS_OUT_LINK,
77 VFS_OUT_LOOKUP,
78 VFS_OUT_MOUNTED,
79 VFS_OUT_OPEN_NODE,
80 VFS_OUT_READ,
81 VFS_OUT_STAT,
82 VFS_OUT_STATFS,
83 VFS_OUT_SYNC,
84 VFS_OUT_TRUNCATE,
85 VFS_OUT_UNMOUNTED,
86 VFS_OUT_WRITE,
87 VFS_OUT_LAST
88} vfs_out_request_t;
89
90/*
91 * Lookup flags.
92 */
93
94/**
95 * No lookup flags used.
96 */
97#define L_NONE 0
98
99/**
100 * Lookup will succeed only if the object is a regular file. If L_CREATE is
101 * specified, an empty file will be created. This flag is mutually exclusive
102 * with L_DIRECTORY.
103 */
104#define L_FILE 1
105
106/**
107 * Lookup will succeed only if the object is a directory. If L_CREATE is
108 * specified, an empty directory will be created. This flag is mutually
109 * exclusive with L_FILE.
110 */
111#define L_DIRECTORY 2
112
113/**
114 * Lookup will not cross any mount points.
115 * If the lookup would have to cross a mount point, it returns EXDEV instead.
116 */
117#define L_DISABLE_MOUNTS 4
118
119/**
120 * Lookup will succeed only if the object is a mount point. The flag is mutually
121 * exclusive with L_FILE.
122 */
123#define L_MP 8
124
125/**
126 * When used with L_CREATE, L_EXCLUSIVE will cause the lookup to fail if the
127 * object already exists. L_EXCLUSIVE is implied when L_DIRECTORY is used.
128 */
129#define L_EXCLUSIVE 16
130
131/**
132 * L_CREATE is used for creating both regular files and directories.
133 */
134#define L_CREATE 32
135
136/**
137 * L_UNLINK is used to remove leaves from the file system namespace. This flag
138 * cannot be passed directly by the client, but will be set by VFS during
139 * VFS_UNLINK.
140 */
141#define L_UNLINK 64
142
143/*
144 * Walk flags.
145 */
146enum {
147 WALK_MAY_CREATE = (1 << 0),
148 WALK_MUST_CREATE = (1 << 1),
149
150 WALK_REGULAR = (1 << 2),
151 WALK_DIRECTORY = (1 << 3),
152 WALK_MOUNT_POINT = (1 << 4),
153
154 WALK_ALL_FLAGS = WALK_MAY_CREATE | WALK_MUST_CREATE | WALK_REGULAR |
155 WALK_DIRECTORY | WALK_MOUNT_POINT,
156};
157
158enum {
159 VFS_MOUNT_BLOCKING = 1,
160 VFS_MOUNT_CONNECT_ONLY = 2,
161 VFS_MOUNT_NO_REF = 4,
162};
163
164enum {
165 MODE_READ = 1,
166 MODE_WRITE = 2,
167 MODE_APPEND = 4,
168};
169
170#endif
171
172/** @}
173 */
Note: See TracBrowser for help on using the repository browser.