xref: /haiku/src/add-ons/kernel/file_systems/userlandfs/server/UserlandRequestHandler.h (revision 02354704729d38c3b078c696adc1bbbd33cbcf72)
1 /*
2  * Copyright 2001-2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef USERLAND_FS_USERLAND_REQUEST_HANDLER_H
6 #define USERLAND_FS_USERLAND_REQUEST_HANDLER_H
7 
8 #include "RequestHandler.h"
9 
10 namespace UserlandFSUtil {
11 
12 // FS
13 class MountVolumeRequest;
14 class UnmountVolumeRequest;
15 class SyncVolumeRequest;
16 class ReadFSInfoRequest;
17 class WriteFSInfoRequest;
18 // vnodes
19 class LookupRequest;
20 class GetVNodeNameRequest;
21 class ReadVNodeRequest;
22 class WriteVNodeRequest;
23 class FSRemoveVNodeRequest;
24 // asynchronous I/O
25 class DoIORequest;
26 class CancelIORequest;
27 class IterativeIOGetVecsRequest;
28 class IterativeIOFinishedRequest;
29 // nodes
30 class IOCtlRequest;
31 class SetFlagsRequest;
32 class SelectRequest;
33 class DeselectRequest;
34 class FSyncRequest;
35 class ReadSymlinkRequest;
36 class CreateSymlinkRequest;
37 class LinkRequest;
38 class UnlinkRequest;
39 class RenameRequest;
40 class AccessRequest;
41 class ReadStatRequest;
42 class WriteStatRequest;
43 // files
44 class CreateRequest;
45 class OpenRequest;
46 class CloseRequest;
47 class FreeCookieRequest;
48 class ReadRequest;
49 class WriteRequest;
50 // directories
51 class CreateDirRequest;
52 class RemoveDirRequest;
53 class OpenDirRequest;
54 class CloseDirRequest;
55 class FreeDirCookieRequest;
56 class ReadDirRequest;
57 class RewindDirRequest;
58 // attribute directories
59 class OpenAttrDirRequest;
60 class CloseAttrDirRequest;
61 class FreeAttrDirCookieRequest;
62 class ReadAttrDirRequest;
63 class RewindAttrDirRequest;
64 // attributes
65 class CreateAttrRequest;
66 class OpenAttrRequest;
67 class CloseAttrRequest;
68 class FreeAttrCookieRequest;
69 class ReadAttrRequest;
70 class WriteAttrRequest;
71 class ReadAttrStatRequest;
72 class WriteAttrStatRequest;
73 class RenameAttrRequest;
74 class RemoveAttrRequest;
75 // indices
76 class OpenIndexDirRequest;
77 class CloseIndexDirRequest;
78 class FreeIndexDirCookieRequest;
79 class ReadIndexDirRequest;
80 class RewindIndexDirRequest;
81 class CreateIndexRequest;
82 class RemoveIndexRequest;
83 class ReadIndexStatRequest;
84 // queries
85 class OpenQueryRequest;
86 class CloseQueryRequest;
87 class FreeQueryCookieRequest;
88 class ReadQueryRequest;
89 class RewindQueryRequest;
90 // node monitoring
91 class NodeMonitoringEventRequest;
92 
93 class RequestAllocator;
94 
95 }	// namespace UserlandFSUtil
96 
97 using namespace UserlandFSUtil;
98 
99 namespace UserlandFS {
100 
101 class FileSystem;
102 
103 class UserlandRequestHandler : public RequestHandler {
104 public:
105 								UserlandRequestHandler(FileSystem* fileSystem);
106 								UserlandRequestHandler(FileSystem* fileSystem,
107 									uint32 expectedReply);
108 	virtual						~UserlandRequestHandler();
109 
110 	virtual	status_t			HandleRequest(Request* request);
111 
112 private:
113 			// FS
114 			status_t			_HandleRequest(MountVolumeRequest* request);
115 			status_t			_HandleRequest(UnmountVolumeRequest* request);
116 			status_t			_HandleRequest(SyncVolumeRequest* request);
117 			status_t			_HandleRequest(ReadFSInfoRequest* request);
118 			status_t			_HandleRequest(WriteFSInfoRequest* request);
119 
120 			// vnodes
121 			status_t			_HandleRequest(LookupRequest* request);
122 			status_t			_HandleRequest(GetVNodeNameRequest* request);
123 			status_t			_HandleRequest(ReadVNodeRequest* request);
124 			status_t			_HandleRequest(WriteVNodeRequest* request);
125 			status_t			_HandleRequest(FSRemoveVNodeRequest* request);
126 
127 			// asynchronous I/O
128 			status_t			_HandleRequest(DoIORequest* request);
129 			status_t			_HandleRequest(CancelIORequest* request);
130 			status_t			_HandleRequest(
131 									IterativeIOGetVecsRequest* request);
132 			status_t			_HandleRequest(
133 									IterativeIOFinishedRequest* request);
134 
135 			// nodes
136 			status_t			_HandleRequest(IOCtlRequest* request);
137 			status_t			_HandleRequest(SetFlagsRequest* request);
138 			status_t			_HandleRequest(SelectRequest* request);
139 			status_t			_HandleRequest(DeselectRequest* request);
140 			status_t			_HandleRequest(FSyncRequest* request);
141 			status_t			_HandleRequest(ReadSymlinkRequest* request);
142 			status_t			_HandleRequest(CreateSymlinkRequest* request);
143 			status_t			_HandleRequest(LinkRequest* request);
144 			status_t			_HandleRequest(UnlinkRequest* request);
145 			status_t			_HandleRequest(RenameRequest* request);
146 			status_t			_HandleRequest(AccessRequest* request);
147 			status_t			_HandleRequest(ReadStatRequest* request);
148 			status_t			_HandleRequest(WriteStatRequest* request);
149 
150 			// files
151 			status_t			_HandleRequest(CreateRequest* request);
152 			status_t			_HandleRequest(OpenRequest* request);
153 			status_t			_HandleRequest(CloseRequest* request);
154 			status_t			_HandleRequest(FreeCookieRequest* request);
155 			status_t			_HandleRequest(ReadRequest* request);
156 			status_t			_HandleRequest(WriteRequest* request);
157 
158 			// directories
159 			status_t			_HandleRequest(CreateDirRequest* request);
160 			status_t			_HandleRequest(RemoveDirRequest* request);
161 			status_t			_HandleRequest(OpenDirRequest* request);
162 			status_t			_HandleRequest(CloseDirRequest* request);
163 			status_t			_HandleRequest(FreeDirCookieRequest* request);
164 			status_t			_HandleRequest(ReadDirRequest* request);
165 			status_t			_HandleRequest(RewindDirRequest* request);
166 
167 			// attribute directories
168 			status_t			_HandleRequest(OpenAttrDirRequest* request);
169 			status_t			_HandleRequest(CloseAttrDirRequest* request);
170 			status_t			_HandleRequest(
171 									FreeAttrDirCookieRequest* request);
172 			status_t			_HandleRequest(ReadAttrDirRequest* request);
173 			status_t			_HandleRequest(RewindAttrDirRequest* request);
174 
175 			// attributes
176 			status_t			_HandleRequest(CreateAttrRequest* request);
177 			status_t			_HandleRequest(OpenAttrRequest* request);
178 			status_t			_HandleRequest(CloseAttrRequest* request);
179 			status_t			_HandleRequest(FreeAttrCookieRequest* request);
180 			status_t			_HandleRequest(ReadAttrRequest* request);
181 			status_t			_HandleRequest(WriteAttrRequest* request);
182 			status_t			_HandleRequest(ReadAttrStatRequest* request);
183 			status_t			_HandleRequest(WriteAttrStatRequest* request);
184 			status_t			_HandleRequest(RenameAttrRequest* request);
185 			status_t			_HandleRequest(RemoveAttrRequest* request);
186 
187 			// indices
188 			status_t			_HandleRequest(OpenIndexDirRequest* request);
189 			status_t			_HandleRequest(CloseIndexDirRequest* request);
190 			status_t			_HandleRequest(
191 									FreeIndexDirCookieRequest* request);
192 			status_t			_HandleRequest(ReadIndexDirRequest* request);
193 			status_t			_HandleRequest(RewindIndexDirRequest* request);
194 			status_t			_HandleRequest(CreateIndexRequest* request);
195 			status_t			_HandleRequest(RemoveIndexRequest* request);
196 			status_t			_HandleRequest(ReadIndexStatRequest* request);
197 
198 			// queries
199 			status_t			_HandleRequest(OpenQueryRequest* request);
200 			status_t			_HandleRequest(CloseQueryRequest* request);
201 			status_t			_HandleRequest(FreeQueryCookieRequest* request);
202 			status_t			_HandleRequest(ReadQueryRequest* request);
203 			status_t			_HandleRequest(RewindQueryRequest* request);
204 
205 			// node monitoring
206 			status_t			_HandleRequest(
207 									NodeMonitoringEventRequest* request);
208 
209 			status_t			_SendReply(RequestAllocator& allocator,
210 									bool expectsReceipt);
211 
212 private:
213 			FileSystem*			fFileSystem;
214 			bool				fExpectReply;
215 			uint32				fExpectedReply;
216 };
217 
218 }	// namespace UserlandFS
219 
220 using UserlandFS::UserlandRequestHandler;
221 
222 #endif	// USERLAND_FS_USERLAND_REQUEST_HANDLER_H
223