1 /***************************************************************************
3 * devinfo.h : definitions for libdevinfo-based device enumeration
5 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
6 * Use is subject to license terms.
8 * Licensed under the Academic Free License version 2.1
10 **************************************************************************/
12 #pragma ident "%Z%%M% %I% %E% SMI"
18 #include <libdevinfo.h>
21 #include "../device_info.h"
23 typedef struct DevinfoDevHandler_s
25 HalDevice
*(*add
) (HalDevice
*parent
, di_node_t node
, char *devfs_path
, char *device_type
);
28 void (*remove
) (char *devfs_path
);
30 void (*hotplug_begin_add
) (HalDevice
*d
, HalDevice
*parent
, struct DevinfoDevHandler_s
*handler
, void *end_token
);
32 void (*hotplug_begin_remove
) (HalDevice
*d
, struct DevinfoDevHandler_s
*handler
, void *end_token
);
34 void (*probing_done
) (HalDevice
*d
, guint32 exit_type
, gint return_code
, char **error
, gpointer userdata1
, gpointer userdata2
);
36 const gchar
*(*get_prober
) (HalDevice
*d
, int *timeout
);
39 #define PROP_INT(d, node, v, diprop, halprop) \
40 if (di_prop_lookup_ints(DDI_DEV_T_ANY, node, diprop, &(v)) > 0) { \
41 hal_device_property_set_int (d, halprop, *(v)); \
44 #define PROP_STR(d, node, v, diprop, halprop) \
45 if (di_prop_lookup_strings(DDI_DEV_T_ANY, node, diprop, &(v)) > 0) { \
46 hal_device_property_set_string (d, halprop, v); \
49 #define PROP_BOOL(d, node, v, diprop, halprop) \
50 hal_device_property_set_bool (d, halprop, \
51 (di_prop_lookup_ints(DDI_DEV_T_ANY, node, diprop, &(v)) >= 0));
53 #define NELEM(a) (sizeof (a) / sizeof (*(a)))
55 void devinfo_add (HalDevice
*parent
, gchar
*path
);
56 void devinfo_set_default_properties (HalDevice
*d
, HalDevice
*parent
, di_node_t node
, char *devfs_path
);
57 void devinfo_callouts_preprobing_done (HalDevice
*d
, gpointer userdata1
, gpointer userdata2
);
58 void devinfo_callouts_probing_done (HalDevice
*d
, guint32 exit_type
, gint return_code
, char **error
,
59 gpointer userdata1
, gpointer userdata2
);
60 void devinfo_callouts_add_done (HalDevice
*d
, gpointer userdata1
, gpointer userdata2
);
61 void devinfo_callouts_remove_done (HalDevice
*d
, gpointer userdata1
, gpointer userdata2
);
62 void hotplug_event_begin_add_devinfo (HalDevice
*d
, HalDevice
*parent
, DevinfoDevHandler
*handler
, void *end_token
);
63 void devinfo_remove (gchar
*path
);
64 void devinfo_remove_branch (gchar
*path
, HalDevice
*d
);
65 void hotplug_event_begin_remove_devinfo (HalDevice
*d
, gchar
*devfs_path
, void *end_token
);
66 void devinfo_hotplug_enqueue(HalDevice
*d
, gchar
*devfs_path
, DevinfoDevHandler
*handler
, int action
, int front
);
67 void devinfo_add_enqueue(HalDevice
*d
, gchar
*devfs_path
, DevinfoDevHandler
*handler
);
68 void devinfo_add_enqueue_at_front(HalDevice
*d
, gchar
*devfs_path
, DevinfoDevHandler
*handler
);
69 void devinfo_remove_enqueue(gchar
*devfs_path
, DevinfoDevHandler
*handler
);
70 gboolean
devinfo_device_rescan (HalDevice
*d
);
71 char *get_devlink(di_devlink_handle_t devlink_hdl
, char *re
, char *path
);
74 #endif /* DEVINFO_H */