* Removed the now superfluous pnp_devfs.h header.
* There was a leftover in devfs that still needed it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25800 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
/*
|
||||
PnP devfs driver interface.
|
||||
|
||||
The interface follows the normal pnp driver rules, i.e.
|
||||
your driver creates a node for it and chooses PNP_DEVFS_MODULE_NAME
|
||||
as the consumer, the type must be PNP_DEVFS_TYPE_NAME. The file
|
||||
name is set via a PNP_DEVFS_FILENAME item.
|
||||
|
||||
Loading and unloading of your driver is done via the pnp manager.
|
||||
Hooks are similar to the original devfs interface, but the open
|
||||
hook gets the driver cookie (as returned by init_device of the
|
||||
driver) instead of a filename.
|
||||
*/
|
||||
|
||||
#ifndef _PNP_DEVFS_H
|
||||
#define _PNP_DEVFS_H
|
||||
|
||||
|
||||
#include <Drivers.h>
|
||||
#include <device_manager.h>
|
||||
|
||||
|
||||
// changed open hook - gets cookie returned by init_device instead of name
|
||||
typedef status_t (*pnp_device_open_hook)(void *device_cookie, uint32 flags,
|
||||
void **handle_cookie);
|
||||
|
||||
// new interface to devfs
|
||||
typedef struct pnp_devfs_driver_info {
|
||||
driver_module_info info;
|
||||
|
||||
pnp_device_open_hook open; // called to open the device
|
||||
device_close_hook close; // called to close the device
|
||||
device_free_hook free; // called to free the cookie
|
||||
device_control_hook control; // called to control the device
|
||||
device_read_hook read; // reads from the device
|
||||
device_write_hook write; // writes to the device
|
||||
device_select_hook select; // start select (can be NULL)
|
||||
device_deselect_hook deselect; // stop select (can be NULL)
|
||||
device_read_pages_hook read_pages; // scatter-gather read from the device (can be NULL)
|
||||
device_write_pages_hook write_pages; // scatter-gather write to the device (can be NULL)
|
||||
} pnp_devfs_driver_info;
|
||||
|
||||
|
||||
// items:
|
||||
// name under which the device should be published under /dev (required, string)
|
||||
#define PNP_DEVFS_FILENAME "devfs/filename"
|
||||
|
||||
#define PNP_DEVFS_MODULE_NAME "system/devfs/device_v1"
|
||||
|
||||
#endif
|
||||
@@ -4,7 +4,6 @@
|
||||
*/
|
||||
|
||||
#include "scsi_internal.h"
|
||||
#include <pnp_devfs.h>
|
||||
|
||||
locked_pool_interface *locked_pool;
|
||||
device_manager_info *pnp;
|
||||
|
||||
@@ -10,9 +10,7 @@
|
||||
*/
|
||||
|
||||
#include <block_io.h>
|
||||
#include <module.h>
|
||||
#include <locked_pool.h>
|
||||
#include <pnp_devfs.h>
|
||||
#include <device_manager.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -450,47 +450,6 @@ translate_partition_access(devfs_partition* partition, off_t& offset,
|
||||
}
|
||||
|
||||
|
||||
static pnp_devfs_driver_info *
|
||||
create_new_driver_info(device_hooks *ops, int32 version)
|
||||
{
|
||||
pnp_devfs_driver_info *info = (pnp_devfs_driver_info *)malloc(
|
||||
sizeof(pnp_devfs_driver_info));
|
||||
if (info == NULL)
|
||||
return NULL;
|
||||
|
||||
memset(info, 0, sizeof(driver_module_info));
|
||||
|
||||
info->open = NULL;
|
||||
// ops->open is used directly for old devices
|
||||
info->close = ops->close;
|
||||
info->free = ops->free;
|
||||
info->control = ops->control;
|
||||
info->read = ops->read;
|
||||
info->write = ops->write;
|
||||
// depends on api_version
|
||||
info->select = NULL;
|
||||
info->deselect = NULL;
|
||||
|
||||
info->read_pages = NULL;
|
||||
info->write_pages = NULL;
|
||||
// old devices can't know how to do physical page access
|
||||
|
||||
if (version >= 2) {
|
||||
// According to Be newsletter, vol II, issue 36,
|
||||
// version 2 added readv/writev, which we don't support, but also
|
||||
// select/deselect.
|
||||
info->select = ops->select;
|
||||
info->deselect = ops->deselect;
|
||||
|
||||
// ops->readv;
|
||||
// ops->writev;
|
||||
// we don't implement scatter-gather atm, so ignore those.
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
get_node_for_path(struct devfs *fs, const char *path,
|
||||
struct devfs_vnode **_node)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
** Copyright 2004, Axel Dörfler, [email protected]. All rights reserved.
|
||||
** Distributed under the terms of the Haiku License.
|
||||
*/
|
||||
* Copyright 2004-2008, Axel Dörfler, [email protected]. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include "IOScheduler.h"
|
||||
@@ -41,9 +41,9 @@ IORequest::IORequest(void *_cookie, off_t _offset, const void *_buffer, size_t _
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
IOScheduler::IOScheduler(const char *name, pnp_devfs_driver_info *hooks)
|
||||
IOScheduler::IOScheduler(const char* name, device_module_info* module)
|
||||
:
|
||||
fDeviceHooks(hooks)
|
||||
fModule(module)
|
||||
{
|
||||
mutex_init(&fLock, "I/O scheduler queue");
|
||||
|
||||
@@ -82,9 +82,9 @@ IOScheduler::Process(IORequest &request)
|
||||
// ToDo: assume locked memory?
|
||||
|
||||
if (request.write)
|
||||
return fDeviceHooks->write(request.cookie, request.offset, (const void *)request.virtual_address, &request.size);
|
||||
return fModule->write(request.cookie, request.offset, (const void *)request.virtual_address, &request.size);
|
||||
|
||||
return fDeviceHooks->read(request.cookie, request.offset, (void *)request.virtual_address, &request.size);
|
||||
return fModule->read(request.cookie, request.offset, (void *)request.virtual_address, &request.size);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
/*
|
||||
** Copyright 2004, Axel Dörfler, [email protected]. All rights reserved.
|
||||
** Distributed under the terms of the Haiku License.
|
||||
*/
|
||||
* Copyright 2004-2008, Axel Dörfler, [email protected]. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef IO_SCHEDULER_H
|
||||
#define IO_SCHEDULER_H
|
||||
|
||||
|
||||
#include <OS.h>
|
||||
#include <Drivers.h>
|
||||
#include <pnp_devfs.h>
|
||||
#include <device_manager.h>
|
||||
|
||||
#include <util/DoublyLinkedList.h>
|
||||
#include <lock.h>
|
||||
@@ -34,11 +32,11 @@ class IORequest : public DoublyLinkedListLinkImpl<IORequest> {
|
||||
|
||||
class IOScheduler {
|
||||
public:
|
||||
IOScheduler(const char *name, pnp_devfs_driver_info *hooks);
|
||||
IOScheduler(const char* name, device_module_info* module);
|
||||
~IOScheduler();
|
||||
|
||||
status_t InitCheck() const;
|
||||
status_t Process(IORequest &request);
|
||||
status_t Process(IORequest& request);
|
||||
|
||||
#if 0
|
||||
static IOScheduler *GetScheduler();
|
||||
@@ -46,10 +44,10 @@ class IOScheduler {
|
||||
|
||||
private:
|
||||
int32 Scheduler();
|
||||
static int32 scheduler(void *);
|
||||
static int32 scheduler(void*);
|
||||
|
||||
private:
|
||||
pnp_devfs_driver_info *fDeviceHooks;
|
||||
device_module_info* fModule;
|
||||
mutex fLock;
|
||||
thread_id fThread;
|
||||
DoublyLinkedList<IORequest> fRequests;
|
||||
|
||||
Reference in New Issue
Block a user