From 05928f80cd4118a16d40d53eaa5b726bb74647df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 3 May 2003 03:02:48 +0000 Subject: [PATCH] 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 --- src/add-ons/kernel/drivers/common/null.c | 36 ++++++++++++++------- src/add-ons/kernel/drivers/common/zero.c | 41 +++++++++++++++--------- 2 files changed, 49 insertions(+), 28 deletions(-) diff --git a/src/add-ons/kernel/drivers/common/null.c b/src/add-ons/kernel/drivers/common/null.c index 41f60d8934..35b39faaa8 100644 --- a/src/add-ons/kernel/drivers/common/null.c +++ b/src/add-ons/kernel/drivers/common/null.c @@ -2,58 +2,67 @@ ** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ -#include -#include -#include -#include -#include + + +#include #include #define DEVICE_NAME "null" + static status_t -null_open(const char *name, uint32 flags, void * *cookie) +null_open(const char *name, uint32 flags, void **cookie) { *cookie = NULL; return 0; } + static status_t -null_close(void * cookie) +null_close(void *cookie) { return 0; } + static status_t -null_freecookie(void * cookie) +null_freecookie(void *cookie) { return 0; } + 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; } + 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; } + static ssize_t null_write(void * cookie, off_t pos, const void *buf, size_t *len) { return 0; } + +// #pragma mark - + + status_t init_hardware() { return 0; } + const char ** publish_devices(void) { @@ -65,6 +74,7 @@ publish_devices(void) return devices; } + device_hooks * find_device(const char *name) { @@ -90,14 +100,16 @@ find_device(const char *name) return NULL; } + status_t -init_driver() +init_driver(void) { return 0; } + void -uninit_driver() +uninit_driver(void) { } diff --git a/src/add-ons/kernel/drivers/common/zero.c b/src/add-ons/kernel/drivers/common/zero.c index 9ac3944bbd..d3358ab83a 100644 --- a/src/add-ons/kernel/drivers/common/zero.c +++ b/src/add-ons/kernel/drivers/common/zero.c @@ -2,16 +2,15 @@ ** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ -#include -#include -#include -#include + + +#include #include #include -#include #define DEVICE_NAME "zero" + static status_t zero_open(const char *name, uint32 flags, void **cookie) { @@ -19,48 +18,55 @@ zero_open(const char *name, uint32 flags, void **cookie) return 0; } + static status_t -zero_close(void * cookie) +zero_close(void *cookie) { return 0; } + static status_t -zero_freecookie(void * cookie) +zero_freecookie(void *cookie) { return 0; } + 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; } -static ssize_t -zero_read(void * cookie, off_t pos, void *buf, size_t *len) -{ - int rc; - rc = user_memset(buf, 0, *len); - if(rc < 0) - return rc; +static ssize_t +zero_read(void *cookie, off_t pos, void *buffer, size_t *_length) +{ + if (user_memset(buffer, 0, *_length) < B_OK) + return B_BAD_ADDRESS; return 0; } + 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; } + +// #pragma mark - + + status_t init_hardware() { return 0; } + const char ** publish_devices(void) { @@ -72,6 +78,7 @@ publish_devices(void) return devices; } + device_hooks * find_device(const char *name) { @@ -97,12 +104,14 @@ find_device(const char *name) return NULL; } + status_t init_driver() { return 0; } + void uninit_driver() {