devfsadm.h (aa646b9d) | devfsadm.h (8d483882) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 5 unchanged lines hidden (view full) --- 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21/* | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 5 unchanged lines hidden (view full) --- 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21/* |
22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. | 22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. |
23 * Use is subject to license terms. 24 */ 25 26#ifndef _DEVFSADM_H 27#define _DEVFSADM_H 28 29#pragma ident "%Z%%M% %I% %E% SMI" 30 31#include <sys/types.h> 32#include <libdevinfo.h> 33#include <sys/devinfo_impl.h> 34#include <regex.h> 35 | 23 * Use is subject to license terms. 24 */ 25 26#ifndef _DEVFSADM_H 27#define _DEVFSADM_H 28 29#pragma ident "%Z%%M% %I% %E% SMI" 30 31#include <sys/types.h> 32#include <libdevinfo.h> 33#include <sys/devinfo_impl.h> 34#include <regex.h> 35 |
36#undef DEBUG 37#ifndef DEBUG 38#define NDEBUG 1 39#else 40#undef NDEBUG 41#endif 42 43#include <assert.h> 44 |
|
36#ifdef __cplusplus 37extern "C" { 38#endif 39 40#define DEVFSADM_SUCCESS 0 41#define DEVFSADM_FAILURE -1 42#define DEVFSADM_MULTIPLE -2 43#define DEVFSADM_TRUE 0 --- 41 unchanged lines hidden (view full) --- 85 86/* devfsadm event service door */ 87#define DEVFSADM_SERVICE_DOOR "/etc/sysevent/devfsadm_event_channel" 88#define DEVNAME_LOOKUP_DOOR ".devname_lookup_door" 89 90/* /dev device name binding rule locations */ 91#define DEVNAME_MASTER_MAP "/etc/dev/devname_master" 92 | 45#ifdef __cplusplus 46extern "C" { 47#endif 48 49#define DEVFSADM_SUCCESS 0 50#define DEVFSADM_FAILURE -1 51#define DEVFSADM_MULTIPLE -2 52#define DEVFSADM_TRUE 0 --- 41 unchanged lines hidden (view full) --- 94 95/* devfsadm event service door */ 96#define DEVFSADM_SERVICE_DOOR "/etc/sysevent/devfsadm_event_channel" 97#define DEVNAME_LOOKUP_DOOR ".devname_lookup_door" 98 99/* /dev device name binding rule locations */ 100#define DEVNAME_MASTER_MAP "/etc/dev/devname_master" 101 |
102/* File of reserved devnames */ 103#define ENUMERATE_RESERVED "/etc/dev/reserved_devnames" 104 |
|
93/* flags for devfsadm_mklink */ 94#define DEV_SYNC 0x02 /* synchronous mklink */ 95 96#define INFO_MID NULL /* always prints */ 97#define VERBOSE_MID "verbose" /* prints with -v */ 98#define CHATTY_MID "chatty" /* prints with -V chatty */ 99 100typedef struct devfsadm_create { --- 83 unchanged lines hidden (view full) --- 184 ((devfsadm_remove_t *)(tbl)) } 185 186#define DEVFSADM_REMOVE_INIT_V1(tbl)\ 187 _devfsadm_remove_reg_V1_t _devfsadm_remove_reg = {\ 188 DEVFSADM_V1, \ 189 (sizeof (tbl) / sizeof (devfsadm_remove_V1_t)), \ 190 ((devfsadm_remove_V1_t *)(tbl)) } 191 | 105/* flags for devfsadm_mklink */ 106#define DEV_SYNC 0x02 /* synchronous mklink */ 107 108#define INFO_MID NULL /* always prints */ 109#define VERBOSE_MID "verbose" /* prints with -v */ 110#define CHATTY_MID "chatty" /* prints with -V chatty */ 111 112typedef struct devfsadm_create { --- 83 unchanged lines hidden (view full) --- 196 ((devfsadm_remove_t *)(tbl)) } 197 198#define DEVFSADM_REMOVE_INIT_V1(tbl)\ 199 _devfsadm_remove_reg_V1_t _devfsadm_remove_reg = {\ 200 DEVFSADM_V1, \ 201 (sizeof (tbl) / sizeof (devfsadm_remove_V1_t)), \ 202 ((devfsadm_remove_V1_t *)(tbl)) } 203 |
204/* reserved devname support */ 205typedef struct devlink_re { 206 char *d_re; 207 int d_subexp; 208 regex_t d_rcomp; 209 regmatch_t *d_pmatch; 210} devlink_re_t; 211 212typedef struct enumerate_file { 213 char *er_file; 214 char *er_id; 215 struct enumerate_file *er_next; 216} enumerate_file_t; 217 |
|
192int devfsadm_noupdate(void); 193const char *devfsadm_root_path(void); 194int devfsadm_link_valid(char *link); 195int devfsadm_mklink(char *link, di_node_t node, di_minor_t minor, int flags); 196int devfsadm_secondary_link(char *link, char *primary_link, int flags); 197void devfsadm_rm_link(char *file); 198void devfsadm_rm_all(char *file); 199void devfsadm_rm_stale_links(char *dir_re, char *valid_link, di_node_t node, 200 di_minor_t minor); 201void devfsadm_errprint(char *message, ...); 202void devfsadm_print(char *mid, char *message, ...); 203int devfsadm_enumerate_int(char *devfs_path, int index, char **buf, 204 devfsadm_enumerate_t rules[], int nrules); 205int devfsadm_enumerate_char(char *devfs_path, int index, char **buf, 206 devfsadm_enumerate_t rules[], int nrules); 207char **devfsadm_lookup_dev_names(char *phys_path, char *re, int *lenp); 208void devfsadm_free_dev_names(char **dev_names, int len); 209 | 218int devfsadm_noupdate(void); 219const char *devfsadm_root_path(void); 220int devfsadm_link_valid(char *link); 221int devfsadm_mklink(char *link, di_node_t node, di_minor_t minor, int flags); 222int devfsadm_secondary_link(char *link, char *primary_link, int flags); 223void devfsadm_rm_link(char *file); 224void devfsadm_rm_all(char *file); 225void devfsadm_rm_stale_links(char *dir_re, char *valid_link, di_node_t node, 226 di_minor_t minor); 227void devfsadm_errprint(char *message, ...); 228void devfsadm_print(char *mid, char *message, ...); 229int devfsadm_enumerate_int(char *devfs_path, int index, char **buf, 230 devfsadm_enumerate_t rules[], int nrules); 231int devfsadm_enumerate_char(char *devfs_path, int index, char **buf, 232 devfsadm_enumerate_t rules[], int nrules); 233char **devfsadm_lookup_dev_names(char *phys_path, char *re, int *lenp); 234void devfsadm_free_dev_names(char **dev_names, int len); 235 |
236/* devlink cache related */ 237di_devlink_handle_t devfsadm_devlink_cache(void); 238 |
|
210/* 211 * Private enumerate interface for disks and sgen modules 212 */ 213int disk_enumerate_int(char *devfs_path, int index, char **buf, 214 devfsadm_enumerate_t rules[], int nrules); 215/* 216 * Private interfaces for ports module (port_link.c). 217 */ 218int devfsadm_enumerate_char_start(char *devfs_path, int index, 219 char **buf, devfsadm_enumerate_t rules[], int nrules, char *start); 220int devfsadm_read_link(char *link, char **devfs_path); 221char *s_strdup(const char *ptr); 222 | 239/* 240 * Private enumerate interface for disks and sgen modules 241 */ 242int disk_enumerate_int(char *devfs_path, int index, char **buf, 243 devfsadm_enumerate_t rules[], int nrules); 244/* 245 * Private interfaces for ports module (port_link.c). 246 */ 247int devfsadm_enumerate_char_start(char *devfs_path, int index, 248 char **buf, devfsadm_enumerate_t rules[], int nrules, char *start); 249int devfsadm_read_link(char *link, char **devfs_path); 250char *s_strdup(const char *ptr); 251 |
252/* Private interface between reserve subsystm and disks link generator */ 253int devfsadm_is_reserved(devlink_re_t re_array[], char *devlink); 254int devfsadm_reserve_id_cache(devlink_re_t re_array[], enumerate_file_t *head); 255 |
|
223#ifdef __cplusplus 224} 225#endif 226 227#endif /* _DEVFSADM_H */ | 256#ifdef __cplusplus 257} 258#endif 259 260#endif /* _DEVFSADM_H */ |