10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 50Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 60Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 70Sstevel@tonic-gate * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 220Sstevel@tonic-gate /* 23*428Ssl108498 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #ifndef _UTILS_H 280Sstevel@tonic-gate #define _UTILS_H 290Sstevel@tonic-gate 300Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 310Sstevel@tonic-gate 320Sstevel@tonic-gate #include <sys/types.h> 330Sstevel@tonic-gate 340Sstevel@tonic-gate #ifdef __cplusplus 350Sstevel@tonic-gate extern "C" { 360Sstevel@tonic-gate #endif 370Sstevel@tonic-gate 380Sstevel@tonic-gate /* Error messages for pool commands */ 390Sstevel@tonic-gate #define ERR_SET_TERM "cleanup installation failed: %s\n" 400Sstevel@tonic-gate #define ERR_CONF_LOAD "cannot load configuration from %s: %s\n" 410Sstevel@tonic-gate #define ERR_CMD_FILE_INIT "cannot initialise command sequence: %s\n" 420Sstevel@tonic-gate #define ERR_PROP_TO_LIST "cannot add property %s to property list\n" 430Sstevel@tonic-gate #define ERR_UNKNOWN_ENTITY "unrecognised entity %lld\n" 440Sstevel@tonic-gate #define ERR_ASSOC_TO_LIST "cannot add association %s to association " \ 450Sstevel@tonic-gate "list\n" 460Sstevel@tonic-gate #define ERR_GET_ELEMENT_DETAILS "cannot get the %s details for %s: %s\n" 470Sstevel@tonic-gate #define ERR_LOCATE_ELEMENT "cannot locate the %s, %s: %s\n" 480Sstevel@tonic-gate #define ERR_CREATE_ELEMENT "cannot create the %s, %s: %s\n" 490Sstevel@tonic-gate #define ERR_DESTROY_ELEMENT "cannot destroy the %s, %s: %s\n" 500Sstevel@tonic-gate #define ERR_ALLOC_ELEMENT "cannot allocate %s: %s\n" 510Sstevel@tonic-gate #define ERR_PUT_PROPERTY "put property %s failed: %s\n" 520Sstevel@tonic-gate #define ERR_REMOVE_PROPERTY "remove property %s failed: %s\n" 530Sstevel@tonic-gate #define ERR_GET_PROPERTY "get property %s failed: %s\n" 540Sstevel@tonic-gate #define ERR_UNKNOWN_RESOURCE "unrecognized resource type: %d\n" 550Sstevel@tonic-gate #define ERR_ASSOC_RESOURCE "cannot associate resource %s to pool: %s\n" 560Sstevel@tonic-gate #define ERR_VALIDATION_FAILED "configuration failed strict validation: %s\n" 570Sstevel@tonic-gate #define ERR_CONFIG_OPEN_FAILED "cannot open the configuration: %s\n" 580Sstevel@tonic-gate #define ERR_CONFIG_SAVE_FAILED "cannot save the configuration: %s\n" 590Sstevel@tonic-gate #define ERR_WRONG_SYSTEM_NAME "incorrect system name supplied: %s\n" 600Sstevel@tonic-gate #define ERR_CMD_LINE_ALLOC "cannot create command, not enough memory\n" 610Sstevel@tonic-gate #define ERR_PROP_ALLOC "cannot create property, not enough memory\n" 620Sstevel@tonic-gate #define ERR_ASSOC_ALLOC "cannot create association, not enough memory\n" 630Sstevel@tonic-gate 640Sstevel@tonic-gate #define ERR_DISABLE "cannot disable pools" 650Sstevel@tonic-gate #define ERR_ENABLE "cannot enable pools" 660Sstevel@tonic-gate #define ERR_NOMEM "not enough memory\n" 670Sstevel@tonic-gate #define ERR_PERMISSIONS "insufficient privileges\n" 680Sstevel@tonic-gate #define ERR_PRIVILEGE "cannot access %s privileges" 690Sstevel@tonic-gate #define ERR_OPEN_DYNAMIC "couldn't open pools state file: %s\n" 700Sstevel@tonic-gate #define ERR_OPEN_STATIC "couldn't open configuration at '%s': %s\n" 710Sstevel@tonic-gate #define ERR_VALIDATE_RUNTIME "configuration at '%s' cannot be instantiated "\ 720Sstevel@tonic-gate "on current system\n" 730Sstevel@tonic-gate #define ERR_COMMIT_DYNAMIC "couldn't commit configuration changes at '%s'"\ 740Sstevel@tonic-gate ": %s\n" 750Sstevel@tonic-gate #define ERR_REMOVE_DYNAMIC "couldn't remove dynamic configuration: %s\n" 760Sstevel@tonic-gate #define ERR_COMMIT_STATIC "couldn't commit configuration changes at '%s'"\ 770Sstevel@tonic-gate ": %s\n" 780Sstevel@tonic-gate #define ERR_EXPORT_DYNAMIC "couldn't export pools state file to '%s': %s\n" 790Sstevel@tonic-gate #define ERR_NO_POOLS "no pools defined\n" 800Sstevel@tonic-gate #define ERR_XFER_COMPONENT "cannot transfer %s %s to %s: %s\n" 810Sstevel@tonic-gate #define ERR_XFER_QUANTITY "cannot transfer %llu from %s to %s: %s\n" 820Sstevel@tonic-gate #define ERR_CMDPARSE_FAILED "command parsing failed, terminating...\n" 830Sstevel@tonic-gate 840Sstevel@tonic-gate #define CONFIGURATION "configuration" 850Sstevel@tonic-gate #define RESOURCE "resource" 860Sstevel@tonic-gate #define POOL "pool" 870Sstevel@tonic-gate #define PSET "pset" 880Sstevel@tonic-gate #define COMPONENT "component" 890Sstevel@tonic-gate #define CPU "cpu" 900Sstevel@tonic-gate #define SYSTEM_NAME "system.name" 910Sstevel@tonic-gate #define POOL_NAME "pool.name" 920Sstevel@tonic-gate #define PSET_NAME "pset.name" 930Sstevel@tonic-gate #define CPU_SYSID "cpu.sys_id" 940Sstevel@tonic-gate 950Sstevel@tonic-gate #define E_PO_SUCCESS 0 /* Exit status for success */ 960Sstevel@tonic-gate #define E_ERROR 1 /* Exit status for error */ 970Sstevel@tonic-gate #define E_USAGE 2 /* Exit status for usage error */ 980Sstevel@tonic-gate 990Sstevel@tonic-gate extern const char *get_errstr(void); 1000Sstevel@tonic-gate extern const char *get_errstr_err(int, int); 1010Sstevel@tonic-gate extern void warn(const char *, ...); 102*428Ssl108498 extern void die(const char *, ...) __NORETURN; 1030Sstevel@tonic-gate extern const char *getpname(const char *); 1040Sstevel@tonic-gate 1050Sstevel@tonic-gate #ifdef __cplusplus 1060Sstevel@tonic-gate } 1070Sstevel@tonic-gate #endif 1080Sstevel@tonic-gate 1090Sstevel@tonic-gate #endif /* _UTILS_H */ 110