2 * Server-side device management
4 * Copyright (C) 1999 Alexandre Julliard
9 * all this stuff is a simple hack to avoid breaking
10 * client-side device support.
28 struct object obj; /* object header */
29 int id; /* client identifier */
32 static void device_dump( struct object *obj, int verbose );
33 static int device_get_info( struct object *obj, struct get_file_info_request *req );
35 static const struct object_ops device_ops =
37 sizeof(struct device), /* size */
38 device_dump, /* dump */
39 no_add_queue, /* add_queue */
40 NULL, /* remove_queue */
43 NULL, /* get_poll_events */
44 NULL, /* poll_event */
45 no_read_fd, /* get_read_fd */
46 no_write_fd, /* get_write_fd */
48 device_get_info, /* get_file_info */
49 no_destroy /* destroy */
52 static struct device *create_device( int id )
55 if ((dev = alloc_object( &device_ops, -1 )))
62 static void device_dump( struct object *obj, int verbose )
64 struct device *dev = (struct device *)obj;
65 assert( obj->ops == &device_ops );
66 fprintf( stderr, "Device id=%08x\n", dev->id );
69 static int device_get_info( struct object *obj, struct get_file_info_request *req )
71 struct device *dev = (struct device *)obj;
72 assert( obj->ops == &device_ops );
73 req->type = FILE_TYPE_UNKNOWN;
74 req->attr = dev->id; /* hack! */
87 DECL_HANDLER(create_device)
92 if ((dev = create_device( req->id )))
94 req->handle = alloc_handle( current->process, dev, req->access, req->inherit );
95 release_object( dev );