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.
27 struct object obj; /* object header */
28 int id; /* client identifier */
31 static void device_dump( struct object *obj, int verbose );
32 static int device_get_info( struct object *obj, struct get_file_info_request *req );
34 static const struct object_ops device_ops =
36 sizeof(struct device), /* size */
37 device_dump, /* dump */
38 no_add_queue, /* add_queue */
39 NULL, /* remove_queue */
42 NULL, /* get_poll_events */
43 NULL, /* poll_event */
44 no_read_fd, /* get_read_fd */
45 no_write_fd, /* get_write_fd */
47 device_get_info, /* get_file_info */
48 no_destroy /* destroy */
51 static struct device *create_device( int id )
54 if ((dev = alloc_object( &device_ops, -1 )))
61 static void device_dump( struct object *obj, int verbose )
63 struct device *dev = (struct device *)obj;
64 assert( obj->ops == &device_ops );
65 fprintf( stderr, "Device id=%08x\n", dev->id );
68 static int device_get_info( struct object *obj, struct get_file_info_request *req )
70 struct device *dev = (struct device *)obj;
71 assert( obj->ops == &device_ops );
72 req->type = FILE_TYPE_UNKNOWN;
73 req->attr = dev->id; /* hack! */
86 DECL_HANDLER(create_device)
91 if ((dev = create_device( req->id )))
93 req->handle = alloc_handle( current->process, dev, req->access, req->inherit );
94 release_object( dev );