1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _LIBDEVINFO_H 28*0Sstevel@tonic-gate #define _LIBDEVINFO_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate #include <errno.h> 33*0Sstevel@tonic-gate #include <sys/param.h> 34*0Sstevel@tonic-gate #include <sys/sunddi.h> 35*0Sstevel@tonic-gate #include <sys/sunmdi.h> 36*0Sstevel@tonic-gate #include <sys/openpromio.h> 37*0Sstevel@tonic-gate #include <sys/ddi_impldefs.h> 38*0Sstevel@tonic-gate #include <sys/devinfo_impl.h> 39*0Sstevel@tonic-gate #include <limits.h> 40*0Sstevel@tonic-gate 41*0Sstevel@tonic-gate #ifdef __cplusplus 42*0Sstevel@tonic-gate extern "C" { 43*0Sstevel@tonic-gate #endif 44*0Sstevel@tonic-gate 45*0Sstevel@tonic-gate /* 46*0Sstevel@tonic-gate * flags for di_walk_node 47*0Sstevel@tonic-gate */ 48*0Sstevel@tonic-gate #define DI_WALK_CLDFIRST 0 49*0Sstevel@tonic-gate #define DI_WALK_SIBFIRST 1 50*0Sstevel@tonic-gate #define DI_WALK_LINKGEN 2 51*0Sstevel@tonic-gate 52*0Sstevel@tonic-gate #define DI_WALK_MASK 0xf 53*0Sstevel@tonic-gate 54*0Sstevel@tonic-gate /* 55*0Sstevel@tonic-gate * flags for di_walk_link 56*0Sstevel@tonic-gate */ 57*0Sstevel@tonic-gate #define DI_LINK_SRC 1 58*0Sstevel@tonic-gate #define DI_LINK_TGT 2 59*0Sstevel@tonic-gate 60*0Sstevel@tonic-gate /* 61*0Sstevel@tonic-gate * return code for node_callback 62*0Sstevel@tonic-gate */ 63*0Sstevel@tonic-gate #define DI_WALK_CONTINUE 0 64*0Sstevel@tonic-gate #define DI_WALK_PRUNESIB -1 65*0Sstevel@tonic-gate #define DI_WALK_PRUNECHILD -2 66*0Sstevel@tonic-gate #define DI_WALK_TERMINATE -3 67*0Sstevel@tonic-gate 68*0Sstevel@tonic-gate /* 69*0Sstevel@tonic-gate * flags for di_walk_minor 70*0Sstevel@tonic-gate */ 71*0Sstevel@tonic-gate #define DI_CHECK_ALIAS 0x10 72*0Sstevel@tonic-gate #define DI_CHECK_INTERNAL_PATH 0x20 73*0Sstevel@tonic-gate 74*0Sstevel@tonic-gate #define DI_CHECK_MASK 0xf0 75*0Sstevel@tonic-gate 76*0Sstevel@tonic-gate /* nodeid types */ 77*0Sstevel@tonic-gate #define DI_PSEUDO_NODEID -1 78*0Sstevel@tonic-gate #define DI_SID_NODEID -2 79*0Sstevel@tonic-gate #define DI_PROM_NODEID -3 80*0Sstevel@tonic-gate 81*0Sstevel@tonic-gate /* node & device states */ 82*0Sstevel@tonic-gate #define DI_DRIVER_DETACHED 0x8000 83*0Sstevel@tonic-gate #define DI_DEVICE_OFFLINE 0x1 84*0Sstevel@tonic-gate #define DI_DEVICE_DOWN 0x2 85*0Sstevel@tonic-gate #define DI_BUS_QUIESCED 0x100 86*0Sstevel@tonic-gate #define DI_BUS_DOWN 0x200 87*0Sstevel@tonic-gate 88*0Sstevel@tonic-gate /* property types */ 89*0Sstevel@tonic-gate #define DI_PROP_TYPE_BOOLEAN 0 90*0Sstevel@tonic-gate #define DI_PROP_TYPE_INT 1 91*0Sstevel@tonic-gate #define DI_PROP_TYPE_STRING 2 92*0Sstevel@tonic-gate #define DI_PROP_TYPE_BYTE 3 93*0Sstevel@tonic-gate #define DI_PROP_TYPE_UNKNOWN 4 94*0Sstevel@tonic-gate #define DI_PROP_TYPE_UNDEF_IT 5 95*0Sstevel@tonic-gate #define DI_PROP_TYPE_INT64 6 96*0Sstevel@tonic-gate 97*0Sstevel@tonic-gate /* private macro for checking if a prop type is valid */ 98*0Sstevel@tonic-gate #define DI_PROP_TYPE_VALID(type) \ 99*0Sstevel@tonic-gate ((((type) >= DI_PROP_TYPE_INT) && ((type) <= DI_PROP_TYPE_BYTE)) || \ 100*0Sstevel@tonic-gate ((type) == DI_PROP_TYPE_INT64)) 101*0Sstevel@tonic-gate 102*0Sstevel@tonic-gate /* opaque handles */ 103*0Sstevel@tonic-gate 104*0Sstevel@tonic-gate typedef struct di_node *di_node_t; /* opaque handle to node */ 105*0Sstevel@tonic-gate typedef struct di_minor *di_minor_t; /* opaque handle to minor node */ 106*0Sstevel@tonic-gate typedef struct di_prop *di_prop_t; /* opaque handle to property */ 107*0Sstevel@tonic-gate typedef struct di_prom_prop *di_prom_prop_t; /* opaque handle to prom prop */ 108*0Sstevel@tonic-gate typedef struct di_prom_handle *di_prom_handle_t; /* opaque handle */ 109*0Sstevel@tonic-gate typedef struct di_path *di_path_t; /* opaque handle */ 110*0Sstevel@tonic-gate typedef struct di_path_prop *di_path_prop_t; /* opaque handle */ 111*0Sstevel@tonic-gate 112*0Sstevel@tonic-gate typedef struct di_devlink_handle *di_devlink_handle_t; /* devlink snapshot */ 113*0Sstevel@tonic-gate typedef struct di_devlink *di_devlink_t; /* opaque handle to devlink */ 114*0Sstevel@tonic-gate typedef struct di_link *di_link_t; /* opaque handle to link */ 115*0Sstevel@tonic-gate typedef struct di_lnode *di_lnode_t; /* opaque handle to endpoint */ 116*0Sstevel@tonic-gate 117*0Sstevel@tonic-gate /* 118*0Sstevel@tonic-gate * Null handles to make handles really opaque 119*0Sstevel@tonic-gate */ 120*0Sstevel@tonic-gate #define DI_NODE_NIL NULL 121*0Sstevel@tonic-gate #define DI_LINK_NIL NULL 122*0Sstevel@tonic-gate #define DI_LNODE_NIL NULL 123*0Sstevel@tonic-gate #define DI_MINOR_NIL NULL 124*0Sstevel@tonic-gate #define DI_PROP_NIL NULL 125*0Sstevel@tonic-gate #define DI_PROM_PROP_NIL NULL 126*0Sstevel@tonic-gate #define DI_PROM_HANDLE_NIL NULL 127*0Sstevel@tonic-gate #define DI_PATH_NIL NULL 128*0Sstevel@tonic-gate 129*0Sstevel@tonic-gate /* Interface Prototypes */ 130*0Sstevel@tonic-gate 131*0Sstevel@tonic-gate /* 132*0Sstevel@tonic-gate * Snapshot initialization and cleanup 133*0Sstevel@tonic-gate */ 134*0Sstevel@tonic-gate extern di_node_t di_init(const char *phys_path, uint_t flag); 135*0Sstevel@tonic-gate extern void di_fini(di_node_t root); 136*0Sstevel@tonic-gate 137*0Sstevel@tonic-gate /* 138*0Sstevel@tonic-gate * tree traversal 139*0Sstevel@tonic-gate */ 140*0Sstevel@tonic-gate extern di_node_t di_parent_node(di_node_t node); 141*0Sstevel@tonic-gate extern di_node_t di_sibling_node(di_node_t node); 142*0Sstevel@tonic-gate extern di_node_t di_child_node(di_node_t node); 143*0Sstevel@tonic-gate extern di_node_t di_drv_first_node(const char *drv_name, di_node_t root); 144*0Sstevel@tonic-gate extern di_node_t di_drv_next_node(di_node_t node); 145*0Sstevel@tonic-gate 146*0Sstevel@tonic-gate /* 147*0Sstevel@tonic-gate * tree walking assistants 148*0Sstevel@tonic-gate */ 149*0Sstevel@tonic-gate extern int di_walk_node(di_node_t root, uint_t flag, void *arg, 150*0Sstevel@tonic-gate int (*node_callback)(di_node_t node, void *arg)); 151*0Sstevel@tonic-gate extern int di_walk_minor(di_node_t root, const char *minortype, uint_t flag, 152*0Sstevel@tonic-gate void *arg, int (*minor_callback)(di_node_t node, di_minor_t minor, 153*0Sstevel@tonic-gate void *arg)); 154*0Sstevel@tonic-gate extern int di_walk_link(di_node_t root, uint_t flag, uint_t endpoint, 155*0Sstevel@tonic-gate void *arg, int (*link_callback)(di_link_t link, void *arg)); 156*0Sstevel@tonic-gate extern int di_walk_lnode(di_node_t root, uint_t flag, 157*0Sstevel@tonic-gate void *arg, int (*lnode_callback)(di_lnode_t lnode, void *arg)); 158*0Sstevel@tonic-gate 159*0Sstevel@tonic-gate extern void di_node_private_set(di_node_t node, void *data); 160*0Sstevel@tonic-gate extern void *di_node_private_get(di_node_t node); 161*0Sstevel@tonic-gate extern void di_minor_private_set(di_minor_t minor, void *data); 162*0Sstevel@tonic-gate extern void *di_minor_private_get(di_minor_t minor); 163*0Sstevel@tonic-gate extern void di_lnode_private_set(di_lnode_t lnode, void *data); 164*0Sstevel@tonic-gate extern void *di_lnode_private_get(di_lnode_t lnode); 165*0Sstevel@tonic-gate extern void di_link_private_set(di_link_t link, void *data); 166*0Sstevel@tonic-gate extern void *di_link_private_get(di_link_t link); 167*0Sstevel@tonic-gate 168*0Sstevel@tonic-gate /* 169*0Sstevel@tonic-gate * generic node parameters 170*0Sstevel@tonic-gate */ 171*0Sstevel@tonic-gate extern char *di_node_name(di_node_t node); 172*0Sstevel@tonic-gate extern char *di_bus_addr(di_node_t node); 173*0Sstevel@tonic-gate extern char *di_binding_name(di_node_t node); 174*0Sstevel@tonic-gate extern int di_compatible_names(di_node_t, char **names); 175*0Sstevel@tonic-gate extern int di_instance(di_node_t node); 176*0Sstevel@tonic-gate extern int di_nodeid(di_node_t node); 177*0Sstevel@tonic-gate extern int di_driver_major(di_node_t node); 178*0Sstevel@tonic-gate extern uint_t di_state(di_node_t node); 179*0Sstevel@tonic-gate extern ddi_node_state_t di_node_state(di_node_t node); 180*0Sstevel@tonic-gate extern ddi_devid_t di_devid(di_node_t node); 181*0Sstevel@tonic-gate 182*0Sstevel@tonic-gate extern char *di_driver_name(di_node_t node); 183*0Sstevel@tonic-gate extern uint_t di_driver_ops(di_node_t node); 184*0Sstevel@tonic-gate 185*0Sstevel@tonic-gate extern char *di_devfs_path(di_node_t node); 186*0Sstevel@tonic-gate extern char *di_devfs_minor_path(di_minor_t minor); 187*0Sstevel@tonic-gate 188*0Sstevel@tonic-gate extern void di_devfs_path_free(char *path_buf); 189*0Sstevel@tonic-gate 190*0Sstevel@tonic-gate /* 191*0Sstevel@tonic-gate * layering data access 192*0Sstevel@tonic-gate */ 193*0Sstevel@tonic-gate extern di_link_t di_link_next_by_node(di_node_t node, 194*0Sstevel@tonic-gate di_link_t link, uint_t endpoint); 195*0Sstevel@tonic-gate extern di_link_t di_link_next_by_lnode(di_lnode_t lnode, 196*0Sstevel@tonic-gate di_link_t link, uint_t endpoint); 197*0Sstevel@tonic-gate extern di_lnode_t di_link_to_lnode(di_link_t link, uint_t endpoint); 198*0Sstevel@tonic-gate 199*0Sstevel@tonic-gate extern di_lnode_t di_lnode_next(di_node_t node, di_lnode_t lnode); 200*0Sstevel@tonic-gate extern char *di_lnode_name(di_lnode_t lnode); 201*0Sstevel@tonic-gate extern di_node_t di_lnode_devinfo(di_lnode_t lnode); 202*0Sstevel@tonic-gate extern int di_lnode_devt(di_lnode_t lnode, dev_t *devt); 203*0Sstevel@tonic-gate 204*0Sstevel@tonic-gate extern int di_link_spectype(di_link_t link); 205*0Sstevel@tonic-gate 206*0Sstevel@tonic-gate /* 207*0Sstevel@tonic-gate * minor data access 208*0Sstevel@tonic-gate */ 209*0Sstevel@tonic-gate extern di_minor_t di_minor_next(di_node_t node, di_minor_t minor); 210*0Sstevel@tonic-gate extern di_node_t di_minor_devinfo(di_minor_t minor); 211*0Sstevel@tonic-gate extern ddi_minor_type di_minor_type(di_minor_t minor); 212*0Sstevel@tonic-gate extern char *di_minor_name(di_minor_t minor); 213*0Sstevel@tonic-gate extern dev_t di_minor_devt(di_minor_t minor); 214*0Sstevel@tonic-gate extern int di_minor_spectype(di_minor_t minor); 215*0Sstevel@tonic-gate extern char *di_minor_nodetype(di_minor_t node); 216*0Sstevel@tonic-gate 217*0Sstevel@tonic-gate /* 218*0Sstevel@tonic-gate * Software property access 219*0Sstevel@tonic-gate */ 220*0Sstevel@tonic-gate extern di_prop_t di_prop_next(di_node_t node, di_prop_t prop); 221*0Sstevel@tonic-gate extern dev_t di_prop_devt(di_prop_t prop); 222*0Sstevel@tonic-gate extern char *di_prop_name(di_prop_t prop); 223*0Sstevel@tonic-gate extern int di_prop_type(di_prop_t prop); 224*0Sstevel@tonic-gate extern int di_prop_ints(di_prop_t prop, int **prop_data); 225*0Sstevel@tonic-gate extern int di_prop_int64(di_prop_t prop, int64_t **prop_data); 226*0Sstevel@tonic-gate extern int di_prop_strings(di_prop_t prop, char **prop_data); 227*0Sstevel@tonic-gate extern int di_prop_bytes(di_prop_t prop, uchar_t **prop_data); 228*0Sstevel@tonic-gate extern int di_prop_lookup_ints(dev_t dev, di_node_t node, 229*0Sstevel@tonic-gate const char *prop_name, int **prop_data); 230*0Sstevel@tonic-gate extern int di_prop_lookup_int64(dev_t dev, di_node_t node, 231*0Sstevel@tonic-gate const char *prop_name, int64_t **prop_data); 232*0Sstevel@tonic-gate extern int di_prop_lookup_strings(dev_t dev, di_node_t node, 233*0Sstevel@tonic-gate const char *prop_name, char **prop_data); 234*0Sstevel@tonic-gate extern int di_prop_lookup_bytes(dev_t dev, di_node_t node, 235*0Sstevel@tonic-gate const char *prop_name, uchar_t **prop_data); 236*0Sstevel@tonic-gate 237*0Sstevel@tonic-gate /* 238*0Sstevel@tonic-gate * PROM property access 239*0Sstevel@tonic-gate */ 240*0Sstevel@tonic-gate extern di_prom_handle_t di_prom_init(void); 241*0Sstevel@tonic-gate extern void di_prom_fini(di_prom_handle_t ph); 242*0Sstevel@tonic-gate 243*0Sstevel@tonic-gate extern di_prom_prop_t di_prom_prop_next(di_prom_handle_t ph, di_node_t node, 244*0Sstevel@tonic-gate di_prom_prop_t prom_prop); 245*0Sstevel@tonic-gate 246*0Sstevel@tonic-gate extern char *di_prom_prop_name(di_prom_prop_t prom_prop); 247*0Sstevel@tonic-gate extern int di_prom_prop_data(di_prom_prop_t prop, uchar_t **prom_prop_data); 248*0Sstevel@tonic-gate 249*0Sstevel@tonic-gate extern int di_prom_prop_lookup_ints(di_prom_handle_t prom, di_node_t node, 250*0Sstevel@tonic-gate const char *prom_prop_name, int **prom_prop_data); 251*0Sstevel@tonic-gate extern int di_prom_prop_lookup_strings(di_prom_handle_t prom, di_node_t node, 252*0Sstevel@tonic-gate const char *prom_prop_name, char **prom_prop_data); 253*0Sstevel@tonic-gate extern int di_prom_prop_lookup_bytes(di_prom_handle_t prom, di_node_t node, 254*0Sstevel@tonic-gate const char *prom_prop_name, uchar_t **prom_prop_data); 255*0Sstevel@tonic-gate 256*0Sstevel@tonic-gate /* 257*0Sstevel@tonic-gate * Private interfaces 258*0Sstevel@tonic-gate * 259*0Sstevel@tonic-gate * The interfaces and structures below are private to this implementation 260*0Sstevel@tonic-gate * of Solaris and are subject to change at any time without notice. 261*0Sstevel@tonic-gate * 262*0Sstevel@tonic-gate * Applications and drivers using these interfaces will fail 263*0Sstevel@tonic-gate * to run on future releases. 264*0Sstevel@tonic-gate */ 265*0Sstevel@tonic-gate 266*0Sstevel@tonic-gate /* 267*0Sstevel@tonic-gate * Interfaces for accessing I/O multipathing data 268*0Sstevel@tonic-gate */ 269*0Sstevel@tonic-gate /* XXX remove di_path_next() after updating NWS consolidation */ 270*0Sstevel@tonic-gate extern di_path_t di_path_next(di_node_t node, di_path_t path); 271*0Sstevel@tonic-gate extern di_path_t di_path_next_phci(di_node_t node, di_path_t path); 272*0Sstevel@tonic-gate extern di_path_t di_path_next_client(di_node_t node, di_path_t path); 273*0Sstevel@tonic-gate extern di_path_state_t di_path_state(di_path_t path); 274*0Sstevel@tonic-gate extern char *di_path_addr(di_path_t path, char *buf); 275*0Sstevel@tonic-gate extern di_node_t di_path_client_node(di_path_t path); 276*0Sstevel@tonic-gate extern void di_path_client_path(di_path_t path, char *buf); 277*0Sstevel@tonic-gate extern di_node_t di_path_phci_node(di_path_t path); 278*0Sstevel@tonic-gate extern void di_path_phci_path(di_path_t path, char *buf); 279*0Sstevel@tonic-gate extern di_path_prop_t di_path_prop_next(di_path_t path, di_path_prop_t prop); 280*0Sstevel@tonic-gate extern char *di_path_prop_name(di_path_prop_t prop); 281*0Sstevel@tonic-gate extern int di_path_prop_type(di_path_prop_t prop); 282*0Sstevel@tonic-gate extern int di_path_prop_len(di_path_prop_t prop); 283*0Sstevel@tonic-gate extern int di_path_prop_bytes(di_path_prop_t prop, uchar_t **prop_data); 284*0Sstevel@tonic-gate extern int di_path_prop_ints(di_path_prop_t prop, int **prop_data); 285*0Sstevel@tonic-gate extern int di_path_prop_int64s(di_path_prop_t prop, int64_t **prop_data); 286*0Sstevel@tonic-gate extern int di_path_prop_strings(di_path_prop_t prop, char **prop_data); 287*0Sstevel@tonic-gate extern int di_path_prop_lookup_bytes(di_path_t path, const char *prop_name, 288*0Sstevel@tonic-gate uchar_t **prop_data); 289*0Sstevel@tonic-gate extern int di_path_prop_lookup_ints(di_path_t path, const char *prop_name, 290*0Sstevel@tonic-gate int **prop_data); 291*0Sstevel@tonic-gate extern int di_path_prop_lookup_int64s(di_path_t path, const char *prop_name, 292*0Sstevel@tonic-gate int64_t **prop_data); 293*0Sstevel@tonic-gate extern int di_path_prop_lookup_strings(di_path_t path, const char *prop_name, 294*0Sstevel@tonic-gate char **prop_data); 295*0Sstevel@tonic-gate 296*0Sstevel@tonic-gate 297*0Sstevel@tonic-gate /* 298*0Sstevel@tonic-gate * Interfaces for private data 299*0Sstevel@tonic-gate */ 300*0Sstevel@tonic-gate extern di_node_t di_init_driver(const char *drv_name, uint_t flag); 301*0Sstevel@tonic-gate extern di_node_t di_init_impl(const char *phys_path, uint_t flag, 302*0Sstevel@tonic-gate struct di_priv_data *priv_data); 303*0Sstevel@tonic-gate 304*0Sstevel@tonic-gate /* 305*0Sstevel@tonic-gate * Prtconf needs to know property lists, raw prop_data, and private data 306*0Sstevel@tonic-gate */ 307*0Sstevel@tonic-gate extern di_prop_t di_prop_drv_next(di_node_t node, di_prop_t prop); 308*0Sstevel@tonic-gate extern di_prop_t di_prop_sys_next(di_node_t node, di_prop_t prop); 309*0Sstevel@tonic-gate extern di_prop_t di_prop_global_next(di_node_t node, di_prop_t prop); 310*0Sstevel@tonic-gate extern di_prop_t di_prop_hw_next(di_node_t node, di_prop_t prop); 311*0Sstevel@tonic-gate 312*0Sstevel@tonic-gate extern int di_prop_rawdata(di_prop_t prop, uchar_t **prop_data); 313*0Sstevel@tonic-gate extern void *di_parent_private_data(di_node_t node); 314*0Sstevel@tonic-gate extern void *di_driver_private_data(di_node_t node); 315*0Sstevel@tonic-gate 316*0Sstevel@tonic-gate /* 317*0Sstevel@tonic-gate * Types of links for devlink lookup 318*0Sstevel@tonic-gate */ 319*0Sstevel@tonic-gate #define DI_PRIMARY_LINK 0x01 320*0Sstevel@tonic-gate #define DI_SECONDARY_LINK 0x02 321*0Sstevel@tonic-gate #define DI_LINK_TYPES 0x03 322*0Sstevel@tonic-gate 323*0Sstevel@tonic-gate /* 324*0Sstevel@tonic-gate * Flag for di_devlink_init() 325*0Sstevel@tonic-gate */ 326*0Sstevel@tonic-gate #define DI_MAKE_LINK 0x01 327*0Sstevel@tonic-gate 328*0Sstevel@tonic-gate /* 329*0Sstevel@tonic-gate * Flag for di_devlink_close() 330*0Sstevel@tonic-gate */ 331*0Sstevel@tonic-gate #define DI_LINK_ERROR 0x01 332*0Sstevel@tonic-gate 333*0Sstevel@tonic-gate /* 334*0Sstevel@tonic-gate * For devfsadm synchronous link creation interfaces 335*0Sstevel@tonic-gate */ 336*0Sstevel@tonic-gate #define DEVFSADM_SYNCH_DOOR ".devfsadm_synch_door" 337*0Sstevel@tonic-gate 338*0Sstevel@tonic-gate /* 339*0Sstevel@tonic-gate * devlink create argument 340*0Sstevel@tonic-gate */ 341*0Sstevel@tonic-gate struct dca_off { 342*0Sstevel@tonic-gate uint32_t dca_root; 343*0Sstevel@tonic-gate uint32_t dca_minor; 344*0Sstevel@tonic-gate uint32_t dca_driver; 345*0Sstevel@tonic-gate int dca_error; 346*0Sstevel@tonic-gate int dca_flags; 347*0Sstevel@tonic-gate char dca_name[PATH_MAX+MAXNAMELEN]; 348*0Sstevel@tonic-gate }; 349*0Sstevel@tonic-gate 350*0Sstevel@tonic-gate extern di_devlink_handle_t di_devlink_init(const char *name, uint_t flags); 351*0Sstevel@tonic-gate extern int di_devlink_walk(di_devlink_handle_t hdl, const char *re, 352*0Sstevel@tonic-gate const char *minor_path, uint_t flags, void *arg, 353*0Sstevel@tonic-gate int (*devlink_callback)(di_devlink_t, void *)); 354*0Sstevel@tonic-gate extern const char *di_devlink_path(di_devlink_t devlink); 355*0Sstevel@tonic-gate extern const char *di_devlink_content(di_devlink_t devlink); 356*0Sstevel@tonic-gate extern int di_devlink_type(di_devlink_t devlink); 357*0Sstevel@tonic-gate extern di_devlink_t di_devlink_dup(di_devlink_t devlink); 358*0Sstevel@tonic-gate extern int di_devlink_free(di_devlink_t devlink); 359*0Sstevel@tonic-gate extern int di_devlink_fini(di_devlink_handle_t *hdlp); 360*0Sstevel@tonic-gate 361*0Sstevel@tonic-gate extern di_devlink_handle_t di_devlink_open(const char *root_dir, uint_t flags); 362*0Sstevel@tonic-gate extern int di_devlink_close(di_devlink_handle_t *pp, int flag); 363*0Sstevel@tonic-gate extern int di_devlink_rm_link(di_devlink_handle_t hdp, const char *link); 364*0Sstevel@tonic-gate extern int di_devlink_add_link(di_devlink_handle_t hdp, const char *link, 365*0Sstevel@tonic-gate const char *content, int flags); 366*0Sstevel@tonic-gate extern int di_devlink_update(di_devlink_handle_t hdp); 367*0Sstevel@tonic-gate extern di_devlink_handle_t di_devlink_init_root(const char *root, 368*0Sstevel@tonic-gate const char *name, uint_t flags); 369*0Sstevel@tonic-gate extern int di_devlink_cache_walk(di_devlink_handle_t hdp, const char *re, 370*0Sstevel@tonic-gate const char *path, uint_t flags, void *arg, 371*0Sstevel@tonic-gate int (*devlink_callback)(di_devlink_t, void *)); 372*0Sstevel@tonic-gate 373*0Sstevel@tonic-gate /* 374*0Sstevel@tonic-gate * Private interfaces for /etc/logindevperm 375*0Sstevel@tonic-gate */ 376*0Sstevel@tonic-gate extern int di_devperm_login(const char *, uid_t, gid_t, void (*)(char *)); 377*0Sstevel@tonic-gate extern int di_devperm_logout(const char *); 378*0Sstevel@tonic-gate 379*0Sstevel@tonic-gate /* 380*0Sstevel@tonic-gate * Private interface for looking up a node in a snapshot 381*0Sstevel@tonic-gate */ 382*0Sstevel@tonic-gate extern di_node_t di_lookup_node(di_node_t root, char *path); 383*0Sstevel@tonic-gate 384*0Sstevel@tonic-gate #ifdef __cplusplus 385*0Sstevel@tonic-gate } 386*0Sstevel@tonic-gate #endif 387*0Sstevel@tonic-gate 388*0Sstevel@tonic-gate #endif /* _LIBDEVINFO_H */ 389