1/* 2** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. 3** Distributed under the terms of the NewOS License. 4*/ 5 6 7#include <Drivers.h> 8#include <KernelExport.h> 9 10#include <string.h> 11 12 13#define DEVICE_NAME "zero" 14 15int32 api_version = B_CUR_DRIVER_API_VERSION; 16 17 18static status_t 19zero_open(const char *name, uint32 flags, void **cookie) 20{ 21 *cookie = NULL; 22 return B_OK; 23} 24 25 26static status_t 27zero_close(void *cookie) 28{ 29 return B_OK; 30} 31 32 33static status_t 34zero_freecookie(void *cookie) 35{ 36 return B_OK; 37} 38 39 40static status_t 41zero_ioctl(void *cookie, uint32 op, void *buffer, size_t length) 42{ 43 return EPERM; 44} 45 46 47static status_t 48zero_read(void *cookie, off_t pos, void *buffer, size_t *_length) 49{ 50 if (user_memset(buffer, 0, *_length) < B_OK) 51 return B_BAD_ADDRESS; 52 53 return B_OK; 54} 55 56 57static status_t 58zero_write(void *cookie, off_t pos, const void *buffer, size_t *_length) 59{ 60 return B_OK; 61} 62 63 64// #pragma mark - 65 66 67status_t 68init_hardware(void) 69{ 70 return B_OK; 71} 72 73 74const char ** 75publish_devices(void) 76{ 77 static const char *devices[] = { 78 DEVICE_NAME, 79 NULL 80 }; 81 82 return devices; 83} 84 85 86device_hooks * 87find_device(const char *name) 88{ 89 static device_hooks hooks = { 90 &zero_open, 91 &zero_close, 92 &zero_freecookie, 93 &zero_ioctl, 94 &zero_read, 95 &zero_write, 96 /* Leave select/deselect/readv/writev undefined. The kernel will 97 * use its own default implementation. The basic hooks above this 98 * line MUST be defined, however. */ 99 NULL, 100 NULL, 101 NULL, 102 NULL 103 }; 104 105 if (!strcmp(name, DEVICE_NAME)) 106 return &hooks; 107 108 return NULL; 109} 110 111 112status_t 113init_driver(void) 114{ 115 return B_OK; 116} 117 118 119void 120uninit_driver(void) 121{ 122} 123 124