Cleanup of the null/zero drivers - removed unused includes, ...

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3131 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2003-05-03 03:02:48 +00:00
parent c8093d3c8d
commit 05928f80cd
2 changed files with 49 additions and 28 deletions

View File

@ -2,15 +2,14 @@
** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. ** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License. ** Distributed under the terms of the NewOS License.
*/ */
#include <kernel.h>
#include <stage2.h>
#include <memheap.h> #include <Drivers.h>
#include <devfs.h>
#include <Errors.h>
#include <string.h> #include <string.h>
#define DEVICE_NAME "null" #define DEVICE_NAME "null"
static status_t static status_t
null_open(const char *name, uint32 flags, void **cookie) null_open(const char *name, uint32 flags, void **cookie)
{ {
@ -18,42 +17,52 @@ null_open(const char *name, uint32 flags, void * *cookie)
return 0; return 0;
} }
static status_t static status_t
null_close(void *cookie) null_close(void *cookie)
{ {
return 0; return 0;
} }
static status_t static status_t
null_freecookie(void *cookie) null_freecookie(void *cookie)
{ {
return 0; return 0;
} }
static status_t static status_t
null_ioctl(void * cookie, uint32 op, void *buf, size_t len) null_ioctl(void *cookie, uint32 op, void *buffer, size_t length)
{ {
return EPERM; return EPERM;
} }
static ssize_t static ssize_t
null_read(void * cookie, off_t pos, void *buf, size_t *len) null_read(void *cookie, off_t pos, void *buffer, size_t *length)
{ {
return 0; return 0;
} }
static ssize_t static ssize_t
null_write(void * cookie, off_t pos, const void *buf, size_t *len) null_write(void * cookie, off_t pos, const void *buf, size_t *len)
{ {
return 0; return 0;
} }
// #pragma mark -
status_t status_t
init_hardware() init_hardware()
{ {
return 0; return 0;
} }
const char ** const char **
publish_devices(void) publish_devices(void)
{ {
@ -65,6 +74,7 @@ publish_devices(void)
return devices; return devices;
} }
device_hooks * device_hooks *
find_device(const char *name) find_device(const char *name)
{ {
@ -90,14 +100,16 @@ find_device(const char *name)
return NULL; return NULL;
} }
status_t status_t
init_driver() init_driver(void)
{ {
return 0; return 0;
} }
void void
uninit_driver() uninit_driver(void)
{ {
} }

View File

@ -2,16 +2,15 @@
** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. ** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License. ** Distributed under the terms of the NewOS License.
*/ */
#include <kernel.h>
#include <stage2.h>
#include <memheap.h> #include <Drivers.h>
#include <devfs.h>
#include <vm.h> #include <vm.h>
#include <string.h> #include <string.h>
#include <Errors.h>
#define DEVICE_NAME "zero" #define DEVICE_NAME "zero"
static status_t static status_t
zero_open(const char *name, uint32 flags, void **cookie) zero_open(const char *name, uint32 flags, void **cookie)
{ {
@ -19,48 +18,55 @@ zero_open(const char *name, uint32 flags, void **cookie)
return 0; return 0;
} }
static status_t static status_t
zero_close(void *cookie) zero_close(void *cookie)
{ {
return 0; return 0;
} }
static status_t static status_t
zero_freecookie(void *cookie) zero_freecookie(void *cookie)
{ {
return 0; return 0;
} }
static status_t static status_t
zero_ioctl(void * cookie, uint32 op, void *buf, size_t len) zero_ioctl(void *cookie, uint32 op, void *buffer, size_t length)
{ {
return EPERM; return EPERM;
} }
static ssize_t
zero_read(void * cookie, off_t pos, void *buf, size_t *len)
{
int rc;
rc = user_memset(buf, 0, *len); static ssize_t
if(rc < 0) zero_read(void *cookie, off_t pos, void *buffer, size_t *_length)
return rc; {
if (user_memset(buffer, 0, *_length) < B_OK)
return B_BAD_ADDRESS;
return 0; return 0;
} }
static ssize_t static ssize_t
zero_write(void * cookie, off_t pos, const void *buf, size_t *len) zero_write(void *cookie, off_t pos, const void *buffer, size_t *_length)
{ {
return 0; return 0;
} }
// #pragma mark -
status_t status_t
init_hardware() init_hardware()
{ {
return 0; return 0;
} }
const char ** const char **
publish_devices(void) publish_devices(void)
{ {
@ -72,6 +78,7 @@ publish_devices(void)
return devices; return devices;
} }
device_hooks * device_hooks *
find_device(const char *name) find_device(const char *name)
{ {
@ -97,12 +104,14 @@ find_device(const char *name)
return NULL; return NULL;
} }
status_t status_t
init_driver() init_driver()
{ {
return 0; return 0;
} }
void void
uninit_driver() uninit_driver()
{ {