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
),
40 NULL
, /* should never get called */
41 NULL
, /* should never get called */
42 NULL
, /* should never get called */
50 static struct device
*create_device( int id
)
53 if ((dev
= alloc_object( &device_ops
)))
60 static void device_dump( struct object
*obj
, int verbose
)
62 struct device
*dev
= (struct device
*)obj
;
63 assert( obj
->ops
== &device_ops
);
64 fprintf( stderr
, "Device id=%08x\n", dev
->id
);
67 static int device_get_info( struct object
*obj
, struct get_file_info_request
*req
)
69 struct device
*dev
= (struct device
*)obj
;
70 assert( obj
->ops
== &device_ops
);
71 req
->type
= FILE_TYPE_UNKNOWN
;
72 req
->attr
= dev
->id
; /* hack! */
85 DECL_HANDLER(create_device
)
90 if ((dev
= create_device( req
->id
)))
92 req
->handle
= alloc_handle( current
->process
, dev
, req
->access
, req
->inherit
);
93 release_object( dev
);