1 | interface vfs extends service {
|
---|
2 | /* Register a filesystem driver */
|
---|
3 | ipcarg_t register(in_copy string name);
|
---|
4 |
|
---|
5 | /* Mount filesystem */
|
---|
6 | ipcarg_t mount(in ipcarg_t device, in ipcarg_t flags, in_copy string point, in_copy string opts, in_copy string fs);
|
---|
7 |
|
---|
8 | /* Open file */
|
---|
9 | ipcarg_t open(in ipcarg_t lflag, in ipcarg_t oflag, in ipcarg_t mode, in_copy string path, out ipcarg_t fd);
|
---|
10 |
|
---|
11 | /* Open file using node */
|
---|
12 | ipcarg_t open_node(in ipcarg_t fs_handle, in ipcarg_t dev_handle, in ipcarg_t index, in ipcarg_t oflag, out ipcarg_t fd);
|
---|
13 |
|
---|
14 | /* Read data from file */
|
---|
15 | ipcarg_t read(in ipcarg_t fd, out_copy stream data);
|
---|
16 |
|
---|
17 | /* Write data to file */
|
---|
18 | ipcarg_t write(in ipcarg_t fd, in_copy stream data);
|
---|
19 |
|
---|
20 | /* Seek in file */
|
---|
21 | ipcarg_t seek(in ipcarg_t fd, in ipcarg_t offset, in ipcarg_t whence);
|
---|
22 |
|
---|
23 | /* Truncate file */
|
---|
24 | ipcarg_t truncate(in ipcarg_t fd, in ipcarg_t size);
|
---|
25 |
|
---|
26 | /* Get file metadata */
|
---|
27 | ipcarg_t fstat(in ipcarg_t fd, out_copy stream stat);
|
---|
28 |
|
---|
29 | /* Get directory entry metadata */
|
---|
30 | ipcarg_t stat(in_copy string path, out_copy stream stat);
|
---|
31 |
|
---|
32 | /* Create directory */
|
---|
33 | ipcarg_t mkdir(in ipcarg_t mode, in_copy string path);
|
---|
34 |
|
---|
35 | /* Delete directory entry */
|
---|
36 | ipcarg_t unlink(in ipcarg_t lflag, in_copy string path);
|
---|
37 |
|
---|
38 | /* Rename directory entry */
|
---|
39 | ipcarg_t rename(in_copy string old, in_copy string new);
|
---|
40 |
|
---|
41 | /* Flush file buffers */
|
---|
42 | ipcarg_t sync(in ipcarg_t fd);
|
---|
43 |
|
---|
44 | /* In-protocol status value */
|
---|
45 | ipcarg_t ipc_m_ping(void);
|
---|
46 |
|
---|
47 | /* Close connection */
|
---|
48 | ipcarg_t ipc_m_phone_hungup(void);
|
---|
49 | protocol:
|
---|
50 | [vfs.bp]
|
---|
51 | };
|
---|
52 |
|
---|
53 | interface fs extends service {
|
---|
54 | /* Notify filesystem that it was mounted */
|
---|
55 | ipcarg_t mounted(in ipcarg_t dev_handle, in_copy string opts);
|
---|
56 |
|
---|
57 | /* Mount filesystem */
|
---|
58 | ipcarg_t mount(in ipcarg_t device, in ipcarg_t flags, in_copy string point, in_copy string opts, ...);
|
---|
59 |
|
---|
60 | /* Open file by node */
|
---|
61 | ipcarg_t open_node(in ipcarg_t lflag, in ipcarg_t oflag, in ipcarg_t mode, ...);
|
---|
62 |
|
---|
63 | /* Lookup file */
|
---|
64 | ipcarg_t lookup(in ipcarg_t lflag, in ipcarg_t oflag, in ipcarg_t mode, ...);
|
---|
65 |
|
---|
66 | /* Read data from file */
|
---|
67 | ipcarg_t read(in ipcarg_t dev_handle, in ipcarg_t fs_index, in ipcarg_t offset, out_copy stream data);
|
---|
68 |
|
---|
69 | /* Write data to file */
|
---|
70 | ipcarg_t write(in ipcarg_t dev_handle, in ipcarg_t fs_index, in ipcarg_t offset, in_copy stream data);
|
---|
71 |
|
---|
72 | /* Truncate file */
|
---|
73 | ipcarg_t truncate(in ipcarg_t dev_handle, in ipcarg_t fs_index, in ipcarg_t size);
|
---|
74 |
|
---|
75 | /* Get directory entry metadata */
|
---|
76 | ipcarg_t stat(in ipcarg_t dev_handle, in ipcarg_t fs_index, out_copy stream stat);
|
---|
77 |
|
---|
78 | /* Flush file buffers */
|
---|
79 | ipcarg_t sync(in ipcarg_t dev_handle, in ipcarg_t fs_index);
|
---|
80 |
|
---|
81 | /* Notify on file close */
|
---|
82 | ipcarg_t close(in ipcarg_t dev_handle, in ipcarg_t fs_index);
|
---|
83 | };
|
---|
84 |
|
---|
85 | frame io_dispatcher {
|
---|
86 | provides:
|
---|
87 | vfs vfs;
|
---|
88 | requires:
|
---|
89 | [/uspace/lib/libc/requires]
|
---|
90 | tmpfs tmpfs;
|
---|
91 | fat fat;
|
---|
92 | devfs devfs;
|
---|
93 | ns ns;
|
---|
94 | protocol:
|
---|
95 | [/uspace/lib/libc/protocol] |
|
---|
96 | [vfs_server.bp]
|
---|
97 | };
|
---|
98 |
|
---|
99 | architecture vfs {
|
---|
100 | inst io_dispatcher io_dispatcher;
|
---|
101 | inst tmpfs tmpfs;
|
---|
102 | inst fat fat;
|
---|
103 | inst devfs devfs;
|
---|
104 |
|
---|
105 | bind io_dispatcher:tmpfs to tmpfs:tmpfs;
|
---|
106 | bind io_dispatcher:fat to fat:fat;
|
---|
107 | bind io_dispatcher:devfs to devfs:devfs;
|
---|
108 |
|
---|
109 | bind tmpfs:vfs to io_dispatcher:vfs;
|
---|
110 | bind fat:vfs to io_dispatcher:vfs;
|
---|
111 | bind devfs:vfs to io_dispatcher:vfs;
|
---|
112 |
|
---|
113 | delegate vfs to io_dispatcher:vfs;
|
---|
114 |
|
---|
115 | [/uspace/lib/libc/subsume%io_dispatcher]
|
---|
116 | [/uspace/lib/libc/subsume%tmpfs]
|
---|
117 | [/uspace/lib/libc/subsume%fat]
|
---|
118 | [/uspace/lib/libc/subsume%devfs]
|
---|
119 |
|
---|
120 | subsume io_dispatcher:ns to ns;
|
---|
121 | subsume tmpfs:ns to ns;
|
---|
122 | subsume fat:ns to ns;
|
---|
123 | subsume devfs:ns to ns;
|
---|
124 |
|
---|
125 | subsume tmpfs:rd to rd;
|
---|
126 | subsume fat:rd to rd;
|
---|
127 |
|
---|
128 | subsume devfs:devmap_client to devmap_client;
|
---|
129 | subsume devfs:device to device;
|
---|
130 | };
|
---|