* Moved IOCallback class into separate source file.

* Moved IOScheduler::_IOCallbackWrapper() to IOCallback::WrapperFunction().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36394 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2010-04-21 11:20:07 +00:00
parent 66f1ecdae7
commit 04b174ca25
5 changed files with 59 additions and 38 deletions

View File

@ -0,0 +1,27 @@
/*
* Copyright 2008-2010, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2004-2009, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*/
#include "IOCallback.h"
IOCallback::~IOCallback()
{
}
status_t
IOCallback::DoIO(IOOperation* operation)
{
return B_ERROR;
}
/*static*/ status_t
IOCallback::WrapperFunction(void* data, io_operation* operation)
{
return ((IOCallback*)data)->DoIO(operation);
}

View File

@ -0,0 +1,27 @@
/*
* Copyright 2008-2010, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2004-2008, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*/
#ifndef IO_CALLBACK_H
#define IO_CALLBACK_H
#include "IORequest.h"
typedef status_t (*io_callback)(void* data, io_operation* operation);
class IOCallback {
public:
virtual ~IOCallback();
virtual status_t DoIO(IOOperation* operation) = 0;
static status_t WrapperFunction(void* data,
io_operation* operation);
};
#endif // IO_CALLBACK_H

View File

@ -31,21 +31,6 @@
#endif
// #pragma mark - IOCallback
IOCallback::~IOCallback()
{
}
status_t
IOCallback::DoIO(IOOperation* operation)
{
return B_ERROR;
}
// #pragma mark -
@ -254,7 +239,7 @@ IOScheduler::InitCheck() const
void
IOScheduler::SetCallback(IOCallback& callback)
{
SetCallback(&_IOCallbackWrapper, &callback);
SetCallback(&IOCallback::WrapperFunction, &callback);
}
@ -870,13 +855,6 @@ IOScheduler::_GetRequestOwner(team_id team, thread_id thread, bool allocate)
}
/*static*/ status_t
IOScheduler::_IOCallbackWrapper(void* data, io_operation* operation)
{
return ((IOCallback*)data)->DoIO(operation);
}
// #pragma mark - IOSchedulerNotificationService

View File

@ -1,5 +1,5 @@
/*
* Copyright 2008-2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2008-2010, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2004-2008, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*/
@ -16,6 +16,7 @@
#include <util/OpenHashTable.h>
#include "dma_resources.h"
#include "IOCallback.h"
#include "IORequest.h"
@ -29,16 +30,6 @@
#define IO_SCHEDULER_OPERATION_FINISHED 0x20
class IOCallback {
public:
virtual ~IOCallback();
virtual status_t DoIO(IOOperation* operation) = 0;
};
typedef status_t (*io_callback)(void* data, io_operation* operation);
struct IORequestOwner : DoublyLinkedListLinkImpl<IORequestOwner> {
team_id team;
thread_id thread;
@ -114,9 +105,6 @@ private:
IORequestOwner* _GetRequestOwner(team_id team, thread_id thread,
bool allocate);
static status_t _IOCallbackWrapper(void* data,
io_operation* operation);
private:
DMAResource* fDMAResource;
char* fName;

View File

@ -11,12 +11,13 @@ KernelMergeObject kernel_device_manager.o :
FileDevice.cpp
id_generator.cpp
io_resources.cpp
IOScheduler.cpp
legacy_drivers.cpp
dma_resources.cpp
io_requests.cpp
IOCallback.cpp
IORequest.cpp
IOScheduler.cpp
:
$(TARGET_KERNEL_PIC_CCFLAGS)
;