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
RevLine 
[ca3ba3a]1/*
[d7f7a4a]2 * SPDX-FileCopyrightText: 2009 Martin Decky
[ca3ba3a]3 *
[d7f7a4a]4 * SPDX-License-Identifier: BSD-3-Clause
[ca3ba3a]5 */
6
7/** @addtogroup libcipc
8 * @{
9 */
10/** @file
11 */
12
[4805495]13#ifndef _LIBC_IPC_VFS_H_
14#define _LIBC_IPC_VFS_H_
[ca3ba3a]15
[64d2b10]16#include <ipc/common.h>
[8d2dd7f2]17#include <stdint.h>
[3e6a98c5]18#include <stdbool.h>
[ca3ba3a]19
20#define FS_NAME_MAXLEN 20
[d2c8533]21#define FS_LABEL_MAXLEN 256
22#define FS_VUID_MAXLEN 128
[51774cd]23#define MAX_PATH_LEN (32 * 1024)
[10e4cd7]24#define MAX_MNTOPTS_LEN 256
[ca3ba3a]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];
[4979403]39 unsigned int instance;
[5581b469]40 bool concurrent_read_write;
41 bool write_retains_size;
[ca3ba3a]42} vfs_info_t;
43
[d2c8533]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
[ca3ba3a]50typedef enum {
[2c40637]51 VFS_IN_CLONE = IPC_FIRST_USER_METHOD,
[d2c8533]52 VFS_IN_FSPROBE,
[b14d9f9]53 VFS_IN_FSTYPES,
[4198f9c3]54 VFS_IN_MOUNT,
[2c40637]55 VFS_IN_OPEN,
[9c4cf0d]56 VFS_IN_PUT,
[2c40637]57 VFS_IN_READ,
[4198f9c3]58 VFS_IN_REGISTER,
59 VFS_IN_RENAME,
[2c40637]60 VFS_IN_RESIZE,
61 VFS_IN_STAT,
[1dff985]62 VFS_IN_STATFS,
[2c40637]63 VFS_IN_SYNC,
[fe91f66]64 VFS_IN_UNLINK,
[2c40637]65 VFS_IN_UNMOUNT,
66 VFS_IN_WAIT_HANDLE,
67 VFS_IN_WALK,
68 VFS_IN_WRITE,
[4198f9c3]69} vfs_in_request_t;
[ca3ba3a]70
71typedef enum {
[2c40637]72 VFS_OUT_CLOSE = IPC_FIRST_USER_METHOD,
73 VFS_OUT_DESTROY,
[d2c8533]74 VFS_OUT_FSPROBE,
[5bcd5b7]75 VFS_OUT_IS_EMPTY,
[bf9dc4e2]76 VFS_OUT_LINK,
[2c40637]77 VFS_OUT_LOOKUP,
78 VFS_OUT_MOUNTED,
79 VFS_OUT_OPEN_NODE,
80 VFS_OUT_READ,
81 VFS_OUT_STAT,
[11baebb]82 VFS_OUT_STATFS,
[2c40637]83 VFS_OUT_SYNC,
84 VFS_OUT_TRUNCATE,
85 VFS_OUT_UNMOUNTED,
86 VFS_OUT_WRITE,
[11baebb]87 VFS_OUT_LAST
[4198f9c3]88} vfs_out_request_t;
[ca3ba3a]89
90/*
91 * Lookup flags.
92 */
93
94/**
95 * No lookup flags used.
96 */
[f7376cbf]97#define L_NONE 0
[ca3ba3a]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 */
[f7376cbf]104#define L_FILE 1
[ca3ba3a]105
106/**
[f7376cbf]107 * Lookup will succeed only if the object is a directory. If L_CREATE is
[ca3ba3a]108 * specified, an empty directory will be created. This flag is mutually
109 * exclusive with L_FILE.
110 */
[f7376cbf]111#define L_DIRECTORY 2
112
113/**
[778d26d]114 * Lookup will not cross any mount points.
115 * If the lookup would have to cross a mount point, it returns EXDEV instead.
[f7376cbf]116 */
[778d26d]117#define L_DISABLE_MOUNTS 4
[f7376cbf]118
119/**
120 * Lookup will succeed only if the object is a mount point. The flag is mutually
[c9e3692]121 * exclusive with L_FILE.
[f7376cbf]122 */
123#define L_MP 8
124
[ca3ba3a]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 */
[f7376cbf]129#define L_EXCLUSIVE 16
[ca3ba3a]130
131/**
132 * L_CREATE is used for creating both regular files and directories.
133 */
[f7376cbf]134#define L_CREATE 32
[ca3ba3a]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 */
[ef4cf62]141#define L_UNLINK 64
[ca3ba3a]142
[cb65bbe]143/*
144 * Walk flags.
145 */
146enum {
[ef4cf62]147 WALK_MAY_CREATE = (1 << 0),
148 WALK_MUST_CREATE = (1 << 1),
[a35b458]149
[ef4cf62]150 WALK_REGULAR = (1 << 2),
151 WALK_DIRECTORY = (1 << 3),
152 WALK_MOUNT_POINT = (1 << 4),
[a35b458]153
[1701a24d]154 WALK_ALL_FLAGS = WALK_MAY_CREATE | WALK_MUST_CREATE | WALK_REGULAR |
155 WALK_DIRECTORY | WALK_MOUNT_POINT,
[cb65bbe]156};
157
[5126f80]158enum {
159 VFS_MOUNT_BLOCKING = 1,
160 VFS_MOUNT_CONNECT_ONLY = 2,
161 VFS_MOUNT_NO_REF = 4,
162};
163
[cb65bbe]164enum {
165 MODE_READ = 1,
166 MODE_WRITE = 2,
167 MODE_APPEND = 4,
168};
169
[ca3ba3a]170#endif
171
172/** @}
173 */
Note: See TracBrowser for help on using the repository browser.