1 /* 2 * Copyright 2002-2006, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. 6 * Distributed under the terms of the NewOS License. 7 */ 8 9 10 #include <Drivers.h> 11 #include <string.h> 12 13 14 #define DEVICE_NAME "null" 15 16 int32 api_version = B_CUR_DRIVER_API_VERSION; 17 18 19 static status_t 20 null_open(const char *name, uint32 flags, void **cookie) 21 { 22 *cookie = NULL; 23 return B_OK; 24 } 25 26 27 static status_t 28 null_close(void *cookie) 29 { 30 return B_OK; 31 } 32 33 34 static status_t 35 null_freecookie(void *cookie) 36 { 37 return B_OK; 38 } 39 40 41 static status_t 42 null_ioctl(void *cookie, uint32 op, void *buffer, size_t length) 43 { 44 return EPERM; 45 } 46 47 48 static status_t 49 null_read(void *cookie, off_t pos, void *buffer, size_t *_length) 50 { 51 *_length = 0; 52 return B_OK; 53 } 54 55 56 static status_t 57 null_write(void *cookie, off_t pos, const void *buffer, size_t *_length) 58 { 59 return B_OK; 60 } 61 62 63 // #pragma mark - 64 65 66 status_t 67 init_hardware() 68 { 69 return B_OK; 70 } 71 72 73 const char ** 74 publish_devices(void) 75 { 76 static const char *devices[] = { 77 DEVICE_NAME, 78 NULL 79 }; 80 81 return devices; 82 } 83 84 85 device_hooks * 86 find_device(const char *name) 87 { 88 static device_hooks hooks = { 89 &null_open, 90 &null_close, 91 &null_freecookie, 92 &null_ioctl, 93 &null_read, 94 &null_write, 95 }; 96 97 if (!strcmp(name, DEVICE_NAME)) 98 return &hooks; 99 100 return NULL; 101 } 102 103 104 status_t 105 init_driver(void) 106 { 107 return B_OK; 108 } 109 110 111 void 112 uninit_driver(void) 113 { 114 } 115 116