devfsadm.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _DEVFSADM_H
#define _DEVFSADM_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <libdevinfo.h>
#include <sys/devinfo_impl.h>
#include <regex.h>
#ifdef __cplusplus
extern "C" {
#endif
#define DEVFSADM_SUCCESS 0
#define DEVFSADM_FAILURE -1
#define DEVFSADM_MULTIPLE -2
#define DEVFSADM_TRUE 0
#define DEVFSADM_FALSE -1
#define ILEVEL_0 0
#define ILEVEL_1 1
#define ILEVEL_2 2
#define ILEVEL_3 3
#define ILEVEL_4 4
#define ILEVEL_5 5
#define ILEVEL_6 6
#define ILEVEL_7 7
#define ILEVEL_8 8
#define ILEVEL_9 9
#define DEVFSADM_V0 0
#define DEVFSADM_CONTINUE 0
#define DEVFSADM_TERMINATE 1
#define INTEGER 0
#define CHARACTER 1
#define RM_HOT 0x01
#define RM_PRE 0x02
#define RM_POST 0x04
#define RM_ALWAYS 0x08
#define TYPE_EXACT 0x01
#define TYPE_RE 0x02
#define TYPE_PARTIAL 0x04
#define TYPE_MASK 0x07
#define DRV_EXACT 0x10
#define DRV_RE 0x20
#define DRV_MASK 0x30
#define CREATE_DEFER 0x100
#define CREATE_MASK 0x100
/* command to start daemon */
#define DEVFSADMD_START_PATH "/usr/lib/devfsadm/devfsadmd"
#define DEVFSADMD_START "devfsadmd"
/* devfsadm event service door */
#define DEVFSADM_SERVICE_DOOR "/etc/sysevent/devfsadm_event_channel"
/* flags for devfsadm_mklink */
typedef struct devfsadm_create {
char *device_class; /* eg "disk", "tape", "display" */
char *node_type; /* eg DDI_NT_TAPE, DDI_NT_BLOCK, etc */
char *drv_name; /* eg sd, ssd */
int flags; /* TYPE_{EXACT,RE,PARTIAL}, DRV_{EXACT,RE} */
int interpose_lvl; /* eg ILEVEL_0.. ILEVEL_10 */
typedef struct devfsadm_remove {
char *device_class; /* eg "disk", "tape", "display" */
char *dev_dirs_re; /* dev dirs regex selector */
int flags; /* eg POST, PRE, HOT, ALWAYS */
int interpose_lvl; /* eg ILEVEL_0 .. ILEVEL_10 */
void (*callback_fcn)(char *logical_link);
typedef struct _devfsadm_create_reg {
/* structures */
typedef struct _devfsadm_remove_reg {
/* structures */
/*
* "flags" in the devfs_enumerate structure can take the following values.
* These values specify the substring of devfs path to be used for
* enumeration. Components (see MATCH_ADDR/MATCH_MINOR) may be specified
* by using the "match_arg" member in the devfsadm_enumerate structure.
*/
/*
* The following flags are private to devfsadm and the disks module.
* NOT to be used by other modules.
*/
#define MATCH_NODE 0x020
#define MATCH_MASK 0x03F
typedef struct devfsadm_enumerate {
char *re;
int subexp;
char *match_arg;
void *cb_arg;
#define DEVFSADM_CREATE_INIT_V0(tbl) \
DEVFSADM_V0, \
(sizeof (tbl) / sizeof (devfsadm_create_t)), \
((devfsadm_create_t *)(tbl)) }
#define DEVFSADM_REMOVE_INIT_V0(tbl)\
DEVFSADM_V0, \
(sizeof (tbl) / sizeof (devfsadm_remove_t)), \
((devfsadm_remove_t *)(tbl)) }
int devfsadm_noupdate(void);
const char *devfsadm_root_path(void);
int devfsadm_link_valid(char *link);
void devfsadm_rm_link(char *file);
void devfsadm_rm_all(char *file);
void devfsadm_errprint(char *message, ...);
/*
* Private enumerate interface for disks and sgen modules
*/
/*
* Private interfaces for ports module (port_link.c).
*/
#ifdef __cplusplus
}
#endif
#endif /* _DEVFSADM_H */