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