xref: /haiku/src/add-ons/kernel/file_systems/userlandfs/server/UserlandRequestHandler.h (revision b671e9bbdbd10268a042b4f4cc4317ccd03d105e)
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 
91 class RequestAllocator;
92 
93 }	// namespace UserlandFSUtil
94 
95 using namespace UserlandFSUtil;
96 
97 namespace UserlandFS {
98 
99 class FileSystem;
100 
101 class UserlandRequestHandler : public RequestHandler {
102 public:
103 								UserlandRequestHandler(FileSystem* fileSystem);
104 								UserlandRequestHandler(FileSystem* fileSystem,
105 									uint32 expectedReply);
106 	virtual						~UserlandRequestHandler();
107 
108 	virtual	status_t			HandleRequest(Request* request);
109 
110 private:
111 			// FS
112 			status_t			_HandleRequest(MountVolumeRequest* request);
113 			status_t			_HandleRequest(UnmountVolumeRequest* request);
114 			status_t			_HandleRequest(SyncVolumeRequest* request);
115 			status_t			_HandleRequest(ReadFSInfoRequest* request);
116 			status_t			_HandleRequest(WriteFSInfoRequest* request);
117 
118 			// vnodes
119 			status_t			_HandleRequest(LookupRequest* request);
120 			status_t			_HandleRequest(GetVNodeNameRequest* request);
121 			status_t			_HandleRequest(ReadVNodeRequest* request);
122 			status_t			_HandleRequest(WriteVNodeRequest* request);
123 			status_t			_HandleRequest(FSRemoveVNodeRequest* request);
124 
125 			// asynchronous I/O
126 			status_t			_HandleRequest(DoIORequest* request);
127 			status_t			_HandleRequest(CancelIORequest* request);
128 			status_t			_HandleRequest(
129 									IterativeIOGetVecsRequest* request);
130 			status_t			_HandleRequest(
131 									IterativeIOFinishedRequest* request);
132 
133 			// nodes
134 			status_t			_HandleRequest(IOCtlRequest* request);
135 			status_t			_HandleRequest(SetFlagsRequest* request);
136 			status_t			_HandleRequest(SelectRequest* request);
137 			status_t			_HandleRequest(DeselectRequest* request);
138 			status_t			_HandleRequest(FSyncRequest* request);
139 			status_t			_HandleRequest(ReadSymlinkRequest* request);
140 			status_t			_HandleRequest(CreateSymlinkRequest* request);
141 			status_t			_HandleRequest(LinkRequest* request);
142 			status_t			_HandleRequest(UnlinkRequest* request);
143 			status_t			_HandleRequest(RenameRequest* request);
144 			status_t			_HandleRequest(AccessRequest* request);
145 			status_t			_HandleRequest(ReadStatRequest* request);
146 			status_t			_HandleRequest(WriteStatRequest* request);
147 
148 			// files
149 			status_t			_HandleRequest(CreateRequest* request);
150 			status_t			_HandleRequest(OpenRequest* request);
151 			status_t			_HandleRequest(CloseRequest* request);
152 			status_t			_HandleRequest(FreeCookieRequest* request);
153 			status_t			_HandleRequest(ReadRequest* request);
154 			status_t			_HandleRequest(WriteRequest* request);
155 
156 			// directories
157 			status_t			_HandleRequest(CreateDirRequest* request);
158 			status_t			_HandleRequest(RemoveDirRequest* request);
159 			status_t			_HandleRequest(OpenDirRequest* request);
160 			status_t			_HandleRequest(CloseDirRequest* request);
161 			status_t			_HandleRequest(FreeDirCookieRequest* request);
162 			status_t			_HandleRequest(ReadDirRequest* request);
163 			status_t			_HandleRequest(RewindDirRequest* request);
164 
165 			// attribute directories
166 			status_t			_HandleRequest(OpenAttrDirRequest* request);
167 			status_t			_HandleRequest(CloseAttrDirRequest* request);
168 			status_t			_HandleRequest(
169 									FreeAttrDirCookieRequest* request);
170 			status_t			_HandleRequest(ReadAttrDirRequest* request);
171 			status_t			_HandleRequest(RewindAttrDirRequest* request);
172 
173 			// attributes
174 			status_t			_HandleRequest(CreateAttrRequest* request);
175 			status_t			_HandleRequest(OpenAttrRequest* request);
176 			status_t			_HandleRequest(CloseAttrRequest* request);
177 			status_t			_HandleRequest(FreeAttrCookieRequest* request);
178 			status_t			_HandleRequest(ReadAttrRequest* request);
179 			status_t			_HandleRequest(WriteAttrRequest* request);
180 			status_t			_HandleRequest(ReadAttrStatRequest* request);
181 			status_t			_HandleRequest(WriteAttrStatRequest* request);
182 			status_t			_HandleRequest(RenameAttrRequest* request);
183 			status_t			_HandleRequest(RemoveAttrRequest* request);
184 
185 			// indices
186 			status_t			_HandleRequest(OpenIndexDirRequest* request);
187 			status_t			_HandleRequest(CloseIndexDirRequest* request);
188 			status_t			_HandleRequest(
189 									FreeIndexDirCookieRequest* request);
190 			status_t			_HandleRequest(ReadIndexDirRequest* request);
191 			status_t			_HandleRequest(RewindIndexDirRequest* request);
192 			status_t			_HandleRequest(CreateIndexRequest* request);
193 			status_t			_HandleRequest(RemoveIndexRequest* request);
194 			status_t			_HandleRequest(ReadIndexStatRequest* request);
195 
196 			// queries
197 			status_t			_HandleRequest(OpenQueryRequest* request);
198 			status_t			_HandleRequest(CloseQueryRequest* request);
199 			status_t			_HandleRequest(FreeQueryCookieRequest* request);
200 			status_t			_HandleRequest(ReadQueryRequest* request);
201 			status_t			_HandleRequest(RewindQueryRequest* request);
202 
203 			status_t			_SendReply(RequestAllocator& allocator,
204 									bool expectsReceipt);
205 
206 private:
207 			FileSystem*			fFileSystem;
208 			bool				fExpectReply;
209 			uint32				fExpectedReply;
210 };
211 
212 }	// namespace UserlandFS
213 
214 using UserlandFS::UserlandRequestHandler;
215 
216 #endif	// USERLAND_FS_USERLAND_REQUEST_HANDLER_H
217