17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 23*414388d7Ssl108498 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #ifndef _UTILS_H 287c478bd9Sstevel@tonic-gate #define _UTILS_H 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate #include <sys/types.h> 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #ifdef __cplusplus 357c478bd9Sstevel@tonic-gate extern "C" { 367c478bd9Sstevel@tonic-gate #endif 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate /* Error messages for pool commands */ 397c478bd9Sstevel@tonic-gate #define ERR_SET_TERM "cleanup installation failed: %s\n" 407c478bd9Sstevel@tonic-gate #define ERR_CONF_LOAD "cannot load configuration from %s: %s\n" 417c478bd9Sstevel@tonic-gate #define ERR_CMD_FILE_INIT "cannot initialise command sequence: %s\n" 427c478bd9Sstevel@tonic-gate #define ERR_PROP_TO_LIST "cannot add property %s to property list\n" 437c478bd9Sstevel@tonic-gate #define ERR_UNKNOWN_ENTITY "unrecognised entity %lld\n" 447c478bd9Sstevel@tonic-gate #define ERR_ASSOC_TO_LIST "cannot add association %s to association " \ 457c478bd9Sstevel@tonic-gate "list\n" 467c478bd9Sstevel@tonic-gate #define ERR_GET_ELEMENT_DETAILS "cannot get the %s details for %s: %s\n" 477c478bd9Sstevel@tonic-gate #define ERR_LOCATE_ELEMENT "cannot locate the %s, %s: %s\n" 487c478bd9Sstevel@tonic-gate #define ERR_CREATE_ELEMENT "cannot create the %s, %s: %s\n" 497c478bd9Sstevel@tonic-gate #define ERR_DESTROY_ELEMENT "cannot destroy the %s, %s: %s\n" 507c478bd9Sstevel@tonic-gate #define ERR_ALLOC_ELEMENT "cannot allocate %s: %s\n" 517c478bd9Sstevel@tonic-gate #define ERR_PUT_PROPERTY "put property %s failed: %s\n" 527c478bd9Sstevel@tonic-gate #define ERR_REMOVE_PROPERTY "remove property %s failed: %s\n" 537c478bd9Sstevel@tonic-gate #define ERR_GET_PROPERTY "get property %s failed: %s\n" 547c478bd9Sstevel@tonic-gate #define ERR_UNKNOWN_RESOURCE "unrecognized resource type: %d\n" 557c478bd9Sstevel@tonic-gate #define ERR_ASSOC_RESOURCE "cannot associate resource %s to pool: %s\n" 567c478bd9Sstevel@tonic-gate #define ERR_VALIDATION_FAILED "configuration failed strict validation: %s\n" 577c478bd9Sstevel@tonic-gate #define ERR_CONFIG_OPEN_FAILED "cannot open the configuration: %s\n" 587c478bd9Sstevel@tonic-gate #define ERR_CONFIG_SAVE_FAILED "cannot save the configuration: %s\n" 597c478bd9Sstevel@tonic-gate #define ERR_WRONG_SYSTEM_NAME "incorrect system name supplied: %s\n" 607c478bd9Sstevel@tonic-gate #define ERR_CMD_LINE_ALLOC "cannot create command, not enough memory\n" 617c478bd9Sstevel@tonic-gate #define ERR_PROP_ALLOC "cannot create property, not enough memory\n" 627c478bd9Sstevel@tonic-gate #define ERR_ASSOC_ALLOC "cannot create association, not enough memory\n" 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate #define ERR_DISABLE "cannot disable pools" 657c478bd9Sstevel@tonic-gate #define ERR_ENABLE "cannot enable pools" 667c478bd9Sstevel@tonic-gate #define ERR_NOMEM "not enough memory\n" 677c478bd9Sstevel@tonic-gate #define ERR_PERMISSIONS "insufficient privileges\n" 687c478bd9Sstevel@tonic-gate #define ERR_PRIVILEGE "cannot access %s privileges" 697c478bd9Sstevel@tonic-gate #define ERR_OPEN_DYNAMIC "couldn't open pools state file: %s\n" 707c478bd9Sstevel@tonic-gate #define ERR_OPEN_STATIC "couldn't open configuration at '%s': %s\n" 717c478bd9Sstevel@tonic-gate #define ERR_VALIDATE_RUNTIME "configuration at '%s' cannot be instantiated "\ 727c478bd9Sstevel@tonic-gate "on current system\n" 737c478bd9Sstevel@tonic-gate #define ERR_COMMIT_DYNAMIC "couldn't commit configuration changes at '%s'"\ 747c478bd9Sstevel@tonic-gate ": %s\n" 757c478bd9Sstevel@tonic-gate #define ERR_REMOVE_DYNAMIC "couldn't remove dynamic configuration: %s\n" 767c478bd9Sstevel@tonic-gate #define ERR_COMMIT_STATIC "couldn't commit configuration changes at '%s'"\ 777c478bd9Sstevel@tonic-gate ": %s\n" 787c478bd9Sstevel@tonic-gate #define ERR_EXPORT_DYNAMIC "couldn't export pools state file to '%s': %s\n" 797c478bd9Sstevel@tonic-gate #define ERR_NO_POOLS "no pools defined\n" 807c478bd9Sstevel@tonic-gate #define ERR_XFER_COMPONENT "cannot transfer %s %s to %s: %s\n" 817c478bd9Sstevel@tonic-gate #define ERR_XFER_QUANTITY "cannot transfer %llu from %s to %s: %s\n" 827c478bd9Sstevel@tonic-gate #define ERR_CMDPARSE_FAILED "command parsing failed, terminating...\n" 837c478bd9Sstevel@tonic-gate 847c478bd9Sstevel@tonic-gate #define CONFIGURATION "configuration" 857c478bd9Sstevel@tonic-gate #define RESOURCE "resource" 867c478bd9Sstevel@tonic-gate #define POOL "pool" 877c478bd9Sstevel@tonic-gate #define PSET "pset" 887c478bd9Sstevel@tonic-gate #define COMPONENT "component" 897c478bd9Sstevel@tonic-gate #define CPU "cpu" 907c478bd9Sstevel@tonic-gate #define SYSTEM_NAME "system.name" 917c478bd9Sstevel@tonic-gate #define POOL_NAME "pool.name" 927c478bd9Sstevel@tonic-gate #define PSET_NAME "pset.name" 937c478bd9Sstevel@tonic-gate #define CPU_SYSID "cpu.sys_id" 947c478bd9Sstevel@tonic-gate 957c478bd9Sstevel@tonic-gate #define E_PO_SUCCESS 0 /* Exit status for success */ 967c478bd9Sstevel@tonic-gate #define E_ERROR 1 /* Exit status for error */ 977c478bd9Sstevel@tonic-gate #define E_USAGE 2 /* Exit status for usage error */ 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gate extern const char *get_errstr(void); 1007c478bd9Sstevel@tonic-gate extern const char *get_errstr_err(int, int); 1017c478bd9Sstevel@tonic-gate extern void warn(const char *, ...); 102*414388d7Ssl108498 extern void die(const char *, ...) __NORETURN; 1037c478bd9Sstevel@tonic-gate extern const char *getpname(const char *); 1047c478bd9Sstevel@tonic-gate 1057c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1067c478bd9Sstevel@tonic-gate } 1077c478bd9Sstevel@tonic-gate #endif 1087c478bd9Sstevel@tonic-gate 1097c478bd9Sstevel@tonic-gate #endif /* _UTILS_H */ 110