Added support for new notify_io_request() function.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31970 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -234,6 +234,8 @@ enum {
|
|||||||
// I/O
|
// I/O
|
||||||
DO_ITERATIVE_FD_IO_REQUEST,
|
DO_ITERATIVE_FD_IO_REQUEST,
|
||||||
DO_ITERATIVE_FD_IO_REPLY,
|
DO_ITERATIVE_FD_IO_REPLY,
|
||||||
|
NOTIFY_IO_REQUEST_REQUEST,
|
||||||
|
NOTIFY_IO_REQUEST_REPLY,
|
||||||
|
|
||||||
// general reply
|
// general reply
|
||||||
RECEIPT_ACK_REPLY,
|
RECEIPT_ACK_REPLY,
|
||||||
@@ -1829,6 +1831,24 @@ public:
|
|||||||
DoIterativeFDIOReply() : ReplyRequest(DO_ITERATIVE_FD_IO_REPLY) {}
|
DoIterativeFDIOReply() : ReplyRequest(DO_ITERATIVE_FD_IO_REPLY) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// NotifyIORequestRequest
|
||||||
|
class NotifyIORequestRequest : public Request {
|
||||||
|
public:
|
||||||
|
NotifyIORequestRequest() : Request(NOTIFY_IO_REQUEST_REQUEST) {}
|
||||||
|
|
||||||
|
enum { MAX_VECS = 8 };
|
||||||
|
|
||||||
|
dev_t nsid;
|
||||||
|
int32 request;
|
||||||
|
status_t status;
|
||||||
|
};
|
||||||
|
|
||||||
|
// NotifyIORequestReply
|
||||||
|
class NotifyIORequestReply : public ReplyRequest {
|
||||||
|
public:
|
||||||
|
NotifyIORequestReply() : ReplyRequest(NOTIFY_IO_REQUEST_REPLY) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
//////////////////
|
//////////////////
|
||||||
// General Reply
|
// General Reply
|
||||||
@@ -2228,6 +2248,10 @@ do_for_request(Request* request, Task& task)
|
|||||||
return task((DoIterativeFDIORequest*)request);
|
return task((DoIterativeFDIORequest*)request);
|
||||||
case DO_ITERATIVE_FD_IO_REPLY:
|
case DO_ITERATIVE_FD_IO_REPLY:
|
||||||
return task((DoIterativeFDIOReply*)request);
|
return task((DoIterativeFDIOReply*)request);
|
||||||
|
case NOTIFY_IO_REQUEST_REQUEST:
|
||||||
|
return task((NotifyIORequestRequest*)request);
|
||||||
|
case NOTIFY_IO_REQUEST_REPLY:
|
||||||
|
return task((NotifyIORequestReply*)request);
|
||||||
// general reply
|
// general reply
|
||||||
case RECEIPT_ACK_REPLY:
|
case RECEIPT_ACK_REPLY:
|
||||||
return task((ReceiptAckReply*)request);
|
return task((ReceiptAckReply*)request);
|
||||||
@@ -2451,6 +2475,8 @@ using UserlandFSUtil::FileCacheWriteReply;
|
|||||||
// I/O
|
// I/O
|
||||||
using UserlandFSUtil::DoIterativeFDIORequest;
|
using UserlandFSUtil::DoIterativeFDIORequest;
|
||||||
using UserlandFSUtil::DoIterativeFDIOReply;
|
using UserlandFSUtil::DoIterativeFDIOReply;
|
||||||
|
using UserlandFSUtil::NotifyIORequestRequest;
|
||||||
|
using UserlandFSUtil::NotifyIORequestReply;
|
||||||
// general reply
|
// general reply
|
||||||
using UserlandFSUtil::ReceiptAckReply;
|
using UserlandFSUtil::ReceiptAckReply;
|
||||||
|
|
||||||
|
|||||||
@@ -106,6 +106,8 @@ KernelRequestHandler::HandleRequest(Request* request)
|
|||||||
// I/O
|
// I/O
|
||||||
case DO_ITERATIVE_FD_IO_REQUEST:
|
case DO_ITERATIVE_FD_IO_REQUEST:
|
||||||
return _HandleRequest((DoIterativeFDIORequest*)request);
|
return _HandleRequest((DoIterativeFDIORequest*)request);
|
||||||
|
case NOTIFY_IO_REQUEST_REQUEST:
|
||||||
|
return _HandleRequest((NotifyIORequestRequest*)request);
|
||||||
}
|
}
|
||||||
PRINT(("KernelRequestHandler::HandleRequest(): unexpected request: %lu\n",
|
PRINT(("KernelRequestHandler::HandleRequest(): unexpected request: %lu\n",
|
||||||
request->GetType()));
|
request->GetType()));
|
||||||
@@ -745,6 +747,31 @@ KernelRequestHandler::_HandleRequest(DoIterativeFDIORequest* request)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// _HandleRequest
|
||||||
|
status_t
|
||||||
|
KernelRequestHandler::_HandleRequest(NotifyIORequestRequest* request)
|
||||||
|
{
|
||||||
|
// check and execute the request
|
||||||
|
Volume* volume = NULL;
|
||||||
|
status_t result = _GetVolume(request->nsid, &volume);
|
||||||
|
VolumePutter _(volume);
|
||||||
|
|
||||||
|
if (result == B_OK)
|
||||||
|
result = volume->NotifyIORequest(request->request, request->status);
|
||||||
|
|
||||||
|
// prepare the reply
|
||||||
|
RequestAllocator allocator(fPort->GetPort());
|
||||||
|
NotifyIORequestReply* reply;
|
||||||
|
status_t error = AllocateRequest(allocator, &reply);
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
reply->error = result;
|
||||||
|
|
||||||
|
// send the reply
|
||||||
|
return fPort->SendRequest(&allocator);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// _GetVolume
|
// _GetVolume
|
||||||
status_t
|
status_t
|
||||||
KernelRequestHandler::_GetVolume(dev_t id, Volume** volume)
|
KernelRequestHandler::_GetVolume(dev_t id, Volume** volume)
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ private:
|
|||||||
status_t _HandleRequest(FileCacheWriteRequest* request);
|
status_t _HandleRequest(FileCacheWriteRequest* request);
|
||||||
// I/O
|
// I/O
|
||||||
status_t _HandleRequest(DoIterativeFDIORequest* request);
|
status_t _HandleRequest(DoIterativeFDIORequest* request);
|
||||||
|
status_t _HandleRequest(NotifyIORequestRequest* request);
|
||||||
|
|
||||||
status_t _GetVolume(dev_t id, Volume** volume);
|
status_t _GetVolume(dev_t id, Volume** volume);
|
||||||
|
|
||||||
|
|||||||
@@ -734,6 +734,20 @@ Volume::DoIterativeFDIO(int fd, int32 requestID, void* clientCookie,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
Volume::NotifyIORequest(int32 requestID, status_t status)
|
||||||
|
{
|
||||||
|
// get the request
|
||||||
|
io_request* request;
|
||||||
|
status_t error = _FindIORequest(requestID, &request);
|
||||||
|
if (error != B_OK)
|
||||||
|
RETURN_ERROR(error);
|
||||||
|
|
||||||
|
notify_io_request(request, status);
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - FS
|
// #pragma mark - FS
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -75,6 +75,8 @@ public:
|
|||||||
status_t DoIterativeFDIO(int fd, int32 requestID,
|
status_t DoIterativeFDIO(int fd, int32 requestID,
|
||||||
void* cookie, const file_io_vec* vecs,
|
void* cookie, const file_io_vec* vecs,
|
||||||
uint32 vecCount);
|
uint32 vecCount);
|
||||||
|
status_t NotifyIORequest(int32 requestID,
|
||||||
|
status_t status);
|
||||||
|
|
||||||
// FS
|
// FS
|
||||||
status_t Mount(const char* device, uint32 flags,
|
status_t Mount(const char* device, uint32 flags,
|
||||||
|
|||||||
@@ -720,8 +720,10 @@ UserlandFSUtil::is_kernel_request(uint32 type)
|
|||||||
return true;
|
return true;
|
||||||
// I/O
|
// I/O
|
||||||
case DO_ITERATIVE_FD_IO_REQUEST:
|
case DO_ITERATIVE_FD_IO_REQUEST:
|
||||||
|
case NOTIFY_IO_REQUEST_REQUEST:
|
||||||
return false;
|
return false;
|
||||||
case DO_ITERATIVE_FD_IO_REPLY:
|
case DO_ITERATIVE_FD_IO_REPLY:
|
||||||
|
case NOTIFY_IO_REQUEST_REPLY:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// general reply
|
// general reply
|
||||||
@@ -961,8 +963,10 @@ UserlandFSUtil::is_userland_request(uint32 type)
|
|||||||
return false;
|
return false;
|
||||||
// I/O
|
// I/O
|
||||||
case DO_ITERATIVE_FD_IO_REQUEST:
|
case DO_ITERATIVE_FD_IO_REQUEST:
|
||||||
|
case NOTIFY_IO_REQUEST_REQUEST:
|
||||||
return true;
|
return true;
|
||||||
case DO_ITERATIVE_FD_IO_REPLY:
|
case DO_ITERATIVE_FD_IO_REPLY:
|
||||||
|
case NOTIFY_IO_REQUEST_REPLY:
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// general reply
|
// general reply
|
||||||
|
|||||||
@@ -319,6 +319,17 @@ io_request_is_write(const io_request* request)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
notify_io_request(io_request* _request, status_t status)
|
||||||
|
{
|
||||||
|
HaikuKernelIORequest* request = (HaikuKernelIORequest*)request;
|
||||||
|
|
||||||
|
// send the request
|
||||||
|
UserlandFS::KernelEmu::notify_io_request(request->volume->GetID(),
|
||||||
|
request->id, status);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - Disk Device Manager
|
// #pragma mark - Disk Device Manager
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -890,6 +890,41 @@ UserlandFS::KernelEmu::do_iterative_fd_io(dev_t volumeID, int fd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
UserlandFS::KernelEmu::notify_io_request(dev_t volumeID, int32 requestID,
|
||||||
|
status_t status)
|
||||||
|
{
|
||||||
|
// get the request port and the file system
|
||||||
|
RequestPort* port;
|
||||||
|
FileSystem* fileSystem;
|
||||||
|
status_t error = get_port_and_fs(&port, &fileSystem);
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
|
||||||
|
// prepare the request
|
||||||
|
RequestAllocator allocator(port->GetPort());
|
||||||
|
NotifyIORequestRequest* request;
|
||||||
|
error = AllocateRequest(allocator, &request);
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
|
||||||
|
request->nsid = volumeID;
|
||||||
|
request->request = requestID;
|
||||||
|
request->status = status;
|
||||||
|
|
||||||
|
// send the request
|
||||||
|
UserlandRequestHandler handler(fileSystem, NOTIFY_IO_REQUEST_REPLY);
|
||||||
|
NotifyIORequestReply* reply;
|
||||||
|
error = port->SendRequest(&allocator, &handler, (Request**)&reply);
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
RequestReleaser requestReleaser(port, reply);
|
||||||
|
|
||||||
|
// process the reply
|
||||||
|
return reply->error;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ status_t file_cache_write(dev_t mountID, ino_t vnodeID, void *cookie,
|
|||||||
|
|
||||||
status_t do_iterative_fd_io(dev_t volumeID, int fd, int32 requestID,
|
status_t do_iterative_fd_io(dev_t volumeID, int fd, int32 requestID,
|
||||||
void* cookie, const file_io_vec* vecs, uint32 vecCount);
|
void* cookie, const file_io_vec* vecs, uint32 vecCount);
|
||||||
|
status_t notify_io_request(dev_t volumeID, int32 requestID, status_t status);
|
||||||
|
|
||||||
void kernel_debugger(const char *message);
|
void kernel_debugger(const char *message);
|
||||||
void vpanic(const char *format, va_list args);
|
void vpanic(const char *format, va_list args);
|
||||||
|
|||||||
Reference in New Issue
Block a user