2 Copyright (C) 2008 Mathias Gottschlag
4 Permission is hereby granted, free of charge, to any person obtaining a copy of
5 this software and associated documentation files (the "Software"), to deal in the
6 Software without restriction, including without limitation the rights to use,
7 copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
8 Software, and to permit persons to whom the Software is furnished to do so,
9 subject to the following conditions:
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
16 PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
18 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
19 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 * Raw file system request functions.
26 #ifndef FS_REQUEST_H_INCLUDED
27 #define FS_REQUEST_H_INCLUDED
30 #include "ke/spinlock.h"
31 #include "ke/thread.h"
34 * File system request type
51 typedef struct FsRequest
62 * Target file. Can only be 0 for FS_REQUEST_OPEN and FS_REQUEST_MKNOD.
66 * Generic flags for the file system request.
71 * Size of the request buffer.
73 uint32_t bufferlength
;
75 * Request buffer for data transmission.
80 * Offset for read/write and seek operations.
84 * Origin for seek operations. 0 means start of the file, 2 means end
89 * If set to 0, don't perform any operations which would block the calling
95 * Status of the request.
99 * Return value for the request type. Holds for example the number of bytes
100 * read/written, or -1 in case of an error.
104 * If set to 1, the request has been finished.
114 * Thread waiting for the request to be completed. This will in many cases
115 * be 0, so don't rely on this being the thread which issued the request.
120 * Request lock. Can be used by file systems.
126 * Creates a file system request.
127 * \param request Request to be issued.
128 * \param wait If set to 1, blocks until the request has been completed.
130 int fsCreateRequest(FsRequest
*request
, int wait
);
132 * Waits for a request to be completed.
134 int fsWaitRequest(FsRequest
*request
);
137 * Finishes a request and wakes up any thread waiting for it.
139 int fsFinishRequest(FsRequest
*request
);