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 <string.h> 9 10 #define DEVICE_NAME "null" 11 12 int32 api_version = B_CUR_DRIVER_API_VERSION; 13 14 15 static status_t 16 null_open(const char *name, uint32 flags, void **cookie) 17 { 18 *cookie = NULL; 19 return B_OK; 20 } 21 22 23 static status_t 24 null_close(void *cookie) 25 { 26 return B_OK; 27 } 28 29 30 static status_t 31 null_freecookie(void *cookie) 32 { 33 return B_OK; 34 } 35 36 37 static status_t 38 null_ioctl(void *cookie, uint32 op, void *buffer, size_t length) 39 { 40 return EPERM; 41 } 42 43 44 static status_t 45 null_read(void *cookie, off_t pos, void *buffer, size_t *length) 46 { 47 return B_OK; 48 } 49 50 51 static status_t 52 null_write(void * cookie, off_t pos, const void *buf, size_t *len) 53 { 54 return B_OK; 55 } 56 57 58 // #pragma mark - 59 60 61 status_t 62 init_hardware() 63 { 64 return B_OK; 65 } 66 67 68 const char ** 69 publish_devices(void) 70 { 71 static const char *devices[] = { 72 DEVICE_NAME, 73 NULL 74 }; 75 76 return devices; 77 } 78 79 80 device_hooks * 81 find_device(const char *name) 82 { 83 static device_hooks hooks = { 84 &null_open, 85 &null_close, 86 &null_freecookie, 87 &null_ioctl, 88 &null_read, 89 &null_write, 90 /* Leave select/deselect/readv/writev undefined. The kernel will 91 * use its own default implementation. The basic hooks above this 92 * line MUST be defined, however. */ 93 NULL, 94 NULL, 95 NULL, 96 NULL 97 }; 98 99 if (!strcmp(name, DEVICE_NAME)) 100 return &hooks; 101 102 return NULL; 103 } 104 105 106 status_t 107 init_driver(void) 108 { 109 return B_OK; 110 } 111 112 113 void 114 uninit_driver(void) 115 { 116 } 117 118