1 // Copyright 2016 The Fuchsia Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #pragma once
6 
7 #include <zircon/types.h>
8 
9 // Rights
10 // The file may be read.
11 #define ZX_FS_RIGHT_READABLE      0x00000001
12 // The file may be written.
13 #define ZX_FS_RIGHT_WRITABLE      0x00000002
14 // The connection can mount and unmount filesystems.
15 #define ZX_FS_RIGHT_ADMIN         0x00000004
16 #define ZX_FS_RIGHTS              0x0000FFFF
17 
18 // Flags
19 // If the file does not exist, it will be created.
20 #define ZX_FS_FLAG_CREATE         0x00010000
21 // The file must not exist, otherwise an error will be returned.
22 // Ignored without ZX_FS_FLAG_CREATE.
23 #define ZX_FS_FLAG_EXCLUSIVE      0x00020000
24 // Truncates the file before using it.
25 #define ZX_FS_FLAG_TRUNCATE       0x00040000
26 // Returns an error if the opened file is not a directory.
27 #define ZX_FS_FLAG_DIRECTORY      0x00080000
28 // The file is opened in append mode, seeking to the end of the file before each
29 // write.
30 #define ZX_FS_FLAG_APPEND         0x00100000
31 // If the endpoint of this request refers to a mount point, open the local
32 // directory, not the remote mount.
33 #define ZX_FS_FLAG_NOREMOTE       0x00200000
34 // The file underlying file should not be opened, just a reference to the file.
35 #define ZX_FS_FLAG_VNODE_REF_ONLY 0x00400000
36 // When the file has been opened, the server should transmit a description event.
37 // This event will be transmitted either on success or failure.
38 #define ZX_FS_FLAG_DESCRIBE       0x00800000
39 
40 // Watch event messages are sent via the provided channel and take the form:
41 // { uint8_t event; uint8_t namelen; uint8_t name[namelen]; }
42 // Multiple events may arrive in one message, one after another.
43 // Names do not include a terminating null.
44 typedef struct {
45     uint8_t event;
46     uint8_t len;
47     char name[];
48 } vfs_watch_msg_t;
49 
50 #define VFS_TYPE_BLOBFS 0x9e694d21
51 #define VFS_TYPE_MINFS 0x6e694d21
52 #define VFS_TYPE_MEMFS 0x3e694d21