diff options
author | Sue Gleeson <Susan.Gleeson@Sun.COM> | 2010-04-05 15:20:40 -0400 |
---|---|---|
committer | Sue Gleeson <Susan.Gleeson@Sun.COM> | 2010-04-05 15:20:40 -0400 |
commit | c3a558e7c77127215b010652905be7916ec5a080 (patch) | |
tree | 4f5c95cd7be43ee57cfe8981c5e9052edea7a5bb /usr/src/lib/libsrpt | |
parent | 9adc5a4e4d9ae99cc46988904fa0509938a2133d (diff) | |
download | illumos-joyent-c3a558e7c77127215b010652905be7916ec5a080.tar.gz |
6879350 RFE: Add ability to enable/disable SRPT on specific HCAs
Diffstat (limited to 'usr/src/lib/libsrpt')
-rw-r--r-- | usr/src/lib/libsrpt/Makefile | 53 | ||||
-rw-r--r-- | usr/src/lib/libsrpt/Makefile.com | 51 | ||||
-rw-r--r-- | usr/src/lib/libsrpt/amd64/Makefile | 29 | ||||
-rw-r--r-- | usr/src/lib/libsrpt/common/libsrpt.c | 493 | ||||
-rw-r--r-- | usr/src/lib/libsrpt/common/libsrpt.h | 180 | ||||
-rw-r--r-- | usr/src/lib/libsrpt/common/llib-lsrpt | 28 | ||||
-rw-r--r-- | usr/src/lib/libsrpt/common/mapfile-vers | 56 | ||||
-rw-r--r-- | usr/src/lib/libsrpt/i386/Makefile | 26 | ||||
-rw-r--r-- | usr/src/lib/libsrpt/sparc/Makefile | 27 | ||||
-rw-r--r-- | usr/src/lib/libsrpt/sparcv9/Makefile | 32 |
10 files changed, 975 insertions, 0 deletions
diff --git a/usr/src/lib/libsrpt/Makefile b/usr/src/lib/libsrpt/Makefile new file mode 100644 index 0000000000..4e049e0fe5 --- /dev/null +++ b/usr/src/lib/libsrpt/Makefile @@ -0,0 +1,53 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (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 +# or http://www.opensolaris.org/os/licensing. +# 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 (c) 2010, Oracle and/or its affiliates. All rights reserved. +# + +include $(SRC)/lib/Makefile.lib + +HDRS = libsrpt.h +HDRDIR = common + +SUBDIRS = $(MACH) +$(BUILD64)SUBDIRS += $(MACH64) + +all := TARGET= all +clean := TARGET= clean +clobber := TARGET= clobber +install := TARGET= install +install_h := TARGET= install_h +lint := TARGET= lint + +.KEEP_STATE: + +all clean clobber install lint: $(SUBDIRS) + +install_h: $(ROOTHDRS) + +check: $(CHECKHDRS) + +$(SUBDIRS): FRC + @cd $@; pwd; $(MAKE) $(TARGET) + +FRC: + +include $(SRC)/lib/Makefile.targ diff --git a/usr/src/lib/libsrpt/Makefile.com b/usr/src/lib/libsrpt/Makefile.com new file mode 100644 index 0000000000..4cc7d1d599 --- /dev/null +++ b/usr/src/lib/libsrpt/Makefile.com @@ -0,0 +1,51 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (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 +# or http://www.opensolaris.org/os/licensing. +# 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 (c) 2010, Oracle and/or its affiliates. All rights reserved. +# + +LIBRARY = libsrpt.a +VERS = .1 +OBJECTS = libsrpt.o + +include ../../Makefile.lib + +LIBS = $(DYNLIB) $(LINTLIB) + +SRCDIR = ../common +$(LINTLIB):= SRCS = $(SRCDIR)/$(LINTSRC) + +SRPTMODDIR = ../../../uts/common/io/comstar/port/srpt + +INCS += -I$(SRCDIR) -I$(SRPTMODDIR) + +C99MODE = -xc99=%all +C99LMODE = -Xc99=%all +LDLIBS += -lc -lnvpair -lstmf +CPPFLAGS += $(INCS) -D_REENTRANT + +.KEEP_STATE: + +all: $(LIBS) + +lint: lintcheck + +include ../../Makefile.targ diff --git a/usr/src/lib/libsrpt/amd64/Makefile b/usr/src/lib/libsrpt/amd64/Makefile new file mode 100644 index 0000000000..644e6b23da --- /dev/null +++ b/usr/src/lib/libsrpt/amd64/Makefile @@ -0,0 +1,29 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (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 +# or http://www.opensolaris.org/os/licensing. +# 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 (c) 2010, Oracle and/or its affiliates. All rights reserved. +# + +include ../Makefile.com +include ../../Makefile.lib.64 + +all: $(LIBS) + +install: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTLINT) diff --git a/usr/src/lib/libsrpt/common/libsrpt.c b/usr/src/lib/libsrpt/common/libsrpt.c new file mode 100644 index 0000000000..5a89f88568 --- /dev/null +++ b/usr/src/lib/libsrpt/common/libsrpt.c @@ -0,0 +1,493 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (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 + * or http://www.opensolaris.org/os/licensing. + * 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 (c) 2010, Oracle and/or its affiliates. All rights reserved. + */ + +#include <sys/types.h> +#include <sys/stat.h> +#include <limits.h> +#include <ctype.h> +#include <fcntl.h> +#include <errno.h> +#include <unistd.h> +#include <strings.h> +#include <libintl.h> +#include <libscf.h> +#include <libnvpair.h> + +#include <libstmf.h> +#include <libsrpt.h> + +#include "srpt_common.h" + +#define SRPT_PROV_NAME "srpt" + +/* + * Function: srpt_GetConfig() + * + * Parameters: + * cfg Current SRPT configuration in nvlist form + * token Configuration generation number. Use this token + * if updating the configuration with srpt_SetConfig. + * + * Return Values: + * 0 Success + * ENOMEM Could not allocate resources + * EINVAL Invalid parameter + */ +int +srpt_GetConfig(nvlist_t **cfg, uint64_t *token) +{ + int ret = 0; + nvlist_t *cfg_nv = NULL; + uint64_t stmf_token = 0; + nvlist_t *hcanv = NULL; + + if (!cfg) { + return (EINVAL); + } + + *cfg = NULL; + + ret = stmfGetProviderDataProt(SRPT_PROV_NAME, &cfg_nv, + STMF_PORT_PROVIDER_TYPE, &stmf_token); + + if (ret == STMF_STATUS_SUCCESS) { + ret = 0; + } else if (ret == STMF_ERROR_NOT_FOUND) { + /* Not initialized yet */ + ret = nvlist_alloc(&cfg_nv, NV_UNIQUE_NAME, 0); + if (ret != 0) { + return (ret); + } + /* create the HCA list */ + ret = nvlist_alloc(&hcanv, NV_UNIQUE_NAME, 0); + if (ret == 0) { + ret = nvlist_add_nvlist(cfg_nv, SRPT_PROP_HCALIST, + hcanv); + if (ret != 0) { + nvlist_free(hcanv); + } + } + if (ret != 0) { + nvlist_free(cfg_nv); + cfg_nv = NULL; + } + } else if (ret == STMF_ERROR_NOMEM) { + ret = ENOMEM; + } else { + ret = EINVAL; + } + + *cfg = cfg_nv; + *token = stmf_token; + + return (ret); +} + +/* + * Function: srpt_SetConfig() + * + * Parameters: + * cfg SRPT configuration in nvlist form + * token Configuration generation number from srpt_GetConfig. + * Use this token to ensure the configuration hasn't been + * updated by another user since the time it was fetched. + * + * Return Values: + * 0 Success + * ENOMEM Could not allocate resources + * EINVAL Invalid parameter + * ECANCELED Configuration updated by another user + */ +int +srpt_SetConfig(nvlist_t *cfg, uint64_t token) +{ + int ret = 0; + + ret = stmfSetProviderDataProt(SRPT_PROV_NAME, cfg, + STMF_PORT_PROVIDER_TYPE, &token); + + if (ret == STMF_STATUS_SUCCESS) { + ret = 0; + } else if (ret == STMF_ERROR_NOMEM) { + ret = ENOMEM; + } else if (ret == STMF_ERROR_PROV_DATA_STALE) { + ret = ECANCELED; /* could be a better errno */ + } else { + ret = EINVAL; + } + + return (ret); +} + +/* + * Function: srpt_GetDefaultState() + * + * Parameters: + * enabled If B_TRUE, indicates that targets will be created for all + * discovered HCAs that have not been specifically disabled. + * If B_FALSE, targets will not be created unless the HCA has + * been specifically enabled. See also srpt_SetDefaultState(). + * + * Return Values: + * 0 Success + * ENOMEM Could not allocate resources + * EINVAL Invalid parameter + */ +int +srpt_GetDefaultState(boolean_t *enabled) +{ + int ret; + nvlist_t *cfgnv; + uint64_t token; + boolean_t val = B_TRUE; + + if (enabled == NULL) { + return (EINVAL); + } + + ret = srpt_GetConfig(&cfgnv, &token); + if (ret != 0) { + return (ret); + } + + if (cfgnv != NULL) { + ret = nvlist_lookup_boolean_value(cfgnv, + SRPT_PROP_DEFAULT_ENABLED, &val); + + if (ret == ENOENT) { + ret = 0; + } + } + + *enabled = val; + return (ret); +} + +/* + * Function: srpt_SetDefaultState() + * + * Parameters: + * enabled If B_TRUE, indicates that targets will be created for all + * discovered HCAs that have not been specifically disabled. + * If B_FALSE, targets will not be created unless the HCA has + * been specifically enabled. See also srpt_SetDefaultState(). + * + * Return Values: + * 0 Success + * ENOMEM Could not allocate resources + * EINVAL Invalid parameter + */ +int +srpt_SetDefaultState(boolean_t enabled) +{ + int ret; + nvlist_t *cfgnv; + uint64_t token; + + ret = srpt_GetConfig(&cfgnv, &token); + if (ret != 0) { + return (ret); + } + + if (cfgnv == NULL) { + ret = nvlist_alloc(&cfgnv, NV_UNIQUE_NAME, 0); + if (ret != 0) { + return (ret); + } + } + + ret = nvlist_add_boolean_value(cfgnv, SRPT_PROP_DEFAULT_ENABLED, + enabled); + + if (ret == 0) { + ret = srpt_SetConfig(cfgnv, token); + } + + nvlist_free(cfgnv); + + return (ret); +} + +/* + * Function: srpt_SetTargetState() + * + * Parameters: + * hca_guid HCA GUID. See description of srpt_NormalizeGuid + * enabled If B_TRUE, indicates that a target will be created for + * this HCA when the SRPT SMF service is enabled. If B_FALSE, + * a target will not be created + * + * Return Values: + * 0 Success + * ENOMEM Could not allocate resources + * EINVAL Invalid parameter + */ +int +srpt_SetTargetState(char *hca_guid, boolean_t enabled) +{ + int ret; + nvlist_t *cfgnv; + uint64_t token; + nvlist_t *hcalist; + nvlist_t *hcanv; + char guid[32]; + uint64_t hcaguid; + + if (hca_guid == NULL) { + return (EINVAL); + } + + ret = srpt_NormalizeGuid(hca_guid, guid, sizeof (guid), &hcaguid); + if (ret != 0) { + return (ret); + } + + ret = srpt_GetConfig(&cfgnv, &token); + if (ret != 0) { + return (ret); + } + + /* get the list of HCAs */ + ret = nvlist_lookup_nvlist(cfgnv, SRPT_PROP_HCALIST, &hcalist); + if (ret != 0) { + nvlist_free(cfgnv); + return (ret); + } + + ret = nvlist_lookup_nvlist(hcalist, guid, &hcanv); + if (ret == ENOENT) { + /* no entry yet */ + ret = nvlist_alloc(&hcanv, NV_UNIQUE_NAME, 0); + if (ret == 0) { + ret = nvlist_add_uint64(hcanv, SRPT_PROP_GUID, hcaguid); + } + } + + if (ret == 0) { + ret = nvlist_add_boolean_value(hcanv, SRPT_PROP_ENABLED, + enabled); + } + + if (ret == 0) { + ret = nvlist_add_nvlist(hcalist, guid, hcanv); + } + + if (ret == 0) { + ret = srpt_SetConfig(cfgnv, token); + } + + nvlist_free(cfgnv); + + return (ret); +} + +/* + * Function: srpt_GetTargetState() + * + * Parameters: + * hca_guid HCA GUID. See description of srpt_NormalizeGuid + * enabled If B_TRUE, indicates that a target will be created for + * this HCA when the SRPT SMF service is enabled. If B_FALSE, + * a target will not be created + * + * Return Values: + * 0 Success + * ENOMEM Could not allocate resources + * EINVAL Invalid parameter + */ +int +srpt_GetTargetState(char *hca_guid, boolean_t *enabled) +{ + int ret; + nvlist_t *cfgnv; + uint64_t token; + nvlist_t *hcalist; + nvlist_t *hcanv; + boolean_t defaultState = B_TRUE; + char guid[32]; + + if (hca_guid == NULL) { + return (EINVAL); + } + + ret = srpt_NormalizeGuid(hca_guid, guid, sizeof (guid), NULL); + if (ret != 0) { + return (ret); + } + + ret = srpt_GetConfig(&cfgnv, &token); + if (ret != 0) { + return (ret); + } + + /* get the list of HCAs */ + ret = nvlist_lookup_nvlist(cfgnv, SRPT_PROP_HCALIST, &hcalist); + if (ret != 0) { + nvlist_free(cfgnv); + return (ret); + } + + /* + * Find the default, for the likely case that this HCA isn't + * explicitly set. + */ + (void) nvlist_lookup_boolean_value(cfgnv, SRPT_PROP_DEFAULT_ENABLED, + &defaultState); + + ret = nvlist_lookup_nvlist(hcalist, guid, &hcanv); + if (ret == 0) { + ret = nvlist_lookup_boolean_value(hcanv, SRPT_PROP_ENABLED, + enabled); + } + + if (ret == ENOENT) { + /* not explicitly set, use the default */ + *enabled = defaultState; + ret = 0; + } + + nvlist_free(cfgnv); + + return (ret); + +} + +/* + * Function: srpt_ResetTarget() + * + * Clears the HCA-specific configuration. Target creation will revert to + * the default. + * + * Parameters: + * hca_guid HCA GUID. See description of srpt_NormalizeGuid + * + * Return Values: + * 0 Success + * ENOMEM Could not allocate resources + * EINVAL Invalid parameter + */ +int +srpt_ResetTarget(char *hca_guid) +{ + int ret; + nvlist_t *cfgnv; + nvlist_t *hcalist; + uint64_t token; + char guid[32]; + + if (hca_guid == NULL) { + return (EINVAL); + } + + ret = srpt_NormalizeGuid(hca_guid, guid, sizeof (guid), NULL); + if (ret != 0) { + return (ret); + } + + ret = srpt_GetConfig(&cfgnv, &token); + if (ret != 0) { + return (ret); + } + + /* get the list of HCAs */ + ret = nvlist_lookup_nvlist(cfgnv, SRPT_PROP_HCALIST, &hcalist); + if (ret != 0) { + nvlist_free(cfgnv); + return (ret); + } + + /* don't set config if we don't actually change anything */ + if (nvlist_exists(hcalist, guid)) { + (void) nvlist_remove_all(hcalist, guid); + + if (ret == 0) { + ret = srpt_SetConfig(cfgnv, token); + } + } + + nvlist_free(cfgnv); + + return (ret); +} + +/* + * srpt_NormalizeGuid() + * + * Parameters: + * in HCA GUID. Must be in one of the following forms: + * 3BA000100CD18 - base hex form + * 0003BA000100CD18 - base hex form with leading zeroes + * hca:3BA000100CD18 - form from cfgadm and/or /dev/cfg + * eui.0003BA000100CD18 - EUI form + * + * buf Buffer to hold normalized guid string. Must be at least + * 17 chars long. + * buflen Length of provided buffer + * int_guid Optional. If not NULL, the integer form of the GUID will also + * be returned. + * Return Values: + * 0 Success + * EINVAL Invalid HCA GUID or invalid parameter. + */ +int +srpt_NormalizeGuid(char *in, char *buf, size_t buflen, uint64_t *int_guid) +{ + uint64_t guid; + char *bufp = in; + char *end = NULL; + + if ((in == NULL) || (buf == NULL)) { + return (EINVAL); + } + + if (strncasecmp(bufp, "eui.", 4) == 0) { + /* EUI form */ + bufp += 4; + } else if (strncasecmp(bufp, "hca:", 4) == 0) { + /* cfgadm and /dev/hca form */ + bufp += 4; + } + + /* + * strtoull() does not return EINVAL as documented. Lucky + * for us, neither 0 nor ULLONG_MAX will be valid. Trap on + * those and fail. + */ + guid = strtoull(bufp, &end, 16); + if ((guid == 0) || (guid == ULLONG_MAX) || + ((end != NULL) && (strlen(end) > 0))) { + return (EINVAL); + } + +#if 0 + (void) snprintf(buf, buflen, "%llX", guid); +#endif + SRPT_FORMAT_HCAKEY(buf, buflen, guid); + + if (int_guid) { + *int_guid = guid; + } + + return (0); +} diff --git a/usr/src/lib/libsrpt/common/libsrpt.h b/usr/src/lib/libsrpt/common/libsrpt.h new file mode 100644 index 0000000000..8b5d1fe26e --- /dev/null +++ b/usr/src/lib/libsrpt/common/libsrpt.h @@ -0,0 +1,180 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (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 + * or http://www.opensolaris.org/os/licensing. + * 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 (c) 2010, Oracle and/or its affiliates. All rights reserved. + */ + +#ifndef _LIBSRPT_H +#define _LIBSRPT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <sys/types.h> +#include <libnvpair.h> + +/* + * Function: srpt_GetConfig() + * + * Parameters: + * cfg Current SRPT configuration in nvlist form + * token Configuration generation number. Use this token + * if updating the configuration with srpt_SetConfig. + * + * Return Values: + * 0 Success + * ENOMEM Could not allocate resources + * EINVAL Invalid parameter + */ +int +srpt_GetConfig(nvlist_t **cfg, uint64_t *token); + +/* + * Function: srpt_SetConfig() + * + * Parameters: + * cfg SRPT configuration in nvlist form + * token Configuration generation number from srpt_GetConfig. + * Use this token to ensure the configuration hasn't been + * updated by another user since the time it was fetched. + * + * Return Values: + * 0 Success + * ENOMEM Could not allocate resources + * EINVAL Invalid parameter + * ECANCELED Configuration updated by another user + */ +int +srpt_SetConfig(nvlist_t *cfg, uint64_t token); + +/* + * Function: srpt_GetDefaultState() + * + * Parameters: + * enabled If B_TRUE, indicates that targets will be created for all + * discovered HCAs that have not been specifically disabled. + * If B_FALSE, targets will not be created unless the HCA has + * been specifically enabled. See also srpt_SetDefaultState(). + * + * Return Values: + * 0 Success + * ENOMEM Could not allocate resources + * EINVAL Invalid parameter + */ +int +srpt_GetDefaultState(boolean_t *enabled); + +/* + * Function: srpt_SetDefaultState() + * + * Parameters: + * enabled If B_TRUE, indicates that targets will be created for all + * discovered HCAs that have not been specifically disabled. + * If B_FALSE, targets will not be created unless the HCA has + * been specifically enabled. See also srpt_SetDefaultState(). + * + * Return Values: + * 0 Success + * ENOMEM Could not allocate resources + * EINVAL Invalid parameter + */ +int +srpt_SetDefaultState(boolean_t enabled); + +/* + * Function: srpt_SetTargetState() + * + * Parameters: + * hca_guid HCA GUID. See description of srpt_NormalizeGuid + * enabled If B_TRUE, indicates that a target will be created for + * this HCA when the SRPT SMF service is enabled. If B_FALSE, + * a target will not be created + * + * Return Values: + * 0 Success + * ENOMEM Could not allocate resources + * EINVAL Invalid parameter + */ +int +srpt_SetTargetState(char *hca_guid, boolean_t enabled); + +/* + * Function: srpt_GetTargetState() + * + * Parameters: + * hca_guid HCA GUID. See description of srpt_NormalizeGuid + * enabled If B_TRUE, indicates that a target will be created for + * this HCA when the SRPT SMF service is enabled. If B_FALSE, + * a target will not be created + * + * Return Values: + * 0 Success + * ENOMEM Could not allocate resources + * EINVAL Invalid parameter + */ +int +srpt_GetTargetState(char *hca_guid, boolean_t *enabled); + +/* + * Function: srpt_ResetTarget() + * + * Clears the HCA-specific configuration. Target creation will revert to + * the default. + * + * Parameters: + * hca_guid HCA GUID. See description of srpt_NormalizeGuid + * + * Return Values: + * 0 Success + * ENOMEM Could not allocate resources + * EINVAL Invalid parameter + */ +int +srpt_ResetTarget(char *hca_guid); + +/* + * srpt_NormalizeGuid() + * + * Parameters: + * in HCA GUID. Must be in one of the following forms: + * 3BA000100CD18 - base hex form + * 0003BA000100CD18 - base hex form with leading zeroes + * hca:3BA000100CD18 - form from cfgadm and/or /dev/cfg + * eui.0003BA000100CD18 - EUI form + * + * buf Buffer to hold normalized guid string. Must be at least + * 17 chars long. + * buflen Length of provided buffer + * int_guid Optional. If not NULL, the integer form of the GUID will also + * be returned. + * Return Values: + * 0 Success + * EINVAL Invalid HCA GUID or invalid parameter. + */ +int +srpt_NormalizeGuid(char *in, char *buf, size_t buflen, uint64_t *int_guid); + +#ifdef __cplusplus +} +#endif + +#endif /* _LIBSRPT_H */ diff --git a/usr/src/lib/libsrpt/common/llib-lsrpt b/usr/src/lib/libsrpt/common/llib-lsrpt new file mode 100644 index 0000000000..c807a7d9f5 --- /dev/null +++ b/usr/src/lib/libsrpt/common/llib-lsrpt @@ -0,0 +1,28 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (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 + * or http://www.opensolaris.org/os/licensing. + * 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 (c) 2010, Oracle and/or its affiliates. All rights reserved. + */ + +/*LINTLIBRARY*/ +/*PROTOLIB1*/ + +#include <libsrpt.h> diff --git a/usr/src/lib/libsrpt/common/mapfile-vers b/usr/src/lib/libsrpt/common/mapfile-vers new file mode 100644 index 0000000000..8be8e62a75 --- /dev/null +++ b/usr/src/lib/libsrpt/common/mapfile-vers @@ -0,0 +1,56 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (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 +# or http://www.opensolaris.org/os/licensing. +# 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 (c) 2010, Oracle and/or its affiliates. All rights reserved. +# + +# +# MAPFILE HEADER START +# +# WARNING: STOP NOW. DO NOT MODIFY THIS FILE. +# Object versioning must comply with the rules detailed in +# +# usr/src/lib/README.mapfiles +# +# You should not be making modifications here until you've read the most current +# copy of that file. If you need help, contact a gatekeeper for guidance. +# +# MAPFILE HEADER END +# +SUNW_1.1 { + global: + srpt_GetConfig; + srpt_SetConfig; + srpt_GetDefaultState; + srpt_SetDefaultState; + srpt_SetTargetState; + srpt_GetTargetState; + srpt_ResetTarget; + srpt_NormalizeGuid; + local: + *; +}; + +SUNWprivate { + global: + local: + *; +}; + diff --git a/usr/src/lib/libsrpt/i386/Makefile b/usr/src/lib/libsrpt/i386/Makefile new file mode 100644 index 0000000000..f9373d2096 --- /dev/null +++ b/usr/src/lib/libsrpt/i386/Makefile @@ -0,0 +1,26 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (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 +# or http://www.opensolaris.org/os/licensing. +# 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 (c) 2010, Oracle and/or its affiliates. All rights reserved. +# + +include ../Makefile.com + +install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT) diff --git a/usr/src/lib/libsrpt/sparc/Makefile b/usr/src/lib/libsrpt/sparc/Makefile new file mode 100644 index 0000000000..3f74bc6793 --- /dev/null +++ b/usr/src/lib/libsrpt/sparc/Makefile @@ -0,0 +1,27 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (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 +# or http://www.opensolaris.org/os/licensing. +# 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 (c) 2010, Oracle and/or its affiliates. All rights reserved. +# +include ../Makefile.com + +all: $(LIBS) + +install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT) diff --git a/usr/src/lib/libsrpt/sparcv9/Makefile b/usr/src/lib/libsrpt/sparcv9/Makefile new file mode 100644 index 0000000000..8f83585151 --- /dev/null +++ b/usr/src/lib/libsrpt/sparcv9/Makefile @@ -0,0 +1,32 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (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 +# or http://www.opensolaris.org/os/licensing. +# 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 (c) 2010, Oracle and/or its affiliates. All rights reserved. +# + +include ../Makefile.com +include ../../Makefile.lib.64 + +LIBS = $(DYNLIB) $(LINTLIB) + +all: $(LIBS) + +install: all $(ROOTLIBS64) $(ROOTLINKS64) |