btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / system / kernel / device_manager / IOScheduler.cpp
blobbc898a009072918515bae360d523807a9e962dfd
1 /*
2 * Copyright 2010, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
7 #include "IOScheduler.h"
9 #include <stdlib.h>
10 #include <string.h>
12 #include "IOSchedulerRoster.h"
15 IOScheduler::IOScheduler(DMAResource* resource)
17 fDMAResource(resource),
18 fName(NULL),
19 fID(IOSchedulerRoster::Default()->NextID()),
20 fIOCallback(NULL),
21 fIOCallbackData(NULL),
22 fSchedulerRegistered(false)
27 IOScheduler::~IOScheduler()
29 if (fSchedulerRegistered)
30 IOSchedulerRoster::Default()->RemoveScheduler(this);
32 free(fName);
36 status_t
37 IOScheduler::Init(const char* name)
39 fName = strdup(name);
40 if (fName == NULL)
41 return B_NO_MEMORY;
43 IOSchedulerRoster::Default()->AddScheduler(this);
44 fSchedulerRegistered = true;
46 return B_OK;
50 void
51 IOScheduler::SetCallback(IOCallback& callback)
53 SetCallback(&IOCallback::WrapperFunction, &callback);
57 void
58 IOScheduler::SetCallback(io_callback callback, void* data)
60 fIOCallback = callback;
61 fIOCallbackData = data;
65 void
66 IOScheduler::SetDeviceCapacity(off_t deviceCapacity)
71 void
72 IOScheduler::MediaChanged()