xref: /haiku/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/KernelRequestHandler.h (revision 1e60bdeab63fa7a57bc9a55b032052e95a18bd2c)
1 /*
2  * Copyright 2001-2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 #ifndef USERLAND_FS_KERNEL_REQUEST_HANDLER_H
7 #define USERLAND_FS_KERNEL_REQUEST_HANDLER_H
8 
9 #include <fs_interface.h>
10 
11 #include "RequestHandler.h"
12 
13 namespace UserlandFSUtil {
14 
15 class AcquireVNodeRequest;
16 class GetVNodeRemovedRequest;
17 class GetVNodeRequest;
18 class NewVNodeRequest;
19 class NotifyListenerRequest;
20 class NotifyQueryRequest;
21 class NotifySelectEventRequest;
22 class PublishVNodeRequest;
23 class PutVNodeRequest;
24 class RemoveVNodeRequest;
25 class UnremoveVNodeRequest;
26 
27 }
28 
29 using UserlandFSUtil::AcquireVNodeRequest;
30 using UserlandFSUtil::GetVNodeRemovedRequest;
31 using UserlandFSUtil::GetVNodeRequest;
32 using UserlandFSUtil::NewVNodeRequest;
33 using UserlandFSUtil::NotifyListenerRequest;
34 using UserlandFSUtil::NotifyQueryRequest;
35 using UserlandFSUtil::NotifySelectEventRequest;
36 using UserlandFSUtil::PublishVNodeRequest;
37 using UserlandFSUtil::PutVNodeRequest;
38 using UserlandFSUtil::RemoveVNodeRequest;
39 using UserlandFSUtil::UnremoveVNodeRequest;
40 
41 class Volume;
42 
43 class KernelRequestHandler : public RequestHandler {
44 public:
45 								KernelRequestHandler(Volume* volume,
46 									uint32 expectedReply);
47 								KernelRequestHandler(FileSystem* fileSystem,
48 									uint32 expectedReply);
49 	virtual						~KernelRequestHandler();
50 
51 	virtual	status_t			HandleRequest(Request* request);
52 
53 private:
54 			// notifications
55 			status_t			_HandleRequest(NotifyListenerRequest* request);
56 			status_t			_HandleRequest(
57 									NotifySelectEventRequest* request);
58 			status_t			_HandleRequest(NotifyQueryRequest* request);
59 			// vnodes
60 			status_t			_HandleRequest(GetVNodeRequest* request);
61 			status_t			_HandleRequest(PutVNodeRequest* request);
62 			status_t			_HandleRequest(AcquireVNodeRequest* request);
63 			status_t			_HandleRequest(NewVNodeRequest* request);
64 			status_t			_HandleRequest(PublishVNodeRequest* request);
65 			status_t			_HandleRequest(RemoveVNodeRequest* request);
66 			status_t			_HandleRequest(UnremoveVNodeRequest* request);
67 			status_t			_HandleRequest(GetVNodeRemovedRequest* request);
68 			// file cache
69 			status_t			_HandleRequest(FileCacheCreateRequest* request);
70 			status_t			_HandleRequest(FileCacheDeleteRequest* request);
71 			status_t			_HandleRequest(FileCacheSetEnabledRequest* request);
72 			status_t			_HandleRequest(FileCacheSetSizeRequest* request);
73 			status_t			_HandleRequest(FileCacheSyncRequest* request);
74 			status_t			_HandleRequest(FileCacheReadRequest* request);
75 			status_t			_HandleRequest(FileCacheWriteRequest* request);
76 			// I/O
77 			status_t			_HandleRequest(DoIterativeFDIORequest* request);
78 			status_t			_HandleRequest(
79 									ReadFromIORequestRequest* request);
80 			status_t			_HandleRequest(
81 									WriteToIORequestRequest* request);
82 			status_t			_HandleRequest(NotifyIORequestRequest* request);
83 			// node monitoring
84 			status_t			_HandleRequest(AddNodeListenerRequest* request);
85 			status_t			_HandleRequest(
86 									RemoveNodeListenerRequest* request);
87 
88 			status_t			_GetVolume(dev_t id, Volume** volume);
89 
90 private:
91 			FileSystem*			fFileSystem;
92 			Volume*				fVolume;
93 			uint32				fExpectedReply;
94 };
95 
96 #endif	// USERLAND_FS_KERNEL_REQUEST_HANDLER_H
97