haiku/src/system/kernel/device_manager/AbstractModuleDevice.cpp
Ingo Weinhold a9689e8492 * VFS:
- Fixed vfs_get_vnode_from_fd() return type.
  - Added vfs_open_vnode().
  - Added a "bool traverseLeafLink" parameter to vfs_get_fs_node_from_path().
    It was always resolving symlinks.
* device manager/devfs:
  - devfs: get_node_for_path() no longer resolves leaf symlinks. That still
    doesn't help with file disk devices, as creating partition wouldn't work
    anyway.
  - Pulled the module-related implementation part of BaseDevice into new class
    AbstractModuleDevice and made all methods of BaseDevice virtual. Small
    adjustments to devfs to be happy with the new BaseDevice interface.
  - Added BaseDevice subclass FileDevice, which maps the interface to a file's
    file descriptor. Still got a few TODOs, but should basically work.
  - Use FileDevice for publishing file disk devices in devfs. Now those do
    actually work, though there's some BFS trouble with one of the images I
    tested.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33385 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-01 03:06:34 +00:00

122 lines
1.9 KiB
C++

/*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2008-2009, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*/
#include "AbstractModuleDevice.h"
AbstractModuleDevice::AbstractModuleDevice()
:
fNode(NULL),
fInitialized(0),
fDeviceModule(NULL),
fDeviceData(NULL)
{
}
AbstractModuleDevice::~AbstractModuleDevice()
{
}
bool
AbstractModuleDevice::HasSelect() const
{
return Module()->select != NULL;
}
bool
AbstractModuleDevice::HasDeselect() const
{
return Module()->deselect != NULL;
}
bool
AbstractModuleDevice::HasRead() const
{
return Module()->read != NULL;
}
bool
AbstractModuleDevice::HasWrite() const
{
return Module()->write != NULL;
}
bool
AbstractModuleDevice::HasIO() const
{
return Module()->io != NULL;
}
status_t
AbstractModuleDevice::Open(const char* path, int openMode, void** _cookie)
{
return Module()->open(Data(), path, openMode, _cookie);
}
status_t
AbstractModuleDevice::Read(void* cookie, off_t pos, void* buffer, size_t* _length)
{
return Module()->read(cookie, pos, buffer, _length);
}
status_t
AbstractModuleDevice::Write(void* cookie, off_t pos, const void* buffer, size_t* _length)
{
return Module()->write(cookie, pos, buffer, _length);
}
status_t
AbstractModuleDevice::IO(void* cookie, io_request* request)
{
return Module()->io(cookie, request);
}
status_t
AbstractModuleDevice::Control(void* cookie, int32 op, void* buffer, size_t length)
{
return Module()->control(cookie, op, buffer, length);
}
status_t
AbstractModuleDevice::Select(void* cookie, uint8 event, selectsync* sync)
{
return Module()->select(cookie, event, sync);
}
status_t
AbstractModuleDevice::Deselect(void* cookie, uint8 event, selectsync* sync)
{
return Module()->deselect(cookie, event, sync);
}
status_t
AbstractModuleDevice::Close(void* cookie)
{
return Module()->close(cookie);
}
status_t
AbstractModuleDevice::Free(void* cookie)
{
return Module()->free(cookie);
}