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 16int32 api_version = B_CUR_DRIVER_API_VERSION; 17 18 19static status_t 20null_open(const char *name, uint32 flags, void **cookie) 21{ 22 *cookie = NULL; 23 return B_OK; 24} 25 26 27static status_t 28null_close(void *cookie) 29{ 30 return B_OK; 31} 32 33 34static status_t 35null_freecookie(void *cookie) 36{ 37 return B_OK; 38} 39 40 41static status_t 42null_ioctl(void *cookie, uint32 op, void *buffer, size_t length) 43{ 44 return EPERM; 45} 46 47 48static status_t 49null_read(void *cookie, off_t pos, void *buffer, size_t *_length) 50{ 51 *_length = 0; 52 return B_OK; 53} 54 55 56static status_t 57null_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 66status_t 67init_hardware() 68{ 69 return B_OK; 70} 71 72 73const char ** 74publish_devices(void) 75{ 76 static const char *devices[] = { 77 DEVICE_NAME, 78 NULL 79 }; 80 81 return devices; 82} 83 84 85device_hooks * 86find_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 /* Leave select/deselect/readv/writev undefined. The kernel will 96 * use its own default implementation. The basic hooks above this 97 * line MUST be defined, however. */ 98 NULL, 99 NULL, 100 NULL, 101 NULL 102 }; 103 104 if (!strcmp(name, DEVICE_NAME)) 105 return &hooks; 106 107 return NULL; 108} 109 110 111status_t 112init_driver(void) 113{ 114 return B_OK; 115} 116 117 118void 119uninit_driver(void) 120{ 121} 122 123