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 _UTILS_H 28*0Sstevel@tonic-gate #define _UTILS_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 <sys/types.h> 33*0Sstevel@tonic-gate 34*0Sstevel@tonic-gate #ifdef __cplusplus 35*0Sstevel@tonic-gate extern "C" { 36*0Sstevel@tonic-gate #endif 37*0Sstevel@tonic-gate 38*0Sstevel@tonic-gate /* Error messages for pool commands */ 39*0Sstevel@tonic-gate #define ERR_SET_TERM "cleanup installation failed: %s\n" 40*0Sstevel@tonic-gate #define ERR_CONF_LOAD "cannot load configuration from %s: %s\n" 41*0Sstevel@tonic-gate #define ERR_CMD_FILE_INIT "cannot initialise command sequence: %s\n" 42*0Sstevel@tonic-gate #define ERR_PROP_TO_LIST "cannot add property %s to property list\n" 43*0Sstevel@tonic-gate #define ERR_UNKNOWN_ENTITY "unrecognised entity %lld\n" 44*0Sstevel@tonic-gate #define ERR_ASSOC_TO_LIST "cannot add association %s to association " \ 45*0Sstevel@tonic-gate "list\n" 46*0Sstevel@tonic-gate #define ERR_GET_ELEMENT_DETAILS "cannot get the %s details for %s: %s\n" 47*0Sstevel@tonic-gate #define ERR_LOCATE_ELEMENT "cannot locate the %s, %s: %s\n" 48*0Sstevel@tonic-gate #define ERR_CREATE_ELEMENT "cannot create the %s, %s: %s\n" 49*0Sstevel@tonic-gate #define ERR_DESTROY_ELEMENT "cannot destroy the %s, %s: %s\n" 50*0Sstevel@tonic-gate #define ERR_ALLOC_ELEMENT "cannot allocate %s: %s\n" 51*0Sstevel@tonic-gate #define ERR_PUT_PROPERTY "put property %s failed: %s\n" 52*0Sstevel@tonic-gate #define ERR_REMOVE_PROPERTY "remove property %s failed: %s\n" 53*0Sstevel@tonic-gate #define ERR_GET_PROPERTY "get property %s failed: %s\n" 54*0Sstevel@tonic-gate #define ERR_UNKNOWN_RESOURCE "unrecognized resource type: %d\n" 55*0Sstevel@tonic-gate #define ERR_ASSOC_RESOURCE "cannot associate resource %s to pool: %s\n" 56*0Sstevel@tonic-gate #define ERR_VALIDATION_FAILED "configuration failed strict validation: %s\n" 57*0Sstevel@tonic-gate #define ERR_CONFIG_OPEN_FAILED "cannot open the configuration: %s\n" 58*0Sstevel@tonic-gate #define ERR_CONFIG_SAVE_FAILED "cannot save the configuration: %s\n" 59*0Sstevel@tonic-gate #define ERR_WRONG_SYSTEM_NAME "incorrect system name supplied: %s\n" 60*0Sstevel@tonic-gate #define ERR_CMD_LINE_ALLOC "cannot create command, not enough memory\n" 61*0Sstevel@tonic-gate #define ERR_PROP_ALLOC "cannot create property, not enough memory\n" 62*0Sstevel@tonic-gate #define ERR_ASSOC_ALLOC "cannot create association, not enough memory\n" 63*0Sstevel@tonic-gate 64*0Sstevel@tonic-gate #define ERR_DISABLE "cannot disable pools" 65*0Sstevel@tonic-gate #define ERR_ENABLE "cannot enable pools" 66*0Sstevel@tonic-gate #define ERR_NOMEM "not enough memory\n" 67*0Sstevel@tonic-gate #define ERR_PERMISSIONS "insufficient privileges\n" 68*0Sstevel@tonic-gate #define ERR_PRIVILEGE "cannot access %s privileges" 69*0Sstevel@tonic-gate #define ERR_OPEN_DYNAMIC "couldn't open pools state file: %s\n" 70*0Sstevel@tonic-gate #define ERR_OPEN_STATIC "couldn't open configuration at '%s': %s\n" 71*0Sstevel@tonic-gate #define ERR_VALIDATE_RUNTIME "configuration at '%s' cannot be instantiated "\ 72*0Sstevel@tonic-gate "on current system\n" 73*0Sstevel@tonic-gate #define ERR_COMMIT_DYNAMIC "couldn't commit configuration changes at '%s'"\ 74*0Sstevel@tonic-gate ": %s\n" 75*0Sstevel@tonic-gate #define ERR_REMOVE_DYNAMIC "couldn't remove dynamic configuration: %s\n" 76*0Sstevel@tonic-gate #define ERR_COMMIT_STATIC "couldn't commit configuration changes at '%s'"\ 77*0Sstevel@tonic-gate ": %s\n" 78*0Sstevel@tonic-gate #define ERR_EXPORT_DYNAMIC "couldn't export pools state file to '%s': %s\n" 79*0Sstevel@tonic-gate #define ERR_NO_POOLS "no pools defined\n" 80*0Sstevel@tonic-gate #define ERR_XFER_COMPONENT "cannot transfer %s %s to %s: %s\n" 81*0Sstevel@tonic-gate #define ERR_XFER_QUANTITY "cannot transfer %llu from %s to %s: %s\n" 82*0Sstevel@tonic-gate #define ERR_CMDPARSE_FAILED "command parsing failed, terminating...\n" 83*0Sstevel@tonic-gate 84*0Sstevel@tonic-gate #define CONFIGURATION "configuration" 85*0Sstevel@tonic-gate #define RESOURCE "resource" 86*0Sstevel@tonic-gate #define POOL "pool" 87*0Sstevel@tonic-gate #define PSET "pset" 88*0Sstevel@tonic-gate #define COMPONENT "component" 89*0Sstevel@tonic-gate #define CPU "cpu" 90*0Sstevel@tonic-gate #define SYSTEM_NAME "system.name" 91*0Sstevel@tonic-gate #define POOL_NAME "pool.name" 92*0Sstevel@tonic-gate #define PSET_NAME "pset.name" 93*0Sstevel@tonic-gate #define CPU_SYSID "cpu.sys_id" 94*0Sstevel@tonic-gate 95*0Sstevel@tonic-gate #define E_PO_SUCCESS 0 /* Exit status for success */ 96*0Sstevel@tonic-gate #define E_ERROR 1 /* Exit status for error */ 97*0Sstevel@tonic-gate #define E_USAGE 2 /* Exit status for usage error */ 98*0Sstevel@tonic-gate 99*0Sstevel@tonic-gate extern const char *get_errstr(void); 100*0Sstevel@tonic-gate extern const char *get_errstr_err(int, int); 101*0Sstevel@tonic-gate extern void warn(const char *, ...); 102*0Sstevel@tonic-gate extern void die(const char *, ...); 103*0Sstevel@tonic-gate extern const char *getpname(const char *); 104*0Sstevel@tonic-gate 105*0Sstevel@tonic-gate #ifdef __cplusplus 106*0Sstevel@tonic-gate } 107*0Sstevel@tonic-gate #endif 108*0Sstevel@tonic-gate 109*0Sstevel@tonic-gate #endif /* _UTILS_H */ 110