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_reply *reply );
33 static void device_destroy( struct object *obj );
35 static const struct object_ops device_ops =
39 NULL, /* should never get called */
40 NULL, /* should never get called */
41 NULL, /* should never get called */
49 static struct object *create_device( int id )
53 if (!(dev = mem_alloc(sizeof(*dev)))) return NULL;
54 init_object( &dev->obj, &device_ops, NULL );
59 static void device_dump( struct object *obj, int verbose )
61 struct device *dev = (struct device *)obj;
62 assert( obj->ops == &device_ops );
63 fprintf( stderr, "Device id=%08x\n", dev->id );
66 static int device_get_info( struct object *obj, struct get_file_info_reply *reply )
68 struct device *dev = (struct device *)obj;
69 assert( obj->ops == &device_ops );
70 memset( reply, 0, sizeof(*reply) );
71 reply->type = FILE_TYPE_UNKNOWN;
72 reply->attr = dev->id; /* hack! */
76 static void device_destroy( struct object *obj )
78 struct device *dev = (struct device *)obj;
79 assert( obj->ops == &device_ops );
84 DECL_HANDLER(create_device)
87 struct create_device_reply reply = { -1 };
89 if ((obj = create_device( req->id )))
91 reply.handle = alloc_handle( current->process, obj,
92 req->access, req->inherit );
93 release_object( obj );
95 send_reply( current, -1, 1, &reply, sizeof(reply) );