diff options
Diffstat (limited to 'usr/src/cmd/wbem/provider/c')
156 files changed, 0 insertions, 47447 deletions
diff --git a/usr/src/cmd/wbem/provider/c/Makefile b/usr/src/cmd/wbem/provider/c/Makefile deleted file mode 100644 index e6a66b971e..0000000000 --- a/usr/src/cmd/wbem/provider/c/Makefile +++ /dev/null @@ -1,60 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 2002-2003 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - - - -COMMON_SUBDIRS = wbem_disk \ - filesystems - -SUBDIRS = $(COMMON_SUBDIRS) $($(ARCH)_SUBDIRS) - - -all:= TARGET = all -clean:= TARGET = clean -clobber:= TARGET = clobber -install:= TARGET = install -lint:= TARGET = lint -check:= TARGET = check -_msg:= TARGET = _msg - -.KEEP_STATE: - -all clean clobber lint _msg: ${SUBDIRS} - -FRC: - -${SUBDIRS}: FRC - cd $@; pwd; $(MAKE) $(TARGET) - -check: ${SUBDIRS} - cd include; pwd; $(MAKE) $(TARGET) - -install: ${SUBDIRS} - cd mof; pwd; $(MAKE) $(TARGET) diff --git a/usr/src/cmd/wbem/provider/c/filesystems/Makefile b/usr/src/cmd/wbem/provider/c/filesystems/Makefile deleted file mode 100644 index aaddff2eda..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/Makefile +++ /dev/null @@ -1,55 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 2003 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -SUBDIRS = common \ - wbem_nfs - -MSGSUBDIRS = wbem_nfs - -all:= TARGET = all -clean:= TARGET = clean -clobber:= TARGET = clobber -install:= TARGET = install -lint:= TARGET = lint -check:= TARGET = check -_msg:= TARGET = _msg - -.KEEP_STATE: - -all install clean clobber lint: ${SUBDIRS} - -_msg: $(MSGSUBDIRS) - -FRC: - -${SUBDIRS}: FRC - cd $@; pwd; $(MAKE) $(TARGET) - -.WAIT: diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/Makefile b/usr/src/cmd/wbem/provider/c/filesystems/common/Makefile deleted file mode 100644 index f1e55fd91d..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/Makefile +++ /dev/null @@ -1,58 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 2003 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -sparc_SUBDIRS = - -i386_SUBDIRS = - -ppc_SUBDIRS = - -COMMON_SUBDIRS = cmdgeneration \ - mount_methods - -SUBDIRS = $(COMMON_SUBDIRS) $($(ARCH)_SUBDIRS) - -all:= TARGET = all -clean:= TARGET = clean -clobber:= TARGET = clobber -install:= TARGET = install -lint:= TARGET = lint -check:= TARGET = check - -.KEEP_STATE: - -all install clean clobber lint: ${SUBDIRS} - -FRC: - -${SUBDIRS}: FRC - cd $@; pwd; $(MAKE) $(TARGET) - -.WAIT: diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/Makefile b/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/Makefile deleted file mode 100644 index fe8e417a86..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/Makefile +++ /dev/null @@ -1,95 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -sparc_SUBDIRS = - -i386_SUBDIRS = - -ppc_SUBDIRS = - -COMMON_SUBDIRS = mount \ - umount \ - share \ - unshare - -SUBDIRS = $(COMMON_SUBDIRS) $($(ARCH)_SUBDIRS) - -OBJECTS = cmdgen.o - -LINT_OBJS = $(OBJECTS:%.o=%.ln) - -GENERAL = . \ - $(ROOTWBEMINC) \ - $(SRC)/cmd/wbem/provider/c/include \ - $(SRC)/cmd/wbem/provider/c/wbem_disk/common \ - $(SRC)/cmd/wbem/provider/c/filesystems/wbem_nfs/include - -CPPFLAGS += -I. $(GENERAL:%=-I%) -D_REENTRANT -DPIC -D_TS_ERRNO - -CFLAGS += $(XREGSFLAG) $(C_BIGPICFLAGS) - -LINTFLAGS += -um -LINTLIBS = $(LDLIBS.cmd) - -POFILES = $(OBJECTS:%.o=%.po) - -all:= TARGET = all -clean:= TARGET = clean -clobber:= TARGET = clobber -install:= TARGET = install -lint:= TARGET = lint -check:= TARGET = check - -.KEEP_STATE: - -all: $(OBJECTS) ${SUBDIRS} - -catalog: $(POFILES) ${SUBDIRS} - -check: ${SUBDIRS} - $(CSTYLE) -p -P $(OBJECTS:%.o=%.c) *.h - $(HDRCHK) *.h - -clean: ${SUBDIRS} - $(RM) $(OBJECTS) $(LINT_OBJS) *.po - -install: all - -lint: $(LINT_OBJS) ${SUBDIRS} - $(LINT.c) $(LINTFLAGS) $(LINT_OBJS) $(LINTLIBS) - -FRC: - -${SUBDIRS}: FRC - cd $@; pwd; $(MAKE) $(TARGET) - -.WAIT: - -include $(SRC)/cmd/Makefile.targ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/cmdgen.c b/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/cmdgen.c deleted file mode 100644 index dcb8f800ce..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/cmdgen.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <errno.h> -#include "cmdgen.h" -#include "nfs_provider_names.h" -#include "util.h" -#include "cmdgen_include.h" - -/* - * Public methods - */ - -/* - * Method: cmdgen_generate_command - * - * Description: Routes the calls to the command generator to the appropriate - * methods depending on the command type passed in. - * - * Parameters: - * - int cmd_type - The command type to execute. This command type must - * be one of those defined in cmdgen.h. - * - CCIMInstance *inst - The instance used to form the command. - * - CCIMObjectPath *objPath - The object path used to form the command. - * - CCIMPropertyList *paramList - The parameter list used to form the - * command. - * - int *errp - The error pointer. - * - * Returns: - * - char * - the command formed from the input parameters. - * - NULL if an error occurred. - */ - -char * -cmdgen_generate_command(int cmd_type, CCIMInstance *inst, - CCIMObjectPath *objPath, CCIMPropertyList *paramList, int *errp) { - - char *cmd = NULL; - int err; - - if (inst == NULL && objPath == NULL && paramList == NULL) { - util_handleError(COMMAND_GEN, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &err); - *errp = EINVAL; - return (NULL); - } - - *errp = 0; - switch (cmd_type) { - case CMDGEN_MOUNTALL: - cmd = cmdgen_mountall(paramList, errp); - break; - case CMDGEN_NFS_MOUNT: - cmd = cmdgen_mount(CMDGEN_NFS, inst, objPath, errp); - break; - case CMDGEN_NFS_UMOUNT: - cmd = cmdgen_umount(inst, objPath, errp); - break; - case CMDGEN_NFS_SHARE: - cmd = cmdgen_share(CMDGEN_NFS, inst, objPath, errp); - break; - case CMDGEN_NFS_UNSHARE: - cmd = cmdgen_unshare(CMDGEN_NFS, inst, objPath, errp); - break; - case CMDGEN_SHAREALL: - cmd = cmdgen_shareall(paramList, errp); - break; - case CMDGEN_UNSHAREALL: - cmd = cmdgen_unshareall(paramList, errp); - break; - case CMDGEN_UMOUNTALL: - cmd = cmdgen_umountall(paramList, errp); - break; - default: - *errp = EINVAL; - - } - return (cmd); -} /* cmdgen_generate_command */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/cmdgen.h b/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/cmdgen.h deleted file mode 100644 index e711f72b94..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/cmdgen.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _CMDGEN_H -#define _CMDGEN_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> - -/* - * Public data type declaration - */ - -/* - * The supported command types. - */ -#define CMDGEN_NFS_MOUNT 0 -#define CMDGEN_MOUNTALL 1 -#define CMDGEN_NFS_UMOUNT 2 -#define CMDGEN_UMOUNTALL 3 -#define CMDGEN_NFS_SHARE 4 -#define CMDGEN_NFS_UNSHARE 5 -#define CMDGEN_SHAREALL 6 -#define CMDGEN_UNSHAREALL 7 - -char *cmdgen_generate_command(int cmd_type, CCIMInstance *inst, - CCIMObjectPath *objPath, CCIMPropertyList *paramList, int *errp); - -#ifdef __cplusplus -} -#endif - -#endif /* _CMDGEN_H */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/cmdgen_include.h b/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/cmdgen_include.h deleted file mode 100644 index 3ad1de93ba..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/cmdgen_include.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _CMDGEN_INCLUDE_H -#define _CMDGEN_INCLUDE_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> -#include <errno.h> - -/* - * Public data type declarations - */ - -/* - * Supported fstypes - */ -#define CMDGEN_NFS 0 - -/* - * Method declarations - */ -char *cmdgen_mount(int fstype, CCIMInstance *inst, CCIMObjectPath *objPath, - int *errp); -char *cmdgen_mountall(CCIMPropertyList *paramList, int *errp); -char *cmdgen_mount_nfs(CCIMInstance *inst, CCIMObjectPath *objPath, - int *errp); -char *cmdgen_share(int fstype, CCIMInstance *inst, CCIMObjectPath *objPath, - int *errp); -char *cmdgen_shareall(CCIMPropertyList *paramList, int *errp); -char *cmdgen_share_nfs(CCIMInstance *inst, CCIMObjectPath *objPath, - int *errp); -char *cmdgen_umount(CCIMInstance *inst, CCIMObjectPath *objPath, int *errp); -char *cmdgen_umountall(CCIMPropertyList *paramList, int *errp); -char *cmdgen_unshare(int fstype, CCIMInstance *inst, CCIMObjectPath *objPath, - int *errp); -char *cmdgen_unshareall(CCIMPropertyList *paramList, int *errp); -char *cmdgen_unshare_nfs(CCIMInstance *inst, CCIMObjectPath *objPath, - int *errp); - -#ifdef __cplusplus -} -#endif - -#endif /* _CMDGEN_INCLUDE_H */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/mount/Makefile b/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/mount/Makefile deleted file mode 100644 index 1eb5bacc7b..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/mount/Makefile +++ /dev/null @@ -1,91 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -sparc_SUBDIRS = - -i386_SUBDIRS = - -ppc_SUBDIRS = - -COMMON_SUBDIRS = nfs - -SUBDIRS = $(COMMON_SUBDIRS) $($(ARCH)_SUBDIRS) - -OBJECTS = cmdgen_mount.o \ - cmdgen_mountall.o - -LINT_OBJS = $(OBJECTS:%.o=%.ln) - -GENERAL = $(ROOTWBEMINC) \ - $(SRC)/cmd/wbem/provider/c/filesystems/common/cmdgeneration - - -CPPFLAGS += -I. $(GENERAL:%=-I%) -D_REENTRANT -DPIC -D_TS_ERRNO - -CFLAGS += $(XREGSFLAG) $(C_BIGPICFLAGS) - -LINTFLAGS += -um -LINTLIBS = $(LDLIBS.cmd) - -POFILES = $(OBJECTS:%.o=%.po) - -all:= TARGET = all -clean:= TARGET = clean -clobber:= TARGET = clobber -install:= TARGET = install -lint:= TARGET = lint -check:= TARGET = check - -.KEEP_STATE: - -all: $(OBJECTS) ${SUBDIRS} - -catalog: $(POFILES) ${SUBDIRS} - -check: ${SUBDIRS} - $(CSTYLE) -p -P $(OBJECTS:%.o=%.c) *.h - $(HDRCHK) *.h - -clean: ${SUBDIRS} - $(RM) $(OBJECTS) $(LINT_OBJS) *.po - -install: all - -lint: $(LINT_OBJS) ${SUBDIRS} - $(LINT.c) $(LINTFLAGS) $(LINT_OBJS) $(LINTLIBS) - -FRC: - -${SUBDIRS}: FRC - cd $@; pwd; $(MAKE) $(TARGET) - -.WAIT: - -include $(SRC)/cmd/Makefile.targ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/mount/cmdgen_mount.c b/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/mount/cmdgen_mount.c deleted file mode 100644 index b84ed9fac8..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/mount/cmdgen_mount.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "cmdgen_include.h" - -/* - * Public methods - */ - -/* - * Method: cmdgen_mount - * - * Description: Routes the calls to the mount command generator to the - * appropriate code for the different mount types. - * - * Parameters: - * - int fstype - The file system type being mounted. - * - CCIMInstance *inst - The instance containing the properties of the - * file system to be mounted. - * - CCIMObjectPath *objPath - The object containing the properties of the - * file system to be mounted. - * - * Returns: - * - char * - The command generated. - */ -char * -cmdgen_mount(int fstype, CCIMInstance *inst, CCIMObjectPath *objPath, - int *errp) { - - char *cmd = NULL; - - *errp = 0; - switch (fstype) { - case CMDGEN_NFS: - cmd = cmdgen_mount_nfs(inst, objPath, errp); - break; - default: - *errp = EINVAL; - } - return (cmd); -} /* cmdgen_mount */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/mount/cmdgen_mountall.c b/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/mount/cmdgen_mountall.c deleted file mode 100644 index 86ebb7f077..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/mount/cmdgen_mountall.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "cmdgen_include.h" - -#define MNTALL_CMD "/usr/sbin/mountall" -#define FSTYPE_FLAG "-F" -#define LOCAL_FLAG "-l" -#define REMOTE_FLAG "-r" -#define SPACE " " - -/* - * Public methods - */ -/* - * The -g flag is a project-private interface for pxfs and is not documented in - * the mountall man page. Therefore, we will not support it with this public - * interface. - */ -/* - * Method: cmdgen_mountall - * - * Description: Forms the mountall command with the options given. - * - * Parameters: - * - CCIMPropertyList *paramList - The property list containing the - * options to form the mountall command. - * - int *errp - The error indicator. Upon error, this will be set to a - * value != 0. - * - * Returns: - * - char * - The mountall command. - * - NULL if an error occurred. - */ -char * -cmdgen_mountall(CCIMPropertyList *paramList, int *errp) { - CCIMPropertyList *currentParam; - CCIMProperty *fstypeProp = NULL; - CCIMProperty *onlyLocalProp = NULL; - CCIMProperty *onlyRemoteProp = NULL; - CCIMProperty *fileProp = NULL; - char *cmd = NULL; - int cmdLen; - - *errp = 0; - cmd = strdup(MNTALL_CMD); - if (cmd == NULL) { - *errp = errno; - return (NULL); - } - - cim_logDebug("cmdgen_mountall", "Set command to: %s", cmd); - /* - * In parameters are as follows: - * 1. String fstype, - * 2. Boolean onlyLocalFileSystems, - * 3. Boolean onlyRemoteFileSystems, - * 4. String fstable - * - * They are expected to always be in this order in the property list. - */ - /* - * Check if a file system type was passed in. If one was we will - * use this in forming the command. - */ - currentParam = paramList; - fstypeProp = currentParam->mDataObject; - if (fstypeProp != NULL && fstypeProp->mValue != NULL && - strlen(fstypeProp->mValue) != 0) { - - cim_logDebug("cmdgen_mountall", "Adding the -F flag"); - /* - * Add -F <fstype> to the command - */ - cmdLen = strlen(cmd) + strlen(SPACE) + strlen(FSTYPE_FLAG) + - strlen(SPACE) + strlen(fstypeProp->mValue) + 1; - cmd = realloc(cmd, (size_t)(cmdLen * sizeof (char))); - if (cmd == NULL) { - *errp = errno; - return (NULL); - } - (void) snprintf(cmd, cmdLen, "%s%s%s%s%s", cmd, SPACE, - FSTYPE_FLAG, SPACE, fstypeProp->mValue); - } - - currentParam = currentParam->mNext; - onlyLocalProp = currentParam->mDataObject; - - if (onlyLocalProp != NULL && onlyLocalProp->mValue != NULL) { - if (strcmp(onlyLocalProp->mValue, "1") == 0 || - strcasecmp(onlyLocalProp->mValue, "true") == 0) { - - cim_logDebug("cmdgen_mountall", "Adding the -l flag"); - /* - * Add the -l flag to the command. - */ - cmdLen = strlen(cmd) + strlen(SPACE) + - strlen(LOCAL_FLAG) + 1; - - cmd = realloc(cmd, (size_t)(cmdLen * sizeof (char))); - if (cmd == NULL) { - *errp = errno; - return (NULL); - } - (void) snprintf(cmd, cmdLen, "%s%s%s", cmd, - SPACE, LOCAL_FLAG); - } - } - - currentParam = currentParam->mNext; - onlyRemoteProp = currentParam->mDataObject; - - cim_logDebug("cmdgen_mountall", "Checking onlyRemoteProp"); - if (onlyRemoteProp != NULL && onlyRemoteProp->mValue != NULL) { - if (strcmp(onlyRemoteProp->mValue, "1") == 0 || - strcasecmp(onlyRemoteProp->mValue, "true") == 0) { - - cim_logDebug("cmdgen_mountall", "Adding the -r flag"); - - /* - * Add the -r flag to the command. - */ - cmdLen = strlen(cmd) + strlen(SPACE) + - strlen(REMOTE_FLAG) + 1; - cmd = realloc(cmd, (size_t)(cmdLen * sizeof (char))); - if (cmd == NULL) { - *errp = errno; - return (NULL); - } - (void) snprintf(cmd, cmdLen, "%s%s%s", cmd, SPACE, - REMOTE_FLAG); - } - } - - currentParam = currentParam->mNext; - fileProp = currentParam->mDataObject; - - if (fileProp != NULL && fileProp->mValue != NULL && - strlen(fileProp->mValue) != 0) { - - cim_logDebug("cmdgen_mountall", "Adding the fstable"); - /* - * Add the file to the command. - */ - cmdLen = strlen(cmd) + strlen(SPACE) + - strlen(fileProp->mValue) + 1; - cmd = realloc(cmd, (size_t)(cmdLen * sizeof (char))); - if (cmd == NULL) { - *errp = errno; - return (NULL); - } - (void) snprintf(cmd, cmdLen, "%s%s%s", cmd, SPACE, - fileProp->mValue); - } - - /* - * The caller must free the memory allocated to the return value - * using free(). - */ - cim_logDebug("cmdgen_mountall", "The return command is: %s", cmd); - return (cmd); -} /* cmdgen_mountall */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/mount/nfs/Makefile b/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/mount/nfs/Makefile deleted file mode 100644 index b89641bd62..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/mount/nfs/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -OBJECTS = cmdgen_mount_nfs.o - -LINT_OBJS = $(OBJECTS:%.o=%.ln) - -GENERAL = $(ROOTWBEMINC) \ - $(SRC)/cmd/wbem/provider/c/include \ - $(SRC)/cmd/wbem/provider/c/wbem_disk/common \ - $(SRC)/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc \ - $(SRC)/cmd/wbem/provider/c/filesystems/wbem_nfs/include \ - $(SRC)/cmd/wbem/provider/c/filesystems/common/cmdgeneration - - -CPPFLAGS += -I. $(GENERAL:%=-I%) -D_REENTRANT -DPIC -D_TS_ERRNO - -CFLAGS += $(XREGSFLAG) $(C_BIGPICFLAGS) - -LINTFLAGS += -um -LINTLIBS = $(LDLIBS.cmd) - -POFILES = $(OBJECTS:%.o=%.po) - -.KEEP_STATE: - -all: $(OBJECTS) -catalog: $(POFILES) -check: - $(CSTYLE) -p -P $(OBJECTS:%.o=%.c) *.h - $(HDRCHK) *.h -clean: - $(RM) $(OBJECTS) $(LINT_OBJS) *.po -install: all -lint: $(LINT_OBJS) - $(LINT.c) $(LINTFLAGS) $(LINT_OBJS) $(LINTLIBS) - -include $(SRC)/cmd/Makefile.targ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/mount/nfs/cmdgen_mount_nfs.c b/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/mount/nfs/cmdgen_mount_nfs.c deleted file mode 100644 index 1b739c8843..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/mount/nfs/cmdgen_mount_nfs.c +++ /dev/null @@ -1,488 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "cmdgen_include.h" -#include "nfs_keys.h" -#include "util.h" -#include "messageStrings.h" -#include "Solaris_NFSMount.h" -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <errno.h> -#include <sys/types.h> - -/* - * Private variables - */ -#define NFS_MNT_CMD "mount -F nfs\0" -#define SPACE " " -#define SPEC_OPT_FLAG "-o" - -/* - * Private method declarations - */ -char *add_property_to_optstring(char *opt_string, CCIMProperty *prop, - int element, int *errp); -char *add_to_mntopts(char *mntopt_string, char *attribute, char *value, - int *errp); -char *create_command(char *resource, char *mntpnt, boolean_t mflag, - boolean_t Oflag, boolean_t spec_option_flag, - char *mntopt, int *errp); -char *create_option_string(CCIMInstance *inst, int *errp); - -/* - * Public methods - */ -/* - * Method: cmdgen_mount_nfs - * - * Description: Creates the nfs mount command with the options from the - * CCIMInstance passed in. - * - * Parameters: - * - CCIMInstance *inst - The instance containing the properties of the - * mount. - * - CCIMObjectPath *objPath - The object path containing properties of - * the mount. - * - int *errp - The error indicator. Upon error, a value != 0 will be - * set. - * - * Returns: - * - char * - The nfs mount command generated. - * - NULL if an error occurred. - */ -/* ARGSUSED */ -char * -cmdgen_mount_nfs(CCIMInstance *inst, CCIMObjectPath *objPath, int *errp) { - boolean_t mflag; /* NoMnttabEntry flag */ - boolean_t Oflag; /* Overlay flag */ - boolean_t spec_option_flag; /* "-o" */ - char *cmd; - char *resource; - char *mntpnt; - char *mntopt; - CCIMProperty *mnt_prop; - - *errp = 0; - if (inst == NULL) { - *errp = EINVAL; - return (NULL); - } - - /* - * First, get the resource and mount point from the Dependent - * and Antecedent properties, respectively. - */ - mnt_prop = cim_getProperty(inst, nfsMountProps[ANT].name); - if (mnt_prop == NULL) { - *errp = EINVAL; - return (NULL); - } else { - CCIMPropertyList *ant_proplist; - char *tmp; - - ant_proplist = mnt_prop->mObjPathValue->mKeyProperties; - - tmp = util_getKeyValue(ant_proplist, string, - NAME, errp); - if (tmp == NULL || *errp != 0) { - return (NULL); - } - - mntpnt = strdup(tmp); - if (mntpnt == NULL) { - *errp = ENOMEM; - return (NULL); - } - cim_freeProperty(mnt_prop); - } - - mnt_prop = cim_getProperty(inst, nfsMountProps[DEP].name); - if (mnt_prop == NULL) { - *errp = EINVAL; - return (NULL); - } else { - CCIMPropertyList *dep_proplist; - char *tmp; - - dep_proplist = mnt_prop->mObjPathValue->mKeyProperties; - /* - * We expect the resource to be in the - * form of "resource\=<resource>" or - * just "<resource>". Determine which - * format we have. - */ - tmp = util_getKeyValue(dep_proplist, string, NAME, errp); - if (tmp == NULL || *errp != 0) { - return (NULL); - } - - resource = strdup(tmp); - if (resource == NULL) { - *errp = ENOMEM; - free(mntpnt); - return (NULL); - } - - cim_freeProperty(mnt_prop); - } - - /* - * Next get the mount attributes which are set with flags. - * For NFS those are: - * -r (read only) ** We don't check for this one since it - * can be added w/ the "ro" option. - * -m:(no mnttab entry) - * -O:(overlay) - */ - mflag = B_FALSE; - mnt_prop = cim_getProperty(inst, nfsMountProps[NOMNTTABENT].name); - if (mnt_prop != NULL && mnt_prop->mValue != NULL) { - if ((strcmp(mnt_prop->mValue, "1") == 0)) - mflag = B_TRUE; - - cim_freeProperty(mnt_prop); - } - - Oflag = B_FALSE; - mnt_prop = cim_getProperty(inst, nfsMountProps[OVERLAY].name); - if (mnt_prop != NULL && mnt_prop->mValue != NULL) { - /* - * Determine the value of the property. - */ - cim_logDebug("cmdgen_mount_nfs", "nfsMountProps[OVERLAY] = %s", - mnt_prop->mValue); - if ((strcmp(mnt_prop->mValue, "1") == 0)) - Oflag = B_TRUE; - - cim_freeProperty(mnt_prop); - } - - /* - * Now check if the MountOptions property is populated. - * If yes, create the mount with the options defined in that - * string. No other property values will need to be checked. - */ - - mnt_prop = cim_getProperty(inst, nfsMountProps[MNTOPTS].name); - if (mnt_prop != NULL && (strlen(mnt_prop->mValue) != 0)) { - cim_logDebug("cmdgen_mount_nfs", - "MountOptions =%s", mnt_prop->mValue); - spec_option_flag = B_TRUE; - cmd = create_command(resource, mntpnt, mflag, Oflag, - spec_option_flag, mnt_prop->mValue, errp); - free(resource); - free(mntpnt); - if (cmd == NULL) { - return (NULL); - } - cim_freeProperty(mnt_prop); - - } else { - mntopt = create_option_string(inst, errp); - /* - * If mntopt is NULL we either don't have any options, - * or we ran into an error. - */ - if (mntopt == NULL) { - if (*errp != 0) { - free(resource); - free(mntpnt); - return (NULL); - } - spec_option_flag = B_FALSE; - } else { - spec_option_flag = B_TRUE; - } - cmd = create_command(resource, mntpnt, mflag, Oflag, - spec_option_flag, mntopt, errp); - free(resource); - free(mntpnt); - free(mntopt); - if (cmd == NULL) { - return (NULL); - } - } - - return (cmd); -} /* cmdgen_mount_nfs */ - -/* - * Private methods - */ - -char * -add_property_to_optstring(char *opt_string, CCIMProperty *prop, int element, - int *errp) { - - char *ret_val = NULL; - - *errp = 0; - if (prop->mType == boolean) { - if (strcmp(prop->mValue, "1") == 0) { - if (nfsMountProps[element].true_opt_value != NULL) { - ret_val = add_to_mntopts(opt_string, - nfsMountProps[element].true_opt_value, - NULL, errp); - if (ret_val == NULL && *errp != 0) { - return (NULL); - } - } - } else { - if (nfsMountProps[element].false_opt_value != NULL) { - ret_val = add_to_mntopts(opt_string, - nfsMountProps[element].false_opt_value, - NULL, errp); - if (ret_val == NULL && *errp != 0) { - return (NULL); - } - } - } - } else { - if ((nfsMountProps[element].string_opt_value != NULL) && - (strlen(prop->mValue) != 0)) { - ret_val = add_to_mntopts(opt_string, - nfsMountProps[element].string_opt_value, - prop->mValue, errp); - if (ret_val == NULL && *errp != 0) { - return (NULL); - } - } - } - - return (ret_val); -} /* add_property_to_optstring */ - -/* - * Method: add_to_mntopts - * - * Description: Adds the passed in mount option to the option list. - * - * Parameters: - * - char *mntopt_string - The option string to add the mount option to. - * A NULL value may be passed in if the option is the first one in the - * mount option string. - * - char *attribute - The mount option being added to the option string. - * - char *value - The value of the mount option. This only applies to - * mount options having an '=' character. Example: acdirmax= - * A NULL value will be passed in if the option does not require a value. - * - int *errp - The error indicator. If an error occurred the value will - * be != 0 upon return. - * - * Returns: The mount option string, as passed in with mntopt_string, - * concatenated with the passed in attribute, and value, if one exists. - * - * NOTE: The caller will have to free the space allocated for the returned - * string. - */ -char * -add_to_mntopts(char *mntopt_string, char *attribute, char *value, int *errp) { - int len; - char *ret_val; - char *tmp = NULL; - - /* - * Check if value is not NULL. If it isn't we need to - * concatenate attribute with value. - */ - if (value != NULL) { - tmp = (char *)calloc((size_t)(strlen(attribute) + - strlen(value) + 1), (size_t)sizeof (char)); - if (tmp == NULL) { - *errp = ENOMEM; - return (NULL); - } - (void) snprintf(tmp, (size_t)(strlen(attribute) + - strlen(value) + 1), "%s%s", attribute, value); - } else { - tmp = strdup(attribute); - if (tmp == NULL) { - *errp = ENOMEM; - return (NULL); - } - } - - /* - * If mntopt_string is NULL, this is the very first attribute in the - * mount option list. - */ - if (mntopt_string == NULL) { - ret_val = strdup(tmp); - if (ret_val == NULL) { - free(tmp); - *errp = ENOMEM; - return (NULL); - } - - } else { - len = (strlen(mntopt_string) + strlen(tmp) + 2); - ret_val = (char *)calloc((size_t)len, (size_t)sizeof (char)); - if (ret_val == NULL) - { - free(tmp); - *errp = ENOMEM; - return (NULL); - } - (void) snprintf(ret_val, (size_t)len, "%s%s%s", - mntopt_string, ",", tmp); - } - free(tmp); - *errp = 0; - return (ret_val); -} /* add_to_mntopts */ - -/* - * Method: create_command - * - * Description: Creates the nfs mount command out of the properties passed in. - * - * Parameters: - * - char *resource - The resource to be mounted. - * - char *mntpnt - The mount point. - * - boolean_t mflag - Whether or not to add the '-m' flag. - * - boolean_t Oflag - Whether or not to add the '-O' flag. - * - boolean_t spec_option_flag - Whether or not to add the '-o' flag. - * - char *mntopts - The mount option string. - * - int *errp - The error indicator. Upon error, this will be set to a - * value != 0. - * - * Returns: - * - char * - The command generated. - * - NULL if an error occurred. - */ -char * -create_command(char *resource, char *mntpnt, boolean_t mflag, boolean_t Oflag, - boolean_t spec_option_flag, char *mntopts, int *errp) { - - char *cmd = NULL; - int cmdMaxLen; - - *errp = 0; - cmdMaxLen = strlen(NFS_MNT_CMD) + strlen(resource) + strlen(mntpnt) + - MAXSIZE; - - if (mntopts != NULL) { - cmdMaxLen = cmdMaxLen + strlen(mntopts); - } - - /* - * Allocate a space we know will be big enough for the command. - */ - cmd = calloc((size_t)cmdMaxLen, (size_t)sizeof (char)); - if (cmd == NULL) { - *errp = errno; - return (NULL); - } - - (void) snprintf(cmd, cmdMaxLen, "%s", NFS_MNT_CMD); - - if (mflag == B_TRUE) - (void) snprintf(cmd, cmdMaxLen, "%s%s%s", cmd, SPACE, - NFS_NOMNTTABENT_TRUE); - - if (Oflag == B_TRUE) - (void) snprintf(cmd, cmdMaxLen, "%s%s%s", cmd, SPACE, - NFS_OVERLAY); - - if (spec_option_flag == B_TRUE) - (void) snprintf(cmd, cmdMaxLen, "%s%s%s%s%s", cmd, SPACE, - SPEC_OPT_FLAG, SPACE, mntopts); - - (void) snprintf(cmd, cmdMaxLen, "%s%s%s%s%s", cmd, SPACE, - resource, SPACE, mntpnt); - - return (cmd); -} /* create_command */ - -/* - * Method: create_option_string - * - * Description: Creates the mount command understandable option string from the - * passed in Solaris_NFSMount instance. - * - * Parameters: - * - CCIMInstance *inst - The Solaris_NFSMount instance containing all of - * the properties of the mount to be created. - * - int *errp - The error indicator. Upon error, this will be set to a - * value != 0. - * - * Returns: - * - char * - The mount option string. - * - NULL if an error occurred. - */ -char * -create_option_string(CCIMInstance *inst, int *errp) { - CCIMProperty *mnt_prop; - char *mntopt_string = NULL; - char *tmp; - int currentElement; - - *errp = 0; - for (currentElement = 0; currentElement < PROPCOUNT; currentElement++) { - mnt_prop = cim_getProperty(inst, - nfsMountProps[currentElement].name); - if (mnt_prop == NULL) { - *errp = EINVAL; - free(mntopt_string); - return (NULL); - } - - /* - * Handle special "vers=highest" case. - */ - if ((strcmp(mnt_prop->mName, "Version") == 0) && - (strcasecmp(mnt_prop->mValue, "highest") == 0)) { - cim_freeProperty(mnt_prop); - continue; - } - - tmp = add_property_to_optstring(mntopt_string, mnt_prop, - currentElement, errp); - if (tmp == NULL) { - if (*errp != 0) { - free(mntopt_string); - return (NULL); - } - } else { - - free(mntopt_string); - mntopt_string = strdup(tmp); - if (mntopt_string == NULL) { - *errp = errno; - free(tmp); - return (NULL); - } - - free(tmp); - } - cim_freeProperty(mnt_prop); - } - - return (mntopt_string); -} /* create_option_string */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/Makefile b/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/Makefile deleted file mode 100644 index ef3a745175..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/Makefile +++ /dev/null @@ -1,94 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -sparc_SUBDIRS = - -i386_SUBDIRS = - -ppc_SUBDIRS = - -COMMON_SUBDIRS = nfs - -SUBDIRS = $(COMMON_SUBDIRS) $($(ARCH)_SUBDIRS) - -OBJECTS = cmdgen_share.o cmdgen_shareall.o - -LINT_OBJS = $(OBJECTS:%.o=%.ln) - -WBEM_PROV = cmd/wbem/provider/c - -GENERAL = $(ROOTWBEMINC) \ - $(SRC)/$(WBEM_PROV)/filesystems/wbem_nfs/nfs_share \ - $(SRC)/$(WBEM_PROV)/filesystems/wbem_nfs/include \ - $(SRC)/$(WBEM_PROV)/filesystems/common/cmdgeneration - - -CPPFLAGS += -I. $(GENERAL:%=-I%) -D_REENTRANT -DPIC -D_TS_ERRNO - -CFLAGS += $(XREGSFLAG) $(C_BIGPICFLAGS) - -LINTFLAGS += -um -LINTLIBS = $(LDLIBS.cmd) - -POFILES = $(OBJECTS:%.o=%.po) - -all:= TARGET = all -clean:= TARGET = clean -clobber:= TARGET = clobber -install:= TARGET = install -lint:= TARGET = lint -check:= TARGET = check - -.KEEP_STATE: - -all: $(OBJECTS) ${SUBDIRS} - -catalog: $(POFILES) ${SUBDIRS} - -check: ${SUBDIRS} - $(CSTYLE) -p -P $(OBJECTS:%.o=%.c) *.h - $(HDRCHK) *.h - -clean: ${SUBDIRS} - $(RM) $(OBJECTS) $(LINT_OBJS) *.po - -install: all - -lint: $(LINT_OBJS) ${SUBDIRS} - $(LINT.c) $(LINTFLAGS) $(LINT_OBJS) $(LINTLIBS) - -FRC: - -${SUBDIRS}: FRC - cd $@; pwd; $(MAKE) $(TARGET) - -.WAIT: - -include $(SRC)/cmd/Makefile.targ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/cmdgen_share.c b/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/cmdgen_share.c deleted file mode 100644 index 77218f8d6b..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/cmdgen_share.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "cmdgen_include.h" - -/* - * Private data type declaration - */ - -/* - * Public methods - */ -char * -cmdgen_share(int fstype, CCIMInstance *inst, CCIMObjectPath *objPath, - int *errp) { - char *cmd = NULL; - - switch (fstype) { - case CMDGEN_NFS: - cmd = cmdgen_share_nfs(inst, objPath, errp); - break; - } - return (cmd); -} /* cmdgen_share */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/cmdgen_shareall.c b/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/cmdgen_shareall.c deleted file mode 100644 index 3619eb4db0..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/cmdgen_shareall.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "cmdgen_include.h" - -#define NFS_SHAREALL_CMD "/usr/sbin/shareall" -#define FSTYPE_FLAG "-F" -#define SPACE " " - -/* - * Public methods - */ -char * -cmdgen_shareall(CCIMPropertyList *paramList, int *errp) { - - CCIMPropertyList *tmpParamList; - CCIMProperty *fstype; - CCIMProperty *filename; - char *cmd = NULL; - int cmdLen; - - /* - * In parameters are as follows: - * 1. String fstype, - * 2. String filename - * - * They are expected to always be in this order in the property list. - */ - if (paramList == NULL) { - *errp = EINVAL; - } else { - /* - * Check if a file system type and/or a filename was - * passed in. These we will be used in forming the - * command. - */ - tmpParamList = paramList; - fstype = tmpParamList->mDataObject; - tmpParamList = tmpParamList->mNext; - filename = tmpParamList->mDataObject; - if (fstype != NULL && fstype->mValue != NULL && - strlen(fstype->mValue) != 0) { - cmdLen = strlen(NFS_SHAREALL_CMD) + - strlen(fstype->mValue) + 5; - /* - * Added two bytes for spaces, two bytes - * for the "-F" filesystem type flag, and - * a byte for the string terminator. - */ - cmd = malloc((size_t)(cmdLen * sizeof (char))); - if (cmd == NULL) { - *errp = errno; - return (NULL); - } - (void) snprintf(cmd, cmdLen, "%s %s %s", - NFS_SHAREALL_CMD, FSTYPE_FLAG, - fstype->mValue); - } - - if (filename != NULL && filename->mValue != NULL && - strlen(filename->mValue) != 0) { - cmdLen = strlen(NFS_SHAREALL_CMD) + - strlen(filename->mValue) + 2; - /* - * Added one byte for a space and one for - * the string terminator. - */ - cmd = malloc((size_t)(cmdLen * sizeof (char))); - if (cmd == NULL) { - *errp = errno; - return (NULL); - } - (void) snprintf(cmd, cmdLen, "%s %s", - cmd, filename->mValue); - } else { - cmd = strdup(NFS_SHAREALL_CMD); - if (cmd == NULL) { - *errp = errno; - } - } - } - return (cmd); -} /* cmdgen_shareall */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/nfs/Makefile b/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/nfs/Makefile deleted file mode 100644 index 03d32e7f3b..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/nfs/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -OBJECTS = cmdgen_share_nfs.o - -LINT_OBJS = $(OBJECTS:%.o=%.ln) - -WBEM_PROV = cmd/wbem/provider/c - -GENERAL = $(ROOTWBEMINC) \ - $(SRC)/$(WBEM_PROV)/filesystems/wbem_nfs/include \ - $(SRC)/$(WBEM_PROV)/filesystems/wbem_nfs/nfs_share \ - $(SRC)/$(WBEM_PROV)/filesystems/common/cmdgeneration - - -CPPFLAGS += -I. $(GENERAL:%=-I%) -D_REENTRANT -DPIC -D_TS_ERRNO - -CFLAGS += $(XREGSFLAG) $(C_BIGPICFLAGS) - -LINTFLAGS += -um -LINTLIBS = $(LDLIBS.cmd) - -POFILES = $(OBJECTS:%.o=%.po) - -.KEEP_STATE: - -all: $(OBJECTS) -catalog: $(POFILES) -check: - $(CSTYLE) -p -P $(OBJECTS:%.o=%.c) *.h - $(HDRCHK) *.h -clean: - $(RM) $(OBJECTS) $(LINT_OBJS) *.po -install: all -lint: $(LINT_OBJS) - $(LINT.c) $(LINTFLAGS) $(LINT_OBJS) $(LINTLIBS) - -include $(SRC)/cmd/Makefile.targ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/nfs/cmdgen_share_nfs.c b/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/nfs/cmdgen_share_nfs.c deleted file mode 100644 index 752a73afd6..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/nfs/cmdgen_share_nfs.c +++ /dev/null @@ -1,356 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <errno.h> -#include "cmdgen_include.h" -#include "nfs_share_attr.h" -#include "nfs_sharesecurity_attr.h" -#include "Solaris_NFSShare.h" - - -/* - * Private data type declaration - */ -#define NFS_SHARE_CMD "share -F nfs" -#define SPEC_OPT_FLAG "-o" - -/* - * Private method declarations - */ -static char *create_shareopt_string(CCIMInstance *, int *); -static char *add_option_string(char *, char *, int *); -static char *create_sharesec_optstring(CCIMInstance *, int *); - -/* - * Public methods - */ -/* - * generates the share command string - * memory returned must be freed by the caller. - */ -/* ARGSUSED */ -char * -cmdgen_share_nfs(CCIMInstance *inst, CCIMObjectPath *objPath, int *error) -{ - - CCIMProperty *share_Prop; - char *share_desc; - char *cmd; - char *shareopts; - char *sharesecopts; - size_t len; - - cim_logDebug("cmdgen_share_nfs", "Just entering..."); - if (inst != NULL) { - /* - * Create the share command using the properties - * passed in from inst. - */ - - /* - * Get the share description attribute if the "-d" - * flag is set. - */ - - share_Prop = cim_getProperty(inst, - nfsShareProps[DESCRIPTION].name); - if (share_Prop != NULL && strcmp(share_Prop->mValue, "") != 0) { - len = strlen(share_Prop->mValue) + 4; - share_desc = (char *)calloc(len, sizeof (char)); - (void) snprintf(share_desc, len, "-d %s", - share_Prop->mValue); - } else { - share_desc = strdup(""); - } - - share_Prop = - cim_getProperty(inst, nfsShareProps[SHAREDNAME].name); - if (share_Prop == NULL) { - free(share_desc); - *error = EINVAL; - return ((char *)NULL); - } - shareopts = create_shareopt_string(inst, error); - sharesecopts = create_sharesec_optstring(inst, error); - - shareopts = add_option_string(shareopts, sharesecopts, error); - free(sharesecopts); - - if (shareopts == NULL) { - len = strlen(NFS_SHARE_CMD) + - strlen(SPEC_OPT_FLAG) + strlen(share_desc) + - strlen(share_Prop->mValue) + 3; - cmd = (char *)calloc(len, sizeof (char)); - (void) snprintf(cmd, len, "%s %s %s", NFS_SHARE_CMD, - share_desc, share_Prop->mValue); - } else { - len = strlen(NFS_SHARE_CMD) + strlen(SPEC_OPT_FLAG) + - strlen(shareopts) + strlen(share_desc) + - strlen(share_Prop->mValue) + 5; - cmd = (char *)calloc(len, sizeof (char)); - (void) snprintf(cmd, len, "%s %s %s %s %s", - NFS_SHARE_CMD, SPEC_OPT_FLAG, shareopts, share_desc, - share_Prop->mValue); - } - cim_freeProperty(share_Prop); - free(share_desc); - if (shareopts != NULL) { - free(shareopts); - } - cim_logDebug("cmdgen_share_nfs", "Returning command: %s", - cmd); - return (cmd); - } else { - cmd = NULL; - return ((char *)cmd); - } - /* - * Not reached - */ -} - -/* - * Private methods - */ - -/* - * creates and returns the options string by gathering the vaious share - * options from the instance attributes. - */ -static char * -create_shareopt_string(CCIMInstance *inst, int *error) -{ - CCIMProperty *share_Prop; - char *shareopts = NULL; - - shareopts = NULL; - - cim_logDebug("create_shareopt_string", "Just entering..."); - /* - * Check AllowAccessControll - */ - share_Prop = - cim_getProperty(inst, nfsShareProps[ALLOWACCESSCONTROL].name); - if (share_Prop != NULL) { - if (strcmp(share_Prop->mValue, "0") != 0 && - strcmp(share_Prop->mValue, "") != 0) { - /* - * add the "aclok" attribute to the shareopt string. - */ - shareopts = add_option_string(shareopts, - ALLOWACCESSCONTROL_TRUE, error); - if (shareopts == NULL) - return (NULL); - } - cim_freeProperty(share_Prop); - } - /* - * Check EffectiveUID - */ - share_Prop = cim_getProperty(inst, nfsShareProps[EFFECTIVEUID].name); - if (share_Prop != NULL) { - if (strcmp(share_Prop->mValue, "0") != 0 && - strcmp(share_Prop->mValue, "") != 0) { - char *tmp; - size_t len; - - len = strlen(share_Prop->mValue) + 7; - tmp = (char *)calloc(len, sizeof (char)); - (void) snprintf(tmp, len, "%s%s", EFFECTIVEUID_SET, - share_Prop->mValue); - /* - * add "anon=" attribute and value to shareopt sting. - */ - shareopts = add_option_string(shareopts, tmp, error); - free(tmp); - if (shareopts == NULL) - return (NULL); - } - cim_freeProperty(share_Prop); - } - - /* - * Check IgnoreSetID - */ - share_Prop = cim_getProperty(inst, nfsShareProps[IGNORESETID].name); - if (share_Prop != NULL) { - if (strcmp(share_Prop->mValue, "0") != 0 && - strcmp(share_Prop->mValue, "") != 0) { - /* - * add "nosuid" attribute to shareopt sting. - */ - shareopts = add_option_string(shareopts, - IGNORESETID_TRUE, error); - if (shareopts == NULL) - return (NULL); - } - cim_freeProperty(share_Prop); - } - - /* - * Check LogFileTag - */ - share_Prop = cim_getProperty(inst, nfsShareProps[LOGFILETAG].name); - if (share_Prop != NULL) { - if (strcmp(share_Prop->mValue, "") != 0) { - char *tmp; - size_t len; - - len = strlen(share_Prop->mValue) + 5; - tmp = (char *)calloc(len, sizeof (char)); - (void) snprintf(tmp, len, "%s%s", LOGFILETAG_SET, - share_Prop->mValue); - /* - * add "log=" attribute and value to shareopt sting. - */ - shareopts = add_option_string(shareopts, tmp, error); - free(tmp); - if (shareopts == NULL) - return (NULL); - } - cim_freeProperty(share_Prop); - } - - /* - * Check PreventSubdirMount - */ - share_Prop = - cim_getProperty(inst, nfsShareProps[PREVENTSUBDIRMOUNT].name); - if (share_Prop != NULL) { - if (strcmp(share_Prop->mValue, "0") != 0 && - strcmp(share_Prop->mValue, "") != 0) { - /* - * add "nosub" attribute to shareopt sting. - */ - shareopts = add_option_string(shareopts, - PREVENTSUBDIRMOUNT_TRUE, error); - if (shareopts == NULL) - return (NULL); - } - cim_freeProperty(share_Prop); - } - - /* - * Check Public - */ - share_Prop = cim_getProperty(inst, nfsShareProps[PUBLIC].name); - if (share_Prop != NULL) { - if (strcmp(share_Prop->mValue, "0") != 0 && - strcmp(share_Prop->mValue, "") != 0) { - /* - * add "public" attribute to shareopt sting. - */ - shareopts = add_option_string(shareopts, PUBLIC_TRUE, - error); - if (shareopts == NULL) - return (NULL); - } - cim_freeProperty(share_Prop); - } - - if (shareopts != NULL) { - cim_logDebug("create_shareopt_string", - "The share opts string is: %s", shareopts); - } else { - cim_logDebug("create_shareopt_string", - "The share opts string is NULL"); - } - return (shareopts); -} - -/* - * Adds the option to the existing option string. The existing option - * string may be reallocated. In either case, the new pointer to - * the complete string is returned. - */ -static char * -add_option_string(char *str, char *opt, int *error) -{ - char *ret_val; - size_t len; - - if (opt == NULL) - ret_val = str; - else if (str == NULL) { - ret_val = strdup(opt); - if (ret_val == NULL) - *error = ENOMEM; - } else { - len = strlen(str) + strlen(opt) + 2; - ret_val = realloc(str, len); - if (ret_val == NULL) { - free(str); - *error = ENOMEM; - } else - (void) snprintf(ret_val, len, "%s,%s", str, opt); - } - - return (ret_val); -} - -/* - * creates and returns the security options string - */ -static char * -create_sharesec_optstring(CCIMInstance *inst, int *err) -{ - CCIMProperty *shareProp; - char **securityStrings; - char *optstring; - int number_of_strings; - optstring = NULL; - - shareProp = cim_getProperty(inst, SECOPTS); - if (shareProp == NULL || strcmp(shareProp->mValue, "") == 0) { - /* - * No security options specified. - */ - return (NULL); - } - securityStrings = - cim_decodeStringArray(shareProp->mValue, &number_of_strings); - if (securityStrings != NULL) { - int i; - - for (i = 0; i < number_of_strings; i++) { - optstring = add_option_string(optstring, - securityStrings[i], err); - if (optstring == NULL) - return (NULL); - } - cim_freeStringArray(securityStrings); - } - if (optstring != NULL) { - cim_logDebug("create_sharesec_optstring", - "The share security opts string is: %s", optstring); - } else { - cim_logDebug("create_sharesec_optstring", - "The share security opts string is NULL"); - } - return (optstring); -} diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/nfs/nfs_share_attr.h b/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/nfs/nfs_share_attr.h deleted file mode 100644 index d27fbdaa89..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/nfs/nfs_share_attr.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _NFS_SHARE_ATTR_H -#define _NFS_SHARE_ATTR_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * NFS Share attributes - */ -#define ALLOWACCESSCONTROL_TRUE "aclok" -#define EFFECTIVEUID_SET "anon=" -#define IGNORESETID_TRUE "nosuid" -#define LOGFILETAG_SET "log=" -#define PREVENTSUBDIRMOUNT_TRUE "nosub" -#define PUBLIC_TRUE "public" -#define DESCRIPTION_FLAG "-d" -#define SECOPTS "SecurityOptions" /* string array with all security options */ - -#ifdef __cplusplus -} -#endif - -#endif /* _NFS_SHARE_ATTR_H */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/nfs/nfs_sharesecurity_attr.h b/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/nfs/nfs_sharesecurity_attr.h deleted file mode 100644 index 908068f2ff..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/nfs/nfs_sharesecurity_attr.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _NFS_SHARESECURITY_ATTR_H -#define _NFS_SHARESECURITY_ATTR_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * NFS Share Security attributes - */ - -#define MAXLIFE "MaxLife" -#define READONLY "ReadOnly" -#define READWRITELIST "ReadWriteList" -#define READONLYLIST "ReadOnlyList" -#define ROOTSERVERS "RootServers" -#define PATH "SettingID" /* This is the Setting ID */ -#define SEC_MODE "Mode" - -#ifdef __cplusplus -} -#endif - -#endif /* _NFS_SHARESECURITY_ATTR_H */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/umount/Makefile b/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/umount/Makefile deleted file mode 100644 index f456701c00..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/umount/Makefile +++ /dev/null @@ -1,64 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -OBJECTS = cmdgen_umount.o \ - cmdgen_umountall.o - -LINT_OBJS = $(OBJECTS:%.o=%.ln) - -GENERAL = $(ROOTWBEMINC) \ - $(SRC)/cmd/wbem/provider/c/include \ - $(SRC)/cmd/wbem/provider/c/wbem_disk/common \ - $(SRC)/cmd/wbem/provider/c/filesystems/wbem_nfs/include \ - $(SRC)/cmd/wbem/provider/c/filesystems/common/cmdgeneration - -CPPFLAGS += -I. $(GENERAL:%=-I%) -D_REENTRANT -DPIC -D_TS_ERRNO - -CFLAGS += $(XREGSFLAG) $(C_BIGPICFLAGS) - -LINTFLAGS += -um -LINTLIBS = $(LDLIBS.cmd) - -POFILES = $(OBJECTS:%.o=%.po) - -.KEEP_STATE: - -all: $(OBJECTS) -catalog: $(POFILES) -check: - $(CSTYLE) -p -P $(OBJECTS:%.o=%.c) *.h - $(HDRCHK) *.h -clean: - $(RM) $(OBJECTS) $(LINT_OBJS) *.po -install: all -lint: $(LINT_OBJS) - $(LINT.c) $(LINTFLAGS) $(LINT_OBJS) $(LINTLIBS) - -include $(SRC)/cmd/Makefile.targ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/umount/cmdgen_umount.c b/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/umount/cmdgen_umount.c deleted file mode 100644 index ba61eab5b8..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/umount/cmdgen_umount.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "cmdgen_include.h" -#include "nfs_keys.h" -#include "util.h" -#include <errno.h> - -/* - * Private variables and constants. - */ -#define UMOUNT_CMD "umount" -#define SPACE " " - -/* - * Private method declaration - */ - -/* - * Public methods - */ -/* - * Method: cmdgen_umount - * - * Description: Forms the umount command with the given options. - * - * Parameters: - * - CCIMInstance *inst - Not used. - * - CCIMObjectPath *objPath - The object path containing the options to - * be used when forming the command. - * - int *errp - The error indicator. Upon error, this will be set to a - * value != 0. - * - * Returns: - * - char * - The formed umount command. - * - NULL if an error occurred. - */ -/* ARGSUSED */ -char * -cmdgen_umount(CCIMInstance *inst, CCIMObjectPath *objPath, int *errp) { - int err; - char *mount_point; - char *cmd; - CCIMObjectPath *depOP; - - if (objPath == NULL) { - *errp = EINVAL; - return (NULL); - } - - /* - * Create the umount command with properties from the Solaris_NFSMount - * CCIMObjectPath passed in. - */ - /* - * We need to get the mount point from the Antecedent Key of the - * Solaris_NFSMount CCIMObjectPath. - */ - depOP = util_getKeyValue(objPath->mKeyProperties, reference, ANTECEDENT, - &err); - - mount_point = util_getKeyValue(depOP->mKeyProperties, string, NAME, - &err); - - cmd = (char *)calloc((size_t)(strlen(mount_point) + strlen(UMOUNT_CMD) - + 2), (size_t)sizeof (char)); - if (cmd == NULL) { - *errp = ENOMEM; - return (NULL); - } - - (void) snprintf(cmd, (size_t)(strlen(mount_point) + strlen(UMOUNT_CMD) - + 2), "%s%s%s", UMOUNT_CMD, SPACE, mount_point); - - *errp = 0; - return (cmd); -} /* cmdgen_umount */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/umount/cmdgen_umountall.c b/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/umount/cmdgen_umountall.c deleted file mode 100644 index 2bd9a48334..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/umount/cmdgen_umountall.c +++ /dev/null @@ -1,240 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "cmdgen_include.h" - -/* - * Public data type declaration - */ -#define UMNTALL_CMD "/usr/sbin/umountall" -#define FSTYPE_FLAG "-F" -#define HOST_FLAG "-h" -#define KILL_FLAG "-k" -#define LOCAL_FLAG "-l" -#define NO_PARALLEL_FLAG "-s" -#define REMOTE_FLAG "-r" -#define SPACE " " - - -/* - * Public methods - */ -/* - * Method: cmdgen_umountall - * - * Description: Forms the umountall command with the options given. - * - * Parameters: - * - CCIMPropertyList *paramList - The parameter list containing the - * options for the umountall command. - * - int *errp - The error indicator. Upon error, this will get set to a - * value != 0. - * - * Returns: - * - char * - The formed umounall command. - * - NULL if an error occurred. - */ -char * -cmdgen_umountall(CCIMPropertyList *paramList, int *errp) { - CCIMPropertyList *currentParam; - CCIMProperty *fstypeProp = NULL; - CCIMProperty *hostProp = NULL; - CCIMProperty *onlyLocalProp = NULL; - CCIMProperty *onlyRemoteProp = NULL; - CCIMProperty *killProcessesProp = NULL; - CCIMProperty *inParallelProp = NULL; - char *cmd = NULL; - int cmdLen; - - cmd = strdup(UMNTALL_CMD); - if (cmd == NULL) { - *errp = errno; - return (NULL); - } - - /* - * In parameters in the paramList are as follows: - * 1. String fstype, - * 2. String host, - * 3. Boolean onlyLocalFileSystems, - * 4. Boolean onlyRemoteFileSystems, - * 5. Boolean killProcesses, - * 6. Boolean umountInParallel - * - * They are expected to always be in this order in the property list. - */ - /* - * Check if a file system type was passed in. If one was we will - * use this in forming the command. - */ - currentParam = paramList; - fstypeProp = currentParam->mDataObject; - if (fstypeProp != NULL && fstypeProp->mValue != NULL && - strlen(fstypeProp->mValue) != 0) { - - cim_logDebug("cmdgen_umountall", "Adding the -F flag"); - /* - * Add -F <fstype> to the command - */ - cmdLen = strlen(cmd) + strlen(SPACE) + strlen(FSTYPE_FLAG) + - strlen(SPACE) + strlen(fstypeProp->mValue) + 1; - cmd = realloc(cmd, (size_t)(cmdLen * sizeof (char))); - if (cmd == NULL) { - *errp = errno; - return (NULL); - } - (void) snprintf(cmd, cmdLen, "%s%s%s%s%s", cmd, SPACE, - FSTYPE_FLAG, SPACE, fstypeProp->mValue); - } - - /* - * Check if a host was passed in. - */ - currentParam = currentParam->mNext; - hostProp = currentParam->mDataObject; - if (hostProp != NULL && hostProp->mValue != NULL && - strlen(hostProp->mValue) != 0) { - - cim_logDebug("cmdgen_umountall", "Adding the -h flag"); - /* - * Add -h <host> to the command. - */ - cmdLen = strlen(cmd) + strlen(SPACE) + strlen(HOST_FLAG) + - strlen(SPACE) + strlen(hostProp->mValue) + 1; - cmd = realloc(cmd, (size_t)(cmdLen * sizeof (char))); - if (cmd == NULL) { - *errp = errno; - return (NULL); - } - (void) snprintf(cmd, cmdLen, "%s%s%s%s%s", cmd, SPACE, - HOST_FLAG, SPACE, hostProp->mValue); - } - - currentParam = currentParam->mNext; - onlyLocalProp = currentParam->mDataObject; - if (onlyLocalProp != NULL && onlyLocalProp->mValue != NULL) { - if (strcmp(onlyLocalProp->mValue, "1") == 0 || - strcasecmp(onlyLocalProp->mValue, "true") == 0) { - - cim_logDebug("cmdgen_umountall", - "Adding the -l flag"); - /* - * Add the -l flag to the command. - */ - cmdLen = strlen(cmd) + strlen(SPACE) + - strlen(LOCAL_FLAG) + 1; - - cmd = realloc(cmd, (size_t)(cmdLen * sizeof (char))); - if (cmd == NULL) { - *errp = errno; - return (NULL); - } - (void) snprintf(cmd, cmdLen, "%s%s%s", cmd, SPACE, - LOCAL_FLAG); - } - } - - currentParam = currentParam->mNext; - onlyRemoteProp = currentParam->mDataObject; - if (onlyRemoteProp != NULL && onlyRemoteProp->mValue != NULL) { - if (strcmp(onlyRemoteProp->mValue, "1") == 0 || - strcasecmp(onlyRemoteProp->mValue, "true") == 0) { - - /* - * Add the -r flag to the command. - */ - cim_logDebug("cmdgen_umountall", - "Adding the -r flag"); - - cmdLen = strlen(cmd) + strlen(SPACE) + - strlen(REMOTE_FLAG) + 1; - cmd = realloc(cmd, (size_t)(cmdLen * sizeof (char))); - if (cmd == NULL) { - *errp = errno; - return (NULL); - } - (void) snprintf(cmd, cmdLen, "%s%s%s", cmd, SPACE, - REMOTE_FLAG); - } - } - - currentParam = currentParam->mNext; - killProcessesProp = currentParam->mDataObject; - if (killProcessesProp != NULL && killProcessesProp->mValue != NULL) { - if (strcmp(killProcessesProp->mValue, "1") == 0 || - strcasecmp(killProcessesProp->mValue, "true") == 0) { - - /* - * Add the -k flag to the command. - */ - cim_logDebug("cmdgen_umountall", - "Adding the -k flag"); - cmdLen = strlen(cmd) + strlen(SPACE) + - strlen(KILL_FLAG) + 1; - cmd = realloc(cmd, (size_t)(cmdLen * sizeof (char))); - if (cmd == NULL) { - *errp = errno; - return (NULL); - } - (void) snprintf(cmd, cmdLen, "%s%s%s", cmd, SPACE, - KILL_FLAG); - } - } - - currentParam = currentParam->mNext; - inParallelProp = currentParam->mDataObject; - if (inParallelProp != NULL && inParallelProp->mValue != NULL) { - if (strcmp(inParallelProp->mValue, "0") == 0 || - strcasecmp(inParallelProp->mValue, "false") == 0) { - - /* - * Add the -s flag (do not perform umount operation in - * parallel) to the command. - */ - cim_logDebug("cmdgen_umountall", - "Adding the -s flag"); - cmdLen = strlen(cmd) + strlen(SPACE) + - strlen(NO_PARALLEL_FLAG) + 1; - cmd = realloc(cmd, (size_t)(cmdLen * sizeof (char))); - if (cmd == NULL) { - *errp = errno; - return (NULL); - } - (void) snprintf(cmd, cmdLen, "%s%s%s", cmd, SPACE, - NO_PARALLEL_FLAG); - } - } - - /* - * The caller must free the memory allocated to the return value - * using free(). - */ - cim_logDebug("cmdgen_umountall", "Returning command: %s", cmd); - *errp = 0; - return (cmd); -} /* cmdgen_umountall */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/unshare/Makefile b/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/unshare/Makefile deleted file mode 100644 index 7d25563111..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/unshare/Makefile +++ /dev/null @@ -1,94 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -sparc_SUBDIRS = - -i386_SUBDIRS = - -ppc_SUBDIRS = - -COMMON_SUBDIRS = nfs - -SUBDIRS = $(COMMON_SUBDIRS) $($(ARCH)_SUBDIRS) - -OBJECTS = cmdgen_unshare.o cmdgen_unshareall.o - -LINT_OBJS = $(OBJECTS:%.o=%.ln) - -WBEM_PROV = cmd/wbem/provider/c - -GENERAL = $(ROOTWBEMINC) \ - $(SRC)/$(WBEM_PROV)/filesystems/wbem_nfs/nfs_share \ - $(SRC)/$(WBEM_PROV)/filesystems/wbem_nfs/include \ - $(SRC)/$(WBEM_PROV)/filesystems/common/cmdgeneration - - -CPPFLAGS += -I. $(GENERAL:%=-I%) -D_REENTRANT -DPIC -D_TS_ERRNO - -CFLAGS += $(XREGSFLAG) $(C_BIGPICFLAGS) - -LINTFLAGS += -um -LINTLIBS = $(LDLIBS.cmd) - -POFILES = $(OBJECTS:%.o=%.po) - -all:= TARGET = all -clean:= TARGET = clean -clobber:= TARGET = clobber -install:= TARGET = install -lint:= TARGET = lint -check:= TARGET = check - -.KEEP_STATE: - -all: $(OBJECTS) ${SUBDIRS} - -catalog: $(POFILES) ${SUBDIRS} - -check: ${SUBDIRS} - $(CSTYLE) -p -P $(OBJECTS:%.o=%.c) *.h - $(HDRCHK) *.h - -clean: ${SUBDIRS} - $(RM) $(OBJECTS) $(LINT_OBJS) *.po - -install: all - -lint: $(LINT_OBJS) ${SUBDIRS} - $(LINT.c) $(LINTFLAGS) $(LINT_OBJS) $(LINTLIBS) - -FRC: - -${SUBDIRS}: FRC - cd $@; pwd; $(MAKE) $(TARGET) - -.WAIT: - -include $(SRC)/cmd/Makefile.targ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/unshare/cmdgen_unshare.c b/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/unshare/cmdgen_unshare.c deleted file mode 100644 index de2de8fd99..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/unshare/cmdgen_unshare.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "cmdgen_include.h" - -/* - * Private data type declaration - */ - -/* - * Public methods - */ -char * -cmdgen_unshare(int fstype, CCIMInstance *inst, CCIMObjectPath *objPath, - int *errp) { - char *cmd = NULL; - - switch (fstype) { - case CMDGEN_NFS: - cmd = cmdgen_unshare_nfs(inst, objPath, errp); - break; - } - return (cmd); -} /* cmdgen_unshare */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/unshare/cmdgen_unshareall.c b/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/unshare/cmdgen_unshareall.c deleted file mode 100644 index 4e4c1dd45a..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/unshare/cmdgen_unshareall.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "cmdgen_include.h" - -#define NFS_UNSHAREALL_CMD "/usr/sbin/unshareall" -#define FSTYPE_FLAG "-F" -#define SPACE " " - -/* - * Public methods - */ -char * -cmdgen_unshareall(CCIMPropertyList *paramList, int *errp) { - CCIMPropertyList *currentParam; - CCIMProperty *fstype; - char *cmd; - int cmdLen; - - if (paramList == NULL) { - *errp = EINVAL; - return (NULL); - } - - /* - * In parameters are as follows: - * 1. String fstype - */ - /* - * If a filesystem type was passed in, add it to - * the command line. - */ - currentParam = paramList; - fstype = currentParam->mDataObject; - if (fstype != NULL && fstype->mValue != NULL && - strlen(fstype->mValue) != 0) { - /* - * Add two bytes for spaces, two bytes for - * the "-F" filesystem type flag, and a - * byte for the string terminator. - */ - cmdLen = strlen(NFS_UNSHAREALL_CMD) + - strlen(fstype->mValue) + 5; - cmd = (char *)malloc((size_t)(cmdLen * sizeof (char))); - if (cmd == NULL) { - *errp = ENOMEM; - } - (void) snprintf(cmd, cmdLen, "%s %s %s", NFS_UNSHAREALL_CMD, - FSTYPE_FLAG, fstype->mValue); - } else { - cmd = strdup(NFS_UNSHAREALL_CMD); - if (cmd == NULL) { - *errp = ENOMEM; - } - } - return (cmd); -} /* cmdgen_unshareall */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/unshare/nfs/Makefile b/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/unshare/nfs/Makefile deleted file mode 100644 index 549b67c4b5..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/unshare/nfs/Makefile +++ /dev/null @@ -1,67 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -OBJECTS = cmdgen_unshare_nfs.o - -LINT_OBJS = $(OBJECTS:%.o=%.ln) - -WBEM_PROV = cmd/wbem/provider/c - -GENERAL = $(ROOTWBEMINC) \ - $(SRC)/$(WBEM_PROV)/include \ - $(SRC)/$(WBEM_PROV)/wbem_disk/common \ - $(SRC)/$(WBEM_PROV)/filesystems/wbem_nfs/include \ - $(SRC)/$(WBEM_PROV)/filesystems/wbem_nfs/nfs_share \ - $(SRC)/$(WBEM_PROV)/filesystems/common/cmdgeneration - - -CPPFLAGS += -I. $(GENERAL:%=-I%) -D_REENTRANT -DPIC -D_TS_ERRNO - -CFLAGS += $(XREGSFLAG) $(C_BIGPICFLAGS) - -LINTFLAGS += -um -LINTLIBS = $(LDLIBS.cmd) - -POFILES = $(OBJECTS:%.o=%.po) - -.KEEP_STATE: - -all: $(OBJECTS) -catalog: $(POFILES) -check: - $(CSTYLE) -p -P $(OBJECTS:%.o=%.c) *.h - $(HDRCHK) *.h -clean: - $(RM) $(OBJECTS) $(LINT_OBJS) *.po -install: all -lint: $(LINT_OBJS) - $(LINT.c) $(LINTFLAGS) $(LINT_OBJS) $(LINTLIBS) - -include $(SRC)/cmd/Makefile.targ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/unshare/nfs/cmdgen_unshare_nfs.c b/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/unshare/nfs/cmdgen_unshare_nfs.c deleted file mode 100644 index e69c5b4036..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/unshare/nfs/cmdgen_unshare_nfs.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "cmdgen_include.h" -#include "nfs_keys.h" -#include "util.h" -#include <errno.h> - - - -/* - * Private data type declaration - */ -#define NFS_UNSHARE_CMD "unshare " - -/* - * Private method declarations - */ - -/* - * Public methods - */ -/* - * generates the share command string - * memory returned must be freed by the caller. - */ -/* ARGSUSED */ -char * -cmdgen_unshare_nfs(CCIMInstance *inst, CCIMObjectPath *objPath, int *error) -{ - char *propValue; - char *cmd; - size_t len; - - if (objPath != NULL) { - /* - * Create the unshare command using the properties - * passed in from inst. - */ - - propValue = util_getKeyValue(objPath->mKeyProperties, string, - NAME, error); - if (propValue == NULL) { - *error = EINVAL; - cim_logDebug("cmdgen_unshare_nfs", - "SHAREDNAME is NULL"); - return ((char *)NULL); - } - len = strlen(NFS_UNSHARE_CMD) + strlen(propValue) + 2; - cmd = (char *)calloc(len, sizeof (char)); - (void) snprintf(cmd, len, "%s %s", NFS_UNSHARE_CMD, propValue); - } else { - cim_logDebug("cmdgen_unshare_nfs", "objPath is NULL"); - cmd = NULL; - } - return (cmd); -} diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/mount_methods/Makefile b/usr/src/cmd/wbem/provider/c/filesystems/common/mount_methods/Makefile deleted file mode 100644 index d30c2a7932..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/mount_methods/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -OBJECTS = mountprov_methods.o - -LINT_OBJS = $(OBJECTS:%.o=%.ln) - -GENERAL = $(ROOTWBEMINC) \ - $(SRC)/lib/libfsmgt/common \ - $(SRC)/cmd/wbem/provider/c/include \ - $(SRC)/cmd/wbem/provider/c/wbem_disk/common \ - $(SRC)/cmd/wbem/provider/c/filesystems/wbem_nfs/common \ - $(SRC)/cmd/wbem/provider/c/filesystems/wbem_nfs/include - - -CPPFLAGS += -I. $(GENERAL:%=-I%) -D_REENTRANT -DPIC -D_TS_ERRNO - -CFLAGS += $(XREGSFLAG) $(C_BIGPICFLAGS) - -LINTFLAGS += -um -LINTLIBS = $(LDLIBS.cmd) - -POFILES = $(OBJECTS:%.o=%.po) - -.KEEP_STATE: - -all: $(OBJECTS) -catalog: $(POFILES) -check: - $(CSTYLE) -p -P $(OBJECTS:%.o=%.c) *.h - $(HDRCHK) *.h -clean: - $(RM) $(OBJECTS) $(LINT_OBJS) *.po -install: all -lint: $(LINT_OBJS) - $(LINT.c) $(LINTFLAGS) $(LINT_OBJS) $(LINTLIBS) - -include $(SRC)/cmd/Makefile.targ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/mount_methods/mountprov_methods.c b/usr/src/cmd/wbem/provider/c/filesystems/common/mount_methods/mountprov_methods.c deleted file mode 100644 index 73bdc2f37b..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/mount_methods/mountprov_methods.c +++ /dev/null @@ -1,323 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "mountprov_methods.h" -#include "nfsprov_methods.h" -#include "util.h" -#include "libfsmgt.h" -#include "nfs_providers_msgstrings.h" -#include "nfs_provider_names.h" -#include <errno.h> - -#define SHOWEXPORTS "/usr/sbin/showmount -e " - -/* - * Private methods - */ -static char **create_export_array(char *exportList_in_string_form, - int *num_elements, int *errp); - -/* - * Public methods - */ -/* - * Method: delete_vfstab_entry - * - * Description: Deletes the /etc/vfstab entry with the corresponding resource - * and mount point as passed in with inParams. - * - * Parameters: - * - CCIMPropertyList *inParams - The input parameters to the method. - * The property list is expected to contain two elements in the following - * order: - * 1.) string resource - the resource that is listed in the device to - * mount column of /etc/vfstab. Example: /dev/dsk/c0t0d0s5 - * 2.) string mount point - * - * Returns: - * - CCIMProperty * - A value telling the success or failure of the method. - */ -CCIMProperty * -delete_vfstab_entry(CCIMPropertyList *inParams) { - fs_mntdefaults_t *vfstabEnts, *vfstabEntToDelete; - CCIMPropertyList *currentParam; - CCIMProperty *resourceProp; - CCIMProperty *mountPointProp; - char *resource; - char *mountPoint; - int err = 0; - - if (inParams == NULL) { - util_handleError(DELETE_VFSTAB_ENT, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &err); - return ((CCIMProperty *)NULL); - } - - /* - * The inParams are expected to contain two elements in this order: - * 1.) string resource - * 2.) string mountPoint - */ - currentParam = inParams; - - resourceProp = currentParam->mDataObject; - if (resourceProp == NULL || resourceProp->mValue == NULL) { - util_handleError(DELETE_VFSTAB_ENT, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &err); - return ((CCIMProperty *)NULL); - } - - resource = resourceProp->mValue; - - currentParam = currentParam->mNext; - - mountPointProp = currentParam->mDataObject; - if (mountPointProp == NULL || mountPointProp->mValue == NULL) { - util_handleError(DELETE_VFSTAB_ENT, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &err); - return ((CCIMProperty *)NULL); - } - - mountPoint = mountPointProp->mValue; - - vfstabEntToDelete = calloc(1, sizeof (fs_mntdefaults_t)); - - vfstabEntToDelete->resource = strdup(resource); - vfstabEntToDelete->mountp = strdup(mountPoint); - - vfstabEnts = fs_del_mount_default_ent(vfstabEntToDelete, &err); - if (vfstabEnts == NULL) { - util_handleError(DELETE_VFSTAB_ENT, CIM_ERR_FAILED, - FS_DEL_MNT_DEFAULT_FAILURE, NULL, &err); - return ((CCIMProperty *)NULL); - } - - cim_logDebug("delete_vfstab_entry", "After fs_del_mount_default_ent"); - fs_free_mntdefaults_list(vfstabEnts); - fs_free_mntdefaults_list(vfstabEntToDelete); - return (cim_createProperty("Status", sint32, "0", NULL, cim_false)); -} /* delete_vfstab_entry */ - -/* - * Method: show_exports - * - * Description: Shows the list of shared file systems on a certain host by - * executing the showmount command. - * - * Parameters: - * - CCIMPropertyList *inParams - The input parameters to the method. - * The property list is expected to contain one element, a string value - * representing the host to show exports on. - * - CCIMPropertyList *outParams - The output of the showmount command. - * - * Returns: - * - CCIMProperty * - A value telling the success or failure of the method. - * - * NOTE: This is a deprecated method, but is supported until the EOL process - * is done. That date is TBD. - */ -CCIMProperty * -show_exports(CCIMPropertyList *inParams, CCIMPropertyList *outParams) { - CCIMProperty *hostProp; - char *showExportsCommand; - char *cmd_return; - char *host; - int commandLen; - int err = 0; - - if (inParams == NULL) { - util_handleError(SHOW_EXPORTS, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &err); - return ((CCIMProperty *)NULL); - } - - /* - * The inParams are expected to contain one element being: - * 1.) string host - */ - hostProp = inParams->mDataObject; - if (hostProp == NULL || hostProp->mValue == NULL) { - util_handleError(SHOW_EXPORTS, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &err); - return ((CCIMProperty *)NULL); - } - - host = hostProp->mValue; - - commandLen = strlen(SHOWEXPORTS) + strlen(host) + 1; - - showExportsCommand = calloc(commandLen, sizeof (char)); - if (showExportsCommand == NULL) { - util_handleError(SHOW_EXPORTS, CIM_ERR_LOW_ON_MEMORY, - NULL, NULL, &err); - return ((CCIMProperty *)NULL); - } - - (void) snprintf(showExportsCommand, commandLen, "%s%s", SHOWEXPORTS, - host); - cmd_return = cmd_execute_command_and_retrieve_string(showExportsCommand, - &err); - if (err != 0) { - cim_logDebug(SHOW_EXPORTS, "err =%d", err); - outParams = NULL; - if (cmd_return != NULL) { - cim_logDebug(SHOW_EXPORTS, "Command return =%s", - cmd_return); - util_handleError(SHOW_EXPORTS, CIM_ERR_FAILED, - cmd_return, NULL, &err); - free(cmd_return); - } else { - util_handleError(SHOW_EXPORTS, CIM_ERR_FAILED, - CMD_EXEC_RETR_STR_FAILURE, NULL, &err); - } - - free(showExportsCommand); - return ((CCIMProperty *)NULL); - } - - if (cmd_return != NULL) { - char **export_array; - int num_elements = 0; - - cim_logDebug("show_exports", "Output =%s", cmd_return); - - export_array = create_export_array(cmd_return, &num_elements, - &err); - if (export_array == NULL) { - cim_logDebug("show_exports", "export_array == NULL"); - if (err != 0) { - util_handleError(SHOW_EXPORTS, - CIM_ERR_LOW_ON_MEMORY, NULL, NULL, - &err); - } - return ((CCIMProperty *)NULL); - } - - create_outParams_list(outParams, export_array, num_elements, - NULL); - fileutil_free_string_array(export_array, num_elements); - } - - free(showExportsCommand); - return (cim_createProperty("Status", sint32, "0", NULL, cim_false)); -} /* show_exports */ - - -/* - * Private methods - */ - -/* - * Method: create_export_array - * - * Description: Creates an array from the export list given in string form. - * - * Parameters: - * - char *exportList_in_string_form - The export list from the showmount - * command. - * - int *num_elements - The element counter which keeps track of the - * number of elements returned in the string array. - * - int *errp - The error pointer which gets set upon error. - * - * Returns: - * - char ** - The string array containing the individual elements from - * the showmount export list. - * - NULL if an error occurred. - */ -static char ** -create_export_array(char *exportList_in_string_form, int *num_elements, - int *errp) { - - char *endOfLine = "\n"; - char *export; - char *listCopy; - char **export_array = NULL; - int i = 0; - - - listCopy = strdup(exportList_in_string_form); - if (listCopy == NULL) { - *errp = errno; - *num_elements = 0; - return (NULL); - } - - /* - * Ignore the first line. It is a header that is always printed out - * when using showmounts -e. - */ - export = strtok(listCopy, endOfLine); - - /* - * Count the number of elements to be in the array. - */ - *num_elements = 0; - for (export = strtok(NULL, endOfLine); export != NULL; - export = strtok(NULL, endOfLine)) { - *num_elements = *num_elements + 1; - } - - export_array = calloc((size_t)*num_elements, (size_t)sizeof (char *)); - if (export_array == NULL) { - *errp = errno; - *num_elements = 0; - free(listCopy); - return (NULL); - } - - free(listCopy); - listCopy = strdup(exportList_in_string_form); - if (listCopy == NULL) { - *errp = errno; - *num_elements = 0; - fileutil_free_string_array(export_array, *num_elements); - return (NULL); - } - - export = strtok(listCopy, endOfLine); - - for (i = 0; i < *num_elements; i++) { - - export = strtok(NULL, endOfLine); - - if (export != NULL) { - export_array[i] = strdup(export); - if (export_array[i] == NULL) { - *errp = errno; - free(listCopy); - fileutil_free_string_array(export_array, - *num_elements); - *num_elements = 0; - return (NULL); - } - } - } - - free(listCopy); - return (export_array); -} /* create_export_array */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/common/mount_methods/mountprov_methods.h b/usr/src/cmd/wbem/provider/c/filesystems/common/mount_methods/mountprov_methods.h deleted file mode 100644 index bd7db6ed65..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/common/mount_methods/mountprov_methods.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _MOUNTPROV_METHODS_H -#define _MOUNTPROV_METHODS_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> - -/* - * Method declarations - */ -CCIMProperty *delete_vfstab_entry(CCIMPropertyList *inParams); -CCIMProperty *show_exports(CCIMPropertyList *inParams, - CCIMPropertyList *outParams); - -#ifdef __cplusplus -} -#endif - -#endif /* _MOUNTPROV_METHODS_H */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/Makefile b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/Makefile deleted file mode 100644 index 492dd2c26e..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 2003 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -COMMON_SUBDIRS = common \ - nfs_filesystem \ - nfs_share \ - assoc \ - nfs_mount - -COMMON_SUBDIR_2 = lib - -SUBDIRS = $(COMMON_SUBDIRS) $(COMMON_SUBDIR_2) - -POFILE = wbem_nfs.po -POFILES = $(SUBDIRS:%=%/_%.po) - -all:= TARGET = all -clean:= TARGET = clean -clobber:= TARGET = clobber -install:= TARGET = install -lint:= TARGET = lint -check:= TARGET = check -_msg:= TARGET = catalog - -.KEEP_STATE: - -all clean install lint check: $(COMMON_SUBDIRS) .WAIT $(COMMON_SUBDIR_2) - -clobber: $(SUBDIRS) - $(RM) $(POFILE) - -FRC: - -${SUBDIRS}: FRC - cd $@; pwd; $(MAKE) $(TARGET) - -$(POFILE): $(POFILES) - $(BUILDPO.pofiles) - -_msg: $(SUBDIRS) .WAIT $(MSGDOMAINPOFILE) - - -include $(SRC)/Makefile.msg.targ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Makefile b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Makefile deleted file mode 100644 index bd0b5ef82d..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Makefile +++ /dev/null @@ -1,83 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -OBJECTS = Solaris_NFSMount.o \ - Solaris_PersistentShareForSystem.o \ - Solaris_HostedShare.o \ - Solaris_SharedFileSystem.o \ - Solaris_NFSShareEntry.o \ - Solaris_NFSShareSecurityModes.o \ - common_functions.o - -LINT_OBJS = $(OBJECTS:%.o=%.ln) - -GENERAL = $(ROOTWBEMINC) \ - $(SRC)/lib/libfsmgt/common \ - $(SRC)/cmd/wbem/provider/c/include \ - $(SRC)/cmd/wbem/provider/c/filesystems/common/cmdgeneration \ - $(SRC)/cmd/wbem/provider/c/filesystems/common/mount_methods \ - $(SRC)/cmd/wbem/provider/c/filesystems/wbem_nfs/common \ - $(SRC)/cmd/wbem/provider/c/filesystems/wbem_nfs/include - -CPPFLAGS += -I. $(GENERAL:%=-I%) -D_REENTRANT -DPIC -D_TS_ERRNO - -CFLAGS += $(XREGSFLAG) $(C_BIGPICFLAGS) - -LINTFLAGS += -um -LINTLIBS = $(LDLIBS.cmd) - -POFILE = _assoc.po -MSGFILES = $(OBJECTS:%.o=%.i) - -CLOBBERFILES += $(POFILE) - -.KEEP_STATE: - -all: $(OBJECTS) - -install: all - -lint: $(LINT_OBJS) - $(LINT.c) $(LINTFLAGS) $(LINT_OBJS) $(LINTLIBS) - -clean: - $(RM) $(OBJECTS) $(LINT_OBJS) $(MSGFILES) - -check: - $(CSTYLE) -p -P $(OBJECTS:%.o=%.c) *.h - $(HDRCHK) *.h - -catalog: $(POFILE) - -$(POFILE): $(MSGFILES) - $(BUILDPO.msgfiles) - -include $(SRC)/cmd/Makefile.targ -include $(SRC)/Makefile.msg.targ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_HostedShare.c b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_HostedShare.c deleted file mode 100644 index fb7c81d63f..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_HostedShare.c +++ /dev/null @@ -1,1086 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "Solaris_HostedShare.h" -#include "nfs_keys.h" -#include "nfs_providers_msgstrings.h" -#include "messageStrings.h" -#include "nfs_provider_names.h" -#include "util.h" -#include "libfsmgt.h" -#include "common_functions.h" -#include "createprop_methods.h" - -/* - * Private method declarations - */ -static CIMBool does_share_exist(char *dir); -static CCIMObjectPath* get_Antecedent(); - -/* - * Public methods - */ - -/* - * Instance provider methods - */ - -/* - * Method: cp_createInstance_Solaris_HostedShare - * - * Description: This method is not supported. It is not supported because in - * order for a Solaris_HostedShare association to exist a corresponding - * Solaris_NFSShare and Solaris_ComputerSystem must exist. - * - * Parameters: - * - CCIMObjectPath *hostedShareOP - An object path containing the name of - * the class of which to create an instance of. - * - CCIMInstance *hostedShareInst - Not used. - * - * Returns: - * - Always returns NULL because the method is not supported. - */ -/* ARGSUSED */ -CCIMObjectPath * -cp_createInstance_Solaris_HostedShare(CCIMObjectPath *hostedShareOP, - CCIMInstance *hostedShareInst) { - - int err = 0; - - util_handleError("SOLARIS_HOSTEDSHARE::CREATE_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return ((CCIMObjectPath *)NULL); -} /* cp_createInstance_Solaris_HostedShare */ - -/* - * Method: cp_deleteInstance_Solaris_HostedShare - * - * Description: This method is not supported. It is not supported because in - * order for it to be actually deleted the corresponding Solaris_NFSShare would - * need to be deleted. That action is not appropriate for this provider. - * - * Parameters: - * - CCIMObjectPath *hostedShareOP - An object path containing the - * information about the class of which to delete the instance of. - * - * Returns: - * - Always returns cim_false because the method is not supported. - */ -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_HostedShare(CCIMObjectPath *hostedShareOP) { - int err = 0; - - util_handleError("SOLARIS_HOSTEDSHARE::DELETE_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_deleteInstance_Solaris_HostedShare */ - -/* - * Method: cp_enumInstances_Solaris_HostedShare - * - * Description: Enumerates the instances of Solaris_HostedShare on a host. - * An instance of Solaris_HostedShare is an association that links a share to - * the hosting machine. - * - * Parameters: - * - CCIMObjectPath *hostedShareOP - An object path containing the name of - * the class of which to enumerate the instances of. - * - * Returns: - * - A pointer to a list of Solaris_HostedShare instances. - * - NULL if an error occurred or if there are no instances of - * Solaris_HostedShare on the host. In the case of an error, the error - * will be logged. - */ -CCIMInstanceList * -cp_enumInstances_Solaris_HostedShare(CCIMObjectPath* hostedShareOP) { - CCIMInstanceList *hostedShareInstList; - CCIMObjectPath *nfsShareOP; - CCIMObjectPathList *nfsShareOPList, *currentShareOP; - CCIMObjectPath *antOP; - CCIMException *ex; - int err = 0; - - /* - * The Antecedent property is a Solaris_ComputerSystem reference. - * The Dependent property is a Solaris_NFSShare reference. - */ - if (hostedShareOP == NULL) { - util_handleError("SOLARIS_HOSTEDSHARE::ENUM_INSTANCES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - nfsShareOP = cim_createEmptyObjectPath(SOLARIS_NFSSHARE); - if (nfsShareOP == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_HOSTEDSHARE::ENUM_INSTANCES", - CIM_ERR_FAILED, CREATE_EMPTY_OBJPATH_FAILURE, ex, &err); - return ((CCIMInstanceList *)NULL); - } - - /* - * Enumerate all of the Solaris_NFSShare object paths on the system. - */ - nfsShareOPList = cimom_enumerateInstanceNames(nfsShareOP, cim_false); - - /* - * A NULL return value indicates an error, an empty list does not. - */ - if (nfsShareOPList == NULL) { - cim_logDebug("cp_enumInstances_Solaris_HostedShare", - "nfsShareOPList = NULL"); - ex = cim_getLastError(); - util_handleError("SOLARIS_HOSTEDSHARE::ENUM_INSTANCES", - CIM_ERR_FAILED, CIMOM_ENUM_INSTNAMES_FAILURE, ex, &err); - cim_freeObjectPath(nfsShareOP); - return ((CCIMInstanceList *)NULL); - - } - - cim_freeObjectPath(nfsShareOP); - - if (nfsShareOPList->mDataObject == NULL) { - return ((CCIMInstanceList *)NULL); - } - - antOP = get_Antecedent(); - if (antOP == NULL) { - /* - * The error was logged in get_Antecedent. - */ - cim_freeObjectPathList(nfsShareOPList); - return ((CCIMInstanceList *)NULL); - } - - hostedShareInstList = cim_createInstanceList(); - if (hostedShareInstList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_HOSTEDSHARE::ENUM_INSTANCES", - CIM_ERR_FAILED, CREATE_INSTANCE_LIST_FAILURE, ex, &err); - cim_freeObjectPathList(nfsShareOPList); - cim_freeObjectPath(antOP); - return ((CCIMInstanceList *)NULL); - } - - /* - * Each share on the system will be associated with the same - * Solaris_ComputerSystem object path. - */ - for (currentShareOP = nfsShareOPList; currentShareOP != NULL; - currentShareOP = currentShareOP->mNext) { - - CCIMInstance *hostedShareInst; - cimchar *propValue; - - hostedShareInst = cim_createInstance(SOLARIS_HOSTEDSHARE); - if (hostedShareInst == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_HOSTEDSHARE::ENUM_INSTANCES", - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, - &err); - cim_freeInstanceList(hostedShareInstList); - cim_freeObjectPath(antOP); - cim_freeObjectPathList(nfsShareOPList); - return ((CCIMInstanceList *)NULL); - } - - propValue = NULL; - if (add_property_to_instance( - hostedShareProps[ANT].name, hostedShareProps[ANT].type, - propValue, antOP, hostedShareProps[ANT].isKey, - hostedShareInst) == cim_false) { - - cim_freeInstance(hostedShareInst); - cim_freeInstanceList(hostedShareInstList); - cim_freeObjectPathList(nfsShareOPList); - cim_freeObjectPath(antOP); - return ((CCIMInstanceList *)NULL); - } - - if (add_property_to_instance(hostedShareProps[DEP].name, - hostedShareProps[DEP].type, propValue, - currentShareOP->mDataObject, - hostedShareProps[DEP].isKey, hostedShareInst) - == cim_false) { - - cim_freeInstance(hostedShareInst); - cim_freeInstanceList(hostedShareInstList); - cim_freeObjectPathList(nfsShareOPList); - cim_freeObjectPath(antOP); - return ((CCIMInstanceList *)NULL); - } - - hostedShareInstList = cim_addInstance(hostedShareInstList, - hostedShareInst); - if (hostedShareInstList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_HOSTEDSHARE::ENUM_INSTANCES", - CIM_ERR_FAILED, ADD_INSTANCE_FAILURE, ex, &err); - cim_freeInstance(hostedShareInst); - cim_freeObjectPathList(nfsShareOPList); - cim_freeObjectPath(antOP); - return ((CCIMInstanceList *)NULL); - } - } - - cim_freeObjectPath(antOP); - cim_freeObjectPathList(nfsShareOPList); - - return (hostedShareInstList); -} /* cp_enumInstances_Solaris_HostedShare */ - -/* - * Method: cp_enumInstanceNames_Solaris_HostedShare - * - * Description: Enumerates the instances of Solaris_HostedShare on the host. - * - * Parameters: - * - CCIMObjectPath *hostedShareOP - An object path containing the name of - * the class of which to enumerate the instance names of. - * - * Returns: - * - A list of object paths corresponding to the instances of - * Solaris_HostedShare on the host. - * - NULL if an error occurred or if there are no instances of - * Solaris_HostedShare on the host. In the case of an error, the error - * will be logged. - */ -CCIMObjectPathList * -cp_enumInstanceNames_Solaris_HostedShare(CCIMObjectPath *hostedShareOP) { - CCIMInstanceList *hostedShareInstList; - CCIMObjectPathList *hostedShareOPList; - int err = 0; - - if (hostedShareOP == NULL) { - util_handleError("SOLARIS_HOSTEDSHARE::ENUM_INSTANCENAMES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMObjectPathList *)NULL); - } - - hostedShareInstList = - cp_enumInstances_Solaris_HostedShare(hostedShareOP); - if (hostedShareInstList == NULL) { - /* - * An error occurred in enumInstances or there are simply - * no Solaris_HostedShare instances to enumerate. In the case, - * of an error, the error would have been handled in the - * cp_enumInstances_Solaris_HostedShare function. - */ - return ((CCIMObjectPathList *)NULL); - } - - hostedShareOPList = cim_createObjectPathList(hostedShareInstList); - - cim_freeInstanceList(hostedShareInstList); - /* - * If an error occurred it will be handled in cim_createObjectPathList. - */ - return (hostedShareOPList); -} /* cp_enumInstanceNames_Solaris_HostedShare */ - -/* - * Method: cp_execQuery_Solaris_HostedShare - * - * Description: Queries the host to find those Solaris_HostedShare instances - * that meet the search criteria. - * - * Parameters: - * - CCIMObjectPath *hostedShareOP - An object path containing the name of - * the class of which to query. - * - char *selectClause - Not used. - * - char *nonJoinExp - Not used. - * - char *queryExp - Not used. - * - char *queryLang - Not used. - * - * Returns: - * - A pointer to a list of Solaris_HostedShare instances that match the - * criteria. - * - NULL if an error occurred or if there are no Solaris_HostedShare - * instances that match the criteria. In the case of an error, the error - * will be logged. - * - * NOTE: Currently, there is no WQL parser for the C providers. As a result, - * what is returned to the CIMOM is a list of instances with - * a NULL value at the beginning of the list. This NULL value indicates - * to the CIMOM that it must do the filtering for the client. - */ -/* ARGSUSED */ -CCIMInstanceList * -cp_execQuery_Solaris_HostedShare(CCIMObjectPath *hostedShareOP, - char *selectClause, char *nonJoinExp, char *queryExp, char *queryLang) { - - CCIMInstance *emptyInst; - CCIMInstanceList *hostedShareInstList; - CCIMException *ex; - int err = 0; - - if (hostedShareOP == NULL) { - util_handleError("SOLARIS_HOSTEDSHARE::EXEC_QUERY", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - hostedShareInstList = cp_enumInstances_Solaris_HostedShare( - hostedShareOP); - if (hostedShareInstList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_HOSTEDSHARE::EXEC_QUERY", - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, &err); - cim_freeInstanceList(hostedShareInstList); - return ((CCIMInstanceList *)NULL); - } - - hostedShareInstList = cim_prependInstance(hostedShareInstList, - emptyInst); - - if (hostedShareInstList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_HOSTEDSHARE::EXEC_QUERY", - CIM_ERR_FAILED, PREPEND_INSTANCE_FAILURE, ex, &err); - cim_freeInstance(emptyInst); - return ((CCIMInstanceList *)NULL); - } - - return (hostedShareInstList); -} /* cp_execQuery_Solaris_HostedShare */ - -/* - * Method: cp_getInstance_Solaris_HostedShare - * - * Description: Gets the instance corresponding to the passed in object path. - * - * Parameters: - * - CCIMObjectPath *hostedShareOP - The object path containing all the - * keys of the instance that is supposed to be returned. - * - * Returns: - * - A pointer to the instance of Solaris_HostedShare corresponding to - * hostedShareOP. - * - NULL if an error occurred or if the instance doesn't exist on the - * host. In the case of an error, the error will be logged. - */ -CCIMInstance * -cp_getInstance_Solaris_HostedShare(CCIMObjectPath *hostedShareOP) { - CCIMInstance *inst; - CCIMInstanceList *instList; - CCIMPropertyList *hsPropList; - CCIMObjectPath *depOP; - CCIMObjectPath *antOP; - int err = 0; - - if (hostedShareOP == NULL || hostedShareOP->mKeyProperties == NULL) { - util_handleError("SOLARIS_HOSTEDSHARE::GET_INSTANCE", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstance *)NULL); - } - - /* - * Get the Dependent and Antecedent properties. - */ - hsPropList = hostedShareOP->mKeyProperties; - depOP = util_getKeyValue(hsPropList, hostedShareProps[DEP].type, - hostedShareProps[DEP].name, &err); - antOP = util_getKeyValue(hsPropList, hostedShareProps[ANT].type, - hostedShareProps[ANT].name, &err); - - /* - * Check if we have the Antecedent and Dependent properties. - */ - if (depOP == NULL || antOP == NULL || - depOP->mKeyProperties == NULL || - antOP->mKeyProperties == NULL) { - util_handleError("SOLARIS_HOSTEDSHARE::GET_INSTANCE", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstance *)NULL); - } - - instList = cp_enumInstances_Solaris_HostedShare(hostedShareOP); - if (instList == NULL) { - return ((CCIMInstance *)NULL); - } - - inst = cim_getInstance(instList, hostedShareOP); - - cim_freeInstanceList(instList); - return (inst); -} /* cp_getInstance_Solaris_HostedShare */ - -/* - * Method: cp_setInstance_Solaris_HostedShare - * - * Description: This method is not supported. It is not supported because in - * order to change a Solaris_HostedShare instance the underlying share and - * computer system must be modified. Those actions must be done on the - * appropriate share and computer system objects, not here. - * - * Parameters: - * - CCIMObjectPath *pOP - An object path containing the name of the class - * of which to set the instance. - * - CCIMInstance *pInst - Not used. - * - * Returns: - * - Always returns cim_false, because the method is not supported. - */ -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_HostedShare(CCIMObjectPath *pOP, CCIMInstance *pInst) { - - int err = 0; - - util_handleError("SOLARIS_HOSTEDSHARE::SET_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_setInstance_Solaris_HostedShare */ - -/* - * Method: cp_setInstanceWithList_Solaris_HostedShare - * - * Description: This method is not supported. It is not supported because in - * order to change a Solaris_HostedShare instance the underlying share and - * computer system must be modified. Those actions must be done on the - * appropriate share and computer system objects, not here. - * - * Parameters: - * - CCIMObjectPath *hostedShareOP - The object path containing the name - * of the class of which to set the instance. - * - CCIMInstance *hostedShareInst - Not used. - * - char **props - Not used. - * - int num_props - Not used. - * - * Returns: - * - Always returns cim_false, because the method is not supported. - */ -/* ARGSUSED */ -CIMBool -cp_setInstanceWithList_Solaris_HostedShare(CCIMObjectPath *hostedShareOP, - CCIMInstance *hostedShareInst, char **props, int num_props) { - - int err = 0; - - util_handleError("SOLARIS_HOSTEDSHARE::SET_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_setInstanceWithList_Solaris_HostedShare */ - -/* - * Association provider methods - */ - -/* - * Method: cp_associators_Solaris_HostedShare - * - * Description: Returns the instances associated, via the Solaris_HostedShare - * association, to the pObjectName parameter. - * - * Parameters: - * - CCIMObjectPath *pAssocName - An object path containing the name of - * the association that the caller is trying to reach. - * - CCIMObjectPath *pObjectName - The object path containing information - * (Class Name, Key Properties) about the object whose associated objects - * are to be returned. - * - char *pResultClass - If specified, only return instances that are of - * this class type. - * - char *pRole - If specified, this is the role of the pObjectName - * object path passed in. If this is not valid, NULL is returned. - * - char *pResultRole - If specified, only return instances that are - * playing this role in the association. - * - * Returns: - * - A list of Solaris_NFSShare (if pRole == Antecedent && pObjectName is - * a Solaris_ComputerSystem object path) or Solaris_ComputerSystem (if - * pRole == Dependent && pObjectName is a Solaris_NFSShare object path) - * instances which are associated to the pObjectName parameter. - * - NULL if an error occurred or if there are no instances associated to - * the pObjectName passed in. In the case of an error, the error will be - * logged. - */ -/* ARGSUSED */ -CCIMInstanceList * -cp_associators_Solaris_HostedShare(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pResultClass, char *pRole, - char *pResultRole) { - - CCIMInstanceList *returnInstList = NULL; - CCIMPropertyList *propList; - CCIMObjectPath *resultOP; - CCIMException *ex; - CIMBool pDeep, pLocalOnly, pIncludeQualifiers, - pIncludeClassOrigin, pUseInternal; - cimchar *resultClassName; - char *name; - char **pPropertyList; - unsigned int pNumProps; - int err = 0; - /* - * Check if the needed parameters are NULL. - */ - if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { - util_handleError("SOLARIS_HOSTEDSHARE::ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - /* - * The Name key property is the defining property for each the - * Antecedent (Solaris_ComputerSystem) and the Dependent - * (Solaris_NFSShare) so retrieve that property. - */ - propList = pObjectName->mKeyProperties; - name = (cimchar *)util_getKeyValue(propList, string, NAME, &err); - - if (name == NULL || err != 0) { - /* - * We don't have the appropriate information. - */ - util_handleError("SOLARIS_HOSTEDSHARE::ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - /* - * Determine whether the pObjectName is the Antecedent or the Dependent - * of the association. Antecedent == Solaris_ComputerSystem, - * Dependent == Solaris_NFSShare - */ - if ((strcasecmp(pObjectName->mName, COMPUTER_SYSTEM) == 0)) { - char *hostname; - - resultClassName = SOLARIS_NFSSHARE; - - /* - * If a value was passed in with pRole and it does not match - * the role that pObjectName actually is then log an invalid - * param error. - */ - if (pRole != NULL && (strcasecmp(pRole, ANTECEDENT) != 0)) { - util_handleError("SOLARIS_NFSMOUNT::ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - /* - * Get the current host name and compare it to the name - * property of the passed in pObjectName. - */ - hostname = sys_get_hostname(&err); - if (hostname == NULL) { - util_handleError("SOLARIS_HOSTEDSHARE::ASSOCIATORS", - CIM_ERR_FAILED, GET_HOSTNAME_FAILURE, NULL, - &err); - return ((CCIMInstanceList *)NULL); - } - - if ((strcmp(name, hostname) != 0)) { - /* - * We can only determine shares on the current host. - * The providers are not distributed. - */ - util_handleError("SOLARIS_HOSTEDSHARE::ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - free(hostname); - return ((CCIMInstanceList *)NULL); - } - free(hostname); - } else if ((strcasecmp(pObjectName->mName, SOLARIS_NFSSHARE) == 0)) { - CIMBool shareExists; - - resultClassName = COMPUTER_SYSTEM; - - /* - * pObjectName is the Dependent (Solaris_NFSShare) so determine - * if the share actually exists by comparing the Name property - * of pObjectName, which is populated with the shared directory, - * to existing nfs shares on the system. - */ - shareExists = does_share_exist(name); - if (shareExists == cim_false) { - return ((CCIMInstanceList *)NULL); - } - } else { - util_handleError("SOLARIS_HOSTEDSHARE::ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - resultOP = cim_createEmptyObjectPath(resultClassName); - if (resultOP == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_HOSTEDSHARE::ASSOCIATORS", - CIM_ERR_FAILED, CREATE_EMPTY_OBJPATH_FAILURE, - ex, &err); - return ((CCIMInstanceList *)NULL); - } - - pDeep = cim_false; - pLocalOnly = cim_false; - pIncludeQualifiers = cim_false; - pIncludeClassOrigin = cim_false; - pUseInternal = cim_false; - pPropertyList = NULL; - pNumProps = 0; - returnInstList = cimom_enumerateInstances(resultOP, pDeep, - pLocalOnly, pIncludeQualifiers, pIncludeClassOrigin, - pUseInternal, pPropertyList, pNumProps); - /* - * A NULL return value indicates an error, an empty list - * doesn't. - */ - if (returnInstList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_HOSTEDSHARE::ASSOCIATORS", - CIM_ERR_FAILED, CIMOM_ENUM_INST_FAILURE, ex, - &err); - cim_freeObjectPath(resultOP); - return ((CCIMInstanceList *)NULL); - } - - cim_freeObjectPath(resultOP); - - if (returnInstList->mDataObject == NULL) { - return ((CCIMInstanceList *)NULL); - } - - return (returnInstList); -} /* cp_associators_Solaris_HostedShare */ - -/* - * Method: cp_associatorNames_Solaris_HostedShare - * - * Description: Returns the object paths of the instances on the other side of - * the association which are associated via the Solaris_HostedShare association - * and having the passed in parameter, pObjectName, as the opposite key. - * - * Parameters: - * - CCIMObjectPath *pAssocName - An object path containing information - * about the association that the caller is trying to reach. - * - CCIMObjectPath *pObjectName - The object path which contains the - * information on whose associated objects are to be returned. - * - char *pResultClass - If specified, only return instances that are of - * this class type. - * - char *pRole - If specified, this is the role of the pObjectName - * object path passed in. If this is not valid, NULL is returned. - * - char *pResultRole - If specified, only return instances that are - * playing this role in the association. - * - * Returns: - * - A list of Solaris_NFSShare (if pRole == Antecedent && pObjectName is - * a Solaris_ComputerSystem object path) or Solaris_ComputerSystem (if - * pRole == Dependent && pObjectName is a Solaris_NFSShare object path) - * object paths which are associated to the pObjectName parameter. - * - NULL if an error occurred or if there are no instances associated to - * the pObjectName passed in. In the case of an error, the error will be - * logged. - */ -CCIMObjectPathList * -cp_associatorNames_Solaris_HostedShare(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pResultClass, char *pRole, - char *pResultRole) { - - CCIMInstanceList *instList; - CCIMObjectPathList *objPathList = NULL; - int err = 0; - - if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { - util_handleError("SOLARIS_HOSTEDSHARE::ASSOCIATOR_NAMES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMObjectPathList *)NULL); - } - - instList = cp_associators_Solaris_HostedShare(pAssocName, pObjectName, - pResultClass, pRole, pResultRole); - if (instList == NULL) { - return ((CCIMObjectPathList *)NULL); - } - - objPathList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - - return (objPathList); -} /* cp_associatorNames_Solaris_HostedShare */ - -/* - * Method: cp_references_Solaris_HostedShare - * - * Description: Returns the Solaris_HostedShare instances that have the passed - * in parameter, pObjectName, as one of it's keys. - * - * Parameters: - * - CCIMObjectPath *pAssocName - An object path containing information - * about the association that the caller is trying to reach. - * - CCIMObjectPath *pObjectName - The object path which contains the - * information on whose associated objects are to be returned. - * - char *pRole - If specified, this is the role of the pObjectName - * object path passed in. If this is not valid, NULL is returned. - * - * Returns: - * - A pointer to a list of Solaris_HostedShare instances. - * - NULL if an error occurred or if there are no Solaris_HostedShare - * instances having pObjectName as one of it's keys. - */ -CCIMInstanceList * -cp_references_Solaris_HostedShare(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pRole) { - - CCIMInstanceList *instList; - CCIMObjectPathList *objPathList; - char *pObjectNameRole; - char *objPathListRole; - int err = 0; - - if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { - util_handleError("SOLARIS_HOSTEDSHARE::REFERENCES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - /* - * Get everything that is related to the pObjectName passed in. - */ - objPathList = cp_associatorNames_Solaris_HostedShare(pAssocName, - pObjectName, NULL, pRole, NULL); - if (objPathList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - /* - * Now use the object paths in the object path list and the pObjectName - * variable to create the association instances. - */ - if ((strcasecmp(pObjectName->mName, SOLARIS_NFSSHARE) == 0)) { - /* - * pObjectName is the Dependent. - */ - pObjectNameRole = DEPENDENT; - objPathListRole = ANTECEDENT; - instList = create_association_instList(SOLARIS_HOSTEDSHARE, - pObjectName, pObjectNameRole, objPathList, - objPathListRole, &err); - } else { - /* - * pObjectName is the Antecedent. - */ - pObjectNameRole = ANTECEDENT; - objPathListRole = DEPENDENT; - instList = create_association_instList(SOLARIS_HOSTEDSHARE, - pObjectName, pObjectNameRole, objPathList, - objPathListRole, &err); - } - cim_freeObjectPathList(objPathList); - - return (instList); -} /* cp_references_Solaris_HostedShare */ - -/* - * Method: cp_referenceNames_Solaris_HostedShare - * - * Description: Returns the Solaris_HostedShare object paths of the instances - * that have the passed in parameter, pObjectName, as one of it's keys. - * - * Parameters: - * - CCIMObjectPath *pAssocName - An object path containing information - * about the association that the caller is trying to reach. - * - CCIMObjectPath *pObjectName - The object path which contains the - * information on whose associated objects are to be returned. - * - char *pRole - If specified, this is the role of the pObjectName - * object path passed in. If this is not valid, NULL is returned. - * - * Returns: - * - A pointer to a list of Solaris_HostedShare object paths. - * - NULL if an error occurred or if there are no Solaris_HostedShare - * instances having pObjectName as one of it's keys. - */ -CCIMObjectPathList * -cp_referenceNames_Solaris_HostedShare(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pRole) { - - CCIMInstanceList *hostedShareInstList; - CCIMObjectPathList *hostedShareOPList; - int err = 0; - - if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { - util_handleError("SOLARIS_HOSTEDSHARE::REFERENCE_NAMES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMObjectPathList *)NULL); - } - - hostedShareInstList = cp_references_Solaris_HostedShare(pAssocName, - pObjectName, pRole); - - if (hostedShareInstList == NULL) { - return ((CCIMObjectPathList *)NULL); - } - - hostedShareOPList = cim_createObjectPathList(hostedShareInstList); - - cim_freeInstanceList(hostedShareInstList); - /* - * If an error occurred it will be handled in cim_createObjectPathList. - */ - return (hostedShareOPList); -} /* cp_referenceNames_Solaris_HostedShare */ - -/* - * Property provider methods - */ - -/* - * Method: cp_getProperty_Solaris_HostedShare - * - * Description: Retrieves a certain property from the instance of - * Solaris_HostedShare on the host that is described by the parameter - * hostedShareOP. - * - * Parameters: - * - CCIMObjectPath *hostedShareOP - The object path containing all the - * information needed to find the instance in which the property is to - * be returned. - * - cimchar *pPropName - The name of the property to be found. - * - * Returns: - * - A pointer to the property corresponding to the name passed in with - * pPropName. - * - NULL if an error occurred or if the property doesn't exist. In the - * case of an error, the error will be logged. - */ -CCIMProperty * -cp_getProperty_Solaris_HostedShare(CCIMObjectPath *hostedShareOP, - cimchar *pPropName) { - - CCIMInstance *hostedShareInst; - CCIMProperty *hostedShareProp; - int err = 0; - - if (hostedShareOP == NULL) { - util_handleError("SOLARIS_HOSTEDSHARE::GET_PROPERTY", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMProperty *)NULL); - } - - hostedShareInst = cp_getInstance_Solaris_HostedShare(hostedShareOP); - if (hostedShareInst == NULL) { - return ((CCIMProperty *)NULL); - } - - hostedShareProp = cim_getProperty(hostedShareInst, pPropName); - cim_freeInstance(hostedShareInst); - - return (hostedShareProp); - -} /* cp_getProperty_Solaris_HostedShare */ - -/* - * Method: cp_setProperty_Solaris_HostedShare - * - * Description: This method is not supported. It is not supported because in - * order to change the properties of a Solaris_HostedShare instance, the - * underlying classes being associated must be changed. This provider isn't - * the appropriate place to be changing other things on the host. - * - * Parameters: - * - CCIMObjectPath *hostedShareOP - Not used. - * - CCIMProperty *pProp - Not used. - * - * Returns: - * - Always returns cim_false because the method is not supported. - */ -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_HostedShare(CCIMObjectPath *hostedShareOP, - CCIMProperty *pProp) { - - int err = 0; - - util_handleError("SOLARIS_HOSTEDSHARE::SET_PROPERTY", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_setProperty_Solaris_HostedShare */ - -/* - * Method provider methods - */ - -/* - * Method: cp_invokeMethod_Solaris_HostedShare - * - * Description: This method is not supported because the provider doesn't have - * any methods. - * - * Parameters: - * - CCIMObjectPath* op - Not used. - * - cimchar* methodName - Not used. - * - CCIMPropertyList* inParams - Not used. - * - CCIMPropertyList* outParams - Not used. - * - * Returns: - * - Always returns null because the method is not supported. - */ -/* ARGSUSED */ -CCIMProperty * -cp_invokeMethod_Solaris_HostedShare(CCIMObjectPath* op, cimchar* methodName, - CCIMPropertyList* inParams, CCIMPropertyList* outParams) { - - return ((CCIMProperty *)NULL); -} /* cp_invokeMethod_Solaris_HostedShare */ - -/* - * Private methods - */ - -/* - * Method: does_share_exist - * - * Description: Determines if a given share exists on the host. - * - * Parameters: - * - char *dir - The name of the directory to see if it is shared. - * - * Returns: - * - An integer corresponding to the existence of the share on the system. - * 1 is returned if the share exists, 0 is returned if the share does not - * exist. - */ -static CIMBool -does_share_exist(char *dir) { - fs_sharelist_t *share_list; - fs_sharelist_t *currentShare; - CIMBool return_val = cim_false; - int err = 0; - - share_list = fs_get_share_list(&err); - if (share_list == NULL) { - /* - * Either there was an error or there are no shares on the - * system. If there was an error err should be a non-zero - * value. - */ - if (err != 0) { - util_handleError("SOLARIS_HOSTEDSHARE::SHARE_EXISTS", - CIM_ERR_FAILED, FS_GET_SHARE_FAILURE, NULL, - &err); - } - - return (return_val); - } - - currentShare = share_list; - while (currentShare != NULL && return_val == cim_false) { - if ((strcmp(currentShare->path, dir) == 0)) { - return_val = cim_true; - } - - currentShare = currentShare->next; - } - - fs_free_share_list(share_list); - return (return_val); - -} /* does_share_exist */ - -/* - * Method: get_Antecedent - * - * Description: Retrieves a reference property of the host's - * Solaris_ComputerSystem class. - * - * Parameters: - * - NONE - * Returns: - * - A pointer to a property which is a reference property of the host's - * Solaris_ComputerSystem instance. - * - Upon error, NULL is returned and the error is logged. - */ -static CCIMObjectPath * -get_Antecedent() { - CCIMInstance *compSysInst; - CCIMObjectPath *compSysOP; - CCIMException *ex; - char *hostname; - int err = 0; - - compSysInst = cim_createInstance(COMPUTER_SYSTEM); - if (compSysInst == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_HOSTEDSHARE::GET_ANT", - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, &err); - return ((CCIMObjectPath *)NULL); - } - - /* - * Create the key properties on the Solaris_ComputerSystem instance. - * - * The Solaris_ComputerSystem keys are as follows: - * CreationClassName = "Solaris_ComputerSystem" - * Name = < host name > - */ - if (add_property_to_instance(CREATION_CLASS, string, COMPUTER_SYSTEM, - NULL, cim_true, compSysInst) == cim_false) { - - cim_freeInstance(compSysInst); - return ((CCIMObjectPath *)NULL); - } - - hostname = sys_get_hostname(&err); - if (hostname == NULL) { - util_handleError("SOLARIS_HOSTEDSHARE::GET_ANT", - CIM_ERR_FAILED, GET_HOSTNAME_FAILURE, NULL, &err); - return ((CCIMObjectPath *)NULL); - } - - if (add_property_to_instance(NAME, string, hostname, NULL, - cim_true, compSysInst) == cim_false) { - - free(hostname); - cim_freeInstance(compSysInst); - return ((CCIMObjectPath *)NULL); - } - free(hostname); - - compSysOP = cim_createObjectPath(compSysInst); - if (compSysOP == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_HOSTEDSHARE::GET_ANT", - CIM_ERR_FAILED, CREATE_OBJECT_PATH_FAILURE, - ex, &err); - cim_freeInstance(compSysInst); - return ((CCIMObjectPath *)NULL); - } - - return (compSysOP); -} /* get_Antecedent */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_HostedShare.h b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_HostedShare.h deleted file mode 100644 index c2a7469ca6..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_HostedShare.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOLARIS_HOSTEDSHARE_H -#define _SOLARIS_HOSTEDSHARE_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> -#include <cimomhandle.h> -#include "nfsprov_include.h" - -#define PROPCOUNT 2 - -static nfs_prov_prop_t hostedShareProps[] = { -#define ANT 0 - {"Antecedent", cim_true, reference}, -#define DEP (ANT + 1) - {"Dependent", cim_true, reference} -}; - -#ifdef __cplusplus -} -#endif - -#endif /* _SOLARIS_HOSTEDSHARE_H */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_NFSMount.c b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_NFSMount.c deleted file mode 100644 index 7235888d66..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_NFSMount.c +++ /dev/null @@ -1,2467 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "Solaris_NFSMount.h" -#include "nfs_keys.h" -#include "nfs_providers_msgstrings.h" -#include "messageStrings.h" -#include "nfs_provider_names.h" -#include "libfsmgt.h" -#include "cmdgen.h" -#include "util.h" -#include "nfsprov_methods.h" -#include "mountprov_methods.h" -#include "createprop_methods.h" -#include <sys/types.h> -#include <string.h> -#include <errno.h> - -/* - * Constants - */ -#define DELETE_VFSTAB_ENT_METHOD "deleteVfstabEntry" -#define GET_DEF_SECMODE_METHOD "getDefaultNfsSecMode" -#define GET_NET_CFG_LIST_METHOD "getNetCfgList" -#define GET_NFS_SEC_LIST_METHOD "getNfsSecList" -#define SHOW_EXPORTS_METHOD "showExports" -/* - * Private method declarations - */ - -static CCIMInstanceList * create_nfsMount_associations(nfs_mntlist_t *mountList, - int *errp); -static CCIMInstanceList * enumerate_mounts(); -static CCIMObjectPath * get_Antecedent(cimchar *mount_point); -static CCIMInstanceList * get_associated_instances(nfs_mntlist_t *mountList, - boolean_t resultIsAnt); -static nfs_mntlist_t *get_associated_nfs_mntlist(boolean_t isAntecedent, - char *nameKeyValue); -static CCIMObjectPath * get_Dependent(nfs_mntlist_t *nfs_mount); -static char *get_devid(char *keyValue, int *errp); -static char *get_resource(char *keyValue, int *errp); -static CCIMPropertyList * populate_property_list(nfs_mntlist_t *nfs_mount); -static CIMBool populate_property_values(nfs_mntlist_t *nfs_mount, - cimchar **propValues); - -/* - * Public methods - */ - -/* - * Instance provider methods - */ - -/* - * Method: cp_enumInstances_Solaris_NFSMount - * - * Description: Enumerates all of the nfs mounts on the host. NFS mounts with - * "ignore" in the option string are ignored. - * - * Parameters: - * - CCIMObjectPath* mountOP - The object path containing the name of the - * class to which the instance to be enumerated belongs. - * - * Returns: - * - A pointer to a list of Solaris_NFSMount instances. - * - NULL if an error occurred or if there are no NFS mounts on the host. - * In the case of an error, the error will be logged. - */ -CCIMInstanceList * -cp_enumInstances_Solaris_NFSMount(CCIMObjectPath* mountOP) { - CCIMInstanceList *instList; - int err = 0; - - /* - * First check if the CCIMObjectPath passed in is null. - */ - if (mountOP == NULL) { - util_handleError( - "SOLARIS_NFSMOUNT::ENUM_INSTANCES", - CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - instList = enumerate_mounts(); - if (instList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - return (instList); -} /* cp_enumInstances_Solaris_NFSMount */ - -/* - * Method: cp_getInstance_Solaris_NFSMount - * - * Description: Gets the instance corresponding to the Solaris_NFSMount - * object path passed in. - * - * Parameters: - * - CCIMObjectPath* mountOP - An object path containing all the keys of - * the instance that is supposed to be returned. - * - * Returns: - * - A pointer to the Solaris_NFSMount instance corresponding to the object - * path parameter. - * - NULL if an error occurred or if the instance doesn't exist. In the - * case of an error, the error will be logged. - */ -CCIMInstance * -cp_getInstance_Solaris_NFSMount(CCIMObjectPath* mountOP) { - CCIMInstanceList *instList; - CCIMInstance *inst; - CCIMPropertyList *mountPropList; - CCIMObjectPath *antOP, *depOP; - int err; - - if (mountOP == NULL || mountOP->mKeyProperties == NULL) { - util_handleError("SOLARIS_NFSMOUNT::GET_INSTANCE", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstance *)NULL); - } - - mountPropList = mountOP->mKeyProperties; - depOP = util_getKeyValue(mountPropList, nfsMountProps[DEP].type, - nfsMountProps[DEP].name, &err); - antOP = util_getKeyValue(mountPropList, nfsMountProps[ANT].type, - nfsMountProps[ANT].name, &err); - - if (depOP == NULL || antOP == NULL || - depOP->mKeyProperties == NULL || - antOP->mKeyProperties == NULL) { - - util_handleError("SOLARIS_NFSMOUNT::GET_INSTANCE", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstance *)NULL); - } - - instList = cp_enumInstances_Solaris_NFSMount(mountOP); - if (instList == NULL) { - /* - * Either an error occurred or we simply don't have any - * instances of Solaris_NFSMount on the system. In the case, - * that an error occurred, it will be handled in - * cp_enumInstances_Solaris_NFSMount. - */ - return ((CCIMInstance *)NULL); - } - - inst = cim_getInstance(instList, mountOP); - - cim_freeInstanceList(instList); - return (inst); -} /* cp_getInstance_Solaris_NFSMount */ - -/* - * Method: cp_createInstance_Solaris_NFSMount - * - * Description: - * Creates an instance of the Solaris_NFSMount class. - * A create instance will actually mount a file system on the current host by - * calling the cmd interface's cmd_execute_command_and_retrieve_string function. - * - * Parameters: - * - CCIMObjectPath* nfsOP - An object path containing the information - * needed about the class of which to have an instance created. - * - CCIMInstance* nfsInst - The instance to be created. - * - * Returns: - * - A pointer to a Solaris_NFSMount CCIMObjectPath which corresponds to - * the mount that was created. - * - Upon error, NULL is returned and the error will be logged. - */ -CCIMObjectPath * -cp_createInstance_Solaris_NFSMount(CCIMObjectPath* nfsOP, - CCIMInstance* nfsInst) { - - char *cmd_return = NULL; - char *cmd; - char *resource; - char *mountp; - char *mntoptsParam, *timeParam; - boolean_t findOverlayParam; - int err = 0; - nfs_mntlist_t *mount; - CCIMObjectPath *nfsMountOP = NULL; - CCIMObjectPath *opParam; - CCIMPropertyList *propListParam; - CCIMInstanceList *nfsMountInstList; - CCIMInstanceList *currentInst; - CCIMProperty *mnt_prop; - CCIMException *ex; - - /* - * First check if the CCIMInstance or CCIMObjectPath is null. - */ - if (nfsOP == NULL || nfsInst == NULL) { - util_handleError( - "SOLARIS_NFSMOUNT::CREATE_INSTANCE", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMObjectPath *)NULL); - } - - /* - * Get the properties from the instance parameter in order to create - * an instance as defined. The properties will be used to create a - * mount command to execute. - */ - - /* - * The only properties required are resource and mount point. - * All other properties are not needed. The defaults will be used. - */ - err = 0; - opParam = NULL; - propListParam = NULL; - cmd = cmdgen_generate_command(CMDGEN_NFS_MOUNT, nfsInst, opParam, - propListParam, &err); - if (cmd == NULL || err != 0) { - util_handleError("SOLARIS_NFSMOUNT::CREATE_INSTANCE", - CIM_ERR_FAILED, CMDGEN_GEN_CMD_FAILURE, NULL, &err); - return ((CCIMObjectPath *)NULL); - } - - cim_logDebug("cp_createInstance_Solaris_NFSMount", - "cmd =%s", cmd); - err = 0; - cmd_return = cmd_execute_command_and_retrieve_string(cmd, &err); - if (err != 0) { - cim_logDebug("cp_createInstance_Solaris_NFSMount", - "cmd_return =%s", cmd_return); - /* - * An error occurred in executing the command. - */ - if (cmd_return != NULL) { - util_handleError("SOLARIS_NFSMOUNT::CREATE_INSTANCE", - CIM_ERR_FAILED, CMD_EXEC_RETR_STR_FAILURE, - NULL, &err); - free(cmd); - free(cmd_return); - return ((CCIMObjectPath *)NULL); - } else { - util_handleError("SOLARIS_NFSMOUNT::CREATE_INSTANCE", - CIM_ERR_FAILED, CMD_EXEC_RETR_STR_FAILURE, - NULL, &err); - free(cmd); - return ((CCIMObjectPath *)NULL); - } - } - - free(cmd); - if (cmd_return != NULL) { - free(cmd_return); - } - - /* - * It should be certain that the mount got created if the - * cmd_execute_command_and_retrieve_string function succeded, but we - * will do a second check to make sure it did and to get the devid. - * We can determine if the mount exists by checking for a mount having - * the same resource/mount point as the instance passed in. - */ - mnt_prop = cim_getProperty(nfsInst, nfsMountProps[ANT].name); - if (mnt_prop != NULL) { - CCIMPropertyList *antPropList; - - antPropList = mnt_prop->mObjPathValue->mKeyProperties; - - mountp = util_getKeyValue(antPropList, string, NAME, &err); - if (mountp == NULL || err != 0) { - util_handleError("SOLARIS_NFSMOUNT::CREATE_INSTANCE", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMObjectPath *)NULL); - } - - cim_freeProperty(mnt_prop); - - } - - mnt_prop = cim_getProperty(nfsInst, nfsMountProps[DEP].name); - if (mnt_prop != NULL) { - CCIMPropertyList *depPropList; - - depPropList = mnt_prop->mObjPathValue->mKeyProperties; - - resource = util_getKeyValue(depPropList, string, NAME, &err); - if (resource == NULL || err != 0) { - util_handleError("SOLARIS_NFSMOUNT::CREATE_INSTANCE", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMObjectPath *)NULL); - } - - cim_freeProperty(mnt_prop); - } - - err = 0; - mntoptsParam = NULL; - timeParam = NULL; - findOverlayParam = B_TRUE; - mount = nfs_get_filtered_mount_list(resource, mountp, mntoptsParam, - timeParam, findOverlayParam, &err); - if (mount == NULL) { - if (err != 0) { - util_handleError("SOLARIS_NFSMOUNT::CREATE_INSTANCE", - CIM_ERR_FAILED, NFS_GET_FILTERED_MOUNTS_FAILURE, - NULL, &err); - } - cim_logDebug("cp_createInstance_Solaris_NFSMount", - "Mount was not found w/ resource/mount point combo"); - /* - * There were no mounts found with the resource and mount point. - * We can assume that the mount wasn't created so return NULL. - */ - return ((CCIMObjectPath *)NULL); - } - - nfsMountInstList = create_nfsMount_associations(mount, &err); - if (nfsMountInstList == NULL) { - if (err != 0) { - nfs_free_mntinfo_list(mount); - util_handleError("SOLARIS_NFSMOUNT::CREATE_INSTANCE", - CIM_ERR_FAILED, CREATE_NFSMOUNT_ASSOC_FAILURE, - NULL, &err); - } - return ((CCIMObjectPath *)NULL); - } - - nfs_free_mntinfo_list(mount); - - for (currentInst = nfsMountInstList; currentInst != NULL; - currentInst = currentInst->mNext) { - - /* - * Ideally there is only one instance, but with being able to - * overlay file systems there is a possibility that there may - * be multiple file systems with the same resource/mount point. - * If there are multiple instances in this list the last one - * returned will be used to create the return object path. - * That should be the most recently created mount. - */ - if (nfsMountOP != NULL) { - cim_logDebug("cp_createInstance_Solaris_NFSMount", - "More than one mount found."); - cim_freeObjectPath(nfsMountOP); - } - nfsMountOP = cim_createObjectPath(currentInst->mDataObject); - if (nfsMountOP == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSMOUNT::CREATE_INSTANCE", - CIM_ERR_FAILED, CREATE_OBJECT_PATH_FAILURE, - ex, &err); - cim_freeInstanceList(nfsMountInstList); - return ((CCIMObjectPath *)NULL); - } - } - - cim_freeInstanceList(nfsMountInstList); - return (nfsMountOP); -} /* cp_createInstance_Solaris_NFSMount */ - -/* - * Method: cp_deleteInstance_Solaris_NFSMount - * - * Description: Deletes a Solaris_NFSMount instance. - * A delete instance will actually unmount a file system on the current host by - * calling the cmd interface's cmd_execute_command_and_retrieve_string function. - * - * Parameters: - * - CCIMObjectPath* nfsOP - The object path containing all information - * needed to delete the appropriate instance. - * - * Returns: - * - A CIMBool value corresponding to whether or not the instance was - * deleted. cim_true will be returned if the delete was successful, - * cim_false will be returned if the delete failed. - */ -CIMBool -cp_deleteInstance_Solaris_NFSMount(CCIMObjectPath* nfsOP) { - - CCIMInstance *instParam; - CCIMPropertyList *propListParam; - char *cmd; - char *cmd_return = NULL; - int err = 0; - - if (nfsOP == NULL) { - util_handleError("SOLARIS_NFSMOUNT::DELETE_INSTANCE", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return (cim_false); - } - - /* - * Get the mount that is to be deleted and generate the command. - */ - instParam = NULL; - propListParam = NULL; - cmd = cmdgen_generate_command(CMDGEN_NFS_UMOUNT, instParam, nfsOP, - propListParam, &err); - if (cmd == NULL || err != 0) { - util_handleError("SOLARIS_NFSMOUNT::DELETE_INSTANCE", - CIM_ERR_FAILED, CMDGEN_GEN_CMD_FAILURE, NULL, &err); - return (cim_false); - } - - /* - * Execute the umount command - */ - err = 0; - cmd_return = cmd_execute_command_and_retrieve_string(cmd, &err); - if (err != 0) { - /* - * The command execution failed. - */ - if (cmd_return != NULL) { - util_handleError("SOLARIS_NFSMOUNT::DELETE_INSTANCE", - CIM_ERR_FAILED, CMD_EXEC_RETR_STR_FAILURE, - NULL, &err); - free(cmd); - free(cmd_return); - return (cim_false); - } else { - util_handleError("SOLARIS_NFSMOUNT::DELETE_INSTANCE", - CIM_ERR_FAILED, CMD_EXEC_RETR_STR_FAILURE, - NULL, &err); - free(cmd); - return (cim_false); - } - } - - free(cmd); - if (cmd_return != NULL) - free(cmd_return); - - return (cim_true); -} /* cp_deleteInstance_Solaris_NFSMount */ - -/* - * Method: cp_enumInstanceNames_Solaris_NFSMount - * - * Description: Enumerates all of the nfs mounts on the host. NFS mounts with - * "ignore" in the option string are ignored. - * - * Parameters: - * - CCIMObjectPath* mountOP - An object path containing the name of the - * class of which to enumerate instances of. - * - * Returns: - * - A pointer to a list of Solaris_NFSMount object paths. - * - NULL if an error occurred or if there are no NFS mounts on the host. - * In the case of an error, the error will be logged. - */ -CCIMObjectPathList * -cp_enumInstanceNames_Solaris_NFSMount(CCIMObjectPath* mountOP) { - CCIMInstanceList *instList; - CCIMObjectPathList *OPList; - int err = 0; - /* - * First check if the CCIMObjectPath parameter is null. - */ - if (mountOP == NULL) { - util_handleError("SOLARIS_NFSMOUNT::ENUM_INSTANCENAMES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMObjectPathList *)NULL); - } - - instList = cp_enumInstances_Solaris_NFSMount(mountOP); - if (instList == NULL) - { - /* - * Failure...or there are no NFS mount instances. - */ - return ((CCIMObjectPathList *)NULL); - } - - OPList = cim_createObjectPathList(instList); - - cim_freeInstanceList(instList); - /* - * If an error occurred in cim_createObjectPathList it will be handled - * there. - */ - return (OPList); -} /* cp_enumInstanceNames_Solaris_NFSMount */ - -/* - * Method: cp_execQuery_Solaris_NFSMount - * - * Description: Queries the nfs mounts on the host to find those that meet the - * search criteria. - * - * Parameters: - * - CCIMObjectPath *hostedShareOP - An object path containing the name of - * the class to query. - * - char *selectClause - Not used. - * - char *nonJoinExp - Not used. - * - char *queryExp - Not used. - * - char *queryLang - Not used. - * - * Returns: - * - A pointer to a list of Solaris_NFSMount instances that match the - * criteria. - * - NULL if an error occurred or if there are no Solaris_NFSMount - * instances that match the criteria. In the case of an error, the error - * will be logged. - * - * NOTE: Currently, there is no WQL parser for the C providers. As a result, - * what is returned to the CIMOM is a list of instances with - * a NULL value at the beginning of the list. This NULL value indicates - * to the CIMOM that it must do the filtering for the client. - */ -/* ARGSUSED */ -CCIMInstanceList * -cp_execQuery_Solaris_NFSMount(CCIMObjectPath *mountOP, char *selectClause, - char *nonJoinExp, char *queryExp, char *queryLang) { - - CCIMInstance *emptyInst; - CCIMInstanceList *nfsMountInstList; - CCIMException *ex; - int err = 0; - - if (mountOP == NULL) { - util_handleError("SOLARIS_NFSMOUNT::EXEC_QUERY", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - nfsMountInstList = cp_enumInstances_Solaris_NFSMount(mountOP); - - if (nfsMountInstList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSMOUNT::EXEC_QUERY", - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, &err); - return ((CCIMInstanceList *)NULL); - } - - nfsMountInstList = cim_prependInstance(nfsMountInstList, emptyInst); - if (nfsMountInstList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSMOUNT::EXEC_QUERY", - CIM_ERR_FAILED, PREPEND_INSTANCE_FAILURE, ex, &err); - cim_freeInstance(emptyInst); - return ((CCIMInstanceList *)NULL); - } - - return (nfsMountInstList); -} /* cp_execQuery_Solaris_NFSMount */ - -/* - * Method: cp_setInstance_Solaris_NFSMount - * - * Description: This method is not supported. This is not allowed because in - * order to change the properties of a mount on the host, the mount must be - * unmounted and mounted with the new properties. This behavior is not - * appropriate for the set instance. If the client wants to change the - * properties of a mount they must delete the old instance and create a - * new one with the desired properties. - * - * Parameters: - * - CCIMObjectPath *pOP - An object path containing the name of the class - * of which to set the instance. - * - CCIMInstance *pInst - Not used. - * - * Returns: - * - cim_false is returned every time since the method is not supported. - */ -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_NFSMount(CCIMObjectPath* pOP, CCIMInstance* pInst) { - int err = 0; - - util_handleError("SOLARIS_NFSMOUNT::SET_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_setInstance_Solaris_NFSMount */ - -/* - * Method: cp_setInstanceWithList_Solaris_NFSMount - * - * Description: This method is not supported. This is not allowed because in - * order to change the properties of a mount on the host, the mount must be - * unmounted and mounted with the new properties. This behavior is not - * appropriate for the set instance. If the client wants to change the - * properties of a mount they must delete the old instance and create a - * new one with the desired properties. - * - * Parameters: - * - CCIMObjectPath *hostedShareOP - The object path containing the name - * of the class of which to set the instance. - * - CCIMInstance *hostedShareInst - Not used. - * - char **props - Not used. - * - int num_props - Not used. - * - * Returns: - * - cim_false is returned every time since the method is not supported. - */ -/* ARGSUSED */ -CIMBool -cp_setInstanceWithList_Solaris_NFSMount(CCIMObjectPath* mountOP, - CCIMInstance* mountInst, - char **props, int num_props) { - int err = 0; - - util_handleError("SOLARIS_NFSMOUNT::SET_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); - -} /* cp_setInstanceWithList_Solaris_NFSMount */ - -/* - * Associator provider methods - */ - -/* - * Method: cp_associators_Solaris_NFSMount - * - * Description: Returns the instances associated, via the Solaris_NFSMount - * association, to the pObjectName parameter. - * - * Parameters: - * - CCIMObjectPath *pAssocName - An object path containing the name of - * the association that the caller is trying to reach. - * - CCIMObjectPath *pObjectName - The object path containing information - * (Class Name, Key Properties) about the object whose associated objects - * are to be returned. - * - char *pResultClass - If specified, only return instances that are of - * this class type. - * - char *pRole - If specified, this is the role of the pObjectName - * object path passed in. If this is not valid, NULL is returned. - * - char *pResultRole - If specified, only return instances that are - * playing this role in the association. - * - * Returns: - * - A pointer to a list of Solaris_NFS (if pRole == Antecedent && - * pObjectName is a Solaris_Directory object path) or Solaris_Directory - * (if pRole == DEPENDENT && pObjectName is a Solaris_NFS object path) - * instances which are associated to the pObjectName parameter. - * - NULL if an error occurred or if there are no instances associated to - * the pObjectName passed in. In the case of an error, the error will be - * logged. - */ -/* ARGSUSED */ -CCIMInstanceList * -cp_associators_Solaris_NFSMount(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pResultClass, char *pRole, - char *pResultRole) { - - CCIMInstanceList *returnInstList; - CCIMPropertyList *propList; - nfs_mntlist_t *mountList; - cimchar *name; - boolean_t isAntecedent = B_FALSE; - int err = 0; - - /* - * Check if the needed parameters are null. - */ - if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { - util_handleError("SOLARIS_NFSMOUNT::ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - /* - * The Name key property is the defining property for each the - * Antecedent (Solaris_Directory) and the Dependent (Solaris_NFS) - * so retrieve that property. - */ - propList = pObjectName->mKeyProperties; - name = (cimchar *)util_getKeyValue(propList, string, NAME, &err); - - if (name == NULL || err != 0) { - util_handleError("SOLARIS_NFSMOUNT::ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - /* - * Determine whether pObjectName is the Antecedent or the Dependent - * of the association. Antecedent = Solaris_Directory, - * Dependent = Solaris_NFS - */ - if ((strcasecmp(pObjectName->mName, SOLARIS_DIR) == 0)) { - isAntecedent = B_TRUE; - /* - * If a value was passed in with pRole and it does not match - * the role that pObjectName actually is then log an invalid - * param error. - */ - if (pRole != NULL && (strcasecmp(pRole, ANTECEDENT) != 0)) { - util_handleError("SOLARIS_NFSMOUNT::ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - } else { - isAntecedent = B_FALSE; - if (pRole != NULL && (strcasecmp(pRole, DEPENDENT) != 0)) { - util_handleError("SOLARIS_NFSMOUNT::ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - } - - mountList = get_associated_nfs_mntlist(isAntecedent, name); - if (mountList == NULL) - return ((CCIMInstanceList *)NULL); - returnInstList = get_associated_instances(mountList, (!isAntecedent)); - nfs_free_mntinfo_list(mountList); - - return (returnInstList); -} /* cp_associators_Solaris_NFSMount */ - -/* - * Method: cp_associatorNames_Solaris_NFSMount - * - * Description: Returns the object paths of the instances on the other side of - * the association which are associated via the Solaris_NFSMount association - * and having the passed in parameter, pObjectName, as the opposite key. - * - * Parameters: - * - CCIMObjectPath *pAssocName - An object path containing information - * about the association that the caller is trying to reach. - * - CCIMObjectPath *pObjectName - The object path which contains the - * information on whose associated objects are to be returned. - * - char *pResultClass - If specified, only return instances that are of - * this class type. - * - char *pRole - If specified, this is the role of the pObjectName - * object path passed in. If this is not valid, NULL is returned. - * - char *pResultRole - If specified, only return instances that are - * playing this role in the association. - * - * Returns: - * - A pointer to a list of Solaris_NFS (if pRole == Antecedent && - * pObjectName is a Solaris_Directory object path) or Solaris_Directory - * (if pRole == DEPENDENT && pObjectName is a Solaris_NFS object path) - * object paths which are associated to the pObjectName parameter. - * - NULL if an error occurred or if there are no instances associated to - * the pObjectName passed in. In the case of an error, the error will be - * logged. - */ -CCIMObjectPathList * -cp_associatorNames_Solaris_NFSMount(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pResultClass, char *pRole, - char *pResultRole) { - - CCIMInstanceList *instList; - CCIMObjectPathList *objPathList; - int err = 0; - - if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { - util_handleError("SOLARIS_NFSMOUNT::ASSOCIATOR_NAMES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMObjectPathList *)NULL); - } - - instList = cp_associators_Solaris_NFSMount(pAssocName, pObjectName, - pResultClass, pRole, pResultRole); - - if (instList != NULL) { - objPathList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objPathList); -} /* cp_associatorNames_Solaris_NFSMount */ - -/* - * Method: cp_references_Solaris_NFSMount - * - * Description: Returns the Solaris_NFSMount instances that have the passed in - * parameter, pObjectName, as one of it's keys. - * - * Parameters: - * - CCIMObjectPath *pAssocName - An object path containing information - * about the association that the caller is trying to reach. - * - CCIMObjectPath *pObjectName - The object path which contains the - * information on whose associated objects are to be returned. - * - char *pRole - If specified, this is the role of the pObjectName - * object path passed in. If this is not valid, NULL is returned. - * - * Returns: - * - A pointer to a list of Solaris_NFSMount instances. - * - NULL if an error occurred or if there are no Solaris_NFSMount - * instances having pObjectName as one of it's keys. - */ -/* ARGSUSED */ -CCIMInstanceList * -cp_references_Solaris_NFSMount(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pRole) { - - CCIMInstanceList *instList; - CCIMPropertyList *propList; - nfs_mntlist_t *mountList; - char *name; - boolean_t isAntecedent = B_FALSE; - int err = 0; - - if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { - util_handleError("SOLARIS_NFSMOUNT::REFERENCES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - /* - * The Name key property is the defining property for each the - * Antecedent (Solaris_Directory) and the Dependent (Solaris_NFS) - * so retrieve that property. - */ - propList = pObjectName->mKeyProperties; - name = (cimchar *)util_getKeyValue(propList, string, NAME, &err); - - if (name == NULL || err != 0) { - /* - * The object path passed in does not have the appropriate - * information. - */ - util_handleError("SOLARIS_NFSMOUNT::ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - if ((strcasecmp(pObjectName->mName, SOLARIS_DIR) == 0)) { - isAntecedent = B_TRUE; - /* - * If a value was passed in with pRole and it does not match - * the role that pObjectName actually is then log an invalid - * param error. - */ - if (pRole != NULL && (strcasecmp(pRole, ANTECEDENT) != 0)) { - util_handleError("SOLARIS_NFSMOUNT::REFERENCES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - } else { - isAntecedent = B_FALSE; - if (pRole != NULL && (strcasecmp(pRole, DEPENDENT) != 0)) { - util_handleError("SOLARIS_NFSMOUNT::REFERENCES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - } - - mountList = get_associated_nfs_mntlist(isAntecedent, name); - if (mountList == NULL) - return ((CCIMInstanceList *)NULL); - instList = create_nfsMount_associations(mountList, &err); - - nfs_free_mntinfo_list(mountList); - - return (instList); -} /* cp_references_Solaris_NFSMount */ - -/* - * Method: cp_referenceNames_Solaris_NFSMount - * - * Description: Returns the Solaris_NFSMount object paths of the instances - * that have the passed in parameter, pObjectName, as one of it's keys. - * - * Parameters: - * - CCIMObjectPath *pAssocName - An object path containing information - * about the association that the caller is trying to reach. - * - CCIMObjectPath *pObjectName - The object path which contains the - * information on whose associated objects are to be returned. - * - char *pRole - If specified, this is the role of the pObjectName - * object path passed in. If this is not valid, NULL is returned. - * - * Returns: - * - A pointer to a list of Solaris_NFSMount object paths. - * - NULL if an error occurred or if there are no Solaris_NFSMount - * instances having pObjectName as one of it's keys. - */ -CCIMObjectPathList * -cp_referenceNames_Solaris_NFSMount(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pRole) { - - CCIMInstanceList *nfsMountInstList; - CCIMObjectPathList *nfsMountOPList; - CCIMException *ex; - int err = 0; - - if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { - util_handleError("SOLARIS_NFSMOUNT::REFERENCES_NAMES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMObjectPathList *)NULL); - } - - nfsMountInstList = cp_references_Solaris_NFSMount(pAssocName, - pObjectName, pRole); - - if (nfsMountInstList == NULL) { - return ((CCIMObjectPathList *)NULL); - } - - nfsMountOPList = cim_createObjectPathList(nfsMountInstList); - if (nfsMountOPList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSMOUNT::REFERENCE_NAMES", - CIM_ERR_FAILED, CREATE_OBJECT_LIST_FAILURE, ex, &err); - cim_freeInstanceList(nfsMountInstList); - return ((CCIMObjectPathList *)NULL); - } - - cim_freeInstanceList(nfsMountInstList); - - return (nfsMountOPList); -} /* cp_referenceNames_Solaris_NFSMount */ - -/* - * Property provider methods - */ - -/* - * Method: cp_getProperty_Solaris_NFSMount - * - * Description: Retrieves a certain property from the instance of - * Solaris_NFSMount on the host that is described by the parameter pOP. - * - * Parameters: - * - CCIMObjectPath *pOP - The object path containing all the - * information needed to find the instance in which the property is to - * be returned. - * - cimchar *pPropName - The name of the property to be found. - * - * Returns: - * - A pointer to the property corresponding to the name passed in with - * pPropName. - * - NULL if an error occurred or if the property doesn't exist. In the - * case of an error, the error will be logged. - */ -CCIMProperty * -cp_getProperty_Solaris_NFSMount(CCIMObjectPath *pOP, cimchar *pPropName) { - CCIMInstance *nfsMountInst; - CCIMProperty *nfsMountProp; - int err = 0; - - if (pOP == NULL || pPropName == NULL) { - util_handleError("SOLARIS_NFSMOUNT::GET_PROPERTY", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMProperty *)NULL); - } - - nfsMountInst = cp_getInstance_Solaris_NFSMount(pOP); - if (nfsMountInst == NULL) { - return ((CCIMProperty *)NULL); - } - - nfsMountProp = cim_getProperty(nfsMountInst, pPropName); - - cim_freeInstance(nfsMountInst); - /* - * If an error occurred in cim_getProperty it will be handled there. - */ - return (nfsMountProp); -} /* cp_getProperty_Solaris_NFSMount */ - -/* - * Method: cp_setProperty_Solaris_NFSMount - * - * Description: This method is not supported. This is not allowed because in - * order to change the properties of a mount on the host, the mount must be - * unmounted and mounted with the new properties. This behavior is not - * appropriate for the set property. If the client wants to change the - * properties of a mount they must delete the old instance and create a - * new one with the desired properties. - * - * Parameters: - * - CCIMObjectPath *pOP - Not used. - * - CCIMProperty *pProp - Not used. - * - * Returns: - * - cim_false is returned every time since the method is not supported. - */ -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_NFSMount(CCIMObjectPath *pOP, CCIMProperty *pProp) { - int err = 0; - - util_handleError("SOLARIS_NFSMOUNT::SET_PROPERTY", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_setProperty_Solaris_NFSMount */ - -/* - * Method provider methods - */ - -/* - * Method: cp_invokeMethod_Solaris_NFSMount - * - * Description: Routes the cp_invokeMethod_Solaris_NFSMount calls to the - * correct Solaris_NFSMount methods. - * - * Parameters: - * - CCIMObjectPath *pOP - The object path containing needed information - * about the class that is to getting methods invoked. - * - cimchar *functionName - The name of the function to be invoked. - * - CCIMPropertyList *inParams - The input parameters to the function. - * - CCIMPropertyList *outParams - The output parameters from the function. - * - * Returns: - * - A pointer to a property which indicates success or failure of the - * function. 1 for success, 0 for failure. - * - Upon error, NULL is returned and the error is logged. - */ -/* ARGSUSED */ -CCIMProperty * -cp_invokeMethod_Solaris_NFSMount(CCIMObjectPath *pOP, cimchar *functionName, - CCIMPropertyList *inParams, CCIMPropertyList *outParams) { - - int err = 0; - CCIMProperty *retVal; - - if (pOP == NULL || functionName == NULL) { - util_handleError("SOLARIS_NFSMOUNT::INVOKE_METHOD", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMProperty *)NULL); - } - cim_logDebug("cp_invokeMethod_Solaris_NFSMount", - "Invoking %s", functionName); - /* - * Determine what method is being called. - */ - if (strcasecmp(functionName, GET_NET_CFG_LIST_METHOD) == 0) { - retVal = get_netconfig_list(outParams); - } else if (strcasecmp(functionName, GET_NFS_SEC_LIST_METHOD) == 0) { - retVal = get_nfssec_list(outParams); - } else if (strcasecmp(functionName, GET_DEF_SECMODE_METHOD) == 0) { - retVal = get_default_secmode(outParams); - } else if (strcasecmp(functionName, SHOW_EXPORTS_METHOD) == 0) { - retVal = show_exports(inParams, outParams); - } else if (strcasecmp(functionName, DELETE_VFSTAB_ENT_METHOD) == 0) { - retVal = delete_vfstab_entry(inParams); - } else { - /* - * No such method name. - */ - util_handleError("SOLARIS_NFSMOUNT::INVOKE_METHOD", - CIM_ERR_FAILED, NO_SUCH_METHOD, NULL, &err); - return ((CCIMProperty *)NULL); - } - - return (retVal); -} /* cp_invokeMethod_Solaris_NFSMount */ - -/* - * Private Methods - */ - -/* - * Method: create_nfsMount_associations - * - * Description: Creates Solaris_NFSMount associations out of the information - * gathered from all the NFS mounts on the host. - * - * Parameters: - * - nfs_mntlist_t *mountList - The list of nfs mounts on the host. - * - int *errp - The error pointer. If an error occurs, this will be a - * non-zero number. - * - * Returns: - * - A pointer to a list of all the Solaris_NFSMount instances on the host. - * - NULL if an error occurred or if there aren't any NFS mounts on the - * host. In the case of an error, the error will be logged. - */ -static CCIMInstanceList * -create_nfsMount_associations(nfs_mntlist_t *mountList, int *errp) { - nfs_mntlist_t *currentMnt; - CCIMInstanceList *nfsMountInstList; - CCIMException *ex; - - nfsMountInstList = cim_createInstanceList(); - if (nfsMountInstList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSMOUNT::CREATE_NFSMOUNT_ASSOC", - CIM_ERR_FAILED, CREATE_INSTANCE_LIST_FAILURE, ex, - errp); - return ((CCIMInstanceList *)NULL); - } - - for (currentMnt = mountList; currentMnt != NULL; - currentMnt = currentMnt->next) { - - CCIMInstance *nfsMountInst; - CCIMPropertyList *nfsMountPropList; - - /* - * Create the Solaris_NFSMount instance and add the properties - * to the instance. - */ - nfsMountInst = cim_createInstance(SOLARIS_NFSMOUNT); - if (nfsMountInst == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSMOUNT::CREATE_NFSMOUNT_ASSOC", - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, - ex, errp); - cim_freeInstanceList(nfsMountInstList); - return ((CCIMInstanceList *)NULL); - } - - nfsMountPropList = populate_property_list(currentMnt); - if (nfsMountPropList == NULL) { - /* - * An error was encountered, but it was logged in - * populate_property_list so just return null. - */ - cim_freeInstanceList(nfsMountInstList); - cim_freeInstance(nfsMountInst); - return ((CCIMInstanceList *)NULL); - } - - /* - * Add the returned property list to the instance. - */ - nfsMountInst = cim_addPropertyListToInstance(nfsMountInst, - nfsMountPropList); - if (nfsMountInst == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSMOUNT::CREATE_NFSMOUNT_ASSOC", - CIM_ERR_FAILED, PROPLIST_TO_INSTANCE_FAILURE, - ex, errp); - cim_freeInstanceList(nfsMountInstList); - cim_freePropertyList(nfsMountPropList); - return ((CCIMInstanceList *)NULL); - } - - /* - * Add the instance to the instance list. - */ - nfsMountInstList = cim_addInstance(nfsMountInstList, - nfsMountInst); - if (nfsMountInstList == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSMOUNT::CREATE_NFSMOUNT_ASSOC", - CIM_ERR_FAILED, ADD_INSTANCE_FAILURE, - ex, errp); - /* - * Freeing the instance will free the property list - * that was added to it. There is no need to free - * the property list separately. - */ - cim_freeInstance(nfsMountInst); - return ((CCIMInstanceList *)NULL); - } - } - - return (nfsMountInstList); -} /* create_nfsMount_associations */ - -/* - * Method: enumerate_mounts - * - * Description: Enumerates the NFS mounts on the host by using the - * nfs_mntinfo nfs_get_mount_list method. - * - * Parameters: - * - NONE - * - * Returns: - * - A pointer to a list of all the Solaris_NFSMount instances on the host. - * - NULL if an error occurred or if there are no NFS mounts on the system. - * In the case of an error, the error will be logged. - */ -static CCIMInstanceList * -enumerate_mounts() { - int get_mntlist_err = 0; - int err = 0; - nfs_mntlist_t *nfs_mount_list; - - nfs_mount_list = nfs_get_mount_list(&get_mntlist_err); - if (nfs_mount_list == NULL) { - /* - * Check whether an error was returned or if we simply don't - * have any nfs file systems on the system. If - * get_mntlist_err is not equal to 0, an error was encountered. - */ - if (get_mntlist_err != 0) { - /* - * Determine the error and log it. - */ - if (get_mntlist_err == ENOMEM || - get_mntlist_err == EAGAIN) { - util_handleError( - "SOLARIS_NFSMOUNT::ENUM_MOUNTS", - CIM_ERR_LOW_ON_MEMORY, - NFS_GET_MNTLIST_FAILURE, - NULL, &err); - - return ((CCIMInstanceList *)NULL); - } else { - /* - * If any other errors were encountered it - * can be handled as a general error. We may - * not know exactly what the error is. - */ - util_handleError( - "SOLARIS_NFSMOUNT::ENUM_MOUNTS", - CIM_ERR_FAILED, - NFS_GET_MNTLIST_FAILURE, - NULL, &err); - - return ((CCIMInstanceList *)NULL); - } - } - /* - * We simply don't have any nfs mounts on the host. - */ - return ((CCIMInstanceList *)NULL); - - } else { - /* - * At this point, one or more nfs mounts were found on the - * system, create the instance list from the nfs_mount_list. - */ - CCIMInstanceList *nfsMountInstList; - - nfsMountInstList = create_nfsMount_associations(nfs_mount_list, - &err); - - nfs_free_mntinfo_list(nfs_mount_list); - return (nfsMountInstList); - } /* if (nfs_mount_list == NULL) */ - -} /* enumerate_mounts */ - -/* - * Method: get_Antecedent - * - * Description: Creates the Antecedent object path of the Solaris_NFSMount - * class. - * - * Parameters: - * - cimchar *mount_point - the mount point of the nfs mount which is - * used as the Name Key property of the Antecedent, Solaris_Directory. - * - * Returns: - * - The corresponding Solaris_Directory CCIMObjectPath* is returned. - * - Upon error NULL is returned. - * The returned CCIMObjectPath* must be freed by the calling function. - */ -static CCIMObjectPath * -get_Antecedent(cimchar *mount_point) { - CCIMInstance *solarisDirInst; - CCIMObjectPath *solarisDirOP; - CCIMException *ex; - int err; - char *hostname; - - solarisDirInst = cim_createInstance(SOLARIS_DIR); - if (solarisDirInst == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSMOUNT::GET_ANT", - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, &err); - return ((CCIMObjectPath *)NULL); - } - - /* - * Create the key properties on the Solaris_Directory instance. - * - * The Solaris_Directory keys are as follows: - * CSCreationClassName = "Solaris_ComputerSystem" - * CSName = < hostname > - * FSCreationClassName = "Solaris_NFS" - * FSName = "NFS" - * CreationClassName = "Solaris_Directory" - * Name = < full pathname of mount point > - */ - if (add_property_to_instance(CS_CREATION_CLASS, string, - SOLARIS_CS, NULL, cim_true, solarisDirInst) == cim_false) { - - cim_freeInstance(solarisDirInst); - return ((CCIMObjectPath *)NULL); - } - - hostname = sys_get_hostname(&err); - if (hostname == NULL) { - util_handleError("SOLARIS_NFSMOUNT::GET_ANT)", CIM_ERR_FAILED, - GET_HOSTNAME_FAILURE, NULL, &err); - return ((CCIMObjectPath *)NULL); - } - - if (add_property_to_instance(CSNAME, string, hostname, - NULL, cim_true, solarisDirInst) == cim_false) { - - free(hostname); - cim_freeInstance(solarisDirInst); - return ((CCIMObjectPath *)NULL); - } - free(hostname); - - if (add_property_to_instance(FS_CREATION_CLASS, string, - SOLARIS_NFS, NULL, cim_true, solarisDirInst) == cim_false) { - - cim_freeInstance(solarisDirInst); - return ((CCIMObjectPath *)NULL); - } - - if (add_property_to_instance(FSNAME, string, - NFS, NULL, cim_true, solarisDirInst) == cim_false) { - - cim_freeInstance(solarisDirInst); - return ((CCIMObjectPath *)NULL); - } - - if (add_property_to_instance(CREATION_CLASS, string, - SOLARIS_DIR, NULL, cim_true, solarisDirInst) == cim_false) { - - cim_freeInstance(solarisDirInst); - return ((CCIMObjectPath *)NULL); - } - - if (add_property_to_instance(NAME, string, mount_point, - NULL, cim_true, solarisDirInst) == cim_false) { - - cim_freeInstance(solarisDirInst); - return ((CCIMObjectPath *)NULL); - } - - solarisDirOP = cim_createObjectPath(solarisDirInst); - if (solarisDirOP == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSMOUNT::GET_ANT", - CIM_ERR_FAILED, CREATE_OBJECT_PATH_FAILURE, - ex, &err); - cim_freeInstance(solarisDirInst); - return ((CCIMObjectPath *)NULL); - } - - cim_freeInstance(solarisDirInst); - return (solarisDirOP); -} /* get_Antecedent */ - -/* - * Method: get_associated_instances - * - * Description: Gets instances associated to the mounts passed in with - * mountList. - * - * Parameters: - * - nfs_mntlist_t *mountList - The nfs mount list from which to get the - * associated instances. - * - boolean_t resultIsAnt - Whether or not the role that the instance - * returned plays in the association is the Antecedent. - * - * Returns: - * - A pointer to a list of Solaris_NFS or Solaris_Directory instances that - * are associated to the mount passed in with mountList. - * - NULL if an error occurred or if there are no instances that are - * associated to mountList. - */ -static CCIMInstanceList * -get_associated_instances(nfs_mntlist_t *mountList, boolean_t resultIsAnt) { - CCIMInstanceList *returnInstList; - CCIMException *ex; - nfs_mntlist_t *currentMnt; - int err = 0; - - returnInstList = cim_createInstanceList(); - if (returnInstList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSMOUNT::GET_ASSOC_INST", - CIM_ERR_FAILED, CREATE_INSTANCE_LIST_FAILURE, ex, &err); - return ((CCIMInstanceList *)NULL); - } - - for (currentMnt = mountList; currentMnt != NULL; - currentMnt = currentMnt->next) { - /* - * Determine if we are supposed to form the Antecedent or - * Dependent instances by checking the value of resultIsAnt. - */ - if (resultIsAnt == B_FALSE) { - CCIMObjectPath *nfsOP; - CCIMInstance *nfsInst; - - nfsOP = get_Dependent(currentMnt); - if (nfsOP == NULL) { - /* - * An error occurred in get_Dependent and was - * handled there so just return NULL. - */ - cim_freeInstanceList(returnInstList); - return ((CCIMInstanceList *)NULL); - } - - nfsInst = cimom_getInstance(nfsOP, cim_false, - cim_false, cim_false, cim_false, NULL, 0); - - /* - * A NULL return value indicates an error, an empty - * list does not. - */ - if (nfsInst == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSMOUNT::GET_ASSOC_INST", - CIM_ERR_FAILED, CIMOM_GET_INST_FAILURE, - ex, &err); - cim_freeObjectPath(nfsOP); - cim_freeInstanceList(returnInstList); - return ((CCIMInstanceList *)NULL); - } - - cim_freeObjectPath(nfsOP); - - if (nfsInst->mProperties == NULL) { - cim_freeInstanceList(returnInstList); - return ((CCIMInstanceList *)NULL); - } - - /* - * Add the Solaris_NFS instance to the instance - * list to be returned. - */ - returnInstList = cim_addInstance(returnInstList, - nfsInst); - if (returnInstList == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSMOUNT::GET_ASSOC_INST", - CIM_ERR_FAILED, ADD_INSTANCE_FAILURE, - ex, &err); - cim_freeInstance(nfsInst); - return ((CCIMInstanceList *)NULL); - } - } else { - CCIMObjectPath *dirOP; - CCIMInstance *dirInst; - - dirOP = (CCIMObjectPath *)get_Antecedent( - currentMnt->nml_mountp); - - if (dirOP == NULL) { - /* - * An error occurred in get_Antecedent and was - * handled there so just return NULL. - */ - cim_freeInstanceList(returnInstList); - return ((CCIMInstanceList *)NULL); - } - cim_logDebug("get_associated_instances", - "dirOP =%s", dirOP->mName); - - dirInst = cimom_getInstance(dirOP, cim_false, - cim_false, cim_false, cim_false, NULL, 0); - - /* - * A NULL return value means error, an empty list - * does not. - */ - if (dirInst == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSMOUNT::GET_ASSOC_INST", - CIM_ERR_FAILED, CIMOM_GET_INST_FAILURE, - ex, &err); - cim_freeObjectPath(dirOP); - cim_freeInstanceList(returnInstList); - return ((CCIMInstanceList *)NULL); - } - - cim_freeObjectPath(dirOP); - - if (dirInst->mProperties == NULL) { - cim_freeInstance(dirInst); - cim_freeInstanceList(returnInstList); - return ((CCIMInstanceList *)NULL); - } - - /* - * Work around for cimom bug 4649100. - */ - if (!set_dir_keyProperties_to_true(dirInst)) { - cim_freeInstance(dirInst); - cim_freeInstanceList(returnInstList); - return ((CCIMInstanceList *)NULL); - } - - /* - * Add the Solaris_Directory instance to the - * instance list to be returned. - */ - returnInstList = cim_addInstance(returnInstList, - dirInst); - if (returnInstList == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSMOUNT::GET_ASSOC_INST", - CIM_ERR_FAILED, ADD_INSTANCE_FAILURE, - ex, &err); - cim_freeInstance(dirInst); - return ((CCIMInstanceList *)NULL); - } - } - } - - return (returnInstList); -} /* get_associated_instances */ - -/* - * Method: get_associated_nfs_mntlist - * - * Description: Gets a list of mounts, including their information, that have - * the same value as nameKeyValue for the Name property. - * - * Parameters: - * - boolean_t isAntecedent - A boolean value representing whether the - * key value passed in with nameKeyVal is the Antecedent or not. - * - char *nameKeyVal - The value of the Name key. - * - * Returns: - * - A pointer to a list of nfs mounts. - * - NULL if an error occurred or if there are no mounts having the same - * information as passed in with nameKeyVal. - */ -static nfs_mntlist_t * -get_associated_nfs_mntlist(boolean_t isAntecedent, char *nameKeyVal) { - nfs_mntlist_t *mountList; - int err = 0; - - if (isAntecedent) { - /* - * The nameKeyValue is that of the Antecedent, - * Solaris_Directory. - */ - /* - * The Name property is populated with the mount point of the - * nfs file system so we need to determine if the mount point - * exists. - */ - mountList = nfs_get_filtered_mount_list(NULL, nameKeyVal, NULL, - NULL, B_TRUE, &err); - if (mountList == NULL) { - /* - * Check if an error occurred and if it did handle it. - */ - if (err != 0) { - util_handleError( - "SOLARIS_NFSMOUNT::GET_ASSOC_NFSMNTS", - CIM_ERR_FAILED, - NFS_GET_FILTERED_MOUNTS_FAILURE, - NULL, &err); - return (NULL); - } - /* - * If no error occurred then we know that the mount - * point doesn't exist so return NULL. - */ - return (NULL); - } - } else { - char *resource; - char *devid; - char *devMntOpt = "dev="; - char *searchOpt; - int searchOptLen; - - /* - * The nameKeyValue is that of the Dependent, Solaris_NFS. - */ - /* - * Get the resource and devid from the Name key property - * which should be in the form: - * "resource:=< resource > devid:=< devid >" - */ - err = 0; - devid = get_devid(nameKeyVal, &err); - if (devid == NULL) { - util_handleError( - "SOLARIS_NFSMOUNT::GET_ASSOC_NFSMNTS", - CIM_ERR_FAILED, GET_DEVID_FAILURE, NULL, &err); - return (NULL); - } - - cim_logDebug("get_associated_nfs_mntlist", - "isDependent: devid =%s", devid); - err = 0; - resource = get_resource(nameKeyVal, &err); - if (resource == NULL) { - util_handleError( - "SOLARIS_NFSMOUNT::GET_ASSOC_NFSMNTS", - CIM_ERR_FAILED, GET_RESOURCE_FAILURE, NULL, - &err); - free(devid); - return (NULL); - } - - cim_logDebug("get_associated_nfs_mntlist", - "isDependent: resource =%s", resource); - /* - * The devid is unique per file system so we will search for - * the mount that has the corresponding devid. Obviously, - * we only expect to get one file system. - */ - searchOptLen = (strlen(devMntOpt) + strlen(devid) + 1); - - searchOpt = (char *)calloc((size_t)searchOptLen, - (size_t)sizeof (char)); - - if (searchOpt == NULL) { - /* - * Out of memory - */ - free(devid); - free(resource); - return (NULL); - } - - (void) snprintf(searchOpt, (size_t)searchOptLen, "%s%s", - devMntOpt, devid); - cim_logDebug("get_associated_nfs_mntlist", - "isDependent: searchOpt =%s", searchOpt); - - free(devid); - - mountList = nfs_get_mounts_by_mntopt(searchOpt, B_FALSE, &err); - if (mountList == NULL) { - free(resource); - free(searchOpt); - if (err != 0) { - util_handleError( - "SOLARIS_NFSMOUNT::GET_ASSOC_NFSMNTS", - CIM_ERR_FAILED, - NFS_GET_MNTS_BY_MNTOPT_FAILURE, - NULL, &err); - return (NULL); - } - return (NULL); - } - - free(searchOpt); - - /* - * Check that the resource from the pObjectName is the same as - * the one in the mountList. If it is not, return null. - */ - if ((strcmp(resource, mountList->nml_resource) != 0)) { - free(resource); - return (NULL); - } - free(resource); - } - - return (mountList); -} /* get_associated_nfs_mntlist */ - -/* - * Method: get_Dependent - * - * Description: Creates the Dependent object path of the Solaris_NFSMount class - * - * Parameters: - * - nfs_mntlist_t *nfs_mount - The nfs mount to be used for filling in - * the properties of the Dependent, Solaris_NFS. - * - * Returns: - * - A Solaris_NFS CCIMObjectPath* is returned. - * - Upon error, NULL is returned. - */ -static CCIMObjectPath * -get_Dependent(nfs_mntlist_t *nfs_mount) { - CCIMInstance *solarisNFSInst; - CCIMObjectPath *solarisNFSOp; - CCIMException *ex; - char *name_val; - char *devid; - char *resourceStr = "resource:="; - char *devidStr = "devid:="; - char *hostname; - int err = 0; - int name_val_len; - - solarisNFSInst = cim_createInstance(SOLARIS_NFS); - if (solarisNFSInst == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSMOUNT::GET_DEP", - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, &err); - return (NULL); - } - - /* - * Create the key properties on the Solaris_NFS instance. - * - * The Solaris_Directory keys are as follows: - * CSCreationClassName = "Solaris_ComputerSystem" - * CSName = < hostname > - * CreationClassName = "Solaris_NFS" - * Name = resource:=< resource > devid:= < devid > - */ - if (add_property_to_instance(CS_CREATION_CLASS, string, - SOLARIS_CS, NULL, cim_true, solarisNFSInst) == cim_false) { - - cim_freeInstance(solarisNFSInst); - return ((CCIMObjectPath *)NULL); - } - - hostname = sys_get_hostname(&err); - if (hostname == NULL) { - util_handleError("SOLARIS_NFSMOUNT::GET_DEP", CIM_ERR_FAILED, - GET_HOSTNAME_FAILURE, NULL, &err); - cim_freeInstance(solarisNFSInst); - return ((CCIMObjectPath *)NULL); - } - - if (add_property_to_instance(CSNAME, string, hostname, NULL, cim_true, - solarisNFSInst) == cim_false) { - - free(hostname); - cim_freeInstance(solarisNFSInst); - return ((CCIMObjectPath *)NULL); - } - free(hostname); - - if (add_property_to_instance(CREATION_CLASS, string, - SOLARIS_NFS, NULL, cim_true, solarisNFSInst) == cim_false) { - - cim_freeInstance(solarisNFSInst); - return ((CCIMObjectPath *)NULL); - } - - if (nfs_mount != NULL) { - err = 0; - devid = fs_parse_optlist_for_option( - nfs_mount->nml_mntopts, "dev=", &err); - if (devid == NULL) { - util_handleError("SOLARIS_NFSMOUNT::GET_DEP", - CIM_ERR_FAILED, FS_PARSE_OPTLIST_FAILURE, - NULL, &err); - cim_freeInstance(solarisNFSInst); - return ((CCIMObjectPath *)NULL); - } - - name_val_len = strlen(resourceStr) + - strlen(nfs_mount->nml_resource) + strlen(devidStr) + - strlen(devid) + 2; - - name_val = (char *)calloc((size_t)name_val_len, - (size_t)(sizeof (char))); - if (name_val == NULL) { - util_handleError("SOLARIS_NFSMOUNT::GET_DEP", - CIM_ERR_LOW_ON_MEMORY, LOW_MEMORY, NULL, NULL); - cim_freeInstance(solarisNFSInst); - return ((CCIMObjectPath *)NULL); - } - - (void) snprintf(name_val, (size_t)name_val_len, - "%s%s%s%s%s", resourceStr, nfs_mount->nml_resource, " ", - devidStr, devid); - } - - free(devid); - - if (add_property_to_instance(NAME, string, name_val, NULL, - cim_true, solarisNFSInst) == cim_false) { - - cim_freeInstance(solarisNFSInst); - return ((CCIMObjectPath *)NULL); - } - - free(name_val); - - solarisNFSOp = cim_createObjectPath(solarisNFSInst); - - if (solarisNFSOp == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSMOUNT::GET_DEP", - CIM_ERR_FAILED, CREATE_OBJECT_PATH_FAILURE, - ex, &err); - cim_freeInstance(solarisNFSInst); - return (NULL); - } - - cim_freeInstance(solarisNFSInst); - - return (solarisNFSOp); -} /* get_Dependent */ - -/* - * Method: get_devid - * - * Description: - * Parses the Solaris_NFS.Name key property, which is in the - * "resource:=<resource> devid:=<devid>" format, for the devid. - * - * Parameters: - * - char *keyValue - The string which is in the - * "resource:=<resource> devid:=<devid>" format to parse the devid from. - * - int *errp - The error pointer. This will be set to a non-zero number - * if an error is encountered. - * - * Returns: - * - A pointer to a string which is the value of the devid. - * - NULL if the devid is not found or if an error occurred. In the case - * of an error, errp will be set to a non-zero number. - * - * NOTE: - * The caller must free the memory allocated for the return string. - */ -char * -get_devid(char *keyValue, int *errp) { - char *devidMarker = "devid:="; - char *devidMarkerStart; - char *devidStart; - char *devid; - - devidMarkerStart = strstr(keyValue, devidMarker); - if (devidMarkerStart == NULL) { - return (NULL); - } - - devidStart = devidMarkerStart + strlen(devidMarker); - devid = strdup(devidStart); - if (devid == NULL) { - *errp = errno; - return (NULL); - } - - return (devid); -} /* get_devid */ - -/* - * Method: get_resource - * - * Description: - * Parses the Solaris_NFS.Name key property, which is in the - * "resource:=<resource> devid:=<devid>" format, for the resource. - * - * Parameters: - * - char *keyValue - The string which is in the - * "resource:=<resource> devid:=<devid>" format to parse the resource from. - * - int *errp - The error pointer. This will be set to a non-zero number - * if an error is encountered. - * - * Returns: - * - A pointer to a string which is the value of the resource. - * - NULL if the resource is not for or if an error occurred. In the case - * of an error, errp will be set to a non-zero number. - * NOTE: - * The caller must free the memory allocated for the return string. - */ -static char * -get_resource(char *keyValue, int *errp) { - char *devid; - char *devidStr = "devid:="; - char *resource; - char *resourceStr = "resource:="; - int totalDevidLen = 0, keyValueLen = 0, resourceLen = 0, - resourceStrLen = 0, i = 0; - int err = 0; - - /* - * First we need to get the devid string portion of the Solaris_NFS.Name - * key value in order to figure out how long that portion is. - */ - devid = get_devid(keyValue, &err); - if (devid == NULL) { - *errp = err; - return (NULL); - } - - totalDevidLen = strlen(devidStr) + strlen(devid); - - keyValueLen = strlen(keyValue); - resourceStrLen = strlen(resourceStr); - - /* - * The length of the space character between the resource and devid - * is not taken out here for the fact that we will use that space in - * order to allocate enough space for the null terminating character. - */ - resourceLen = keyValueLen - totalDevidLen - resourceStrLen; - resourceLen = strlen(keyValue) - (strlen(devidStr) + strlen(devid)) - - strlen(resourceStr); - - resource = (char *)calloc((size_t)resourceLen, (size_t)sizeof (char)); - if (resource == NULL) { - *errp = errno; - return (NULL); - } - - for (i = 0; i < (resourceLen - 1); i++) { - resource[i] = keyValue[resourceStrLen+i]; - } - - /* - * Make sure to put the null terminating character at the end. - */ - resource[resourceLen-1] = '\0'; - - free(devid); - return (resource); -} /* get_resource */ - -/* - * Method: populate_property_list - * - * Description: Populates all the properties of the passed in mount into a - * property list. - * - * Parameters: - * - nfs_mntlist_t *nfs_mount - The nfs mount to retrieve the properties - * from. - * - * Returns: - * - A pointer to a list of properties that correspond to the properties of - * nfs_mount. - * - Upon error, NULL is returned and the error is logged. - */ -static CCIMPropertyList * -populate_property_list(nfs_mntlist_t *nfs_mount) { - CCIMException *ex; - CCIMPropertyList *nfsMountPropList; - CCIMObjectPath *antOP; - CCIMObjectPath *depOP; - cimchar **propValues; - int i = 0; - int err = 0; - - nfsMountPropList = cim_createPropertyList(); - if (nfsMountPropList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSMOUNT::POPULATE_PROPLIST", - CIM_ERR_FAILED, CREATE_PROPLIST_FAILURE, ex, &err); - return ((CCIMPropertyList *)NULL); - } - - /* - * Create the CCIMProperties for this instance - */ - - /* - * Antecedent - */ - antOP = get_Antecedent(nfs_mount->nml_mountp); - if (antOP == NULL) { - cim_freePropertyList(nfsMountPropList); - return ((CCIMPropertyList *)NULL); - } - nfsMountPropList = add_property_to_list(nfsMountProps[ANT].name, - nfsMountProps[ANT].type, NULL, antOP, nfsMountProps[ANT].isKey, - nfsMountPropList); - - /* - * Dependent - */ - depOP = get_Dependent(nfs_mount); - if (depOP == NULL) { - cim_freePropertyList(nfsMountPropList); - return ((CCIMPropertyList *)NULL); - } - nfsMountPropList = add_property_to_list(nfsMountProps[DEP].name, - nfsMountProps[DEP].type, NULL, depOP, nfsMountProps[DEP].isKey, - nfsMountPropList); - - propValues = calloc((size_t)PROPCOUNT, (size_t)sizeof (cimchar *)); - if (propValues == NULL) { - util_handleError("SOLARIS_NFSMOUNT::POPULATE_PROPLIST", - CIM_ERR_LOW_ON_MEMORY, LOW_MEMORY, NULL, &err); - return ((CCIMPropertyList *)NULL); - } - - if (populate_property_values(nfs_mount, propValues) == cim_false) { - fileutil_free_string_array(propValues, PROPCOUNT); - cim_freePropertyList(nfsMountPropList); - return ((CCIMPropertyList *)NULL); - } - - for (i = 0; i < PROPCOUNT; i++) { - if (i == ANT || i == DEP) { - continue; - } - nfsMountPropList = add_property_to_list(nfsMountProps[i].name, - nfsMountProps[i].type, propValues[i], NULL, - nfsMountProps[i].isKey, nfsMountPropList); - if (nfsMountPropList == NULL) { - fileutil_free_string_array(propValues, PROPCOUNT); - return ((CCIMPropertyList *)NULL); - } - } - - fileutil_free_string_array(propValues, PROPCOUNT); - return (nfsMountPropList); -} /* populate_property_list */ - -static CIMBool -populate_property_values(nfs_mntlist_t *nfs_mount, - cimchar **propValues) { - - fs_mntdefaults_t vfstab_filter; - fs_mntdefaults_t *vfstab_entry; - boolean_t readonly; - boolean_t optHasEquals; - char *enableQuota, *failoverList, *noSuid, - *posix, *public, *port; - cimchar propValue[MAXSIZE]; - int defaultValue = 0; - int err = 0; - - /* - * AttributeCaching - */ - (void) snprintf(propValue, MAXSIZE, "%d", !(nfs_mount->nml_noac)); - propValues[ATTRCACHE] = strdup(propValue); - if (propValues[ATTRCACHE] == NULL) { - return (cim_false); - } - - /* - * AttributeCachingForDirectoriesMax - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_acdirmax); - propValues[ATTRCACHEDIRMAX] = strdup(propValue); - if (propValues[ATTRCACHEDIRMAX] == NULL) { - return (cim_false); - } - - /* - * AttributeCachingForDirectoriesMin - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_acdirmin); - propValues[ATTRCACHEDIRMIN] = strdup(propValue); - if (propValues[ATTRCACHEDIRMIN] == NULL) { - return (cim_false); - } - - /* - * AttributeCachingForRegularFilesMax - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_acregmax); - propValues[ATTRCACHEFILESMAX] = strdup(propValue); - if (propValues[ATTRCACHEFILESMAX] == NULL) { - return (cim_false); - } - - /* - * AttributeCachingForRegularFilesMin - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_acregmin); - propValues[ATTRCACHEFILESMIN] = strdup(propValue); - if (propValues[ATTRCACHEFILESMIN] == NULL) { - return (cim_false); - } - - /* - * EnableQuotaChecking - */ - optHasEquals = B_FALSE; - enableQuota = get_property_from_opt_string(nfs_mount->nml_mntopts, - "quota", optHasEquals, defaultValue); - if (enableQuota == NULL) { - return (cim_false); - } - propValues[ENABLEQUOTA] = strdup(enableQuota); - if (propValues[ENABLEQUOTA] == NULL) { - return (cim_false); - } - free(enableQuota); - - /* - * FailoverList - */ - failoverList = cim_encodeStringArray(nfs_mount->nml_failoverlist, - nfs_mount->nml_failovercount); - if (failoverList == NULL) { - cim_logDebug("populate_property_values", "encoding FAILED"); - return (cim_false); - } - propValues[FAILOVER] = strdup(failoverList); - if (propValues[FAILOVER] == NULL) { - return (cim_false); - } - - /* - * ForceDirectIO - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_directio); - propValues[FORCEDIRECTIO] = strdup(propValue); - if (propValues[FORCEDIRECTIO] == NULL) { - return (cim_false); - } - - /* - * FsType - */ - propValues[FSTYPE] = strdup(nfs_mount->nml_fstype); - if (propValues[FSTYPE] == NULL) { - return (cim_false); - } - - /* - * GroupId - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_grpid); - propValues[GRPID] = strdup(propValue); - if (propValues[GRPID] == NULL) { - return (cim_false); - } - - /* - * HardMount - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_hard); - propValues[HARDMNT] = strdup(propValue); - if (propValues[HARDMNT] == NULL) { - return (cim_false); - } - - /* - * Interrupt - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_intr); - propValues[INTR] = strdup(propValue); - if (propValues[INTR] == NULL) { - return (cim_false); - } - - /* - * MaxRetransmissionAttempts - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_retrans); - propValues[MAXRETRANSATTEMPTS] = strdup(propValue); - if (propValues[MAXRETRANSATTEMPTS] == NULL) { - return (cim_false); - } - - /* - * MountAtBootEntry - Deprecated - */ - vfstab_filter.resource = nfs_mount->nml_resource; - vfstab_filter.fsckdevice = NULL; - vfstab_filter.mountp = nfs_mount->nml_mountp; - vfstab_filter.fstype = nfs_mount->nml_fstype; - vfstab_filter.fsckpass = NULL; - vfstab_filter.mountatboot = NULL; - vfstab_filter.mntopts = NULL; - - err = 0; - /* - * The space allocated for the value returned by - * fs_get_filtered_mount_defaults is freed later in this function - * because it is needed to set the value of the VfstabEntry property. - */ - vfstab_entry = fs_get_filtered_mount_defaults(&vfstab_filter, &err); - if (vfstab_entry == NULL) { - if (err != 0) { - util_handleError("SOLARIS_NFSMOUNT::POPULATE_PROPLIST", - CIM_ERR_FAILED, - FS_GET_FILTERED_MNTDEFAULTS_FAILURE, NULL, - &err); - return (cim_false); - } - (void) snprintf(propValue, (size_t)MAXSIZE, "%d", B_FALSE); - } else { - /* - * The possible values in the mount at boot field are "yes", - * "no" and "-". The "-" character, although it is not likely - * to be used, will be interpretted as the mount is to not be - * mounted at boot. "-" is used when a field does not apply to - * the resource being mounted. - */ - if (strcasecmp(vfstab_entry->mountatboot, "yes") == 0) { - (void) snprintf(propValue, (size_t)MAXSIZE, "%d", - B_TRUE); - } else { - (void) snprintf(propValue, (size_t)MAXSIZE, "%d", - B_FALSE); - } - } - propValues[MNTATBOOTENTRY] = strdup(propValue); - if (propValues[MNTATBOOTENTRY] == NULL) { - return (cim_false); - } - - /* - * MountOptions - */ - propValues[MNTOPTS] = strdup(nfs_mount->nml_mntopts); - if (propValues[MNTOPTS] == NULL) { - return (cim_false); - } - - /* - * MountFailureRetries - This value is only valid upon creation of an - * instance of Solaris_NFSMount. This is actually a mount _process_ - * option and not a mount option. - */ - - /* - * NoCloseToOpenConsistency - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_nocto); - propValues[NOCTO] = strdup(propValue); - if (propValues[NOCTO] == NULL) { - return (cim_false); - } - - /* - * NoMnttabEntry - This will always be false for every nfs mount that - * is shown in the CIM/WBEM interface because there is no way to - * programatically determine a file system that is mounted if it is not - * in /etc/mnttab. If it is not in /etc/mnttab, it is like that for a - * reason and is also an argument for not showing the existense of - * those file systems. - */ - (void) snprintf(propValue, (size_t)MAXSIZE, "%d", B_FALSE); - propValues[NOMNTTABENT] = strdup(propValue); - if (propValues[NOMNTTABENT] == NULL) { - return (cim_false); - } - - /* - * NoSuid - */ - optHasEquals = B_FALSE; - noSuid = get_property_from_opt_string(nfs_mount->nml_mntopts, - "nosuid", optHasEquals, defaultValue); - if (noSuid == NULL) { - return (cim_false); - } - propValues[NOSUID] = strdup(noSuid); - if (propValues[NOSUID] == NULL) { - return (cim_false); - } - free(noSuid); - - /* - * Overlay - This is a property which is only valid upon creation of a - * Solaris_NFSMount instance. It specifies that the file system to be - * mounted should be mounted on top of another existing mounted file - * system. - */ - - /* - * Overlayed - */ - /* - * We must do some magic here with determining an overlayed file system. - * We must check for mounts with the same mount point and determine - * which is further down in the mnttab list to determine the top most - * file system. This is all done in the fs_mounts interface. - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_overlayed); - propValues[OVERLAYED] = strdup(propValue); - if (propValues[OVERLAYED] == NULL) { - return (cim_false); - } - - /* - * Posix - */ - optHasEquals = B_FALSE; - posix = get_property_from_opt_string(nfs_mount->nml_mntopts, "posix", - optHasEquals, defaultValue); - if (posix == NULL) { - return (cim_false); - } - propValues[POSIX] = strdup(posix); - if (propValues[POSIX] == NULL) { - return (cim_false); - } - free(posix); - - /* - * Protocol - */ - propValues[PROTO] = strdup(nfs_mount->nml_proto); - if (propValues[PROTO] == NULL) { - return (cim_false); - } - - /* - * Public - */ - optHasEquals = B_FALSE; - public = get_property_from_opt_string(nfs_mount->nml_mntopts, - "public", optHasEquals, defaultValue); - if (public == NULL) { - return (cim_false); - } - propValues[PUBLIC] = strdup(public); - if (propValues[PUBLIC] == NULL) { - return (cim_false); - } - free(public); - - /* - * ReadBufferSize - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_curread); - propValues[READBUFFSIZE] = strdup(propValue); - if (propValues[READBUFFSIZE] == NULL) { - return (cim_false); - } - - /* - * ReadOnly - */ - readonly = fs_is_readonly(nfs_mount->nml_mountp, &err); - if (err != 0) { - return (cim_false); - } - (void) snprintf(propValue, (size_t)MAXSIZE, "%d", readonly); - propValues[READONLY] = strdup(propValue); - if (propValues[READONLY] == NULL) { - return (cim_false); - } - - /* - * ReplicatedResources - Deprecated. - */ - /* - * This is the same as the FailoverList so we can use the value used - * to create that property (failoverList). - */ - propValues[REPLRESOURCES] = strdup(failoverList); - if (propValues[REPLRESOURCES] == NULL) { - free(failoverList); - return (cim_false); - } - free(failoverList); - - /* - * RetransmissionTimeout - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_timeo); - propValues[RETRANSTIMEO] = strdup(propValue); - if (propValues[RETRANSTIMEO] == NULL) { - return (cim_false); - } - - /* - * RetryInForeground - This value is only valid upon creation of an - * instance of Solaris_NFSMount. This is actually a mount _process_ - * option and not a mount option. - */ - - /* - * SecurityMode - */ - if (nfs_mount->nml_securitymode == NULL) { - cim_logDebug("populate_property_value", "secmode == NULL"); - } else { - cim_logDebug("populate_property_value", "secmode =%s", - nfs_mount->nml_securitymode); - } - - if (nfs_mount->nml_securitymode != NULL) { - propValues[SECMODE] = strdup(nfs_mount->nml_securitymode); - if (propValues[SECMODE] == NULL) { - return (cim_false); - } - } - - /* - * ServerCommunicationPort - */ - optHasEquals = B_TRUE; - defaultValue = NFS_PORT; - port = get_property_from_opt_string(nfs_mount->nml_mntopts, "port=", - optHasEquals, defaultValue); - if (port == NULL) { - return (cim_false); - } - propValues[SERVERCOMMPORT] = strdup(port); - if (propValues[SERVERCOMMPORT] == NULL) { - return (cim_false); - } - free(port); - - /* - * ServerName - */ - propValues[SERVERNAME] = strdup(nfs_mount->nml_curserver); - if (propValues[SERVERNAME] == NULL) { - return (cim_false); - } - - /* - * ServerPath - */ - propValues[SERVERPATH] = strdup(nfs_mount->nml_curpath); - if (propValues[SERVERPATH] == NULL) { - return (cim_false); - } - - /* - * Version - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_vers); - propValues[VERS] = strdup(propValue); - if (propValues[VERS] == NULL) { - return (cim_false); - } - - /* - * VfstabEntry - */ - /* - * The vfstab_entry variable is retrieved from the - * fs_get_filtered_mount_defaults call when populating the - * MountAtBootEntry property. - */ - if (vfstab_entry == NULL) { - (void) snprintf(propValue, MAXSIZE, "%d", B_FALSE); - } else { - (void) snprintf(propValue, MAXSIZE, "%d", B_TRUE); - fs_free_mntdefaults_list(vfstab_entry); - } - propValues[VFSTABENTRY] = strdup(propValue); - if (propValues[VFSTABENTRY] == NULL) { - return (cim_false); - } - - /* - * WriteBufferSize - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_curwrite); - propValues[WRITEBUFFSIZE] = strdup(propValue); - if (propValues[WRITEBUFFSIZE] == NULL) { - return (cim_false); - } - - /* - * Xattr - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_xattr); - propValues[XATTR] = strdup(propValue); - if (propValues[XATTR] == NULL) { - return (cim_false); - } - - cim_logDebug("populate_property_values", "returning cim_true"); - return (cim_true); -} /* populate_property_values */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_NFSMount.h b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_NFSMount.h deleted file mode 100644 index ff6826cede..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_NFSMount.h +++ /dev/null @@ -1,189 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOLARIS_NFSMOUNT_H -#define _SOLARIS_NFSMOUNT_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> -#include <cp_required.h> -#include <cp_instance.h> -#include <cp_associator.h> -#include <cp_method.h> -#include <cp_property.h> -#include <cimomhandle.h> -#include <cimeventsvc.h> -#include <cimlogsvc.h> -#include "nfsprov_include.h" -#include "nfs_mount_attr.h" - -#define PROPCOUNT 39 - -static nfs_prov_prop_plus_optVals_t nfsMountProps[] = { -#define ANT 0 - {"Antecedent", cim_true, reference, NULL, NULL, NULL}, - -#define ATTRCACHE (ANT + 1) - {"AttributeCaching", cim_false, boolean, NULL, NFS_ATTRCACHE_FALSE, - NULL}, - -#define ATTRCACHEDIRMAX (ATTRCACHE + 1) - {"AttributeCachingForDirectoriesMax", cim_false, uint16, NULL, NULL, - NFS_ATTRCACHEDIRMAX}, - -#define ATTRCACHEDIRMIN (ATTRCACHEDIRMAX + 1) - {"AttributeCachingForDirectoriesMin", cim_false, uint16, NULL, NULL, - NFS_ATTRCACHEDIRMIN}, - -#define ATTRCACHEFILESMAX (ATTRCACHEDIRMIN + 1) - {"AttributeCachingForRegularFilesMax", cim_false, uint16, NULL, NULL, - NFS_ATTRCACHEFILESMAX}, - -#define ATTRCACHEFILESMIN (ATTRCACHEFILESMAX + 1) - {"AttributeCachingForRegularFilesMin", cim_false, uint16, NULL, NULL, - NFS_ATTRCACHEFILESMIN}, - -#define DEP (ATTRCACHEFILESMIN + 1) - {"Dependent", cim_true, reference, NULL, NULL, NULL}, - -#define ENABLEQUOTA (DEP + 1) - {"EnableQuotaChecking", cim_false, boolean, NFS_ENABLEQUOTA_TRUE, - NFS_ENABLEQUOTA_FALSE, NULL}, - -#define FAILOVER (ENABLEQUOTA + 1) - {"FailoverList", cim_false, string_array, NULL, NULL, NULL}, - -#define FORCEDIRECTIO (FAILOVER + 1) - {"ForceDirectIO", cim_false, boolean, NFS_FORCEDIRECTIO_TRUE, - NFS_FORCEDIRECTIO_FALSE, NULL}, - -#define FSTYPE (FORCEDIRECTIO + 1) - {"FsType", cim_false, string, NULL, NULL, NULL}, - -#define GRPID (FSTYPE + 1) - {"GroupId", cim_false, boolean, NFS_GRPID_TRUE, NULL, NULL}, - -#define HARDMNT (GRPID + 1) - {"HardMount", cim_false, boolean, NFS_HARDMNT_TRUE, NFS_HARDMNT_FALSE, - NULL}, - -#define INTR (HARDMNT + 1) - {"Interrupt", cim_false, boolean, NFS_INTR_TRUE, NFS_INTR_FALSE, NULL}, - -#define MAXRETRANSATTEMPTS (INTR + 1) - {"MaxRetransmissionAttempts", cim_false, uint16, NULL, NULL, - NFS_MAXRETRANSATTEMPTS}, - -#define MNTATBOOTENTRY (MAXRETRANSATTEMPTS + 1) - {"MountAtBootEntry", cim_false, boolean, NULL, NULL, NULL}, - -#define MNTOPTS (MNTATBOOTENTRY + 1) - {"MountOptions", cim_false, string, NULL, NULL, NULL}, - -#define MNTFAILRETRIES (MNTOPTS + 1) - {"MountFailureRetries", cim_false, uint16, NULL, NULL, - NFS_MNTFAILRETRIES}, - -#define NOCTO (MNTFAILRETRIES + 1) - {"NoCloseToOpenConsistency", cim_false, boolean, NFS_NOCTO_TRUE, NULL, - NULL}, - -#define NOMNTTABENT (NOCTO + 1) - {"NoMnttabEntry", cim_false, boolean, NULL, NULL, NULL}, - -#define NOSUID (NOMNTTABENT + 1) - {"NoSuid", cim_false, boolean, NFS_NOSUID_TRUE, NFS_NOSUID_FALSE, - NULL}, - -#define OVERLAY (NOSUID + 1) - {"Overlay", cim_false, boolean, NULL, NULL, NULL}, - -#define OVERLAYED (OVERLAY + 1) - {"Overlayed", cim_false, boolean, NULL, NULL, NULL}, - -#define POSIX (OVERLAYED + 1) - {"Posix", cim_false, boolean, NFS_POSIX_TRUE, NULL, NULL}, - -#define PROTO (POSIX + 1) - {"Protocol", cim_false, string, NULL, NULL, NFS_PROTO}, - -#define PUBLIC (PROTO + 1) - {"Public", cim_false, boolean, NFS_PUBLIC_TRUE, NULL, NULL}, - -#define READBUFFSIZE (PUBLIC + 1) - {"ReadBufferSize", cim_false, uint64, NULL, NULL, NFS_READBUFFSIZE}, - -#define READONLY (READBUFFSIZE + 1) - {"ReadOnly", cim_false, boolean, NFS_READONLY_TRUE, NFS_READONLY_FALSE, - NULL}, - -#define REPLRESOURCES (READONLY + 1) - {"ReplicatedResources", cim_false, string_array, NULL, NULL, NULL}, - -#define RETRANSTIMEO (REPLRESOURCES + 1) - {"RetransmissionTimeout", cim_false, uint32, NULL, NULL, - NFS_RETRANSTIMEO}, - -#define FOREGROUND (RETRANSTIMEO + 1) - {"RetryInForeground", cim_false, boolean, NFS_FOREGROUND_TRUE, - NFS_FOREGROUND_FALSE, NULL}, - -#define SECMODE (FOREGROUND + 1) - {"SecurityMode", cim_false, string, NULL, NULL, NFS_SECMODE}, - -#define SERVERCOMMPORT (SECMODE + 1) - {"ServerCommunicationPort", cim_false, uint32, NULL, NULL, - NFS_SERVERCOMMPORT}, - -#define SERVERNAME (SERVERCOMMPORT + 1) - {"ServerName", cim_false, string, NULL, NULL, NULL}, - -#define SERVERPATH (SERVERNAME + 1) - {"ServerPath", cim_false, string, NULL, NULL, NULL}, - -#define VERS (SERVERPATH + 1) - {"Version", cim_false, string, NULL, NULL, NFS_VERS}, - -#define VFSTABENTRY (VERS + 1) - {"VfstabEntry", cim_false, boolean, NULL, NULL, NULL}, - -#define WRITEBUFFSIZE (VFSTABENTRY + 1) - {"WriteBufferSize", cim_false, uint64, NULL, NULL, NFS_WRITEBUFFSIZE}, - -#define XATTR (WRITEBUFFSIZE + 1) - {"Xattr", cim_false, boolean, NFS_XATTR_TRUE, NFS_XATTR_FALSE, NULL} -}; - -#ifdef __cplusplus -} -#endif - -#endif /* _SOLARIS_NFSMOUNT_H */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_NFSShareEntry.c b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_NFSShareEntry.c deleted file mode 100644 index 7e91f2bee0..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_NFSShareEntry.c +++ /dev/null @@ -1,1329 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "Solaris_NFSShareEntry.h" -#include "nfs_keys.h" -#include "nfs_providers_msgstrings.h" -#include "nfs_provider_names.h" -#include "messageStrings.h" -#include "util.h" -#include "common_functions.h" -#include "createprop_methods.h" -#include "libfsmgt.h" - -#define COMMAND "Command" -/* - * Private method declarations - */ -static CCIMInstanceList* create_shareEntry_inst_and_update_list( - CCIMObjectPath *nfsShare, CCIMInstanceList *shareEntInstList); -static CCIMInstanceList* get_associated_nfsShare_instList( - CCIMObjectPath *sharePersistOP); -static CCIMInstanceList* get_associated_sharePersist_instList( - CCIMObjectPath *nfsShareOP); -static CCIMObjectPathList* get_associated_sharePersist_OPList( - CCIMObjectPath *nfsShareOP, int *errp); -static CCIMObjectPath* get_Solaris_NFSShare_OP(char *nameKey); -static CCIMInstance* get_Solaris_PersistentShare_Inst(char *path, - char *command); - -/* - * Public methods - */ - -/* - * Instance provider methods - */ - -/* - * Method: cp_createInstance_Solaris_NFSShareEntry - * - * Description: This method is not supported. It is not supported because in - * order for a Solaris_NFSShareEntry association to exist a corresponding - * Solaris_NFSShare and Solaris_PersistentShare must exist. - * - * Parameters: - * - CCIMObjectPath *hostedShareOP - An object path containing the name of - * the class of which to create an instance of. - * - CCIMInstance *pInst - Not used. - * - * Return Value: - * - Always returns NULL because the method is not supported. - */ -/* ARGSUSED */ -CCIMObjectPath * -cp_createInstance_Solaris_NFSShareEntry(CCIMObjectPath *pOP, - CCIMInstance *pInst) { - - int err = 0; - - util_handleError("SOLARIS_NFSSHAREENT::CREATE_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return ((CCIMObjectPath *)NULL); -} /* cp_createInstance_Solaris_NFSShareEntry */ - -/* - * Method: cp_deleteInstance_Solaris_NFSShareEntry - * - * Description: This method is not supported. It is not supported because in - * order for it to be actually deleted the corresponding Solaris_NFSShare or - * Solaris_PersistentShare would need to be deleted. That action is not - * for this provider. - * - * Parameters: - * - CCIMObjectPath *pOP - An object path containing the - * information about the class of which to delete the instance of. - * - * Return Value: - * - Always returns cim_false because the method is not supported. - */ -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_NFSShareEntry(CCIMObjectPath *pOP) { - int err = 0; - - util_handleError("SOLARIS_NFSSHAREENT::DELETE_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_deleteInstance_Solaris_NFSShareEntry */ - -/* - * Method: cp_enumInstances_Solaris_NFSShareEntry - * - * Description: Enumerates the instances of Solaris_NFSShareEntry on a host. - * An instance of Solaris_NFSShareEntry is an association that links a share to - * it's persistent share entry. - * - * Parameters: - * - CCIMObjectPath *pOP - An object path containing the name of - * the class of which to enumerate the instances of. - * - * Return Value: - * - A pointer to a list of Solaris_NFSShareEntry instances. - * - NULL if an error occurred or if there are no instances of - * Solaris_NFSShareEntry on the host. In the case of an error, the error - * will be logged. - */ - -CCIMInstanceList * -cp_enumInstances_Solaris_NFSShareEntry(CCIMObjectPath *pOP) { - CCIMInstanceList *shareEntryInstList; - CCIMObjectPathList *nfsShareOPList; - CCIMObjectPathList *currentShareOP; - CCIMObjectPath *nfsShareOP; - CCIMException *ex; - int err = 0; - - if (pOP == NULL) { - util_handleError("SOLARIS_NFSSHAREENT::ENUM_INSTANCES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - nfsShareOP = cim_createEmptyObjectPath(SOLARIS_NFSSHARE); - if (nfsShareOP == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHAREENT::ENUM_INSTANCES", - CIM_ERR_FAILED, CREATE_EMPTY_OBJPATH_FAILURE, ex, - &err); - return ((CCIMInstanceList *)NULL); - } - - nfsShareOPList = cimom_enumerateInstanceNames(nfsShareOP, cim_false); - - /* - * A NULL return value means error, an empty list does not. - */ - if (nfsShareOPList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHAREENT::ENUM_INSTANCES", - CIM_ERR_FAILED, CIMOM_ENUM_INSTNAMES_FAILURE, ex, &err); - cim_freeObjectPath(nfsShareOP); - return ((CCIMInstanceList *)NULL); - } - - cim_freeObjectPath(nfsShareOP); - - if (nfsShareOPList->mDataObject == NULL) { - cim_freeObjectPathList(nfsShareOPList); - return ((CCIMInstanceList *)NULL); - } - - shareEntryInstList = cim_createInstanceList(); - if (shareEntryInstList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHAREENT::ENUM_INSTANCES", - CIM_ERR_FAILED, CREATE_INSTANCE_LIST_FAILURE, ex, &err); - cim_freeObjectPathList(nfsShareOPList); - return ((CCIMInstanceList *)NULL); - } - - for (currentShareOP = nfsShareOPList; currentShareOP != NULL; - currentShareOP = currentShareOP->mNext) { - - shareEntryInstList = create_shareEntry_inst_and_update_list( - currentShareOP->mDataObject, shareEntryInstList); - if (shareEntryInstList == NULL) { - cim_freeObjectPathList(nfsShareOPList); - return ((CCIMInstanceList *)NULL); - } - } - - cim_freeObjectPathList(nfsShareOPList); - return (shareEntryInstList); -} /* cp_enumInstances_Solaris_NFSShareEntry */ - -/* - * Method: cp_enumInstanceNames_Solaris_NFSShareEntry - * - * Description: Enumerates all of the instances of Solaris_NFSShareEntry on the - * host. - * - * Parameters: - * - CCIMObjectPath* pOP - An object path containing the name of the - * class of which to enumerate instances of. - * - * Returns: - * - A pointer to a list of Solaris_NFSShareEntry object paths. - * - NULL if an error occurred or if there are no NFS mounts on the host. - * In the case of an error, the error will be logged. - */ -CCIMObjectPathList * -cp_enumInstanceNames_Solaris_NFSShareEntry(CCIMObjectPath *pOP) { - CCIMInstanceList *instList; - CCIMObjectPathList *OPList; - int err = 0; - - if (pOP == NULL) { - util_handleError("SOLARIS_NFSSHAREENT::ENUM_INSTANCENAMES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMObjectPathList *)NULL); - } - - instList = cp_enumInstances_Solaris_NFSShareEntry(pOP); - if (instList == NULL) { - /* - * Either an error occurred or we don't have any - * Solaris_NFSShareEntry instances on the host. - */ - return ((CCIMObjectPathList *)NULL); - } - - OPList = cim_createObjectPathList(instList); - - cim_freeInstanceList(instList); - return (OPList); -} /* cp_enumInstanceNames_Solaris_NFSShareEntry */ - -/* - * Method: cp_execQuery_Solaris_NFSShareEntry - * - * Description: Queries the Solaris_NFSShareEntry instances on the host to find - * those that meet the search criteria. - * - * Parameters: - * - CCIMObjectPath *pOP - An object path containing the name of - * the class of which to query. - * - char *selectClause - Not used. - * - char *nonJoinExp - Not used. - * - char *queryExp - Not used. - * - char *queryLang - Not used. - * - * Returns: - * - A pointer to a list of Solaris_NFSShareEntry instances that match the - * criteria. - * - NULL if an error occurred or if there are no Solaris_NFSShareEntry - * instances that match the criteria. In the case of an error, the error - * will be logged. - * - * NOTE: Currently, there is no WQL parser for the C providers. As a result, - * what is returned to the CIMOM is a list of instances with - * a NULL value at the beginning of the list. This NULL value indicates - * to the CIMOM that it must do the filtering for the client. - */ -/* ARGSUSED */ -CCIMInstanceList * -cp_execQuery_Solaris_NFSShareEntry(CCIMObjectPath *pOP, char *selectClause, - char *nonJoinExp, char *queryExp, char *queryLang) { - - CCIMInstance *emptyInst; - CCIMInstanceList *shareEntryInstList; - CCIMException *ex; - int err = 0; - - if (pOP == NULL) { - util_handleError("SOLARIS_NFSSHAREENT::EXEC_QUERY", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - shareEntryInstList = cp_enumInstances_Solaris_NFSShareEntry(pOP); - if (shareEntryInstList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHAREENT::EXEC_QUERY", - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, &err); - cim_freeInstanceList(shareEntryInstList); - return ((CCIMInstanceList *)NULL); - } - - shareEntryInstList = cim_prependInstance(shareEntryInstList, - emptyInst); - if (shareEntryInstList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHAREENT::EXEC_QUERY", - CIM_ERR_FAILED, PREPEND_INSTANCE_FAILURE, ex, &err); - cim_freeInstance(emptyInst); - return ((CCIMInstanceList *)NULL); - } - - return (shareEntryInstList); -} /* cp_execQuery_Solaris_NFSShareEntry */ - -/* - * Method: cp_getInstance_Solaris_NFSShareEntry - * - * Description: Gets the instance corresponding to the Solaris_NFSShareEntry - * object path passed in. - * - * Parameters: - * - CCIMObjectPath* pOP - An object path containing all the keys of - * the instance that is supposed to be returned. - * - * Returns: - * - A pointer to the Solaris_NFSShareEntry instance corresponding to the - * object path parameter. - * - NULL if an error occurred or if the instance doesn't exist. In the - * case of an error, the error will be logged. - */ -CCIMInstance * -cp_getInstance_Solaris_NFSShareEntry(CCIMObjectPath *pOP) { - CCIMInstanceList *instList; - CCIMInstance *inst; - CCIMObjectPath *setOP; - CCIMObjectPath *elemOP; - CCIMPropertyList *shareEntPropList; - int err = 0; - - if (pOP == NULL || pOP->mKeyProperties == NULL) { - util_handleError("SOLARIS_NFSSHAREENT::GET_INSTANCE", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstance *)NULL); - } - - /* - * Determine if the key values are populated. - */ - shareEntPropList = pOP->mKeyProperties; - setOP = util_getKeyValue(shareEntPropList, shareEntProps[SETTING].type, - shareEntProps[SETTING].name, &err); - elemOP = util_getKeyValue(shareEntPropList, shareEntProps[ELEMENT].type, - shareEntProps[ELEMENT].name, &err); - - if (setOP == NULL || elemOP == NULL || - setOP->mKeyProperties == NULL || - elemOP->mKeyProperties == NULL) { - - util_handleError("SOLARIS_NFSSHAREENT::GET_INSTANCE", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstance *)NULL); - } - - instList = cp_enumInstances_Solaris_NFSShareEntry(pOP); - if (instList == NULL) { - /* - * Either an error occurred or we simply don't have any - * instances of Solaris_NFSShareEntry on the system. In the - * case that an error occurred, it will be handled in - * cp_enumInstances_Solaris_NFSShareEntry. - */ - return ((CCIMInstance *)NULL); - } - - inst = cim_getInstance(instList, pOP); - - cim_freeInstanceList(instList); - return (inst); -} /* cp_getInstance_Solaris_NFSShareEntry */ - -/* - * Method: cp_setInstance_Solaris_NFSShareEntry - * - * Description: This method is not supported. This is not allowed because in - * order to change the properties a Solaris_NFSShareEntry on the host, the - * Solaris_NFSShare and Solaris_PersistentShare must most likely be changed. - * In order to change the associated objects, they need to be changed in those - * providers and not this one. - * - * Parameters: - * - CCIMObjectPath *pOP - An object path containing the name of the class - * of which to set the instance. - * - CCIMInstance *pInst - Not used. - * - * Returns: - * - cim_false is returned every time since the method is not supported. - */ -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_NFSShareEntry(CCIMObjectPath *pOP, CCIMInstance *pInst) { - int err = 0; - - util_handleError("SOLARIS_NFSSHAREENT::SET_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_setInstance_Solaris_NFSShareEntry */ - -/* - * Method: cp_setInstanceWithList_Solaris_NFSShareEntry - * - * Description: This method is not supported. This is not allowed because in - * order to change the properties a Solaris_NFSShareEntry on the host, the - * Solaris_NFSShare and Solaris_PersistentShare must most likely be changed. - * In order to change the associated objects, they need to be changed in those - * providers and not this one. - * - * Parameters: - * - CCIMObjectPath *pOP - An object path containing the name of the class - * of which to set the instance. - * - CCIMInstance *pInst - Not used. - * - * Returns: - * - cim_false is returned every time since the method is not supported. - */ -/* ARGSUSED */ -CIMBool -cp_setInstanceWithList_Solaris_NFSShareEntry(CCIMObjectPath *pOP, - CCIMInstance *pInst, char **props, int num_props) { - - int err = 0; - - util_handleError("SOLARIS_NFSSHAREENT::SET_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_setInstanceWithList_Solaris_NFSShareEntry */ - -/* - * Association provider methods - */ - -/* - * Method: cp_associators_Solaris_NFSShareEntry - * - * Description: Returns the instances associated, via the Solaris_NFSShareEntry - * association, to the pObjectName parameter. - * - * Parameters: - * - CCIMObjectPath *pAssocName - An object path containing the name of - * the association that the caller is trying to reach. - * - CCIMObjectPath *pObjectName - The object path containing information - * (Class Name, Key Properties) about the object whose associated objects - * are to be returned. - * - char *pResultClass - If specified, only return instances that are of - * this class type. - * - char *pRole - If specified, this is the role of the pObjectName - * object path passed in. If this is not valid, NULL is returned. - * - char *pResultRole - If specified, only return instances that are - * playing this role in the association. - * - * Returns: - * - A pointer to a list of Solaris_PersistentShare (if pRole == - * Element && pObjectName is a Solaris_NFSShare object path) or - * Solaris_NFSShare (if pRole == Setting && pObjectName is a - * Solaris_PersistentShare object path) instances which are associated to - * the pObjectName parameter. - * - NULL if an error occurred or if there are no instances associated to - * the pObjectName passed in. In the case of an error, the error will be - * logged. - */ -/* ARGSUSED */ -CCIMInstanceList * -cp_associators_Solaris_NFSShareEntry(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pResultClass, char *pRole, - char *pResultRole) { - - CCIMInstanceList *returnInstList; - int err = 0; - - if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { - util_handleError("SOLARIS_NFSSHAREENT::ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - /* - * Determine whether pObjectname is the Element or the Setting of the - * association. Element = Solaris_NFSShare, - * Setting = Solaris_PersistentShare. - */ - if (strcasecmp(pObjectName->mName, SOLARIS_NFSSHARE) == 0) { - if (pRole != NULL && (strcasecmp(pRole, - shareEntProps[ELEMENT].name) != 0)) { - - util_handleError("SOLARIS_NFSSHAREENT::ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - returnInstList = get_associated_sharePersist_instList( - pObjectName); - } else if (strcasecmp(pObjectName->mName, SOLARIS_PERSISTSHARE) == 0) { - if (pRole != NULL && (strcasecmp(pRole, - shareEntProps[SETTING].name) != 0)) { - - util_handleError("SOLARIS_NFSSHAREENT::ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - returnInstList = get_associated_nfsShare_instList(pObjectName); - } else { - util_handleError("SOLARIS_NFSSHAREENT::ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - return (returnInstList); -} /* cp_associators_Solaris_NFSShareEntry */ - -/* - * Method: cp_associatorNames_Solaris_NFSShareEntry - * - * Description: Returns the object paths of the instances on the other side of - * the association which are associated via the Solaris_NFSShareEntry - * association and having the passed in parameter, pObjectName, as the - * opposite key. - * - * Parameters: - * - CCIMObjectPath *pAssocName - An object path containing information - * about the association that the caller is trying to reach. - * - CCIMObjectPath *pObjectName - The object path which contains the - * information on whose associated objects are to be returned. - * - char *pResultClass - If specified, only return instances that are of - * this class type. - * - char *pRole - If specified, this is the role of the pObjectName - * object path passed in. If this is not valid, NULL is returned. - * - char *pResultRole - If specified, only return instances that are - * playing this role in the association. - * - * Returns: - * - A pointer to a list of Solaris_PersistentShare (if pRole == - * Element && pObjectName is a Solaris_NFSShare object path) or - * Solaris_NFSShare (if pRole == Setting && pObjectName is a - * Solaris_PersistentShare object path) object paths which are associated - * to the pObjectName parameter. - * - NULL if an error occurred or if there are no instances associated to - * the pObjectName passed in. In the case of an error, the error will be - * logged. - */ -CCIMObjectPathList * -cp_associatorNames_Solaris_NFSShareEntry(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pResultClass, char *pRole, - char *pResultRole) { - - CCIMInstanceList *instList; - CCIMObjectPathList *objPathList; - int err = 0; - - if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { - util_handleError("SOLARIS_NFSSHAREENT::ASSOCIATOR_NAMES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMObjectPathList *)NULL); - } - - instList = cp_associators_Solaris_NFSShareEntry(pAssocName, pObjectName, - pResultClass, pRole, pResultRole); - if (instList == NULL) { - return ((CCIMObjectPathList *)NULL); - } - - objPathList = cim_createObjectPathList(instList); - - cim_freeInstanceList(instList); - - return (objPathList); -} /* cp_associatorNames_Solaris_NFSShareEntry */ - -/* - * Method: cp_references_Solaris_NFSShareEntry - * - * Description: Returns the Solaris_NFSShareEntry instances that have the - * passed in parameter, pObjectName, as one of it's keys. - * - * Parameters: - * - CCIMObjectPath *pAssocName - An object path containing information - * about the association that the caller is trying to reach. - * - CCIMObjectPath *pObjectName - The object path which contains the - * information on whose associated objects are to be returned. - * - char *pRole - If specified, this is the role of the pObjectName - * object path passed in. If this is not valid, NULL is returned. - * - * Returns: - * - A pointer to a list of Solaris_NFSShareEntry instances. - * - NULL if an error occurred or if there are no Solaris_NFSShareEntry - * instances having pObjectName as one of it's keys. - */ -CCIMInstanceList * -cp_references_Solaris_NFSShareEntry(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pRole) { - - CCIMInstanceList *instList; - CCIMObjectPathList *objPathList; - int err = 0; - - if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { - util_handleError("SOLARIS_NFSSHAREENT::REFERENCES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - /* - * Get everything that is related to the pObjectName passed in. - */ - objPathList = cp_associatorNames_Solaris_NFSShareEntry( - pAssocName, pObjectName, NULL, pRole, NULL); - if (objPathList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - /* - * Determine whether pObjectname is the Element or the Setting of the - * association. Element = Solaris_NFSShare, - * Setting = Solaris_PersistentShare. - */ - - if (strcasecmp(pObjectName->mName, SOLARIS_NFSSHARE) == 0) { - instList = create_association_instList(SOLARIS_NFSSHAREENT, - pObjectName, shareEntProps[ELEMENT].name, objPathList, - shareEntProps[SETTING].name, &err); - } else { - instList = create_association_instList(SOLARIS_NFSSHAREENT, - pObjectName, shareEntProps[SETTING].name, objPathList, - shareEntProps[ELEMENT].name, &err); - } - cim_freeObjectPathList(objPathList); - - return (instList); -} /* cp_references_Solaris_NFSShareEntry */ - -/* - * Method: cp_referenceNames_Solaris_NFSShareEntry - * - * Description: Returns the Solaris_NFSShareEntry object paths of the instances - * that have the passed in parameter, pObjectName, as one of it's keys. - * - * Parameters: - * - CCIMObjectPath *pAssocName - An object path containing information - * about the association that the caller is trying to reach. - * - CCIMObjectPath *pObjectName - The object path which contains the - * information on whose associated objects are to be returned. - * - char *pRole - If specified, this is the role of the pObjectName - * object path passed in. If this is not valid, NULL is returned. - * - * Returns: - * - A pointer to a list of Solaris_NFSShareEntry object paths. - * - NULL if an error occurred or if there are no Solaris_NFSShareEntry - * instances having pObjectName as one of it's keys. - */ -CCIMObjectPathList * -cp_referenceNames_Solaris_NFSShareEntry(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pRole) { - - CCIMInstanceList *shareEntryInstList; - CCIMObjectPathList *shareEntryOPList; - int err = 0; - - if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { - util_handleError("SOLARIS_NFSSHAREENT::REFERENCE_NAMES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - shareEntryInstList = cp_references_Solaris_NFSShareEntry(pAssocName, - pObjectName, pRole); - - if (shareEntryInstList == NULL) { - return ((CCIMObjectPathList *)NULL); - } - - shareEntryOPList = cim_createObjectPathList(shareEntryInstList); - - cim_freeInstanceList(shareEntryInstList); - - return (shareEntryOPList); -} /* cp_referenceNames_Solaris_NFSShareEntry */ - -/* - * Property provider methods - */ - -/* - * Method: cp_getProperty_Solaris_NFSShareEntry - * - * Description: Retrieves a certain property from the instance of - * Solaris_NFSShareEntry on the host that is described by the parameter pOP. - * - * Parameters: - * - CCIMObjectPath *pOP - The object path containing all the - * information needed to find the instance in which the property is to - * be returned. - * - cimchar *pPropName - The name of the property to be found. - * - * Returns: - * - A pointer to the property corresponding to the name passed in with - * pPropName. - * - NULL if an error occurred or if the property doesn't exist. In the - * case of an error, the error will be logged. - */ -CCIMProperty * -cp_getProperty_Solaris_NFSShareEntry(CCIMObjectPath *pOP, cimchar *pPropName) { - CCIMInstance *shareEntryInst; - CCIMProperty *shareEntryProp; - int err = 0; - - if (pOP == NULL) { - util_handleError("SOLARIS_NFSSHAREENT::GET_PROPERTY", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMProperty *)NULL); - } - - shareEntryInst = cp_getInstance_Solaris_NFSShareEntry(pOP); - if (shareEntryInst == NULL) { - return ((CCIMProperty *)NULL); - } - - shareEntryProp = cim_getProperty(shareEntryInst, pPropName); - cim_freeInstance(shareEntryInst); - - return (shareEntryProp); -} /* cp_getProperty_Solaris_NFSShareEntry */ - -/* - * Method: cp_setProperty_Solaris_NFSShareEntry - * - * Description: This method is not supported. This is not allowed because in - * order to change the properties a Solaris_NFSShareEntry on the host, the - * Solaris_NFSShare and Solaris_PersistentShare must most likely be changed. - * In order to change the associated objects, they need to be changed in those - * providers and not this one. - * - * Parameters: - * - CCIMObjectPath *pOP - Not used. - * - CCIMProperty *pProp - Not used. - * - * Returns: - * - cim_false is returned every time since the method is not supported. - */ -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_NFSShareEntry(CCIMObjectPath *pOP, CCIMProperty *pProp) { - int err = 0; - - util_handleError("SOLARIS_NFSSHAREENT::SET_PROPERTY", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_setProperty_Solaris_NFSShareEntry */ - -/* - * Method provider methods - */ - -/* - * Method: cp_invokeMethod_Solaris_NFSShareEntry - * - * Description: This method is not supported because the provider doesn't have - * any methods. - * - * Parameters: - * - CCIMObjectPath* op - Not used. - * - cimchar* methodName - Not used. - * - CCIMPropertyList* inParams - Not used. - * - CCIMPropertyList* outParams - Not used. - * - * Return Value: - * - Always returns null because the method is not supported. - */ -/* ARGSUSED */ -CCIMProperty * -cp_invokeMethod_Solaris_NFSShareEntry(CCIMObjectPath* op, cimchar* methodName, - CCIMPropertyList* inParams, CCIMPropertyList* outParams) { - - return ((CCIMProperty *)NULL); -} /* cp_invokeMethod_Solaris_NFSShareEntry */ - -/* - * Private methods - */ - -/* - * Method: create_shareEntry_inst_and_update_list - * - */ -static CCIMInstanceList * -create_shareEntry_inst_and_update_list(CCIMObjectPath *nfsShareOP, - CCIMInstanceList *shareEntInstList) { - - CCIMObjectPathList *sharePersistOPList; - CCIMObjectPathList *currentPersistShareOP; - CCIMInstance *shareEntryInst; - CCIMException *ex; - int err = 0; - - shareEntryInst = cim_createInstance(SOLARIS_NFSSHAREENT); - if (shareEntryInst == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHAREENT::ENUM_INSTANCES", - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, - &err); - return ((CCIMInstanceList *)NULL); - } - - /* - * Retrieve all of the Solaris_PersistentShare object paths - * associated with the current Solaris_NFSShare object path. - * - * NOTE: Although it is wrong, and we can't control it since - * /etc/dfs/dfstab is a editable file, there may be multiple - * dfstab entries for one nfs share. - */ - sharePersistOPList = get_associated_sharePersist_OPList(nfsShareOP, - &err); - if (sharePersistOPList == NULL) { - if (err != 0) { - cim_freeInstance(shareEntryInst); - return ((CCIMInstanceList *)NULL); - } - cim_freeInstance(shareEntryInst); - return (shareEntInstList); - } - - for (currentPersistShareOP = sharePersistOPList; - currentPersistShareOP != NULL; - currentPersistShareOP = currentPersistShareOP->mNext) { - /* - * Add the properties to the Solaris_NFSShareEntry - * instance. - */ - if (add_property_to_instance(shareEntProps[SETTING].name, - shareEntProps[SETTING].type, NULL, - currentPersistShareOP->mDataObject, - shareEntProps[SETTING].isKey, shareEntryInst) - == cim_false) { - - cim_freeObjectPathList(sharePersistOPList); - return ((CCIMInstanceList *)NULL); - } - - if (add_property_to_instance(shareEntProps[ELEMENT].name, - shareEntProps[ELEMENT].type, NULL, nfsShareOP, - shareEntProps[ELEMENT].isKey, shareEntryInst) - == cim_false) { - - cim_freeObjectPathList(sharePersistOPList); - return ((CCIMInstanceList *)NULL); - } - - shareEntInstList = cim_addInstance(shareEntInstList, - shareEntryInst); - if (shareEntInstList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHAREENT::ENUM_INSTANCES", - CIM_ERR_FAILED, ADD_INSTANCE_FAILURE, - ex, &err); - cim_freeInstance(shareEntryInst); - return ((CCIMInstanceList *)NULL); - } - } - - return (shareEntInstList); -} /* create_shareEntry_inst_and_update_list */ - -/* - * Method: get_associated_nfsShare_instList - * - * Description: Finds the Solaris_NFSShare instances that are associated to - * the passed in Solaris_PersistentShare object path. - * - * Parameters: - * - CCIMObjectPath *sharePersistOP - The Solaris_PersistentShare object - * path that is to be used to find the associated Solaris_NFSShare - * instances. - * - * Returns: - * - A pointer to a list of Solaris_NFSShare instances that are associated - * to the Solaris_PersistentShare object path, sharePersistOP, passed in. - * - NULL if an error occurred or if there are no Solaris_NFSShare - * instances associated to the Solaris_PersistentShare object path. In - * the case of an error, the error will be logged. - */ -static CCIMInstanceList * -get_associated_nfsShare_instList(CCIMObjectPath *sharePersistOP) { - CCIMInstanceList *nfsShareInstList; - CCIMInstance *nfsShareInst; - CCIMObjectPath *nfsShareOP; - CCIMException *ex; - char *settingId; - int err = 0; - - settingId = util_getKeyValue(sharePersistOP->mKeyProperties, string, - SETTING_ID, &err); - if (settingId == NULL || err != 0) { - util_handleError( - "SOLARIS_NFSSHAREENT::GET_ASSOC_SHARE_INSTLIST", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - nfsShareInstList = cim_createInstanceList(); - if (nfsShareInstList == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSSHAREENT::GET_ASSOC_SHARE_INSTLIST", - CIM_ERR_FAILED, CREATE_INSTANCE_LIST_FAILURE, ex, &err); - return ((CCIMInstanceList *)NULL); - } - - nfsShareOP = get_Solaris_NFSShare_OP(settingId); - if (nfsShareOP == NULL) { - /* - * An error occurred in get_Solaris_NFSShare_OP and was - * handled there. - */ - cim_freeInstanceList(nfsShareInstList); - return ((CCIMInstanceList *)NULL); - } - - nfsShareInst = cimom_getInstance(nfsShareOP, cim_false, cim_false, - cim_false, cim_false, NULL, 0); - - cim_freeObjectPath(nfsShareOP); - /* - * A NULL return value indicates an error, an empty instance does not. - */ - if (nfsShareInst == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSSHAREENT::GET_ASSOC_SHARE_INSTLIST", - CIM_ERR_FAILED, CIMOM_GET_INST_FAILURE, ex, &err); - cim_freeInstanceList(nfsShareInstList); - return ((CCIMInstanceList *)NULL); - } - - if (nfsShareInst->mProperties == NULL) { - cim_freeInstanceList(nfsShareInstList); - cim_freeInstance(nfsShareInst); - return ((CCIMInstanceList *)NULL); - } - - /* - * Work around for cimom bug 4649100. - */ - if (!set_share_keyProperties_to_true(nfsShareInst)) { - /* - * Key values not found - */ - cim_logDebug( - "get_associated_nfsShareSec_instList", - "No keyProprties found, should return error here"); - cim_freeInstance(nfsShareInst); - cim_freeInstanceList(nfsShareInstList); - return ((CCIMInstanceList *)NULL); - } - - nfsShareInstList = cim_addInstance(nfsShareInstList, nfsShareInst); - if (nfsShareInstList == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSSHAREENT::GET_ASSOC_SHARE_INSTLIST", - CIM_ERR_FAILED, ADD_INSTANCE_FAILURE, ex, &err); - cim_freeInstance(nfsShareInst); - return ((CCIMInstanceList *)NULL); - } - - return (nfsShareInstList); -} /* get_associated_nfsShare_instList */ - -/* - * Method: get_associated_sharePersist_instList - * - * Description: Finds the Solaris_PersistentShare instances that are - * associated to the passed in Solaris_NFSShare object path. - * - * Parameters: - * - CCIMObjectPath *nfsShareOP - The Solaris_NFSShare object path that is - * to be used to find the associated Solaris_PersistentShare instances. - * - * Returns: - * - A pointer to a list of Solaris_PersistentShare instances that are - * associated to the Solaris_NFSShare object path, nfsShareOP, passed in. - * NOTE: An instance list is returned rather than a single instance - * because it is possible (although unlikely) to have multiple - * /etc/dfs/dfstab entries per share. - * - NULL if an error occurred or if there are no Solaris_PersistentShare - * instances associated to the Solaris_NFSShare object path. - */ -static CCIMInstanceList * -get_associated_sharePersist_instList(CCIMObjectPath *nfsShareOP) { - CCIMInstanceList *sharePersistInstList = NULL; - CCIMException *ex; - fs_dfstab_entry_t dfstabEnt; - fs_dfstab_entry_t tmpDfstabEnt; - char *name; - int err = 0; - - name = util_getKeyValue(nfsShareOP->mKeyProperties, string, NAME, &err); - if (name == NULL || err != 0) { - util_handleError("SOLARIS_NFSSHAREENT::GET_ASSOC_SP_INSTLIST", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - sharePersistInstList = cim_createInstanceList(); - if (sharePersistInstList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHAREENT::GET_ASSOC_SP_INSTLIST", - CIM_ERR_FAILED, CREATE_INSTANCE_LIST_FAILURE, ex, &err); - return ((CCIMInstanceList *)NULL); - } - - dfstabEnt = fs_get_DFStab_ents(&err); - if (dfstabEnt == NULL) { - /* - * Check if an error occurred or if there just weren't any - * /etc/dfs/dfstab entries. - */ - if (err != 0) { - util_handleError( - "SOLARIS_NFSSHAREENT::GET_ASSOC_SP_INSTLIST", - CIM_ERR_FAILED, FS_GET_DFSTAB_ENT_FAILURE, - NULL, &err); - cim_freeInstanceList(sharePersistInstList); - return ((CCIMInstanceList *)NULL); - } - - return ((CCIMInstanceList *)NULL); - } - - for (tmpDfstabEnt = dfstabEnt; tmpDfstabEnt != NULL; - tmpDfstabEnt = fs_get_DFStab_ent_Next(tmpDfstabEnt)) { - char *path; - char *fstype; - char *command; - - err = 0; - path = fs_get_DFStab_ent_Path(tmpDfstabEnt); - fstype = fs_get_DFStab_ent_Fstype(tmpDfstabEnt); - command = fs_get_Dfstab_share_cmd(tmpDfstabEnt, &err); - - /* - * Compare the dfstab entry to the nfs share. Do this by first - * checking if the fstype is "nfs" and second by checking - * if the path is the same. - */ - if ((strcasecmp(fstype, NFS) == 0) && - (strcmp(path, name) == 0)) { - - CCIMInstance *sharePersistInst; - - /* - * We can't just call Solaris_PersistentShare's - * cp_getInstance method because there is a chance that - * multiple dfstab entries having the same path. If - * this is the case, that method will return null and - * some sort of "key not unique" error. - */ - sharePersistInst = get_Solaris_PersistentShare_Inst( - path, command); - if (sharePersistInst == NULL) { - /* - * An error occurred and it was handled in - * get_sharePersist_Inst. - */ - fs_free_DFStab_ents(dfstabEnt); - return ((CCIMInstanceList *)NULL); - } - - sharePersistInstList = cim_addInstance( - sharePersistInstList, sharePersistInst); - if (sharePersistInstList == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSSHAREENT::GET_ASSOC_SP_INSTLIST", - CIM_ERR_FAILED, ADD_INSTANCE_FAILURE, ex, &err); - cim_freeInstance(sharePersistInst); - fs_free_DFStab_ents(dfstabEnt); - return ((CCIMInstanceList *)NULL); - } - } - } - - fs_free_DFStab_ents(dfstabEnt); - return (sharePersistInstList); -} /* get_associated_sharePersist_instList */ - -/* - * Method: get_associated_sharePersist_OPList - * - * Description: Finds the Solaris_PersistentShare object paths that are - * associated to the passed in Solaris_NFSShare object path. - * - * Parameters: - * - CCIMObjectPath *nfsShareOP - The Solaris_NFSShare object path of - * of which to retrieve the associated Solaris_PersistentShare object - * paths. - * - * Returns: - * - A pointer to a list of Solaris_PersistentShare object paths that are - * associated to the passed in Solaris_NFSShare object path. - * - Upon error, NULL is returned and the error is logged. - * - * Returns: - */ -static CCIMObjectPathList * -get_associated_sharePersist_OPList(CCIMObjectPath *nfsShareOP, int *errp) { - CCIMInstanceList *sharePersistInstList; - CCIMObjectPathList *sharePersistOPList; - CCIMException *ex; - int err = 0; - - sharePersistInstList = get_associated_sharePersist_instList(nfsShareOP); - if (sharePersistInstList == NULL) { - /* - * An error occurred in get_associated_sharePersist_InstList - * and was handled in that function. - */ - *errp = -1; - return ((CCIMObjectPathList *)NULL); - } - - sharePersistOPList = cim_createObjectPathList(sharePersistInstList); - if (sharePersistOPList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHAREENT::GET_ASSOC_SP_OPLIST", - CIM_ERR_FAILED, CREATE_OBJECT_LIST_FAILURE, ex, &err); - cim_freeInstanceList(sharePersistInstList); - *errp = -1; - return ((CCIMObjectPathList *)NULL); - } - - cim_freeInstanceList(sharePersistInstList); - return (sharePersistOPList); -} /* get_associated_sharePersist_OPList */ - -/* - * Method: get_Solaris_NFSShare_OP - * - * Description: - * - * Parameters: - * - * Returns: - */ -static CCIMObjectPath * -get_Solaris_NFSShare_OP(char *nameKey) { - CCIMObjectPath *nfsShareOP; - CCIMPropertyList *nfsShareKeyPropList; - CCIMException *ex; - char *sysName; - int err = 0; - - nfsShareOP = cim_createEmptyObjectPath(SOLARIS_NFSSHARE); - if (nfsShareOP == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHAREENT::GET_NFSSHARE_OP", - CIM_ERR_FAILED, CREATE_EMPTY_OBJPATH_FAILURE, ex, - &err); - return ((CCIMObjectPath *)NULL); - } - - sysName = (cimchar *)sys_get_hostname(&err); - if (sysName == NULL) { - util_handleError("SOLARIS_NFSSHAREENT::GET_NFSSHARE_OP", - CIM_ERR_FAILED, GET_HOSTNAME_FAILURE, NULL, &err); - cim_freeObjectPath(nfsShareOP); - return ((CCIMObjectPath *)NULL); - } - - /* - * Create the property list which to add all the key properties to and - * which will be added to the object path. - */ - nfsShareKeyPropList = cim_createPropertyList(); - if (nfsShareKeyPropList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHAREENT::GET_NFSSHARE_OP", - CIM_ERR_FAILED, CREATE_PROPLIST_FAILURE, ex, &err); - cim_freeObjectPath(nfsShareOP); - return ((CCIMObjectPath *)NULL); - } - - /* - * add_property_to_list parameters are as follows: - * 1.) property name (cimchar *), - * 2.) property type (CIMType), - * 3.) property value (cimchar *), - * 4.) property object path for reference properties (CCIMObjectPath *), - * 5.) is property a key? (CIMBool), - * 6.) property list to add the property to (CCIMPropertyList *). - */ - nfsShareKeyPropList = add_property_to_list(NAME, string, nameKey, - NULL, cim_true, nfsShareKeyPropList); - if (nfsShareKeyPropList == NULL) { - cim_freeObjectPath(nfsShareOP); - return ((CCIMObjectPath *)NULL); - } - - nfsShareKeyPropList = add_property_to_list(CREATION_CLASS, string, - SOLARIS_NFSSHARE, NULL, cim_true, nfsShareKeyPropList); - if (nfsShareKeyPropList == NULL) { - cim_freeObjectPath(nfsShareOP); - return ((CCIMObjectPath *)NULL); - } - - nfsShareKeyPropList = add_property_to_list(SYS_CREATION_CLASS, string, - COMPUTER_SYSTEM, NULL, cim_true, nfsShareKeyPropList); - if (nfsShareKeyPropList == NULL) { - cim_freeObjectPath(nfsShareOP); - return ((CCIMObjectPath *)NULL); - } - - nfsShareKeyPropList = add_property_to_list(SYSTEM, string, sysName, - NULL, cim_true, nfsShareKeyPropList); - if (nfsShareKeyPropList == NULL) { - free(sysName); - cim_freeObjectPath(nfsShareOP); - return ((CCIMObjectPath *)NULL); - } - free(sysName); - - nfsShareOP = cim_addPropertyListToObjectPath(nfsShareOP, - nfsShareKeyPropList); - if (nfsShareOP == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHAREENT::GET_NFSSHARE_OP", - CIM_ERR_FAILED, ADD_PROP_TO_OBJPATH_FAILURE, ex, &err); - cim_freePropertyList(nfsShareKeyPropList); - return ((CCIMObjectPath *)NULL); - } - - return (nfsShareOP); -} /* get_Solaris_NFSShare_OP */ - -/* - * Method: get_Solaris_PersistentShare_Inst - * - * Description: Creates an instance of the Solaris_PersistentShare class. - * - * Parameters: - * - char *path - The value to be used for the SettingID property. - * - char *command - The value to be used for the Command property. - * - * Returns: - * - A pointer to a Solaris_PersistentShare instance. - * - Upon error, NULL is returned and the error is logged. - */ -static CCIMInstance * -get_Solaris_PersistentShare_Inst(char *path, char *command) { - CCIMInstance *sharePersistInst; - CCIMException *ex; - cimchar *sysName; - int err = 0; - - sysName = (cimchar *)sys_get_hostname(&err); - if (sysName == NULL) { - util_handleError("SOLARIS_NFSSHAREENT::GET_SHAREPERSIST_INST", - CIM_ERR_FAILED, GET_HOSTNAME_FAILURE, NULL, &err); - return ((CCIMInstance *)NULL); - } - - sharePersistInst = cim_createInstance(SOLARIS_PERSISTSHARE); - if (sharePersistInst == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHAREENT::GET_SHAREPERSIST_INST", - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, &err); - return ((CCIMInstance *)NULL); - } - - /* - * add_property_to_instance parameters are as follows: - * 1.) property name (cimchar *), - * 2.) property type (CIMType), - * 3.) property value (cimchar *), - * 4.) property object path for reference properties (CCIMObjectPath *), - * 5.) is property a key? (CIMBool), - * 6.) instance to add the property to (CCIMInstance *). - */ - if (add_property_to_instance(CREATION_CLASS, string, - SOLARIS_PERSISTSHARE, NULL, cim_true, sharePersistInst) - == cim_false) { - - cim_freeInstance(sharePersistInst); - return ((CCIMInstance *)NULL); - } - - if (add_property_to_instance(SYS_CREATION_CLASS, string, - COMPUTER_SYSTEM, NULL, cim_true, sharePersistInst) - == cim_false) { - - cim_freeInstance(sharePersistInst); - return ((CCIMInstance *)NULL); - } - - if (add_property_to_instance(SETTING_ID, string, path, - NULL, cim_true, sharePersistInst) == cim_false) { - - cim_freeInstance(sharePersistInst); - return ((CCIMInstance *)NULL); - } - - if (add_property_to_instance(SYSTEM, string, sysName, - NULL, cim_true, sharePersistInst) == cim_false) { - - free(sysName); - cim_freeInstance(sharePersistInst); - return ((CCIMInstance *)NULL); - } - free(sysName); - - if (add_property_to_instance(COMMAND, string, command, - NULL, cim_false, sharePersistInst) == cim_false) { - - cim_freeInstance(sharePersistInst); - return ((CCIMInstance *)NULL); - } - - return (sharePersistInst); -} /* get_Solaris_PersistentShare_Inst */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_NFSShareEntry.h b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_NFSShareEntry.h deleted file mode 100644 index a9ace27e87..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_NFSShareEntry.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOLARIS_NFSSHAREENTRY_H -#define _SOLARIS_NFSSHAREENTRY_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Public data type declaration - */ - -#include <cimapi.h> -#include <cimomhandle.h> -#include "nfsprov_include.h" - -#define PROPCOUNT 2 - -static nfs_prov_prop_t shareEntProps[] = { -#define ELEMENT 0 - {"Element", cim_true, reference}, -#define SETTING (ELEMENT + 1) - {"Setting", cim_true, reference} -}; - -#ifdef __cplusplus -} -#endif - -#endif /* _SOLARIS_NFSSHAREENTRY_H */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_NFSShareSecurityModes.c b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_NFSShareSecurityModes.c deleted file mode 100644 index 82b6eefa8b..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_NFSShareSecurityModes.c +++ /dev/null @@ -1,1339 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <errno.h> -#include "Solaris_NFSShareSecurityModes.h" -#include "nfs_keys.h" -#include "nfs_providers_msgstrings.h" -#include "nfs_provider_names.h" -#include "messageStrings.h" -#include "util.h" -#include "common_functions.h" -#include "createprop_methods.h" -#include "libfsmgt.h" - - -/* - * Private method declarations - */ - -static CCIMInstanceList *get_associated_nfsShare_instList( - CCIMObjectPath *nfsShareOP); -static CCIMInstanceList *get_associated_nfsShareSec_instList( - CCIMObjectPath *nfsShareSecOP); -static CCIMObjectPathList *get_associated_nfsShareSec_OPList( - CCIMObjectPath *nfsShareSecOP, int *err); -static CCIMObjectPath *get_Solaris_NFSShare_OP(char *nameKey); -static CCIMObjectPath *get_Solaris_NFSShareSec_OP(char *, char *); -static CCIMInstanceList *update_list_with_secMode_inst( - CCIMObjectPath *nfsShareOP, - CCIMInstanceList *shareSecModeInstList); - -/* - * Public methods - */ -/* - * Instance provider methods - */ - -/* - * Method: cp_createInstance_Solaris_NFSShareSecurityModes - * - * This method is not supported. In order for a Solaris_NFSShareSecurityModes - * association to exist a corresponding Solaris_NFSShare and - * Solaris_NFSShareSecurity must already exist. - */ -/* ARGSUSED */ -CCIMObjectPath * -cp_createInstance_Solaris_NFSShareSecurityModes(CCIMObjectPath *pOP, - CCIMInstance *pInst) { - - int err = 0; - - util_handleError("SOLARIS_NFSSHARESECMODES::CREATE_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return ((CCIMObjectPath *)NULL); -} /* cp_createInstance_Solaris_NFSShareSecurityModes */ - -/* - * Method: cp_deleteInstance_Solaris_NFSShareSecurityModes - * - * This method is not supported. In order for a Solaris_NFSShareSecurityModes - * association to be deleted a corresponding Solaris_NFSShare and - * Solaris_NFSShareSecurity must be deleted. The Solaris_NFSShare and - * Solaris_NFSShareSecurity should only be deleted through those providers. - */ -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_NFSShareSecurityModes(CCIMObjectPath *pOP) { - int err = 0; - - util_handleError("SOLARIS_NFSSHARESECMODES::DELETE_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_deleteInstance_Solaris_NFSShareSecurityModes */ - -/* - * Method: cp_enumInstances_Solaris_NFSShareSecurityModes - * - * Description: Enumerates the instances of Solaris_NFSShareSecurityModes - * on a host. An instance of Solaris_NFSShareSecurityModes is an - * association that links a share to it's share security entry. - * - * Parameters: - * - CCIMObjectPath *pOP - An object path containing the name of - * the class of which to enumerate the instances of. - * - * Return Value: - * - A pointer to a list of Solaris_NFSShareSecurityModes instances. - * - NULL if an error occurred or if there are no instances of - * Solaris_NFSShareSecurityModes on the host. In the case of an - * error, the error will be logged. - */ - -CCIMInstanceList * -cp_enumInstances_Solaris_NFSShareSecurityModes(CCIMObjectPath *pOP) { - CCIMInstanceList *shareSecModeInstList; - CCIMObjectPathList *nfsShareOPList; - CCIMObjectPathList *tmpOPList; - CCIMObjectPath *nfsShareOP; - CCIMException *ex; - int err = 0; - - if (pOP == NULL) { - util_handleError("SOLARIS_NFSSHARESECMODES::ENUM_INSTANCES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - nfsShareOP = cim_createEmptyObjectPath(SOLARIS_NFSSHARE); - if (nfsShareOP == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHARESECMODES::ENUM_INSTANCES", - CIM_ERR_FAILED, CREATE_EMPTY_OBJPATH_FAILURE, ex, - &err); - return ((CCIMInstanceList *)NULL); - } - - nfsShareOPList = cimom_enumerateInstanceNames(nfsShareOP, cim_false); - if (nfsShareOPList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHARESECMODES::ENUM_INSTANCES", - CIM_ERR_FAILED, CIMOM_ENUM_INSTNAMES_FAILURE, ex, &err); - cim_freeObjectPath(nfsShareOP); - return ((CCIMInstanceList *)NULL); - } - - cim_freeObjectPath(nfsShareOP); - - - if (nfsShareOPList->mDataObject == NULL) { - cim_freeObjectPathList(nfsShareOPList); - return ((CCIMInstanceList *)NULL); - } - - shareSecModeInstList = cim_createInstanceList(); - if (shareSecModeInstList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHARESECMODES::ENUM_INSTANCES", - CIM_ERR_FAILED, CREATE_INSTANCE_LIST_FAILURE, ex, &err); - cim_freeObjectPathList(nfsShareOPList); - return ((CCIMInstanceList *)NULL); - } - - - for (tmpOPList = nfsShareOPList; tmpOPList != NULL; - tmpOPList = tmpOPList->mNext) { - shareSecModeInstList = update_list_with_secMode_inst( - tmpOPList->mDataObject, shareSecModeInstList); - if (shareSecModeInstList == NULL) { - cim_freeObjectPathList(nfsShareOPList); - return ((CCIMInstanceList *)NULL); - } - } - cim_freeObjectPathList(nfsShareOPList); - return (shareSecModeInstList); -} /* cp_enumInstances_Solaris_NFSShareSecurityModes */ - -/* - * Method: cp_enumInstanceNames_Solaris_NFSShareSecurityModes - * - * Description: Enumerates all of the instances of - * Solaris_NFSShareSecurityModes on the host. - * - * Parameters: - * - CCIMObjectPath* pOP - An object path containing the name of the - * class of which to enumerate instances of. - * - * Returns: - * - A pointer to a list of Solaris_NFSShareSecurityModes object paths. - * - NULL if an error occurred or if there are no NFS mounts on the host. - * In the case of an error, the error will be logged. - */ - -CCIMObjectPathList * -cp_enumInstanceNames_Solaris_NFSShareSecurityModes(CCIMObjectPath *pOP) { - CCIMInstanceList *instList; - CCIMObjectPathList *OPList; - CCIMException *ex; - int err = 0; - - /* - * First check if pOP is null. - */ - if (pOP == NULL) { - util_handleError( - "SOLARIS_NFSSHARESECMODES::ENUM_INSTANCENAMES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMObjectPathList *)NULL); - } - - instList = cp_enumInstances_Solaris_NFSShareSecurityModes(pOP); - if (instList == NULL) { - /* - * Either an error occurred or we don't have any - * Solaris_NFSShareSecurityModes instances on the host. - */ - return ((CCIMObjectPathList *)NULL); - } - - OPList = cim_createObjectPathList(instList); - if (OPList == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSSHARESECMODES::ENUM_INSTANCENAMES", - CIM_ERR_FAILED, CREATE_OBJECT_LIST_FAILURE, ex, &err); - } - - cim_freeInstanceList(instList); - return (OPList); -} /* cp_enumInstanceNames_Solaris_NFSShareSecurityModes */ - -/* - * Method: cp_execQuery_Solaris_NFSShareSecurityModes - * - * Description: Queries the Solaris_NFSShareSecurityModes instances on the - * host to find those that meet the search criteria. - * - * Parameters: - * - CCIMObjectPath *pOP - An object path containing the name of - * the class of which to query. - * - char *selectClause - Not used. - * - char *nonJoinExp - Not used. - * - char *queryExp - Not used. - * - char *queryLang - Not used. - * - * Returns: - * - A pointer to a list of Solaris_NFSShareSecurityModes instances - * that match the search criteria. - * - NULL if an error occurred or if there are no - * Solaris_NFSShareSecurityModes instances matching the search criteria. - * in case of an error, the error will be logged. - */ -/* ARGSUSED */ -CCIMInstanceList * -cp_execQuery_Solaris_NFSShareSecurityModes(CCIMObjectPath *pOP, - char *selectClause, char *nonJoinExp, char *queryExp, - char *queryLang) { - - CCIMInstance *emptyInst; - CCIMInstanceList *shareSecModeInstList; - CCIMException *ex; - int err = 0; - - if (pOP == NULL) { - util_handleError("SOLARIS_NFSSHARESECMODES::EXEC_QUERY", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - shareSecModeInstList = - cp_enumInstances_Solaris_NFSShareSecurityModes(pOP); - if (shareSecModeInstList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHARESECMODES::EXEC_QUERY", - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, &err); - cim_freeInstanceList(shareSecModeInstList); - return ((CCIMInstanceList *)NULL); - } - - shareSecModeInstList = cim_prependInstance(shareSecModeInstList, - emptyInst); - if (shareSecModeInstList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHARESECMODES::EXEC_QUERY", - CIM_ERR_FAILED, PREPEND_INSTANCE_FAILURE, ex, &err); - cim_freeInstance(emptyInst); - return ((CCIMInstanceList *)NULL); - } - - return (shareSecModeInstList); -} /* cp_execQuery_Solaris_NFSShareSecurityModes */ - -/* - * Method: cp_getInstance_Solaris_NFSShareSecurityModes - * - * Description: Gets the instance corresponding to the - * Solaris_NFSShareSecurityModes object path passed in. - * - * Parameters: - * - CCIMObjectPath* pOP - An object path containing all the keys of - * the instance that is supposed to be returned. - * - * Returns: - * - A pointer to the Solaris_NFSShareSecurityModes instance corresponding - * to the object path parameter. - * - NULL if an error occurred or if the instance doesn't exist. In the - * case of an error the error is logged. - */ -CCIMInstance * -cp_getInstance_Solaris_NFSShareSecurityModes(CCIMObjectPath *pOP) { - CCIMInstanceList *instList; - CCIMInstance *inst; - CCIMObjectPath *settingOP; - CCIMObjectPath *elementOP; - CCIMPropertyList *shareSecModesPropList; - int err = 0; - - if (pOP == NULL) { - util_handleError("SOLARIS_NFSSHARESECMODES::GET_INSTANCE", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstance *)NULL); - } - - /* - * Make sure the key values passed in are populated. - */ - shareSecModesPropList = pOP->mKeyProperties; - settingOP = util_getKeyValue(shareSecModesPropList, - shareSecModeProps[SETTING].type, shareSecModeProps[SETTING].name, - &err); - elementOP = util_getKeyValue(shareSecModesPropList, - shareSecModeProps[ELEMENT].type, shareSecModeProps[ELEMENT].name, - &err); - - if (settingOP == NULL || elementOP == NULL || - settingOP->mKeyProperties == NULL || - elementOP->mKeyProperties == NULL) { - util_handleError("SOLARIS_NFSSHARESECMODES::GET_INSTANCE", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstance *)NULL); - } - - instList = cp_enumInstances_Solaris_NFSShareSecurityModes(pOP); - if (instList == NULL) { - /* - * Either an error occurred or we simply don't have any - * instances of Solaris_NFSShareSecurityModes on the system. - * In the case that an error occurred, it will be handled in - * cp_enumInstances_Solaris_NFSShareSecurityModes. - */ - return ((CCIMInstance *)NULL); - } - - inst = cim_getInstance(instList, pOP); - - cim_freeInstanceList(instList); - return (inst); -} /* cp_getInstance_Solaris_NFSShareSecurityModes */ - -/* - * Method: cp_setInstance_Solaris_NFSShareSecurityModes - * - * Not Supported: Inorder to change the properties of a - * Solaris_NFSShareSecurityModes instance on the host the Solaris_NFSShare and - * Solaris_NFSShareSecurity instances would have to be changed. These changes - * must be done in the providers for Solaris_NFSShare and - * Solaris_NFSShareSecurity. - */ -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_NFSShareSecurityModes(CCIMObjectPath *pOP, - CCIMInstance *pInst, char **props, int num_props) { - - int err = 0; - - util_handleError("SOLARIS_NFSSHAREDEFSECMODES::SET_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_setInstance_Solaris_NFSShareDefSecurityModes */ - -/* - * Method: cp_setInstanceWithList_Solaris_NFSShareSecurityModes - * - * Not Supported: Inorder to change the properties of a - * Solaris_NFSShareSecurityModes instance on the host the Solaris_NFSShare and - * Solaris_NFSShareSecurity instances would have to be changed. These changes - * must be done in the providers for Solaris_NFSShare and - * Solaris_NFSShareSecurity. - */ -/* ARGSUSED */ -CIMBool -cp_setInstanceWithList_Solaris_NFSShareSecurityModes(CCIMObjectPath *pOP, - CCIMInstance *pInst, char **props, int num_props) { - - int err = 0; - - util_handleError("SOLARIS_NFSSHARESECMODES::SET_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_setInstanceWithList_Solaris_NFSShareSecurityModes */ - -/* - * Association provider methods - */ -/* - * Method: cp_associators_Solaris_NFSShareSecurityModes - * - * Description: Returns the instances associated with the pObjectName - * parameter via the Solaris_NFSShareSecurityModes association. - * - * Parameters: - * - CCIMObjectPath *pAssocName - An object path containing the name of - * the association that the caller is trying to reach. - * - CCIMObjectPath *pObjectName - The object path containing information - * (Class Name, Key Properties) about the object whose associated objects - * are to be returned. - * - char *pResultClass - If specified, only return instances that are of - * this class type. - * - char *pRole - If specified, this is the role of the pObjectName - * object path passed in. If this is not valid, NULL is returned. - * - char *pResultRole - If specified, only return instances that are - * playing this role in the association. - * - * Returns: - * - A pointer to a list of Solaris_NFSShareSecurity (if pRole == - * Element && pObjectName is a Solaris_NFSShare object path) or - * Solaris_NFSShare (if pRole == Setting && pObjectName is a - * Solaris_NFSShareSecurity object path) instances which are associated to - * the pObjectName parameter. - * - NULL if an error occurred or if there are no instances associated to - * the pObjectName passed in. In the case of an error, the error will be - * logged. - */ -/* ARGSUSED */ -CCIMInstanceList * -cp_associators_Solaris_NFSShareSecurityModes(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pResultClass, char *pRole, - char *pResultRole) { - - CCIMInstanceList *returnInstList; - int err = 0; - - if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { - util_handleError("SOLARIS_NFSSHARESECMODES::ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - /* - * Determine whether pObjectname is the Element or the Setting of the - * association. Element = Solaris_NFSShare, - * Setting = Solaris_NFSShareSecurity. - */ - if ((strcasecmp(pObjectName->mName, SOLARIS_NFSSHARE) == 0)) { - if (pRole != NULL && (strcasecmp(pRole, - shareSecModeProps[ELEMENT].name) != 0)) { - util_handleError( - "SOLARIS_NFSSHARESECMODES::ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, - &err); - return ((CCIMInstanceList *)NULL); - } - returnInstList = get_associated_nfsShareSec_instList( - pObjectName); - } else if (strcasecmp(pObjectName->mName, - SOLARIS_NFSSHARESECURITY) == 0) { - if (pRole != NULL && (strcasecmp(pRole, - shareSecModeProps[SETTING].name) != 0)) { - util_handleError( - "SOLARIS_NFSSHARESECMODES::ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, - &err); - return ((CCIMInstanceList *)NULL); - } - returnInstList = get_associated_nfsShare_instList(pObjectName); - } else { - util_handleError("SOLARIS_NFSSHARESECMODES::ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - return (returnInstList); -} /* cp_associators_Solaris_NFSShareSecurityModes */ - -/* - * Method:cp_associatorNames_Solaris_NFSShareSecurityModes - * - * Description: Returns the object paths of the instances on the other side - * of the association. These are associated via the - * Solaris_NFSShareSecurityModes association and have the opposite key - * passed in as the parameter(pObjectName). - * - * Parameters: - * - CCIMObjectPath *pAssocName - An object path containing information - * about the association that the caller is trying to reach. - * - CCIMObjectPath *pObjectName - The object path which contains the - * information on whose associated objects are to be returned. - * - char *pResultClass - If specified, only return instances that are of - * this class type. - * - char *pRole - If specified, this is the role of the pObjectName - * object path passed in. If this is not valid, NULL is returned. - * - char *pResultRole - If specified, only return instances that are - * playing this role in the association. - * - * Returns: - * - A pointer to a list of Solaris_NFSShareSecurity (if Role == - * Element and pObjectName is a Solaris_NFSShare object path) or - * Solaris_NFSShare (if Role == Setting and pObjectName is a - * Solaris_NFSShareSecurity object path) object paths which are - * associated to the pObjectName parameter. - * - NULL if an error occurred or if there are no instances associated to - * the pObjectName passed in. In the case of an error, the error will be - * logged. - */ -CCIMObjectPathList * -cp_associatorNames_Solaris_NFSShareSecurityModes(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pResultClass, char *pRole, - char *pResultRole) { - - CCIMInstanceList *instList; - CCIMObjectPathList *objPathList = NULL; - int err = 0; - - if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { - util_handleError("SOLARIS_NFSSHARESECMODES::ASSOCIATOR_NAMES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - } else { - instList = - cp_associators_Solaris_NFSShareSecurityModes(pAssocName, - pObjectName, pResultClass, pRole, pResultRole); - if (instList != NULL) { - objPathList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - } - return (objPathList); -} /* cp_associatorNames_Solaris_NFSShareSecurityModes */ - -/* - * Method: cp_references_Solaris_NFSShareSecurityModes - * - * Description: Returns the Solaris_NFSShareSecurityModes instances that have - * the passed in parameter, pObjectName, as one of it's keys. - * - * Parameters: - * - CCIMObjectPath *pAssocName - An object path containing information - * about the association that the caller is trying to reach. - * - CCIMObjectPath *pObjectName - The object path which contains the - * information on whose associated objects are to be returned. - * - char *pRole - If specified, this is the role of the pObjectName - * object path passed in. If this is not valid, NULL is returned. - * - * Returns: - * - A pointer to a list of Solaris_NFSShareSecurityModes instances. - * - NULL if an error occurred or if there are no - * Solaris_NFSShareSecurityModes instances having pObjectName as one of - * it's keys. - */ -CCIMInstanceList * -cp_references_Solaris_NFSShareSecurityModes(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pRole) { - - CCIMInstanceList *instList; - CCIMObjectPathList *objPathList; - int err = 0; - - if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { - util_handleError("SOLARIS_NFSSHARESECMODES::REFERENCES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - - /* - * Get everything that is related to the pObjectName passed in. - */ - objPathList = cp_associatorNames_Solaris_NFSShareSecurityModes( - pAssocName, pObjectName, NULL, pRole, NULL); - if (objPathList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - /* - * Determine whether pObjectname is the Element or the Setting of the - * association. Element = Solaris_NFSShare, - * Setting = Solaris_NFSShareSecurity. - */ - if ((strcasecmp(pObjectName->mName, SOLARIS_NFSSHARE) == 0)) { - instList = create_association_instList( - SOLARIS_NFSSHARESECMODES, pObjectName, - shareSecModeProps[ELEMENT].name, objPathList, - shareSecModeProps[SETTING].name, &err); - } else { - instList = - create_association_instList(SOLARIS_NFSSHARESECMODES, - pObjectName, shareSecModeProps[SETTING].name, - objPathList, shareSecModeProps[ELEMENT].name, &err); - } - cim_freeObjectPathList(objPathList); - - return (instList); -} /* cp_references_Solaris_NFSShareSecurityModes */ - -/* - * Method: cp_referenceNames_Solaris_NFSShareSecurityModes - * - * Description: Returns the Solaris_NFSShareSecurityModes object paths for - * the instances that have the passed in parameter (pObjectName, as one of - * it's keys. - * - * Parameters: - * - CCIMObjectPath *pAssocName - An object path containing information - * about the association that the caller is trying to reach. - * - CCIMObjectPath *pObjectName - The object path which contains the - * information on whose associated objects are to be returned. - * - char *pRole - If specified, this is the role of the pObjectName - * object path passed in. If this is not valid, NULL is returned. - * - * Returns: - * - A pointer to a list of Solaris_NFSShareSecurityModes object paths. - * - NULL if there was an error or if there are no - * Solaris_NFSShareSecurityModes instances having pObjectName as one of - * it's keys. - */ -CCIMObjectPathList * -cp_referenceNames_Solaris_NFSShareSecurityModes(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pRole) { - - CCIMInstanceList *shareSecModeInstList; - CCIMObjectPathList *shareSecModeOPList; - int err = 0; - - if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { - util_handleError("SOLARIS_NFSSHARESECMODES::REFERENCE_NAMES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - shareSecModeInstList = - cp_references_Solaris_NFSShareSecurityModes(pAssocName, - pObjectName, pRole); - - if (shareSecModeInstList == NULL) { - return ((CCIMObjectPathList *)NULL); - } - - shareSecModeOPList = cim_createObjectPathList(shareSecModeInstList); - - cim_freeInstanceList(shareSecModeInstList); - - return (shareSecModeOPList); -} /* cp_referenceNames_Solaris_NFSShareSecurityModes */ - -/* - * Property provider methods - */ - -/* - * Method: cp_getProperty_Solaris_NFSShareSecurityModes - * - * Description: Retrieves the property, described by the parameter pOP, from - * the instance of Solaris_NFSShareSecurityModes on the host. - * - * Parameters: - * - CCIMObjectPath *pOP - The object path containing all the - * information needed to find the instance in which the property is to - * be returned. - * - cimchar *pPropName - The name of the property to be found. - * - * Returns: - * - A pointer to the property corresponding to the name passed in with - * pPropName. - * - NULL if an error occurred or if the property doesn't exist. In the - * case of an error, the error will be logged. - */ -CCIMProperty * -cp_getProperty_Solaris_NFSShareSecurityModes(CCIMObjectPath *pOP, - cimchar *pPropName) { - - CCIMInstance *shareSecModeInst; - CCIMProperty *shareSecModeProp; - int err = 0; - - if (pOP == NULL) { - util_handleError("SOLARIS_NFSSHARESECMODES::GET_PROPERTY", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMProperty *)NULL); - } - - shareSecModeInst = cp_getInstance_Solaris_NFSShareSecurityModes(pOP); - if (shareSecModeInst == NULL) { - return ((CCIMProperty *)NULL); - } - - shareSecModeProp = cim_getProperty(shareSecModeInst, pPropName); - cim_freeInstance(shareSecModeInst); - - return (shareSecModeProp); -} /* cp_getProperty_Solaris_NFSShareSecurityModes */ - -/* - * Method: cp_setProperty_Solaris_NFSShareSecurityModes - * - * This method is not supported. This is not allowed because in - * order to change the properties a Solaris_NFSShareSecurityModes on - * the host, the Solaris_NFSShare and Solaris_NFSShareSecurity must - * be changed. Any changes to Solaris_NFSShare and Solaris_NFSShareSecurity - * need to be done in those providers. - */ -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_NFSShareSecurityModes( - CCIMObjectPath *pOP, - CCIMProperty *pProp) { - - int err = 0; - - util_handleError("SOLARIS_NFSSHARESECMODES::SET_PROPERTY", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_setProperty_Solaris_NFSShareSecurityModes */ - -/* - * Method provider methods - */ - -/* - * Method: cp_invokeMethod_Solaris_NFSShareSecurityModes - * - * Description: This method is not supported because the provider doesn't have - * any methods. - * - */ -/* ARGSUSED */ -CCIMProperty * -cp_invokeMethod_Solaris_NFSShareSecurityModes( - CCIMObjectPath *pOP, - cimchar *functionName, - CCIMPropertyList *inParams, - CCIMPropertyList *outParams) { - int err = 0; - - util_handleError("SOLARIS_NFSSHARESECMODES::INVOKE_METHOD", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - return ((CCIMProperty *)NULL); -} /* cp_invokeMethod_Solaris_NFSShareSecurityModes */ - - -/* - * Private methods - */ - -/* - * Method: get_associated_nfsShare_instList - * - * Finds the Solaris_NFSShare instances that are associated to the - * Solaris_NFSShareSecurity object path that was passed in. - */ -static CCIMInstanceList * -get_associated_nfsShare_instList(CCIMObjectPath *nfsShareSecOP) { - CCIMInstanceList *nfsShareInstList; - CCIMInstance *nfsShareInst; - CCIMObjectPath *nfsShareOP; - CCIMException *ex; - char *settingID; - int err = 0; - - settingID = util_getKeyValue(nfsShareSecOP->mKeyProperties, string, - SETTING_ID, &err); - if (settingID == NULL || err != 0) { - util_handleError( - "SOLARIS_NFSSHARESECMODES::GET_ASSOC_SHARE_INSTLIST", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - nfsShareInstList = cim_createInstanceList(); - if (nfsShareInstList == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSSHARESECMODES::GET_ASSOC_SHARE_INSTLIST", - CIM_ERR_FAILED, CREATE_INSTANCE_LIST_FAILURE, ex, &err); - return ((CCIMInstanceList *)NULL); - } - - nfsShareOP = get_Solaris_NFSShare_OP(settingID); - if (nfsShareOP == NULL) { - /* - * An error occurred in get_Solaris_NFSShare_OP and was - * handled there. - */ - return ((CCIMInstanceList *)NULL); - } - - nfsShareInst = cimom_getInstance(nfsShareOP, cim_false, cim_false, - cim_false, cim_false, NULL, 0); - - cim_freeObjectPath(nfsShareOP); - - if (nfsShareInst == NULL) { - /* - * No instances exist which are associated with the passed in - * Solaris_NFSShareSecurity object. - */ - cim_freeInstanceList(nfsShareInstList); - return ((CCIMInstanceList *)NULL); - } - - /* - * Work around for cimom bug 4649100. - */ - if (!set_share_keyProperties_to_true(nfsShareInst)) { - /* - * Key values not found - */ - cim_logDebug( - "get_associated_nfsShareSec_instList", - "No keyProprties found, should return error here"); - cim_freeInstance(nfsShareInst); - cim_freeInstanceList(nfsShareInstList); - return ((CCIMInstanceList *)NULL); - } - - if (nfsShareInst->mProperties == NULL) { - cim_freeInstanceList(nfsShareInstList); - cim_freeInstance(nfsShareInst); - return ((CCIMInstanceList *)NULL); - } - - nfsShareInstList = cim_addInstance(nfsShareInstList, nfsShareInst); - if (nfsShareInstList == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSSHARESECMODES::GET_ASSOC_SHARE_INSTLIST", - CIM_ERR_FAILED, CREATE_INSTANCE_LIST_FAILURE, ex, &err); - cim_freeInstance(nfsShareInst); - return ((CCIMInstanceList *)NULL); - } - - return (nfsShareInstList); -} /* get_associated_nfsShare_instList */ - -/* - * Method: get_associated_nfsShareSec_instList - * - * Finds the Solaris_NFSShareSecurity instances that are associated to the - * Solaris_NFSShare object path that was passed in. - */ -static CCIMInstanceList * -get_associated_nfsShareSec_instList(CCIMObjectPath *nfsShareOP) { - CCIMObjectPath *nfsShareSecOP; - CCIMInstanceList *nfsShareSecInstList = NULL; - CCIMException *ex; - char *name; - int err = 0; - fs_sharelist_t *nfs_sharesec_list, *tmp_sharesec_list; - - - name = util_getKeyValue(nfsShareOP->mKeyProperties, string, - NAME, &err); - if (name == NULL || err != 0) { - util_handleError( - "SOLARIS_NFSSHARESECMODES::GET_ASSOC_SP_INSTLIST", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - nfsShareSecInstList = cim_createInstanceList(); - if (nfsShareSecInstList == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSSHARESECMODES::GET_ASSOC_SP_INSTLIST", - CIM_ERR_FAILED, CREATE_INSTANCE_LIST_FAILURE, ex, &err); - return ((CCIMInstanceList *)NULL); - } - - nfs_sharesec_list = fs_get_share_list(&err); - if (nfs_sharesec_list == NULL) { - /* - * Check whether an error was returned or if we simply don't - * have any nfs shares on the system. If err is not - * equal to 0, an error was encountered. - */ - - if (err != 0) { - /* - * Determine the error and log it. - */ - if (err == ENOMEM || err == EAGAIN) { - util_handleError( - "SOLARIS_NFSSHARESECMODES:" \ - ":GET_ASSOC_SEC_INSTLIST", - CIM_ERR_LOW_ON_MEMORY, LOW_MEMORY, - NULL, &err); - cim_freeInstanceList(nfsShareSecInstList); - return ((CCIMInstanceList *)NULL); - } else { - - /* - * If any other errors were encountered it - * can be handled as a general error. We may - * not know exactly what the error is. - */ - util_handleError( - "SOLARIS_NFSSHARESECMODES:" \ - ":GET_ASSOC_SEC_INSTLIST", - CIM_ERR_FAILED, strerror(err), - NULL, &err); - cim_freeInstanceList(nfsShareSecInstList); - return ((CCIMInstanceList *)NULL); - } - } - } - - - for (tmp_sharesec_list = nfs_sharesec_list; tmp_sharesec_list != NULL; - tmp_sharesec_list = tmp_sharesec_list->next) { - char **sec_modes; - char *optionValue = NULL; - int count = 0; - - err = 0; - - - sec_modes = fs_parse_opts_for_sec_modes( - tmp_sharesec_list->options, &count, &err); - - - if (sec_modes == NULL || count == 0) { - util_handleError( - "SOLARIS_NFSSHARESECMODES::GET_ASSOC_SEC_INSTLIST", - CIM_ERR_FAILED, - FS_PARSE_OPTS_FOR_SEC_MODES_FAILURE, ex, &err); - fs_free_share_list(nfs_sharesec_list); - cim_freeInstanceList(nfsShareSecInstList); - return ((CCIMInstanceList *)NULL); - } - - - if ((strcasecmp(tmp_sharesec_list->fstype, "nfs") == 0) && - (strcmp(tmp_sharesec_list->path, name) == 0)) { - - CCIMInstance *nfsShareSecInst; - int i; - - for (i = 0; i < count; i++) { - char tmpString[MAXSIZE]; - (void) strcpy(tmpString, sec_modes[i]); - optionValue = get_property_from_opt_string( - sec_modes[i], "sec=", B_TRUE, B_FALSE); - - if (strcmp(optionValue, "0") == 0) { - free(optionValue); - optionValue = strdup("sys"); - } - - nfsShareSecOP = - get_Solaris_NFSShareSec_OP(name, - optionValue); - - free(optionValue); - if (nfsShareSecOP == NULL) { - /* - * An error occurred and it was - * handled in get_NFSShareSec_OP. - */ - fs_free_share_list(nfs_sharesec_list); - fileutil_free_string_array(sec_modes, - count); - cim_freeInstanceList( - nfsShareSecInstList); - return ((CCIMInstanceList *)NULL); - } - - nfsShareSecInst = - cimom_getInstance(nfsShareSecOP, cim_false, - cim_false, cim_false, cim_false, NULL, 0); - if (nfsShareSecInst == NULL) { - /* - * An error occurred and it was - * handled in cimom_getInstance. - */ - fs_free_share_list(nfs_sharesec_list); - fileutil_free_string_array(sec_modes, - count); - cim_freeInstanceList( - nfsShareSecInstList); - return ((CCIMInstanceList *)NULL); - } - - /* - * Work around for cimom bug 4649100. - */ - if (!set_shareSec_keyProperties_to_true( - nfsShareSecInst)) { - /* - * Key values not found - */ - cim_logDebug( - "get_associated_nfsShareSec_" \ - "instList", "No keyProprties " \ - "found, should return error here"); - cim_freeInstance(nfsShareSecInst); - cim_freeInstanceList( - nfsShareSecInstList); - return ((CCIMInstanceList *)NULL); - } - - /* - * Add the instance to the instance list. - */ - nfsShareSecInstList = cim_addInstance( - nfsShareSecInstList, nfsShareSecInst); - if (nfsShareSecInstList == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSSHARESECMODES:" \ - ":GET_ASSOC_SEC_INSTLIST", - CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &err); - cim_freeInstance(nfsShareSecInst); - fs_free_share_list(nfs_sharesec_list); - fileutil_free_string_array(sec_modes, - count); - return ((CCIMInstanceList *)NULL); - } - } - } - fileutil_free_string_array(sec_modes, count); - } - fs_free_share_list(nfs_sharesec_list); - return (nfsShareSecInstList); -} /* get_associated_nfsShareSec_instList */ - -/* - * Method: get_associated_nfsShareSec_OPList - * - * Finds the Solaris_NFSShareSecurity object paths that are associated - * to the Solaris_NFSShare object path that was passed in. - */ -static CCIMObjectPathList * -get_associated_nfsShareSec_OPList(CCIMObjectPath *nfsShareOP, int *errp) { - CCIMInstanceList *nfsShareSecInstList; - CCIMObjectPathList *nfsShareSecOPList; - CCIMException *ex; - int err = 0; - - - nfsShareSecInstList = - get_associated_nfsShareSec_instList(nfsShareOP); - if (nfsShareSecInstList == NULL) { - /* - * An error occurred in get_associated_nfsShareSec_InstList - * and was handled in that function. - */ - *errp = -1; - return ((CCIMObjectPathList *)NULL); - } - - nfsShareSecOPList = cim_createObjectPathList(nfsShareSecInstList); - if (nfsShareSecOPList == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSSHARESECMODES::GET_ASSOC_SP_OPLIST", - CIM_ERR_FAILED, CREATE_OBJECT_LIST_FAILURE, - ex, &err); - *errp = -1; - } - - cim_freeInstanceList(nfsShareSecInstList); - return (nfsShareSecOPList); -} /* get_associated_nfsShareSec_OPList */ - -/* - * Method: get_Solaris_NFSShare_OP - * - * Gets the Solaris_NFSShare object path based on the passed in name key. - */ -static CCIMObjectPath * -get_Solaris_NFSShare_OP(char *nameKey) { - CCIMObjectPath *nfsShareOP; - CCIMPropertyList *nfsShareKeyPropList; - CCIMException *ex; - char *sysName; - int err = 0; - - nfsShareOP = cim_createEmptyObjectPath(SOLARIS_NFSSHARE); - if (nfsShareOP == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHARESECMODES::GET_NFSSHARE_OP", - CIM_ERR_FAILED, CREATE_EMPTY_OBJPATH_FAILURE, ex, - &err); - return ((CCIMObjectPath *)NULL); - } - - sysName = (cimchar *)sys_get_hostname(&err); - if (sysName == NULL) { - util_handleError("SOLARIS_NFSSHARESECMODES::GET_NFSSHARE_OP", - CIM_ERR_FAILED, GET_HOSTNAME_FAILURE, NULL, &err); - cim_freeObjectPath(nfsShareOP); - return ((CCIMObjectPath *)NULL); - } - - /* - * Create the property list which to add all the key properties to and - * which will be added to the object path. - */ - nfsShareKeyPropList = cim_createPropertyList(); - if (nfsShareKeyPropList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHARESECMODES::GET_NFSSHARE_OP", - CIM_ERR_FAILED, CREATE_PROPLIST_FAILURE, ex, &err); - cim_freeObjectPath(nfsShareOP); - free(sysName); - return ((CCIMObjectPath *)NULL); - } - - /* - * add_property_to_list parameters are as follows: - * 1.) property name (cimchar *), - * 2.) property type (CIMType), - * 3.) property value (cimchar *), - * 4.) property object path for reference properties (CCIMObjectPath *), - * 5.) is property a key? (CIMBool), - * 6.) property list to add the property to (CCIMPropertyList *). - */ - - nfsShareKeyPropList = add_property_to_list(CREATION_CLASS, string, - SOLARIS_NFSSHARE, NULL, cim_true, nfsShareKeyPropList); - if (nfsShareKeyPropList == NULL) { - cim_freeObjectPath(nfsShareOP); - free(sysName); - return ((CCIMObjectPath *)NULL); - } - - nfsShareKeyPropList = add_property_to_list(NAME, string, nameKey, - NULL, cim_true, nfsShareKeyPropList); - if (nfsShareKeyPropList == NULL) { - cim_freeObjectPath(nfsShareOP); - free(sysName); - return ((CCIMObjectPath *)NULL); - } - - nfsShareKeyPropList = add_property_to_list(SYS_CREATION_CLASS, string, - SOLARIS_CS, NULL, cim_true, nfsShareKeyPropList); - if (nfsShareKeyPropList == NULL) { - cim_freeObjectPath(nfsShareOP); - free(sysName); - return ((CCIMObjectPath *)NULL); - } - - nfsShareKeyPropList = add_property_to_list(SYSTEM, string, sysName, - NULL, cim_true, nfsShareKeyPropList); - if (nfsShareKeyPropList == NULL) { - cim_freeObjectPath(nfsShareOP); - free(sysName); - return ((CCIMObjectPath *)NULL); - } - - nfsShareOP = cim_addPropertyListToObjectPath(nfsShareOP, - nfsShareKeyPropList); - if (nfsShareOP == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHARESECMODES::GET_NFSSHARE_OP", - CIM_ERR_FAILED, ADD_PROP_TO_OBJPATH_FAILURE, ex, &err); - cim_freePropertyList(nfsShareKeyPropList); - free(sysName); - return ((CCIMObjectPath *)NULL); - } - - free(sysName); - return (nfsShareOP); -} /* get_Solaris_NFSShare_OP */ - -/* - * Method: get_Solaris_NFSShareSec_OP - * - * Gets the Solaris_NFSShareSecurity object path based on the passed in - * path and mode keys. - */ -static CCIMObjectPath * -get_Solaris_NFSShareSec_OP(char *path, char *mode) { - CCIMObjectPath *nfsShareSecOP; - CCIMPropertyList *nfsShareSecKeyPropList; - CCIMException *ex; - int err = 0; - - cim_logDebug("get_Solaris_NFSShareSec_OP", - "Just entering"); - - nfsShareSecOP = - cim_createEmptyObjectPath(SOLARIS_NFSSHARESEC); - if (nfsShareSecOP == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSSHAREDEFSECMODES::GET_NFSSHARESEC_OP", - CIM_ERR_FAILED, CREATE_EMPTY_OBJPATH_FAILURE, ex, &err); - return ((CCIMObjectPath *)NULL); - } - - nfsShareSecKeyPropList = - cim_createPropertyList(); - if (nfsShareSecKeyPropList == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSSHAREDEFSECMODES::GET_NFSSHARESEC_OP", - CIM_ERR_FAILED, CREATE_PROPLIST_FAILURE, ex, &err); - cim_freeObjectPath(nfsShareSecOP); - return ((CCIMObjectPath *)NULL); - } - - /* - * add_property_to_list parameters are as follows: - * 1.) property settingID (cimchar *), - * 2.) property mode (cimchar *) - */ - nfsShareSecKeyPropList = add_property_to_list(SETTING_ID, string, - path, NULL, cim_true, nfsShareSecKeyPropList); - if (nfsShareSecKeyPropList == NULL) { - cim_freeObjectPath(nfsShareSecOP); - return ((CCIMObjectPath *)NULL); - } - - nfsShareSecKeyPropList = add_property_to_list(MODE, string, mode, - NULL, cim_true, nfsShareSecKeyPropList); - if (nfsShareSecKeyPropList == NULL) { - cim_freeObjectPath(nfsShareSecOP); - return ((CCIMObjectPath *)NULL); - } - - nfsShareSecOP = cim_addPropertyListToObjectPath( - nfsShareSecOP, nfsShareSecKeyPropList); - if (nfsShareSecOP == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSSHAREDEFSECMODES::GET_NFSSHARESEC_OP", - CIM_ERR_FAILED, ADD_PROPERTY_FAILURE, ex, &err); - cim_freePropertyList(nfsShareSecKeyPropList); - return ((CCIMObjectPath *)NULL); - } - - return (nfsShareSecOP); -} /* get_Solaris_NFSShareSec_OP */ - -/* - * Method: update_list_with_secMode_inst - * - * Adds the Solaris_NFSShareSecurityModes instance described by the passed - * in object path to the shareSecModeInstList instance list. - */ -static CCIMInstanceList * -update_list_with_secMode_inst(CCIMObjectPath *nfsShareOP, - CCIMInstanceList *shareSecModeInstList) { - - CCIMObjectPathList *nfsShareSecOPList; - CCIMObjectPathList *tmpOPList; - CCIMInstance *shareSecModeInst; - CCIMException *ex; - int err = 0; - - /* - * Retrieve all of the Solaris_NFSShareSecurity instances - * associated with the current Solaris_NFSShare object path. - * The get_associate_nfsShareSec_propList function will return - * the appropriate reference properties to be used in creating - * a Solaris_NFSShareSecurityModes instance. - */ - nfsShareSecOPList = get_associated_nfsShareSec_OPList( - nfsShareOP, &err); - if (nfsShareSecOPList == NULL) { - if (err != 0) { - return ((CCIMInstanceList *)NULL); - } - return (shareSecModeInstList); - } - - for (tmpOPList = nfsShareSecOPList; tmpOPList != NULL; - tmpOPList = tmpOPList->mNext) { - shareSecModeInst = cim_createInstance(SOLARIS_NFSSHARESECMODES); - if (shareSecModeInst == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSSHARESECMODES::ENUM_INSTANCES", - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, &err); - return ((CCIMInstanceList *)NULL); - } - /* - * Add the properties to the - * Solaris_NFSSHareSecurityModes instance. - */ - - if (add_property_to_instance(shareSecModeProps[SETTING].name, - shareSecModeProps[SETTING].type, NULL, - tmpOPList->mDataObject, shareSecModeProps[SETTING].isKey, - shareSecModeInst) == cim_false) { - cim_freeObjectPathList(nfsShareSecOPList); - return ((CCIMInstanceList *)NULL); - } - - if (add_property_to_instance(shareSecModeProps[ELEMENT].name, - shareSecModeProps[ELEMENT].type, NULL, - nfsShareOP, shareSecModeProps[ELEMENT].isKey, - shareSecModeInst) == cim_false) { - cim_freeObjectPathList(nfsShareSecOPList); - return ((CCIMInstanceList *)NULL); - } - - shareSecModeInstList = - cim_addInstance(shareSecModeInstList, - shareSecModeInst); - if (shareSecModeInstList == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSSHARESECMODES::ENUM_INSTANCES", - CIM_ERR_FAILED, ADD_INSTANCE_FAILURE, - ex, &err); - cim_freeInstance(shareSecModeInst); - cim_freeObjectPathList(nfsShareSecOPList); - return ((CCIMInstanceList *)NULL); - } - } - - return (shareSecModeInstList); -} /* update_list_with_secMode_inst */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_NFSShareSecurityModes.h b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_NFSShareSecurityModes.h deleted file mode 100644 index 0d81f0435a..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_NFSShareSecurityModes.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOLARIS_NFSSHARESECURITYMODES_H -#define _SOLARIS_NFSSHARESECURITYMODES_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> -#include <cimomhandle.h> -#include "nfsprov_include.h" - -#define PROPCOUNT 2 - -static nfs_prov_prop_t shareSecModeProps[] = { -#define ELEMENT 0 - {"Element", cim_true, reference}, -#define SETTING (ELEMENT + 1) - {"Setting", cim_true, reference} -}; - -#ifdef __cplusplus -} -#endif - -#endif /* _SOLARIS_NFSSHARESECURITYMODES_H */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_PersistentShareForSystem.c b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_PersistentShareForSystem.c deleted file mode 100644 index 92345fbb78..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_PersistentShareForSystem.c +++ /dev/null @@ -1,1113 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "Solaris_PersistentShareForSystem.h" -#include "nfs_keys.h" -#include "nfs_providers_msgstrings.h" -#include "messageStrings.h" -#include "nfs_provider_names.h" -#include "util.h" -#include "common_functions.h" -#include "createprop_methods.h" -#include "libfsmgt.h" - -/* - * Private methods - */ -static CIMBool does_persistent_share_exist(CCIMObjectPath *pShareOP); -static CCIMProperty *get_Antecedent(); - -/* - * Public methods - */ - -/* - * Instance provider methods - */ - -/* - * Method: cp_createInstance_Solaris_PersistentShareForSystem - * - * Description: This method is not supported. It is not supported because in - * order for a Solaris_PersistentShareForSystem association to exist a - * corresponding Solaris_PersistentShare and Solaris_ComputerSystem must exist. - * - * Parameters: - * - CCIMObjectPath *pOP - An object path containing the name of - * the class for which to create an instance. - * - CCIMInstance *pInst - Not used. - * - * Returns: - * - Always returns NULL because the method is not supported. - */ -/* ARGSUSED */ -CCIMObjectPath * -cp_createInstance_Solaris_PersistentShareForSystem(CCIMObjectPath *pOP, - CCIMInstance *pInst) { - int err = 0; - - util_handleError("SOLARIS_SYSPERSISTSHARE::CREATE_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return ((CCIMObjectPath *)NULL); - -} /* cp_createInstance_Solaris_PersistentShareForSystem */ - -/* - * Method: cp_deleteInstance_Solaris_PersistentShareForSystem - * - * Description: This method is not supported. It is not supported because in - * order for it to be actually deleted the corresponding - * Solaris_PersistentShare would need to be deleted. That action is not - * appropriate for this provider. - * - * Parameters: - * - CCIMObjectPath *pOP - An object path containing the - * information about the class for which to delete the instance. - * - * Returns: - * - Always returns cim_false because the method is not supported. - */ -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_PersistentShareForSystem(CCIMObjectPath *pOP) { - int err = 0; - - util_handleError("SOLARIS_SYSPERSISTSHARE::DELETE_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); - -} /* cp_deleteInstance_Solaris_PersistentShareForSystem */ - -/* - * Method: cp_enumInstances_Solaris_PersistentShareForSystem - * - * Description: Enumerates the instances of Solaris_PersistentShareForSystem on - * a host. - * An instance of Solaris_PersistentShareForSystem is an association that links - * a persistent share to the hosting machine. - * - * Parameters: - * - CCIMObjectPath *pOP - An object path containing the name of - * the class for which to enumerate the instances. - * - * Returns: - * - A pointer to a list of Solaris_PersistentShareForSystem instances. - * - NULL if an error occurred or if there are no instances of - * Solaris_PersistentShareForSystem on the host. In the case of an error, - * the error will be logged. - */ -CCIMInstanceList * -cp_enumInstances_Solaris_PersistentShareForSystem(CCIMObjectPath *pOP) { - CCIMObjectPathList *persistShareOPList; - CCIMObjectPathList *tmpOPList; - CCIMObjectPath *persistShareOP; - CCIMInstanceList *persistShareForSysInstList; - CCIMProperty *antProp; - CIMBool returned_val; - CCIMException *ex; - int err = 0; - - if (pOP == NULL) { - util_handleError("SOLARIS_SYSPERSISTSHARE::ENUM_INSTANCES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - persistShareOP = cim_createEmptyObjectPath(SOLARIS_PERSISTSHARE); - if (persistShareOP == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_SYSPERSISTSHARE::ENUM_INSTANCES", - CIM_ERR_FAILED, CREATE_EMPTY_OBJPATH_FAILURE, ex, &err); - return ((CCIMInstanceList *)NULL); - } - - persistShareOPList = cimom_enumerateInstanceNames(persistShareOP, - cim_false); - - /* - * A NULL return value indicates an error, an empty list does not. - */ - if (persistShareOPList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_SYSPERSISTSHARE::ENUM_INSTANCES", - CIM_ERR_FAILED, CIMOM_ENUM_INSTNAMES_FAILURE, ex, &err); - cim_freeObjectPath(persistShareOP); - return ((CCIMInstanceList *)NULL); - } - - cim_freeObjectPath(persistShareOP); - - if (persistShareOPList->mDataObject == NULL) { - cim_freeObjectPathList(persistShareOPList); - return ((CCIMInstanceList *)NULL); - } - - /* - * Retrieve the Antecedent property. The Antecedent property is the - * same for every instance of Solaris_PersistentShareForSystem because - * it is the Solaris_ComputerSystem upon which the - * Solaris_PersistentShare resides. - */ - antProp = get_Antecedent(); - if (antProp == NULL) { - /* - * An error was encountered and it was handled in - * get_Antecedent. - */ - cim_freeObjectPathList(persistShareOPList); - return ((CCIMInstanceList *)NULL); - } - - persistShareForSysInstList = cim_createInstanceList(); - if (persistShareForSysInstList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_SYSPERSISTSHARE::ENUM_INSTANCES", - CIM_ERR_FAILED, CREATE_INSTANCE_LIST_FAILURE, ex, &err); - cim_freeObjectPathList(persistShareOPList); - cim_freeProperty(antProp); - return ((CCIMInstanceList *)NULL); - } - - for (tmpOPList = persistShareOPList; tmpOPList != NULL; - tmpOPList = tmpOPList->mNext) { - - CCIMInstance *persistShareForSysInst; - - persistShareForSysInst = cim_createInstance( - SOLARIS_SYSPERSISTSHARE); - if (persistShareForSysInst == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_SYSPERSISTSHARE::ENUM_INSTANCES", - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, - &err); - cim_freeObjectPathList(persistShareOPList); - cim_freeProperty(antProp); - cim_freeInstanceList(persistShareForSysInstList); - return ((CCIMInstanceList *)NULL); - } - - /* - * Create a reference property out of the current - * Solaris_PersistentShare object path. - */ - if (add_property_to_instance(sysPersShareProps[DEP].name, - sysPersShareProps[DEP].type, NULL, - tmpOPList->mDataObject, sysPersShareProps[DEP].isKey, - persistShareForSysInst) == cim_false) { - - cim_freeObjectPathList(persistShareOPList); - cim_freeProperty(antProp); - cim_freeInstance(persistShareForSysInst); - cim_freeInstanceList(persistShareForSysInstList); - return ((CCIMInstanceList *)NULL); - } - - /* - * Add the Antecedent (Solaris_ComputerSystem) property to the - * instance. - */ - returned_val = cim_addProperty(persistShareForSysInst, antProp); - if (returned_val == cim_false) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_SYSPERSISTSHARE::ENUM_INSTANCES", - CIM_ERR_FAILED, ADD_PROPERTY_FAILURE, ex, &err); - cim_freeObjectPathList(persistShareOPList); - cim_freeProperty(antProp); - cim_freeInstanceList(persistShareForSysInstList); - cim_freeInstance(persistShareForSysInst); - return ((CCIMInstanceList *)NULL); - } - - /* - * Add the Solaris_PersistentShareForSystem instance to the - * instance list. - */ - persistShareForSysInstList = cim_addInstance( - persistShareForSysInstList, - persistShareForSysInst); - if (persistShareForSysInstList == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_SYSPERSISTSHARE::ENUM_INSTANCES", - CIM_ERR_FAILED, ADD_INSTANCE_FAILURE, ex, &err); - cim_freeObjectPathList(persistShareOPList); - cim_freeInstance(persistShareForSysInst); - return ((CCIMInstanceList *)NULL); - } - } - - cim_freeObjectPathList(persistShareOPList); - return (persistShareForSysInstList); - -} /* cp_enumInstances_Solaris_PersistentShareForSystem */ - -/* - * Method: cp_enumInstanceNames_Solaris_PersistentShareForSystem - * - * Description: Enumerates the object paths corresponding to the instances of - * Solaris_PersistentShareForSystem on a host. - * An instance of Solaris_PersistentShareForSystem is an association that links - * a persistent share to the hosting machine. - * - * Parameters: - * - CCIMObjectPath *pOP - An object path containing the name of - * the class for which to enumerate the instances. - * - * Returns: - * - A pointer to a list of Solaris_PersistentShareForSystem object paths. - * - NULL if an error occurred or if there are no instances of - * Solaris_PersistentShareForSystem on the host. In the case of an error, - * the error will be logged. - */ -CCIMObjectPathList * -cp_enumInstanceNames_Solaris_PersistentShareForSystem(CCIMObjectPath *pOP) { - CCIMInstanceList *persistShareForSysInstList; - CCIMObjectPathList *persistShareForSysOPList; - int err = 0; - - /* - * First check if the CCIMObjectPath parameter is null. - */ - if (pOP == NULL) { - util_handleError("SOLARIS_SYSPERSISTSHARE::ENUM_INSTANCE_NAMES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMObjectPathList *)NULL); - } - - persistShareForSysInstList = - cp_enumInstances_Solaris_PersistentShareForSystem(pOP); - if (persistShareForSysInstList == NULL) { - /* - * An error occurred in enumInstances or there are simply no - * Solaris_PersistentShareForSystem instances to enumerate. In - * the case of an error, the error would have been handled in - * the cp_enumInstances_Solaris_PersistentShareForSystem - * function. - */ - return ((CCIMObjectPathList *)NULL); - } - - persistShareForSysOPList = cim_createObjectPathList( - persistShareForSysInstList); - - cim_freeInstanceList(persistShareForSysInstList); - return (persistShareForSysOPList); - -} /* cp_enumInstanceNames_Solaris_PersistentShareForSystem */ - -/* - * Method: cp_execQuery_Solaris_PersistentShareForSystem - * - * Description: Queries the host to find those Solaris_PersistentShareForSystem - * instances that meet the search criteria. - * - * Parameters: - * - CCIMObjectPath *pOP - An object path containing the name of - * the class to query. - * - char *selectClause - Not used. - * - char *nonJoinExp - Not used. - * - char *queryExp - Not used. - * - char *queryLang - Not used. - * - * Returns: - * - A pointer to a list of Solaris_PersistentShareForSystem instances - * that match the criteria. - * - NULL if an error occurred or if there are no - * Solaris_PersistentShareForSystem instances that match the criteria. - * In the case of an error, the error will be logged. - * - * NOTE: Currently, there is no WQL parser for the C providers. As a result, - * what is returned to the CIMOM is a list of instances with - * a NULL value at the beginning of the list. This NULL value indicates - * to the CIMOM that it must do the filtering for the client. - */ -/* ARGSUSED */ -CCIMInstanceList * -cp_execQuery_Solaris_PersistentShareForSystem(CCIMObjectPath *pOP, - char *selectClause, char *nonJoinExp, char *queryExp, char *queryLang) { - - CCIMInstance *emptyInst; - CCIMInstanceList *persistShareForSysInstList; - CCIMException *ex; - int err = 0; - - if (pOP == NULL) { - util_handleError("SOLARIS_SYSPERSISTSHARE::EXEC_QUERY", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - persistShareForSysInstList = - cp_enumInstances_Solaris_PersistentShareForSystem(pOP); - if (persistShareForSysInstList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_SYSPERSISTSHARE::EXEC_QUERY", - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, &err); - return ((CCIMInstanceList *)NULL); - } - - persistShareForSysInstList = cim_prependInstance( - persistShareForSysInstList, emptyInst); - if (persistShareForSysInstList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_SYSPERSISTSHARE::EXEC_QUERY", - CIM_ERR_FAILED, PREPEND_INSTANCE_FAILURE, ex, &err); - cim_freeInstance(emptyInst); - return ((CCIMInstanceList *)NULL); - } - - return (persistShareForSysInstList); -} /* cp_execQuery_Solaris_PersistentShareForSystem */ - -/* - * Method: cp_getInstance_Solaris_PersistentShareForSystem - * - * Description: Gets the instance corresponding to the passed in object path. - * - * Parameters: - * - CCIMObjectPath *pOP - The object path containing all the - * keys of the instance that is to be returned. - * - * Returns: - * - A pointer to the instance of Solaris_PersistentShareForSystem - * corresponding to pOP. - * - NULL if an error occurred or if the instance doesn't exist on the - * host. In the case of an error, the error will be logged. - */ -CCIMInstance * -cp_getInstance_Solaris_PersistentShareForSystem(CCIMObjectPath *pOP) { - CCIMInstance *persistShareForSysInst; - CCIMPropertyList *persistShareForSysPropList; - CCIMInstanceList *instList; - CCIMObjectPath *antOP; - CCIMObjectPath *depOP; - int err = 0; - - if (pOP == NULL || pOP->mKeyProperties == NULL) { - util_handleError("SOLARIS_SYSPERSISTSHARE::GET_INSTANCE", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstance *)NULL); - } - - /* - * Get the Dependent and Antecedent properties. - */ - persistShareForSysPropList = pOP->mKeyProperties; - antOP = util_getKeyValue(persistShareForSysPropList, - sysPersShareProps[ANT].type, sysPersShareProps[ANT].name, &err); - depOP = util_getKeyValue(persistShareForSysPropList, - sysPersShareProps[DEP].type, sysPersShareProps[DEP].name, &err); - - /* - * Check if we have the Antecedent and Dependent properties. - */ - if (antOP == NULL || depOP == NULL || - antOP->mKeyProperties == NULL || - depOP->mKeyProperties == NULL) { - - util_handleError("SOLARIS_SYSPERSISTSHARE::GET_INSTANCE", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstance *)NULL); - } - - instList = cp_enumInstances_Solaris_PersistentShareForSystem(pOP); - if (instList == NULL) { - return ((CCIMInstance *)NULL); - } - - persistShareForSysInst = cim_getInstance(instList, pOP); - - cim_freeInstanceList(instList); - return (persistShareForSysInst); - -} /* cp_getInstance_Solaris_PersistentShareForSystem */ - -/* - * Method: cp_setInstance_Solaris_PersistentShareForSystem - * - * Description: This method is not supported. It is not supported because in - * order to change a Solaris_PersistentShareForSystem instance the underlying - * persistent share and computer system must be modified. Those actions must - * done on the appropriate persistent share and computer system objects, not - * here. - * - * Parameters: - * - CCIMObjectPath *pOP - An object path containing the name of the class - * for which to set the instance. - * - CCIMInstance *pInst - Not used. - * - * Returns: - * - Always returns cim_false, because the method is not supported. - */ -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_PersistentShareForSystem(CCIMObjectPath *pOP, - CCIMInstance *pInst) { - - int err = 0; - - util_handleError("SOLARIS_SYSPERSISTSHARE::SET_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_setInstance_Solaris_PersistentShareForSystem */ - -/* - * Method: cp_setInstanceWithList_Solaris_PersistentShareForSystem - * - * Description: This method is not supported. It is not supported because in - * order to change a Solaris_PersistentShareForSystem instance the underlying - * persistent share and computer system must be modified. Those actions must - * done on the appropriate persistent share and computer system objects, not - * here. - * - * Parameters: - * - CCIMObjectPath *pOP - An object path containing the name of the class - * for which to set the instance. - * - CCIMInstance *pInst - Not used. - * - * Returns: - * - Always returns cim_false, because the method is not supported. - */ -/* ARGSUSED */ -CIMBool -cp_setInstanceWithList_Solaris_PersistentShareForSystem(CCIMObjectPath *pOP, - CCIMInstance *pInst, char **props, int num_props) { - - int err = 0; - - util_handleError("SOLARIS_SYSPERSISTSHARE::SET_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_setInstanceWithList_Solaris_PersistentShareForSystem */ - -/* - * Associator provider methods - */ - -/* - * Method: cp_associators_Solaris_PersistentShareForSystem - * - * Description: Returns the instances associated, via the - * Solaris_PersistentShareForSystem association, to the pObjectName parameter. - * - * Parameters: - * - CCIMObjectPath *pAssocName - An object path containing the name of - * the association that the caller is trying to reach. - * - CCIMObjectPath *pObjectName - The object path containing information - * (Class Name, Key Properties) about the object whose associated objects - * are to be returned. - * - char *pResultClass - If specified, only return instances that are of - * this class type. - * - char *pRole - If specified, this is the role of the pObjectName - * object path passed in. If this is not valid, NULL is returned. - * - char *pResultRole - If specified, only return instances that are - * playing this role in the association. - * - * Returns: - * - A list of Solaris_PersistentShare (if pRole == Antecedent && - * pObjectName is a Solaris_ComputerSystem object path) or - * Solaris_ComputerSystem (if pRole == Dependent && pObjectName is a - * Solaris_PersistentShare object path) instances which are associated - * to the pObjectName parameter. - * - NULL if an error occurred or if there are no instances associated to - * the pObjectName passed in. In the case of an error, the error will be - * logged. - */ -/* ARGSUSED */ -CCIMInstanceList * -cp_associators_Solaris_PersistentShareForSystem(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pResultClass, char *pRole, - char *pResultRole) { - - CCIMInstanceList *returnInstList = NULL; - CCIMObjectPath *resultOP; - CCIMException *ex; - cimchar *resultClassName; - int err = 0; - - if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { - util_handleError("SOLARIS_SYSPERSISTSHARE::ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - /* - * Determine whether the pObjectName is the Antecedent or the Dependent - * of the association. Antecedent == Solaris_ComputerSystem, - * Dependent = Solaris_PersistentShare - */ - if ((strcasecmp(pObjectName->mName, COMPUTER_SYSTEM) == 0)) { - CCIMPropertyList *propList; - char *name; - char *hostname; - - resultClassName = SOLARIS_PERSISTSHARE; - - /* - * If a value was passed in with pRole and it does not match - * the role that the pObjectName actually is then log an - * invalid param error. - */ - if (pRole != NULL && (strcasecmp(pRole, - sysPersShareProps[ANT].name) != 0)) { - util_handleError("SOLARIS_SYSPERSISTSHARE::ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - /* - * Retrieve the Name key property from the pObjectName object - * path. This is expected to be populated with the host name. - * If the Name key value is not the same as that of the current - * host, return null. - */ - propList = pObjectName->mKeyProperties; - name = (cimchar *)util_getKeyValue(propList, string, NAME, - &err); - - if (name == NULL || err != 0) { - /* - * We don't have the appropriate information. - */ - util_handleError("SOLARIS_SYSPERSISTSHARE::ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - err = 0; - hostname = sys_get_hostname(&err); - if (hostname == NULL || err != 0) { - util_handleError("SOLARIS_SYSPERSISTSHARE::ASSOCIATORS", - CIM_ERR_FAILED, GET_HOSTNAME_FAILURE, NULL, - &err); - return ((CCIMInstanceList *)NULL); - } - - if ((strcmp(name, hostname) != 0)) { - /* - * We can only determine shares on the current host. - * The providers are not distributed. - */ - util_handleError("SOLARIS_SYSPERSISTSHARE::ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - free(hostname); - return ((CCIMInstanceList *)NULL); - } - free(hostname); - - } else if (strcasecmp(pObjectName->mName, SOLARIS_PERSISTSHARE) == 0) { - CIMBool persistShareExists; - - resultClassName = COMPUTER_SYSTEM; - if (pRole != NULL && (strcasecmp(pRole, - sysPersShareProps[DEP].name) != 0)) { - util_handleError("SOLARIS_SYSPERSISTSHARE::ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - persistShareExists = does_persistent_share_exist(pObjectName); - - if (persistShareExists == cim_false) { - cim_logDebug("cp_associators", - "persistShareExists == cim_false"); - util_handleError("SOLARIS_SYSPERSISTSHARE:ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - } else { - util_handleError("SOLARIS_SYSPERSISTSHARE:ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - resultOP = cim_createEmptyObjectPath(resultClassName); - if (resultOP == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_SYSPERSISTSHARE:ASSOCIATORS", - CIM_ERR_FAILED, CREATE_EMPTY_OBJPATH_FAILURE, ex, &err); - return ((CCIMInstanceList *)NULL); - } - - returnInstList = cimom_enumerateInstances(resultOP, cim_false, - cim_false, cim_false, cim_false, cim_false, NULL, 0); - - /* - * A NULL return value indicates error, an empty list does not. - */ - if (returnInstList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_SYSPERSISTSHARE:ASSOCIATORS", - CIM_ERR_FAILED, CIMOM_ENUM_INST_FAILURE, ex, &err); - cim_freeObjectPath(resultOP); - return ((CCIMInstanceList *)NULL); - } - - cim_freeObjectPath(resultOP); - - if (returnInstList->mDataObject == NULL) { - return ((CCIMInstanceList *)NULL); - } - - return (returnInstList); -} /* cp_associators_Solaris_PersistentShareForSystem */ - -/* - * Method: cp_associatorNames_Solaris_PersistentShareForSystem - * - * Description: Returns the object paths corresponding to the instances on the - * other side of the association which are associated via the - * Solaris_PersistentShareForSystem association and having the passed in - * parameter, pObjectName, as the opposite key. - * - * Parameters: - * - CCIMObjectPath *pAssocName - An object path containing information - * about the association that the caller is trying to reach. - * - CCIMObjectPath *pObjectName - The object path which contains the - * information on whose associated objects are to be returned. - * - char *pResultClass - If specified, only return instances that are of - * this class type. - * - char *pRole - If specified, this is the role of the pObjectName - * object path passed in. If this is not valid, NULL is returned. - * - char *pResultRole - If specified, only return instances that are - * playing this role in the association. - * - * Returns: - * - A list of Solaris_PersistentShare (if pRole == Antecedent && - * pObjectName is a Solaris_ComputerSystem object path) or - * Solaris_ComputerSystem (if pRole == Dependent && pObjectName is a - * Solaris_PersistentShare object path) object paths which are associated - * to the pObjectName parameter. - * - NULL if an error occurred or if there are no instances associated to - * the pObjectName passed in. In the case of an error, the error will be - * logged. - */ -CCIMObjectPathList * -cp_associatorNames_Solaris_PersistentShareForSystem(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pResultClass, char *pRole, - char *pResultRole) { - - CCIMInstanceList *instList; - CCIMObjectPathList *objPathList; - int err = 0; - - if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { - util_handleError("SOLARIS_SYSPERSISTSHARE::ASSOCIATOR_NAMES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMObjectPathList *)NULL); - } - - instList = cp_associators_Solaris_PersistentShareForSystem(pAssocName, - pObjectName, pResultClass, pRole, pResultRole); - if (instList == NULL) { - return ((CCIMObjectPathList *)NULL); - } - - objPathList = cim_createObjectPathList(instList); - - cim_freeInstanceList(instList); - return (objPathList); -} /* cp_associatorNames_Solaris_PersistentShareForSystem */ - -/* - * Method: cp_references_Solaris_PersistentShareForSystem - * - * Description: Returns the Solaris_PersistentShareForSystem instances that - * have the passed in parameter, pObjectName, as one of it's keys. - * - * Parameters: - * - CCIMObjectPath *pAssocName - An object path containing information - * about the association that the caller is trying to reach. - * - CCIMObjectPath *pObjectName - The object path which contains the - * information on whose associated objects are to be returned. - * - char *pRole - If specified, this is the role of the pObjectName - * object path passed in. If this is not valid, NULL is returned. - * - * Returns: - * - A pointer to a list of Solaris_PersistentShareForSystem instances. - * - NULL if an error occurred or if there are no - * Solaris_PersistentShareForSystem instances having pObjectName as one of - * it's keys. - */ -CCIMInstanceList * -cp_references_Solaris_PersistentShareForSystem(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pRole) { - - CCIMInstanceList *instList; - CCIMObjectPathList *objPathList; - int err = 0; - - if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { - util_handleError("SOLARIS_SYSPERSISTSHARE::REFERENCES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - /* - * Get everything that is related to the pObjectName passed in. - */ - objPathList = cp_associatorNames_Solaris_PersistentShareForSystem( - pAssocName, pObjectName, NULL, pRole, NULL); - if (objPathList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - /* - * Now use the object paths in the object path list and the pObjectName - * variable to create the association instances. - */ - - if ((strcasecmp(pObjectName->mName, SOLARIS_PERSISTSHARE) == 0)) { - /* - * pObjectName is the Dependent - */ - instList = create_association_instList(SOLARIS_SYSPERSISTSHARE, - pObjectName, DEPENDENT, objPathList, ANTECEDENT, &err); - } else { - /* - * pObjectName is the Antecedent - */ - instList = create_association_instList(SOLARIS_SYSPERSISTSHARE, - pObjectName, ANTECEDENT, objPathList, DEPENDENT, &err); - } - cim_freeObjectPathList(objPathList); - - return (instList); -} /* cp_references_Solaris_PersistentShareForSystem */ - -/* - * Method: cp_referenceNames_Solaris_PersistentShareForSystem - * - * Description: Returns the object paths corresponding to the - * Solaris_PersistentShareForSystem instances that have the passed in parameter, - * pObjectName, as one of it's keys. - * - * Parameters: - * - CCIMObjectPath *pAssocName - An object path containing information - * about the association that the caller is trying to reach. - * - CCIMObjectPath *pObjectName - The object path which contains the - * information on whose associated objects are to be returned. - * - char *pRole - If specified, this is the role of the pObjectName - * object path passed in. If this is not valid, NULL is returned. - * - * Returns: - * - A pointer to a list of Solaris_PersistentShareForSystem object paths. - * - NULL if an error occurred or if there are no - * Solaris_PersistentShareForSystem instances having pObjectName as one of - * it's keys. - */ -CCIMObjectPathList * -cp_referenceNames_Solaris_PersistentShareForSystem(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pRole) { - - CCIMInstanceList *persistShareForSysInstList; - CCIMObjectPathList *persistShareForSysOPList; - int err = 0; - - if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { - util_handleError("SOLARIS_SYSPERSISTSHARE::REFERENCE_NAMES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMObjectPathList *)NULL); - } - - persistShareForSysInstList = - cp_references_Solaris_PersistentShareForSystem(pAssocName, - pObjectName, pRole); - if (persistShareForSysInstList == NULL) { - return ((CCIMObjectPathList *)NULL); - } - - persistShareForSysOPList = cim_createObjectPathList( - persistShareForSysInstList); - - cim_freeInstanceList(persistShareForSysInstList); - return (persistShareForSysOPList); -} /* cp_referenceNames_Solaris_PersistentShareForSystem */ - -/* - * Property provider methods - */ - -/* - * Method: cp_getProperty_Solaris_PersistentShareForSystem - * - * Description: Retrieves a certain property from the instance of - * Solaris_PersistentShareForSystem on the host that is described by the - * parameter pOP. - * - * Parameters: - * - CCIMObjectPath *pOP - The object path containing all the - * information needed to find the instance for which the property is to - * be returned. - * - cimchar *pPropName - The name of the property to be found. - * - * Returns: - * - A pointer to the property corresponding to the name passed in with - * pPropName. - * - NULL if an error occurred or if the property doesn't exist. In the - * case of an error, the error will be logged. - */ -CCIMProperty * -cp_getProperty_Solaris_PersistentShareForSystem(CCIMObjectPath *pOP, - cimchar *pPropName) { - - CCIMInstance *persistShareForSysInst; - CCIMProperty *persistShareForSysProp; - int err = 0; - - if (pOP == NULL) { - util_handleError("SOLARIS_SYSPERSISTSHARE::GET_PROPERTY", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMProperty *)NULL); - } - - persistShareForSysInst = - cp_getInstance_Solaris_PersistentShareForSystem(pOP); - if (persistShareForSysInst == NULL) { - return ((CCIMProperty *)NULL); - } - - persistShareForSysProp = cim_getProperty(persistShareForSysInst, - pPropName); - cim_freeInstance(persistShareForSysInst); - - return (persistShareForSysProp); - -} /* cp_getProperty_Solaris_PersistentShareForSystem */ - -/* - * Method: cp_setProperty_Solaris_PersistentShareForSystem - * - * Description: This method is not supported. It is not supported because in - * order to change a Solaris_PersistentShareForSystem instance the underlying - * persistent share and computer system must be modified. Those actions must - * done on the appropriate persistent share and computer system objects, not - * here. - * - * Parameters: - * - CCIMObjectPath *pOP - Not used. - * - CCIMProperty *pProp - Not used. - * - * Returns: - * - Always returns cim_false because the method is not supported. - */ -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_PersistentShareForSystem(CCIMObjectPath *pOP, - CCIMProperty *pProp) { - - int err = 0; - - util_handleError("SOLARIS_SYSPERSISTSHARE::SET_PROPERTY", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_setProperty_Solaris_PersistentShareForSystem */ - -/* - * Method provider methods - */ - -/* - * Method: cp_invokeMethod_Solaris_PersistentShareForSystem - * - * Description: This method is not supported because the provider doesn't have - * any methods. - * - * Parameters: - * - CCIMObjectPath* op - Not used. - * - cimchar* methodName - Not used. - * - CCIMPropertyList* inParams - Not used. - * - CCIMPropertyList* outParams - Not used. - * - * Returns: - * - Always returns null because the method is not supported. - */ -/* ARGSUSED */ -CCIMProperty * -cp_invokeMethod_Solaris_PersistentShareForSystem(CCIMObjectPath *pOP, - cimchar *methodName, CCIMPropertyList *inParams, - CCIMPropertyList *outParams) { - - return ((CCIMProperty *)NULL); -} /* cp_invokeMethod_Solaris_PersistentShareForSystem */ - -/* - * Private Methods - */ - -/* - * Method: does_persistent_share_exist - * - * Description: Determines from the Solaris_PersistentShare object path whether - * or not the dfstab entry actually exists. - * - * Parameters: - * - CCIMObjectPath *persShareOP - The object path used (by retrieving - * the SettingId property) to determine whether or not the dfstab entry - * exists. - * - * Returns: - * - cim_true or cim_false representing whether or not the entry was - * found. - */ -static CIMBool -does_persistent_share_exist(CCIMObjectPath *persShareOP) { - CCIMPropertyList *propList; - CIMBool foundEntry = cim_false; - fs_dfstab_entry_t dfstabEnts, currentDfstabEnt; - char *settingId; - int err = 0; - - propList = persShareOP->mKeyProperties; - - settingId = util_getKeyValue(propList, string, SETTING_ID, &err); - if (settingId == NULL || err != 0) { - return (cim_false); - } - - cim_logDebug("does_persistent_share_exist", "SettingId =%s", settingId); - dfstabEnts = fs_get_DFStab_ents(&err); - - currentDfstabEnt = dfstabEnts; - while (currentDfstabEnt != NULL && foundEntry == cim_false) { - char *path; - - path = fs_get_DFStab_ent_Path(currentDfstabEnt); - - if (strcasecmp(path, settingId) == 0) { - foundEntry = cim_true; - } - currentDfstabEnt = fs_get_DFStab_ent_Next(currentDfstabEnt); - } - - fs_free_DFStab_ents(dfstabEnts); - return (foundEntry); -} /* does_persistent_share_exist */ - -/* - * Method: get_Antecedent - * - * Description: Retrieves the antecedent, Solaris_ComputerSystem, reference - * property for the association. - * - * Parameters: - * - NONE - * - * Returns: - * - A pointer to a Solaris_ComputerSystem reference property. - * - Upon error, NULL is returned and the error is logged. - */ -static CCIMProperty * -get_Antecedent() { - CCIMInstance *compSysInst; - CCIMObjectPath *compSysOP; - CCIMProperty *compSysRefProp; - CCIMException *ex; - char *hostname; - int err = 0; - - compSysInst = cim_createInstance(COMPUTER_SYSTEM); - if (compSysInst == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_SYSPERSISTSHARE::GET_ANT", - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, &err); - return ((CCIMProperty *)NULL); - } - - /* - * Create the key properties on the Solaris_ComputerSystem instance. - * - * The Solaris_ComputerSystem keys are as follows: - * CreationClassName = "Solaris_ComputerSystem" - * Name = < host name > - */ - - if (add_property_to_instance(CREATION_CLASS, string, - COMPUTER_SYSTEM, NULL, cim_true, compSysInst) == cim_false) { - - cim_freeInstance(compSysInst); - return ((CCIMProperty *)NULL); - } - - err = 0; - hostname = sys_get_hostname(&err); - if (hostname == NULL) { - util_handleError("SOLARIS_SYSPERSISTSHARE::GET_ANT", - CIM_ERR_FAILED, GET_HOSTNAME_FAILURE, NULL, &err); - cim_freeInstance(compSysInst); - return ((CCIMProperty *)NULL); - } - - if (add_property_to_instance(NAME, string, hostname, NULL, - cim_true, compSysInst) == cim_false) { - - free(hostname); - cim_freeInstance(compSysInst); - return ((CCIMProperty *)NULL); - } - free(hostname); - - compSysOP = cim_createObjectPath(compSysInst); - if (compSysOP == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_SYSPERSISTSHARE::GET_ANT", - CIM_ERR_FAILED, CREATE_OBJECT_PATH_FAILURE, - ex, &err); - cim_freeInstance(compSysInst); - return ((CCIMProperty *)NULL); - } - - cim_freeInstance(compSysInst); - - compSysRefProp = cim_createReferenceProperty( - sysPersShareProps[ANT].name, compSysOP, - sysPersShareProps[ANT].isKey); - if (compSysRefProp == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_SYSPERSISTSHARE::GET_ANT", - CIM_ERR_FAILED, CREATE_REFPROP_FAILURE, ex, &err); - cim_freeObjectPath(compSysOP); - return ((CCIMProperty *)NULL); - } - - cim_freeObjectPath(compSysOP); - - return (compSysRefProp); -} /* get_Antecedent */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_PersistentShareForSystem.h b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_PersistentShareForSystem.h deleted file mode 100644 index 1152316d91..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_PersistentShareForSystem.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOLARIS_PERSISTENTSHAREFORSYSTEM_H -#define _SOLARIS_PERSISTENTSHAREFORSYSTEM_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> -#include <cimomhandle.h> -#include "nfsprov_include.h" - -#define PROPCOUNT 2 - -static nfs_prov_prop_t sysPersShareProps[] = { -#define ANT 0 - {"Antecedent", cim_true, reference}, -#define DEP (ANT + 1) - {"Dependent", cim_true, reference} -}; - -#ifdef __cplusplus -} -#endif - -#endif /* _SOLARIS_PERSISTENTSHAREFORSYSTEM_H */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_SharedFileSystem.c b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_SharedFileSystem.c deleted file mode 100644 index 9a7811d0a6..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_SharedFileSystem.c +++ /dev/null @@ -1,1161 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "Solaris_SharedFileSystem.h" -#include "nfs_keys.h" -#include "nfs_providers_msgstrings.h" -#include "messageStrings.h" -#include "nfs_provider_names.h" -#include "util.h" -#include "common_functions.h" -#include "createprop_methods.h" -#include <sys/types.h> - -typedef void* inst_or_objPath; - -/* - * Private method declaration - */ -static inst_or_objPath get_associated_directory(CCIMObjectPath *nfsShareOP, - boolean_t returnInst); -static CCIMInstanceList* get_associated_instances(CCIMObjectPath *pOP, - boolean_t isSystemElement); -static CCIMInstance* get_associated_share(CCIMObjectPath *dirOP); - -/* - * Public methods - */ - -/* - * Instance provider methods - */ - -/* - * Method: cp_createInstance_Solaris_SharedFileSystem - * - * Description: This method is not supported. It is not supported because in - * order for a Solaris_SharedFileSystem association to exist a corresponding - * Solaris_NFSShare and Solaris_Directory must exist. - * - * Parameters: - * - CCIMObjectPath *pOP - An object path containing the name of - * the class of which to create an instance of. - * - CCIMInstance *pInst - Not used. - * - * Returns: - * - Always returns NULL because the method is not supported. - */ -/* ARGSUSED */ -CCIMObjectPath * -cp_createInstance_Solaris_SharedFileSystem(CCIMObjectPath *pOP, - CCIMInstance *pInst) { - - int err = 0; - - util_handleError("SOLARIS_SHAREDFS::CREATE_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return ((CCIMObjectPath *)NULL); -} /* cp_createInstance_Solaris_SharedFileSystem */ - -/* - * Method: cp_deleteInstance_Solaris_SharedFileSystem - * - * Description: This method is not supported. It is not supported because in - * order for it to be actually deleted the corresponding Solaris_NFSShare or - * Solaris_Directory would need to be deleted. That action is not appropriate - * for this provider. - * - * Parameters: - * - CCIMObjectPath *pOP - An object path containing the - * information about the class of which to delete the instance of. - * - * Returns: - * - Always returns cim_false because the method is not supported. - */ -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_SharedFileSystem(CCIMObjectPath pOP) { - int err = 0; - - util_handleError("SOLARIS_SHAREDFS::DELETE_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_deleteInstance_Solaris_SharedFileSystem */ - -/* - * Method: cp_enumInstances_Solaris_SharedFileSystem - * - * Description: Enumerates the instances of Solaris_SharedFileSystem on a host. - * An instance of Solaris_SharedFileSystem is an association that links a share - * object to the directory that is shared. - * - * Parameters: - * - CCIMObjectPath *pOP - An object path containing the name of - * the class of which to enumerate the instances of. - * - * Returns: - * - A pointer to a list of Solaris_SharedFileSystem instances. - * - NULL if an error occurred or if there are no instances of - * Solaris_SharedFileSystem on the host. In the case of an error, the - * error will be logged. - */ -CCIMInstanceList * -cp_enumInstances_Solaris_SharedFileSystem(CCIMObjectPath *pOP) { - CCIMObjectPathList *nfsShareOPList; - CCIMObjectPathList *currentShareOP; - CCIMInstanceList *sharedFSInstList; - CCIMObjectPath *nfsShareOP; - CCIMException *ex; - cimchar *pValue; - int err = 0; - - if (pOP == NULL) { - util_handleError("SOLARIS_SHAREDFS::ENUM_INSTANCES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - nfsShareOP = cim_createEmptyObjectPath(SOLARIS_NFSSHARE); - if (nfsShareOP == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_SHAREDFS::ENUM_INSTANCES", - CIM_ERR_FAILED, CREATE_EMPTY_OBJPATH_FAILURE, ex, &err); - return ((CCIMInstanceList *)NULL); - } - - nfsShareOPList = cimom_enumerateInstanceNames(nfsShareOP, cim_false); - /* - * A NULL return value means error, an empty list does not. - */ - if (nfsShareOPList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_SHAREDFS::ENUM_INSTANCES", - CIM_ERR_FAILED, CIMOM_ENUM_INSTNAMES_FAILURE, ex, &err); - cim_freeObjectPath(nfsShareOP); - return ((CCIMInstanceList *)NULL); - } - - cim_freeObjectPath(nfsShareOP); - - if (nfsShareOPList->mDataObject == NULL) { - return ((CCIMInstanceList *)NULL); - } - - sharedFSInstList = cim_createInstanceList(); - if (sharedFSInstList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_SHAREDFS::ENUM_INSTANCES", - CIM_ERR_FAILED, CREATE_INSTANCE_LIST_FAILURE, ex, &err); - cim_freeObjectPathList(nfsShareOPList); - return ((CCIMInstanceList *)NULL); - } - - for (currentShareOP = nfsShareOPList; currentShareOP != NULL; - currentShareOP = currentShareOP->mNext) { - - CCIMObjectPath *sysElementOP; - CCIMInstance *sharedFSInst; - - sharedFSInst = cim_createInstance(SOLARIS_SHAREDFS); - if (sharedFSInst == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_SHAREDFS::ENUM_INSTANCES", - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, - &err); - cim_freeObjectPathList(nfsShareOPList); - cim_freeInstanceList(sharedFSInstList); - return ((CCIMInstanceList *) NULL); - } - - /* - * Retrieve the Solaris_Directory instance associated with - * the current Solaris_NFSShare object path. - */ - sysElementOP = get_associated_directory( - currentShareOP->mDataObject, B_FALSE); - if (sysElementOP == NULL) { - cim_freeObjectPathList(nfsShareOPList); - cim_freeInstanceList(sharedFSInstList); - cim_freeInstance(sharedFSInst); - return ((CCIMInstanceList *)NULL); - } - - pValue = NULL; - if (add_property_to_instance(sharedFSProps[SYS].name, - sharedFSProps[SYS].type, pValue, sysElementOP, - sharedFSProps[SYS].isKey, sharedFSInst) == cim_false) { - - cim_freeObjectPathList(nfsShareOPList); - cim_freeObjectPath(sysElementOP); - cim_freeInstanceList(sharedFSInstList); - cim_freeInstance(sharedFSInst); - return ((CCIMInstanceList *)NULL); - } - - cim_freeObjectPath(sysElementOP); - - pValue = NULL; - if (add_property_to_instance(sharedFSProps[SAME].name, - sharedFSProps[SAME].type, pValue, - currentShareOP->mDataObject, sharedFSProps[SAME].isKey, - sharedFSInst) == cim_false) { - - cim_freeObjectPathList(nfsShareOPList); - cim_freeInstanceList(sharedFSInstList); - cim_freeInstance(sharedFSInst); - return ((CCIMInstanceList *)NULL); - } - - /* - * Add the instance to the instance list. - */ - sharedFSInstList = cim_addInstance(sharedFSInstList, - sharedFSInst); - if (sharedFSInstList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_SHAREDFS::ENUM_INSTANCES", - CIM_ERR_FAILED, ADD_INSTANCE_FAILURE, ex, &err); - cim_freeObjectPathList(nfsShareOPList); - cim_freeInstance(sharedFSInst); - return ((CCIMInstanceList *)NULL); - } - - } /* end for */ - - cim_freeObjectPathList(nfsShareOPList); - return (sharedFSInstList); -} /* cp_enumInstances_Solaris_SharedFileSystem */ - -/* - * Method: cp_enumInstanceNames_Solaris_SharedFileSystem - * - * Description: Enumerates the instances of Solaris_SharedFileSystem on a host. - * An instance of Solaris_SharedFileSystem is an association that links a share - * object to the directory that is shared. - * - * Parameters: - * - CCIMObjectPath *pOP - An object path containing the name of - * the class of which to enumerate the instances of. - * - * Returns: - * - A pointer to a list of object paths corresponding to the - * Solaris_SharedFileSystem instances on the host. - * - NULL if an error occurred or if there are no instances of - * Solaris_SharedFileSystem on the host. In the case of an error, the - * error will be logged. - */ -CCIMObjectPathList * -cp_enumInstanceNames_Solaris_SharedFileSystem(CCIMObjectPath *pOP) { - CCIMInstanceList *sharedFSInstList; - CCIMObjectPathList *sharedFSOPList; - int err = 0; - - if (pOP == NULL) { - util_handleError("SOLARIS_SHAREDFS::ENUM_INSTANCENAMES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMObjectPathList *)NULL); - } - - sharedFSInstList = cp_enumInstances_Solaris_SharedFileSystem(pOP); - if (sharedFSInstList == NULL) { - /* - * Either an error occurred or there are no instances of - * Solaris_SharedFileSystem on the system. In the case of an - * error, the error would have been handled in - * cp_enumInstances_Solaris_SharedFileSystem. - */ - return ((CCIMObjectPathList *)NULL); - } - - sharedFSOPList = cim_createObjectPathList(sharedFSInstList); - - cim_freeInstanceList(sharedFSInstList); - return (sharedFSOPList); -} /* cp_enumInstanceNames_Solaris_SharedFileSystem */ - -/* - * Method: cp_execQuery_Solaris_SharedFileSystem - * - * Description: Queries the host to find those Solaris_SharedFileSystem - * instances that meet the search criteria. - * - * Parameters: - * - CCIMObjectPath *pOP - An object path containing the name of - * the class of which to query. - * - char *selectClause - Not used. - * - char *nonJoinExp - Not used. - * - char *queryExp - Not used. - * - char *queryLang - Not used. - * - * Returns: - * - A pointer to a list of Solaris_SharedFileSystem instances that match - * the criteria. - * - NULL if an error occurred or if there are no Solaris_SharedFileSystem - * instances that match the criteria. In the case of an error, the error - * will be logged. - * - * NOTE: Currently, there is no WQL parser for the C providers. As a result, - * what is returned to the CIMOM is a list of instances with - * a NULL value at the beginning of the list. This NULL value indicates - * to the CIMOM that it must do the filtering for the client. - */ -/* ARGSUSED */ -CCIMInstanceList * -cp_execQuery_Solaris_SharedFileSystem(CCIMObjectPath *pOP, - char *selectClause, char *nonJoinExp, char *queryExp, char *queryLang) { - - CCIMInstance *emptyInst; - CCIMInstanceList *sharedElemInstList; - CCIMException *ex; - int err = 0; - - if (pOP == NULL) { - util_handleError("SOLARIS_SHAREDFS::EXEC_QUERY", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - sharedElemInstList = cp_enumInstances_Solaris_SharedFileSystem(pOP); - if (sharedElemInstList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_SHAREDFS::EXEC_QUERY", - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, &err); - cim_freeInstanceList(sharedElemInstList); - return ((CCIMInstanceList *)NULL); - } - - sharedElemInstList = cim_prependInstance(sharedElemInstList, emptyInst); - if (sharedElemInstList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_SHAREDFS::EXEC_QUERY", - CIM_ERR_FAILED, PREPEND_INSTANCE_FAILURE, ex, &err); - cim_freeInstance(emptyInst); - return ((CCIMInstanceList *)NULL); - } - - return (sharedElemInstList); -} /* cp_execQuery_Solaris_SharedFileSystem */ - -/* - * Method: cp_getInstance_Solaris_SharedFileSystem - * - * Description: Gets the instance corresponding to the passed in object path. - * - * Parameters: - * - CCIMObjectPath *pOP - The object path containing all the - * keys of the instance that is supposed to be returned. - * - * Returns: - * - A pointer to the instance of Solaris_SharedFileSystem corresponding - * to pOP. - * - NULL if an error occurred or if the instance doesn't exist on the - * host. In the case of an error, the error will be logged. - */ -CCIMInstance * -cp_getInstance_Solaris_SharedFileSystem(CCIMObjectPath *pOP) { - CCIMInstanceList *instList; - CCIMInstance *inst; - CCIMObjectPath *sameOP; - CCIMObjectPath *sysOP; - CCIMPropertyList *sharedFSPropList; - int err = 0; - - if (pOP == NULL || pOP->mKeyProperties == NULL) { - util_handleError("SOLARIS_SHAREDFS::GET_INSTANCE", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstance *)NULL); - } - - /* - * Check if we have the SameElement and SystemElement properties. - */ - sharedFSPropList = pOP->mKeyProperties; - sameOP = util_getKeyValue(sharedFSPropList, sharedFSProps[SAME].type, - sharedFSProps[SAME].name, &err); - sysOP = util_getKeyValue(sharedFSPropList, sharedFSProps[SYS].type, - sharedFSProps[SYS].name, &err); - - if (sameOP == NULL || sysOP == NULL) { - util_handleError("SOLARIS_SHAREDFS::GET_INSTANCE", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstance *)NULL); - } - - if (sameOP->mKeyProperties == NULL || sysOP->mKeyProperties == NULL) { - util_handleError("SOLARIS_SHAREDFS::GET_INSTANCE", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstance *)NULL); - } - - instList = cp_enumInstances_Solaris_SharedFileSystem(pOP); - if (instList == NULL) { - return ((CCIMInstance *)NULL); - } - - inst = cim_getInstance(instList, pOP); - - cim_freeInstanceList(instList); - return (inst); -} /* cp_getInstances_Solaris_SharedFileSystem */ - -/* - * Method: cp_setInstance_Solaris_SharedFileSystem - * - * Description: This method is not supported. It is not supported because in - * order to change a Solaris_SharedFileSystem instance the underlying share and - * directory must be modified. Those actions must be done on the appropriate - * share and directory objects, not here. - * - * Parameters: - * - CCIMObjectPath *pOP - An object path containing the name of the class - * of which to set the instance. - * - CCIMInstance *pInst - Not used. - * - * Returns: - * - Always returns cim_false, because the method is not supported. - */ -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_SharedFileSystem(CCIMObjectPath *pOP, - CCIMInstance *pInst) { - - int err = 0; - - util_handleError("SOLARIS_SHAREDFS::SET_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_setInstance_Solaris_SharedFileSystem */ - -/* - * Method: cp_setInstanceWithList_Solaris_SharedFileSystem - * - * Description: This method is not supported. It is not supported because in - * order to change a Solaris_SharedFileSystem instance the underlying share and - * directory must be modified. Those actions must be done on the appropriate - * share and directory objects, not here. - * - * Parameters: - * - CCIMObjectPath *pOP - An object path containing the name of the class - * of which to set the instance. - * - CCIMInstance *pInst - Not used. - * - * Returns: - * - Always returns cim_false, because the method is not supported. - */ -/* ARGSUSED */ -CIMBool -cp_setInstanceWithList_Solaris_SharedFileSystem(CCIMObjectPath *pOP, - CCIMInstance *pInst, char **props, int num_props) { - - int err = 0; - - util_handleError("SOLARIS_SHAREDFS::SET_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_setInstanceWithList_Solaris_SharedFileSystem */ - -/* - * Association provider methods - */ - -/* - * Method: cp_associators_Solaris_SharedFileSystem - * - * Description: Returns the instances associated, via the - * Solaris_SharedFileSystem association, to the pObjectName parameter. - * - * Parameters: - * - CCIMObjectPath *pAssocName - An object path containing the name of - * the association that the caller is trying to reach. - * - CCIMObjectPath *pObjectName - The object path containing information - * (Class Name, Key Properties) about the object whose associated objects - * are to be returned. - * - char *pResultClass - If specified, only return instances that are of - * this class type. - * - char *pRole - If specified, this is the role of the pObjectName - * object path passed in. If this is not valid, NULL is returned. - * - char *pResultRole - If specified, only return instances that are - * playing this role in the association. - * - * Returns: - * - A list of Solaris_NFSShare (if pRole == SystemElement && pObjectName - * is a Solaris_Directory object path) or Solaris_Directory (if - * pRole == SameElement && pObjectName is a Solaris_NFSShare object path) - * instances which are associated to the pObjectName parameter. - * - NULL if an error occurred or if there are no instances associated to - * the pObjectName passed in. In the case of an error, the error will be - * logged. - */ -/* ARGSUSED */ -CCIMInstanceList * -cp_associators_Solaris_SharedFileSystem(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pResultClass, char *pRole, - char *pResultRole) { - - CCIMInstanceList *returnInstList = NULL; - boolean_t isSystemElement = B_FALSE; - int err = 0; - - /* - * Check if the needed parameters are null. - */ - if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { - util_handleError("SOLARIS_SHAREDFS::ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - if ((strcasecmp(pObjectName->mName, SOLARIS_DIR) == 0)) { - isSystemElement = B_TRUE; - /* - * If a value was passed in with pRole and it does not match - * the role that pObjectName actually is then log an invalid - * param error. - */ - if (pRole != NULL && (strcasecmp(pRole, SYSTEM_ELEMENT) != 0)) { - util_handleError("SOLARIS_SHAREDFS::ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - } else if ((strcasecmp(pObjectName->mName, SOLARIS_NFSSHARE) == 0)) { - isSystemElement = B_FALSE; - if (pRole != NULL && (strcasecmp(pRole, SAME_ELEMENT) != 0)) { - util_handleError("SOLARIS_SHAREDFS::ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - } else { - util_handleError("SOLARIS_SHAREDFS::ASSOCIATORS", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - returnInstList = get_associated_instances(pObjectName, isSystemElement); - - return (returnInstList); -} /* cp_associators_Solaris_SharedFileSystem */ - -/* - * Method: cp_associatorNames_Solaris_SharedFileSystem - * - * Description: Returns the object paths of the instances on the other side of - * the association which are associated via the Solaris_SharedFileSystem - * association and having the passed in parameter, pObjectName, as the opposite - * key. - * - * Parameters: - * - CCIMObjectPath *pAssocName - An object path containing information - * about the association that the caller is trying to reach. - * - CCIMObjectPath *pObjectName - The object path which contains the - * information on whose associated objects are to be returned. - * - char *pResultClass - If specified, only return instances that are of - * this class type. - * - char *pRole - If specified, this is the role of the pObjectName - * object path passed in. If this is not valid, NULL is returned. - * - char *pResultRole - If specified, only return instances that are - * playing this role in the association. - * - * Returns: - * - A list of Solaris_NFSShare (if pRole == SystemElement && pObjectName - * is a Solaris_Directory object path) or Solaris_Directory (if - * pRole == SameElement && pObjectName is a Solaris_NFSShare object path) - * object paths which are associated to the pObjectName parameter. - * - NULL if an error occurred or if there are no instances associated to - * the pObjectName passed in. In the case of an error, the error will be - * logged. - */ -CCIMObjectPathList * -cp_associatorNames_Solaris_SharedFileSystem(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pResultClass, char *pRole, - char *pResultRole) { - - CCIMInstanceList *instList; - CCIMObjectPathList *objPathList; - CCIMException *ex; - int err = 0; - - if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { - util_handleError("SOLARIS_SHAREDFS::ASSOCIATOR_NAMES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMObjectPathList *)NULL); - } - - instList = cp_associators_Solaris_SharedFileSystem(pAssocName, - pObjectName, pResultClass, pRole, pResultRole); - if (instList == NULL) { - return ((CCIMObjectPathList *)NULL); - } - - objPathList = cim_createObjectPathList(instList); - if (objPathList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_SHAREDFS::ASSOCIATOR_NAMES", - CIM_ERR_FAILED, CREATE_OBJECT_LIST_FAILURE, ex, &err); - cim_freeInstanceList(instList); - return ((CCIMObjectPathList *)NULL); - } - - cim_freeInstanceList(instList); - return (objPathList); -} /* cp_associatorNames_Solaris_SharedFileSystem */ - -/* - * Method: cp_references_Solaris_SharedFileSystem - * - * Description: Returns the Solaris_ShareSharedFileSystem instances that have - * the passed in parameter, pObjectName, as one of it's keys. - * - * Parameters: - * - CCIMObjectPath *pAssocName - An object path containing information - * about the association that the caller is trying to reach. - * - CCIMObjectPath *pObjectName - The object path which contains the - * information on whose associated objects are to be returned. - * - char *pRole - If specified, this is the role of the pObjectName - * object path passed in. If this is not valid, NULL is returned. - * - * Returns: - * - A pointer to a list of Solaris_SharedFileSystem instances. - * - NULL if an error occurred or if there are no Solaris_SharedFileSystem - * instances having pObjectName as one of it's keys. - */ -CCIMInstanceList * -cp_references_Solaris_SharedFileSystem(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pRole) { - - CCIMInstanceList *instList; - CCIMObjectPathList *objPathList; - int err = 0; - - if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { - util_handleError("SOLARIS_SHAREDFS::REFERENCES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMObjectPathList *)NULL); - } - - /* - * Get everything that is related to the pObjectName passed in. - */ - objPathList = cp_associatorNames_Solaris_SharedFileSystem(pAssocName, - pObjectName, NULL, pRole, NULL); - if (objPathList == NULL) { - return ((CCIMObjectPathList *)NULL); - } - - /* - * Now use the object paths in the object path list and the pObjectName - * variable to create the association instances. - */ - if ((strcasecmp(pObjectName->mName, SOLARIS_DIR) == 0)) { - /* - * pObjectName is the SystemElement - */ - instList = create_association_instList(SOLARIS_SHAREDFS, - pObjectName, SYS_ELEMENT, objPathList, SAME_ELEMENT, - &err); - } else { - /* - * pObjectName is the SameElement - */ - instList = create_association_instList(SOLARIS_SHAREDFS, - pObjectName, SAME_ELEMENT, objPathList, SYS_ELEMENT, - &err); - } - - cim_freeObjectPathList(objPathList); - - return (instList); -} /* cp_references_Solaris_SharedFileSystem */ - -/* - * Method: cp_referenceNames_Solaris_SharedFileSystem - * - * Description: Returns the object paths of the Solaris_ShareSharedFileSystem - * instances that have the passed in parameter, pObjectName, as one of it's - * keys. - * - * Parameters: - * - CCIMObjectPath *pAssocName - An object path containing information - * about the association that the caller is trying to reach. - * - CCIMObjectPath *pObjectName - The object path which contains the - * information on whose associated objects are to be returned. - * - char *pRole - If specified, this is the role of the pObjectName - * object path passed in. If this is not valid, NULL is returned. - * - * Returns: - * - A pointer to a list of Solaris_SharedFileSystem object paths. - * - NULL if an error occurred or if there are no Solaris_SharedFileSystem - * instances having pObjectName as one of it's keys. - */ -CCIMObjectPathList * -cp_referenceNames_Solaris_SharedFileSystem(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pRole) { - - CCIMInstanceList *sharedElemInstList; - CCIMObjectPathList *sharedElemOPList; - int err = 0; - - if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { - util_handleError("SOLARIS_SHAREDFS::REFERENCE_NAMES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMObjectPathList *)NULL); - } - - sharedElemInstList = cp_references_Solaris_SharedFileSystem(pAssocName, - pObjectName, pRole); - if (sharedElemInstList == NULL) { - return ((CCIMObjectPathList *)NULL); - } - - sharedElemOPList = cim_createObjectPathList(sharedElemInstList); - - cim_freeInstanceList(sharedElemInstList); - - return (sharedElemOPList); -} /* cp_referenceNames_Solaris_SharedFileSystem */ - -/* - * Property provider methods - */ - -/* - * Method: cp_getProperty_Solaris_SharedFileSystem - * - * Description: Retrieves a certain property from the instance of - * Solaris_SharedFileSystem on the host that is described by the parameter - * pOP. - * - * Parameters: - * - CCIMObjectPath *pOP - The object path containing all the - * information needed to find the instance in which the property is to - * be returned. - * - cimchar *pPropName - The name of the property to be found. - * - * Returns: - * - A pointer to the property corresponding to the name passed in with - * pPropName. - * - NULL if an error occurred or if the property doesn't exist. In the - * case of an error, the error will be logged. - */ -CCIMProperty * -cp_getProperty_Solaris_SharedFileSystem(CCIMObjectPath *pOP, cimchar *pPropName) -{ - CCIMInstance *sharedElemInst; - CCIMProperty *sharedElemProp; - int err = 0; - - if (pOP == NULL) { - util_handleError("SOLARIS_SHAREDFS::GET_PROPERTY", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMProperty *)NULL); - } - - sharedElemInst = cp_getInstance_Solaris_SharedFileSystem(pOP); - if (sharedElemInst == NULL) { - return ((CCIMProperty *)NULL); - } - - sharedElemProp = cim_getProperty(sharedElemInst, pPropName); - cim_freeInstance(sharedElemInst); - - return (sharedElemProp); -} /* cp_getProperty_Solaris_SharedFileSystem */ - -/* - * Method: cp_setProperty_Solaris_SharedFileSystem - * - * Description: This method is not supported. It is not supported because in - * order to change a Solaris_SharedFileSystem instance the underlying share and - * directory must be modified. Those actions must be done on the appropriate - * share and directory objects, not here. - * - * Parameters: - * - CCIMObjectPath *pOP - Not used. - * - CCIMProperty *pProp - Not used. - * - * Returns: - * - Always returns cim_false because the method is not supported. - */ -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_SharedFileSystem(CCIMObjectPath *pOP, - CCIMProperty *pProp) { - - int err = 0; - - util_handleError("SOLARIS_SHAREDFS::SET_PROPERTY", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_setProperty_Solaris_SharedFileSystem */ - -/* - * Method provider methods - */ - -/* - * Method: cp_invokeMethod_Solaris_SharedFileSystem - * - * Description: This method is not supported because the provider doesn't have - * any methods. - * - * Parameters: - * - CCIMObjectPath* op - Not used. - * - cimchar* methodName - Not used. - * - CCIMPropertyList* inParams - Not used. - * - CCIMPropertyList* outParams - Not used. - * - * Returns: - * - Always returns null because the method is not supported. - */ -/* ARGSUSED */ -CCIMProperty * -cp_invokeMethod_Solaris_SharedFileSystem(CCIMObjectPath* op, - cimchar* methodName, CCIMPropertyList* inParams, - CCIMPropertyList* outParams) { - - return ((CCIMProperty *)NULL); -} /* cp_invokeMethod_Solaris_SharedFileSystem */ - -/* - * Private methods - */ - -/* - * Method: get_associated_directory - * - * Description: - * This method will return the Solaris_Directory instance or object path - * associated with the Solaris_NFSShare object path passed in. The returnInst - * parameter determines whether an CCIMInstance* or a CCIMObjectPath* is - * returned. - * - * Parameters: - * - CCIMObjectPath *nfsShareOP - Solaris_NFSShare object path which to - * find the associated Solaris_Directory instance. - * - boolean_t returnInst - The value which determines whether to return - * a Solaris_Directory instance or an object path. - * - * Returns: - * - If returnInst == B_TRUE, a pointer to a Solaris_Directory instance. - * If returnInst == B_FALSE, a pointer to a Solaris_Directory object path. - * - NULL is returned if an error occurred or if there are no - * Solaris_Directory instances associated to the Solaris_NFSShare object - * path passed in. - */ -static inst_or_objPath -get_associated_directory(CCIMObjectPath *nfsShareOP, boolean_t returnInst) { - CCIMObjectPath *dirOP; - CCIMInstance *dirInst; - CCIMException *ex; - CCIMObjectPath *propOP; - CIMType propType; - CIMBool propIsKey; - cimchar *propName; - cimchar *propValue; - char *name; - int err = 0; - - /* - * Retrieve the Name key property value from the Solaris_NFSShare - * object path passed in with nfsShareOP. - */ - name = util_getKeyValue(nfsShareOP->mKeyProperties, string, NAME, &err); - if (name == NULL || err != 0) { - util_handleError("SOLARIS_SHAREDFS::GET_ASSOC_DIR", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return (NULL); - } - - dirInst = cim_createInstance(SOLARIS_DIR); - if (dirInst == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_SHAREDFS::GET_ASSOC_DIR", - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, &err); - return (NULL); - } - - /* - * Create Name property and add it to the Solaris_Directory instance - */ - propName = NAME; - propType = string; - propValue = name; - propOP = NULL; - propIsKey = cim_true; - if (add_property_to_instance(propName, propType, propValue, - propOP, propIsKey, dirInst) == cim_false) { - - cim_freeInstance(dirInst); - return (NULL); - } - - /* - * Create the Solaris_Directory object path. - */ - dirOP = cim_createObjectPath(dirInst); - cim_freeInstance(dirInst); - if (dirOP == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_SHAREDFS::GET_ASSOC_DIR", - CIM_ERR_FAILED, CREATE_OBJECT_PATH_FAILURE, ex, &err); - return (NULL); - } - - /* - * Must use cimom_getInstance to determine if the directory exists. - */ - dirInst = cimom_getInstance(dirOP, cim_false, cim_false, cim_false, - cim_false, NULL, 0); - cim_freeObjectPath(dirOP); - /* - * A NULL return value means error, an empty list does not. - */ - if (dirInst == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_SHAREDFS::GET_ASSOC_DIR", - CIM_ERR_FAILED, CIMOM_GET_INST_FAILURE, ex, &err); - return (NULL); - } - - if (dirInst->mProperties == NULL) { - cim_freeInstance(dirInst); - return (NULL); - } - - /* - * Work around for cimom bug 4649100. - */ - if (!set_dir_keyProperties_to_true(dirInst)) { - cim_freeInstance(dirInst); - return (NULL); - } - - if (returnInst == B_TRUE) - return (dirInst); - - /* - * Create the correct Solaris_Directory object path. - */ - dirOP = cim_createObjectPath(dirInst); - if (dirOP == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_SHAREDFS::GET_ASSOC_DIR", - CIM_ERR_FAILED, CREATE_OBJECT_PATH_FAILURE, ex, &err); - cim_freeInstance(dirInst); - return (NULL); - } - - cim_freeInstance(dirInst); - return (dirOP); -} /* get_associated_directory */ - -/* - * Method: get_associated_instances - * - * Description: - * This method will get the instances associated to the object passed in. - * The result role is the role the Instances to be returned in the instance - * list are to play regarding the Solaris_SharedFileSystem association. - * - * Parameters: - * - CCIMObjectPath *pOP - The object path of which to get the associated - * instances. - * - boolean_t isSystemElement - Whether or not the pObjectName is the - * SystemElement. If isSystemElement == B_FALSE, pObjectName is the - * SameElement. - * Returns: - * - A pointer to a list of Solaris_NFSShare or Solaris_Directory - * instances depending on the parameters passed in. - * - NULL if an error occurred or if there are no instances associated - * with the object path passed in. - */ - -static CCIMInstanceList * -get_associated_instances(CCIMObjectPath *pOP, boolean_t isSystemElement) { - CCIMInstanceList *returnInstList; - CCIMInstance *assocInst; - CCIMException *ex; - int err = 0; - - returnInstList = cim_createInstanceList(); - if (returnInstList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_SHAREDFS::GET_ASSOC_INST", - CIM_ERR_FAILED, CREATE_INSTANCE_LIST_FAILURE, ex, &err); - return ((CCIMInstanceList *)NULL); - } - - /* - * Determine if we are supposed to return the SameElement or - * SystemElement instances by checking isSystemElement. - */ - if (isSystemElement == B_TRUE) { - /* - * pOP is a Solaris_Directory object path so find the associated - * Solaris_NFSShare instances. There should only be one. - */ - assocInst = get_associated_share(pOP); - } else { - /* - * pOP is a Solaris_NFSShare object path so find the associated - * Solaris_Directory instances. There should only be one. - */ - assocInst = get_associated_directory(pOP, B_TRUE); - } - - if (assocInst == NULL) { - cim_freeInstanceList(returnInstList); - return ((CCIMInstanceList *)NULL); - } - /* - * Add the instance to the instance list. - */ - returnInstList = cim_addInstance(returnInstList, assocInst); - if (returnInstList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_SHAREDFS::GET_ASSOC_INST", - CIM_ERR_FAILED, ADD_INSTANCE_FAILURE, ex, &err); - cim_freeInstance(assocInst); - return ((CCIMInstanceList *)NULL); - } - - return (returnInstList); -} /* get_associated_instances */ - -/* - * Method: get_associated_share - * - * Description: - * This method will return the Solaris_NFSShare instance or reference property - * associated with the Solaris_Directory object path passed in. The returnInst - * parameter determines whether an CCIMInstance or a CCIMProperty is returned. - * - * Parameters: - * - CCIMObjectPath *nfsShareOP - Solaris_Directory object path which to - * find the associated Solaris_NFSShare instance. - * - boolean_t returnInst - The value which determines whether to return - * a Solaris_NFSShare instance or a reference property. - * - * Returns: - * - If returnInst == B_TRUE, a pointer to a Solaris_NFSShare instance. - * If returnInst == B_FALSE, a pointer to a Solaris_NFSShare reference - * property. - * - NULL is returned if an error occurred or if there are no - * Solaris_NFSShare instances associated to the Solaris_Directory object - * path passed in. - */ -static CCIMInstance * -get_associated_share(CCIMObjectPath *dirOP) { - CCIMObjectPath *nfsShareOP; - CCIMInstance *nfsShareInst; - CCIMException *ex; - CCIMObjectPath *propOP; - CIMType propType; - CIMBool propIsKey; - cimchar *propName; - cimchar *propValue; - char *name; - int err = 0; - - /* - * Retrieve the Name key property value from the Solaris_Directory - * object path passed in with dirOP. - */ - name = util_getKeyValue(dirOP->mKeyProperties, string, NAME, &err); - if (name == NULL || err != 0) { - util_handleError("SOLARIS_SHAREDFS::GET_ASSOC_SHARE", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstance *)NULL); - } - - nfsShareInst = cim_createInstance(SOLARIS_NFSSHARE); - if (nfsShareInst == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_SHAREDFS::GET_ASSOC_SHARE", - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, &err); - return ((CCIMInstance *)NULL); - } - - propName = NAME; - propType = string; - propValue = name; - propOP = NULL; - propIsKey = cim_true; - if (add_property_to_instance(propName, propType, propValue, - propOP, propIsKey, nfsShareInst) == cim_false) { - - cim_freeInstance(nfsShareInst); - return ((CCIMInstance *)NULL); - } - - nfsShareOP = cim_createObjectPath(nfsShareInst); - if (nfsShareOP == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_SHAREDFS::GET_ASSOC_SHARE", - CIM_ERR_FAILED, CREATE_OBJECT_PATH_FAILURE, ex, &err); - cim_freeInstance(nfsShareInst); - return ((CCIMInstance *)NULL); - } - - cim_freeInstance(nfsShareInst); - - /* - * Use cimom_getInstance to determine if the share exists. - */ - nfsShareInst = cimom_getInstance(nfsShareOP, cim_false, cim_false, - cim_false, cim_false, NULL, 0); - - /* - * A NULL return value indicates an error, an empty list does not. - */ - if (nfsShareInst == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_SHAREDFS::GET_ASSOC_SHARE", - CIM_ERR_FAILED, CIMOM_GET_INST_FAILURE, ex, &err); - cim_freeObjectPath(nfsShareOP); - return ((CCIMInstance *)NULL); - } - - cim_freeObjectPath(nfsShareOP); - - if (nfsShareInst->mProperties == NULL) { - return ((CCIMInstance *)NULL); - } - - return (nfsShareInst); - -} /* get_associated_share */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_SharedFileSystem.h b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_SharedFileSystem.h deleted file mode 100644 index 518e1b8a21..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_SharedFileSystem.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOLARIS_SHAREDFILESYSTEM_H -#define _SOLARIS_SHAREDFILESYSTEM_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> -#include <cimomhandle.h> -#include "nfsprov_include.h" - -#define PROPCOUNT 2 - -static nfs_prov_prop_t sharedFSProps[] = { -#define SAME 0 - {"SameElement", cim_true, reference}, -#define SYS (SAME + 1) - {"SystemElement", cim_true, reference} -}; - -#ifdef __cplusplus -} -#endif - -#endif /* _SOLARIS_SHAREDFILESYSTEM_H */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/common_functions.c b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/common_functions.c deleted file mode 100644 index 774b6dcb3c..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/common_functions.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "common_functions.h" -#include "util.h" - -/* - * Public methods - */ - -/* - * Method: create_association_instList - * - * Description: Creates an instance list for the association class as named in - * the pClassName parameter. - * - * Parameters: - * - cimchar *pClassName - The name of the association class to create - * the instances of. - * - CCIMObjectPath *pObjectName - One of the references for the - * association. - * - char *pObjectNameRole - The role that the pObjectName parameter plays - * in the association. - * - CCIMObjectPathList *pObjPathList - The other reference for the - * association - * - char *pRole - The role that the object paths in the - * CCIMObjectPathList play in the association. - * - * Returns: - * - CCIMInstanceList * - The instance list created from the parameters. - * - NULL if an error occurred. - */ -CCIMInstanceList * -create_association_instList(cimchar *pClassName, CCIMObjectPath *pObjectName, - char *pObjectNameRole, CCIMObjectPathList *pObjPathList, char *pRole, - int *errp) { - - CCIMObjectPathList *currentObjPath; - CCIMProperty *objectNameProp; - CCIMInstanceList *instList; - CCIMException *ex; - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError("CREATE_ASSOC_INSTLIST", CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, errp); - return ((CCIMInstanceList *)NULL); - } - - objectNameProp = cim_createReferenceProperty(pObjectNameRole, - pObjectName, cim_true); - if (objectNameProp == NULL) { - ex = cim_getLastError(); - util_handleError("CREATE_ASSOC_INSTLIST", CIM_ERR_FAILED, - CREATE_REFPROP_FAILURE, ex, errp); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - currentObjPath = pObjPathList; - - while (currentObjPath != NULL) { - CCIMInstance *inst; - CCIMProperty *objPathListProp; - CIMBool returned_val; - - /* - * Create the property from the current object path in the list. - */ - objPathListProp = cim_createReferenceProperty(pRole, - currentObjPath->mDataObject, cim_true); - if (objPathListProp == NULL) { - ex = cim_getLastError(); - util_handleError("CREATE_ASSOC_INSTLIST", - CIM_ERR_FAILED, CREATE_REFPROP_FAILURE, ex, - errp); - cim_freeInstanceList(instList); - cim_freeProperty(objectNameProp); - return ((CCIMInstanceList *)NULL); - } - - /* - * Create the instance of the class name as passed in with - * pClassName and add the properties to the instance. - */ - inst = cim_createInstance(pClassName); - if (inst == NULL) { - ex = cim_getLastError(); - util_handleError("CREATE_ASSOC_INSTLIST", - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, - errp); - cim_freeInstanceList(instList); - cim_freeProperty(objectNameProp); - cim_freeProperty(objPathListProp); - return ((CCIMInstanceList *)NULL); - } - - returned_val = cim_addProperty(inst, objectNameProp); - if (returned_val == cim_false) { - ex = cim_getLastError(); - util_handleError("CREATE_ASSOC_INSTLIST", - CIM_ERR_FAILED, ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - cim_freeInstanceList(instList); - cim_freeProperty(objectNameProp); - cim_freeProperty(objPathListProp); - return ((CCIMInstanceList *)NULL); - } - - returned_val = cim_addProperty(inst, objPathListProp); - if (returned_val == cim_false) { - ex = cim_getLastError(); - util_handleError("CREATE_ASSOC_INSTLIST", - CIM_ERR_FAILED, ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - cim_freeInstanceList(instList); - cim_freeProperty(objPathListProp); - return ((CCIMInstanceList *)NULL); - } - - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError("CREATE_ASSOC_INSTLIST", - CIM_ERR_FAILED, ADD_INSTANCE_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - - currentObjPath = currentObjPath->mNext; - } - - return (instList); -} /* create_association_instList */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/common_functions.h b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/common_functions.h deleted file mode 100644 index d6dbcf9268..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/common_functions.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _COMMON_FUNCTIONS_H -#define _COMMON_FUNCTIONS_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> - -/* - * Method declaration - */ - -/* - * Method: create_association_instList - * - * Description: This method creates instances of the association <pClassName> - * out of the <pObjectName> and <pObjPathList> parameters. The roles of - * <pObjectName> and <pObjPathList> are defined by <pObjectNameRole> and - * <pRole> respectively. - * - * Parameters: - * cimchar *pClassName - The name of the association class of which to create - * the instances of. - * CCIMObjectPath *pObjectName - One of the association keys that will is to be - * associated to one or more objects. - * cimchar *pObjectNameRole - The role of <pObjectName> in the association. - * For example, this could be "Antecedent", "Dependent", "Element", etc. - * CCIMObjectPathList *pObjPathList - The other association keys that will - * be associated to <pObjectName>. - * cimchar *pRole - The role of <pObjPathList> in the association. - * int *errp - The error pointer. - * - * Returns: - * An instance list filled with instances of the <pClassName> association. - */ -CCIMInstanceList *create_association_instList(cimchar *pClassName, - CCIMObjectPath *pObjectName, - cimchar *pObjectNameRole, - CCIMObjectPathList *pObjPathList, - cimchar *pRole, int *errp); - -#ifdef __cplusplus -} -#endif - -#endif /* _COMMON_FUNCTIONS_H */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/nfs_mount_attr.h b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/nfs_mount_attr.h deleted file mode 100644 index 5b1e79ed84..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/nfs_mount_attr.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _NFS_MOUNT_ATTR_H -#define _NFS_MOUNT_ATTR_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Public data type declarations - */ - -/* - * NFS mount attributes - */ - -#define NFS_ATTRCACHE_FALSE "noac" -#define NFS_ATTRCACHEDIRMAX "acdirmax=" -#define NFS_ATTRCACHEDIRMIN "acdirmin=" -#define NFS_ATTRCACHEFILESMAX "acregmax=" -#define NFS_ATTRCACHEFILESMIN "acregmin=" -#define NFS_ENABLEQUOTA_TRUE "quota" -#define NFS_ENABLEQUOTA_FALSE "noquota" -#define NFS_FORCEDIRECTIO_TRUE "forcedirectio" -#define NFS_FORCEDIRECTIO_FALSE "noforcedirectio" -#define NFS_GRPID_TRUE "grpid" -#define NFS_HARDMNT_TRUE "hard" -#define NFS_HARDMNT_FALSE "soft" -#define NFS_INTR_TRUE "intr" -#define NFS_INTR_FALSE "nointr" -#define NFS_MAXRETRANSATTEMPTS "retrans=" -#define NFS_MNTFAILRETRIES "retry=" -#define NFS_NOCTO_TRUE "nocto" -#define NFS_NOMNTTABENT_TRUE "-m" -#define NFS_NOSUID_FALSE "suid" -#define NFS_NOSUID_TRUE "nosuid" -#define NFS_OVERLAY "-O" -#define NFS_POSIX_TRUE "posix" -#define NFS_PROTO "proto=" -#define NFS_PUBLIC_TRUE "public" -#define NFS_READBUFFSIZE "rsize=" -#define NFS_READONLY_TRUE "ro" -#define NFS_READONLY_FALSE "rw" -#define NFS_RETRANSTIMEO "timeo=" -#define NFS_FOREGROUND_TRUE "fg" -#define NFS_FOREGROUND_FALSE "bg" -#define NFS_SECMODE "sec=" -#define NFS_SERVERCOMMPORT "port=" -#define NFS_VERS "vers=" -#define NFS_WRITEBUFFSIZE "wsize=" -#define NFS_XATTR_TRUE "xattr" -#define NFS_XATTR_FALSE "noxattr" - -#ifdef __cplusplus -} -#endif - -#endif /* _NFS_MOUNT_ATTR_H */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/common/Makefile b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/common/Makefile deleted file mode 100644 index adaaddd0aa..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/common/Makefile +++ /dev/null @@ -1,76 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -OBJECTS = nfsprov_methods.o \ - createprop_methods.o - -LINT_OBJS = $(OBJECTS:%.o=%.ln) - -GENERAL = $(ROOTWBEMINC) \ - $(SRC)/lib/libfsmgt/common \ - $(SRC)/cmd/wbem/provider/c/include \ - $(SRC)/cmd/wbem/provider/c/filesystems/wbem_nfs/include \ - $(SRC)/cmd/wbem/provider/c/filesystems/common/cmdgeneration - - -CPPFLAGS += -I. $(GENERAL:%=-I%) -D_REENTRANT -DPIC -D_TS_ERRNO - -CFLAGS += $(XREGSFLAG) $(C_BIGPICFLAGS) - -LINTFLAGS += -um -LINTLIBS = $(LDLIBS.cmd) - -POFILE = _common.po -MSGFILES = $(OBJECTS:%.o=%.i) - -CLOBBERFILES += $(POFILE) - -.KEEP_STATE: - -all: $(OBJECTS) - -catalog: $(POFILE) - -check: - $(CSTYLE) -p -P $(OBJECTS:%.o=%.c) *.h - $(HDRCHK) *.h -clean: - $(RM) $(OBJECTS) $(LINT_OBJS) $(MSGFILES) - -install: all - -lint: $(LINT_OBJS) - $(LINT.c) $(LINTFLAGS) $(LINT_OBJS) $(LINTLIBS) - -$(POFILE): $(MSGFILES) - $(BUILDPO.msgfiles) - -include $(SRC)/cmd/Makefile.targ -include $(SRC)/Makefile.msg.targ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/common/createprop_methods.c b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/common/createprop_methods.c deleted file mode 100644 index dbad21b2af..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/common/createprop_methods.c +++ /dev/null @@ -1,347 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <string.h> -#include "createprop_methods.h" -#include "messageStrings.h" -#include "nfs_providers_msgstrings.h" -#include "nfs_provider_names.h" -#include "nfs_keys.h" -#include "libfsmgt.h" -#include "util.h" - -#define MAXSIZE 256 - -/* - * Method: add_property_to_instance - * - * Description: Creates a property corresponding to the input parameters and - * adds it to the instance passed in. - * - * Parameters: - * - cimchar *pName - The name of the property to be created. - * - CIMType pType - The type of the property. - * - cimchar *pValue - The value of the property if it is NOT to be a - * reference property. - * - CCIMObjectPath *pOP - The value of the property if it is to be a - * reference property. - * - CIMBool pIsKey - A boolean value representing whether or not the - * property is a key. - * - CCIMInstance *pInst - The instance that the property is added to. - * - * Returns: - * - A CIMBool which is true if the property was added to the instance and - * false if it was not. - */ -CIMBool -add_property_to_instance(cimchar *pName, CIMType pType, cimchar *pValue, - CCIMObjectPath *pOP, CIMBool pIsKey, CCIMInstance *pInst) { - - CCIMProperty *prop; - CCIMException *ex; - int err = 0; - - if (pOP == NULL) { - prop = cim_createProperty(pName, pType, pValue, NULL, pIsKey); - } else { - prop = cim_createReferenceProperty(pName, pOP, pIsKey); - } - - if (prop == NULL) { - ex = cim_getLastError(); - util_handleError(ADD_PROP_TO_INST, CIM_ERR_FAILED, - CREATE_PROPERTY_FAILURE, ex, &err); - return (cim_false); - } - - if (cim_addProperty(pInst, prop) == cim_false) { - ex = cim_getLastError(); - util_handleError(ADD_PROP_TO_INST, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, &err); - cim_freeProperty(prop); - return (cim_false); - } - - return (cim_true); -} /* add_property_to_instance */ - -/* - * Method: add_property_to_list - * - * Description: Creates a property corresponding to the input parameters and - * adds it to the property list passed in. - * - * Parameters: - * - cimchar *pName - The name of the property to be created. - * - CIMType pType - The type of the property. - * - cimchar *pValue - The value of the property if it is NOT to be a - * reference property. - * - CCIMObjectPath *pOP - The value of the property if it is to be a - * reference property. - * - CIMBool pIsKey - A boolean value representing whether or not the - * property is a key. - * - CCIMPropertyList *pPropList - The property list that the property is - * added to. - * - * Returns: - * - A pointer to the property list that the property was added to. - * - NULL if an error occurred. - * - * NOTE: Upon error, the passed in CCIMPropertyList*, pPropList, is freed. - * Since this is a wrapper for the cim_addPropertyToPropertyList function - * this is done to be consistent with the way that the CIM C API works. - * Upon error, the CCIMPropertyList passed into cim_addPropertyToPropertyList - * is freed. - */ -CCIMPropertyList * -add_property_to_list(cimchar *pName, CIMType pType, cimchar *pValue, - CCIMObjectPath *pOP, CIMBool pIsKey, CCIMPropertyList *pPropList) { - - CCIMProperty *prop; - CCIMException *ex; - int err = 0; - - if (pOP == NULL) { - prop = cim_createProperty(pName, pType, pValue, NULL, pIsKey); - } else { - prop = cim_createReferenceProperty(pName, pOP, pIsKey); - } - - /* - * If NULL, an error was encountered. - */ - if (prop == NULL) { - ex = cim_getLastError(); - util_handleError(ADD_PROP_TO_LIST, CIM_ERR_FAILED, - CREATE_PROPERTY_FAILURE, ex, &err); - cim_freePropertyList(pPropList); - return ((CCIMPropertyList *)NULL); - } - - pPropList = cim_addPropertyToPropertyList(pPropList, prop); - if (pPropList == NULL) { - ex = cim_getLastError(); - util_handleError(ADD_PROP_TO_LIST, CIM_ERR_FAILED, - ADD_PROP_TO_PROPLIST_FAILURE, ex, &err); - cim_freeProperty(prop); - return ((CCIMPropertyList *)NULL); - } - - /* - * Debugging... - */ - if (pValue != NULL) { - cim_logDebug("add_property_to_list", "Adding %s, value %s", - pName, pValue); - } - - return (pPropList); -} /* add_property_to_list */ - -/* - * Method: get_property_from_opt_string - * - * Description: Determines if a property exists in the mount option string and - * returns a value of the property to be used in creating a CCIMProperty. - * - * Parameters: - * - char *mntopts - The mount option string to search. - * - char *option - The option to search for. - * - boolean_t optHasEquals - A boolean telling the method whether or not - * the option being searched for contains the "=" character. - * - int defaultValue - The value of the property if it is not found in - * the option string. - * - * Returns: - * - The string value of the property found. - * - NULL if an error occurred. - * - * NOTE: The caller must free space allocated for return value. - */ -cimchar * -get_property_from_opt_string(char *mntopts, char *option, - boolean_t optHasEquals, int defaultValue) { - - cimchar propValue[MAXSIZE]; - cimchar *retVal; - char *optionString = NULL; - char *optionFound; - int err = 0; - - optionString = strdup(mntopts); - if (optionString == NULL) { - util_handleError(GET_PROP_FROM_OPTS, - CIM_ERR_LOW_ON_MEMORY, LOW_MEMORY, NULL, &err); - return (NULL); - } else { - optionFound = fs_parse_optlist_for_option(optionString, - option, &err); - /* - * Was the option found in the option string? - * If it was, propValue = true or propValue = optionFound. - */ - if (optionFound != NULL) { - if (optHasEquals) { - (void) snprintf(propValue, MAXSIZE, "%s", - optionFound); - free(optionFound); - } else { - (void) snprintf(propValue, MAXSIZE, "%d", - B_TRUE); - free(optionFound); - } - } else { - /* - * Since the option was not found we know that - * propValue = false or the default value. - */ - if (optHasEquals) { - (void) snprintf(propValue, MAXSIZE, "%d", - defaultValue); - } else { - (void) snprintf(propValue, MAXSIZE, "%d", - B_FALSE); - } - } - } - - retVal = strdup(propValue); - if (retVal == NULL) { - util_handleError(GET_PROP_FROM_OPTS, - CIM_ERR_LOW_ON_MEMORY, LOW_MEMORY, NULL, &err); - return (NULL); - } - - free(optionString); - return (retVal); -} /* get_property_from_opt_string */ - -/* - * Method set_dir_keyProperties_to_true - * - * Helper function to work around cimom bug 4649100 which causes - * cimom_getInstance to return the instance with the value of - * keyProperty set to cim_false instead of cim_true. - */ -CIMBool -set_dir_keyProperties_to_true(CCIMInstance *dirInst) { - CCIMProperty *tempProp; - CCIMPropertyList *tempPList; - CIMBool return_value = cim_false; - - for (tempPList = dirInst->mProperties; tempPList != NULL; - tempPList = tempPList->mNext) { - - tempProp = tempPList->mDataObject; - if (strcmp(tempProp->mName, CREATION_CLASS) == 0) { - tempProp->mKeyProperty = cim_true; - return_value = cim_true; - } else if (strcmp(tempProp->mName, NAME) == 0) { - tempProp->mKeyProperty = cim_true; - return_value = cim_true; - } else if (strcmp(tempProp->mName, CS_CREATION_CLASS) - == 0) { - tempProp->mKeyProperty = cim_true; - return_value = cim_true; - } else if (strcmp(tempProp->mName, CSNAME) == 0) { - tempProp->mKeyProperty = cim_true; - return_value = cim_true; - } else if (strcmp(tempProp->mName, FS_CREATION_CLASS) == 0) { - tempProp->mKeyProperty = cim_true; - return_value = cim_true; - } else if (strcmp(tempProp->mName, FSNAME) == 0) { - tempProp->mKeyProperty = cim_true; - return_value = cim_true; - } - } - return (return_value); -} /* set_dir_keyProperties_to_true */ - -/* - * Method set_share_keyProperties_to_true - * - * Helper function to work around cimom bug 4649100 which causes - * cimom_getInstance to return the instance with the value of - * keyProperty set to cim_false instead of cim_true. - */ -CIMBool -set_share_keyProperties_to_true(CCIMInstance *nfsShareInst) { - CCIMProperty *tempProp; - CCIMPropertyList *tempPList; - CIMBool return_value = cim_false; - - for (tempPList = nfsShareInst->mProperties; tempPList != NULL; - tempPList = tempPList->mNext) { - - tempProp = tempPList->mDataObject; - if (strcmp(tempProp->mName, CREATION_CLASS) == 0) { - tempProp->mKeyProperty = cim_true; - return_value = cim_true; - } else if (strcmp(tempProp->mName, NAME) == 0) { - tempProp->mKeyProperty = cim_true; - return_value = cim_true; - } else if (strcmp(tempProp->mName, SYS_CREATION_CLASS) - == 0) { - tempProp->mKeyProperty = cim_true; - return_value = cim_true; - } else if (strcmp(tempProp->mName, SYSTEM) == 0) { - tempProp->mKeyProperty = cim_true; - return_value = cim_true; - } - } - return (return_value); -} /* set_share_keyProperties_to_true */ - -/* - * Method set_shareSec_keyProperties_to_true - * - * Helper function to work around cimom bug 4649100 which causes - * cimom_getInstance to return the instance with the value of - * keyProperty set to cim_false instead of cim_true. - */ -CIMBool -set_shareSec_keyProperties_to_true(CCIMInstance *nfsShareSecInst) { - CCIMProperty *tempProp; - CCIMPropertyList *tempPList; - CIMBool return_value = cim_false; - - for (tempPList = nfsShareSecInst->mProperties; tempPList != NULL; - tempPList = tempPList->mNext) { - - tempProp = tempPList->mDataObject; - if (strcmp(tempProp->mName, MODE) == 0) { - tempProp->mKeyProperty = cim_true; - return_value = cim_true; - } else if (strcmp(tempProp->mName, SETTING_ID_LOWCASE) == 0) { - tempProp->mKeyProperty = cim_true; - return_value = cim_true; - } - } - return (return_value); -} /* set_shareSec_keyProperties_to_true */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/common/createprop_methods.h b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/common/createprop_methods.h deleted file mode 100644 index 9012daae2c..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/common/createprop_methods.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _CREATEPROP_METHODS_H -#define _CREATEPROP_METHODS_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> - -/* - * Method declarations - */ -CIMBool add_property_to_instance(cimchar *pName, CIMType pType, - cimchar *pValue, CCIMObjectPath *pOP, CIMBool pIsKey, - CCIMInstance *pInst); - -CCIMPropertyList *add_property_to_list(cimchar *pName, CIMType pType, - cimchar *pValue, CCIMObjectPath *pOP, - CIMBool pIsKey, CCIMPropertyList *propList); - -cimchar *get_property_from_opt_string(char *mntopts, char *option, - boolean_t optHasEquals, int defaultValue); -CIMBool set_dir_keyProperties_to_true(CCIMInstance *dirInst); -CIMBool set_share_keyProperties_to_true(CCIMInstance *nfsShareInst); -CIMBool set_shareSec_keyProperties_to_true( - CCIMInstance *nfsShareSecInst); - -#ifdef __cplusplus -} -#endif - -#endif /* _CREATEPROP_METHODS_H */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/common/nfsprov_methods.c b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/common/nfsprov_methods.c deleted file mode 100644 index f525319d1c..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/common/nfsprov_methods.c +++ /dev/null @@ -1,461 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "nfsprov_methods.h" -#include "util.h" -#include "libfsmgt.h" -#include "util.h" -#include "cmdgen.h" -#include "nfs_providers_msgstrings.h" -#include "messageStrings.h" -#include "nfs_provider_names.h" -#include <sys/types.h> - -CCIMProperty *exec_command(char *cmd); - -/* - * Public methods - */ - -/* - * Method: create_outParams_list - * - * Description: Creates a string or a string array property to be added to the - * passed in CCIMPropertyList*, outParams. - * - * Parameters: - * - CCIMPropertyList *outParams - The property list to add the string - * array property to. - * - char **list - The string array to add to outParams. - * - int num_elements - The number of elements in list. - * - char *single_value - The string to add to outParams. - * - * Returns: - * - Nothing - */ -void -create_outParams_list(CCIMPropertyList *outParams, char **list, - int num_elements, char *single_value) { - - CCIMProperty *prop = NULL; - CCIMException *ex; - cimchar *outParamValues; - int err = 0; - - if (list != NULL) { - /* - * cim_encodeStringArray converts an array or strings into a - * regular string for placement into the CCIMProperty. - */ - outParamValues = cim_encodeStringArray(list, num_elements); - if (outParamValues == NULL) { - ex = cim_getLastError(); - util_handleError(CREATE_OUT_PARAMS, CIM_ERR_FAILED, - ENCODE_STRING_ARRAY_FAILURE, ex, &err); - outParams = NULL; - return; - } - prop = cim_createProperty("outParams", string_array, - outParamValues, NULL, cim_false); - } else if (single_value != NULL) { - prop = cim_createProperty("outParams", string, single_value, - NULL, cim_false); - } - - if (prop == NULL) { - ex = cim_getLastError(); - util_handleError(CREATE_OUT_PARAMS, CIM_ERR_FAILED, - CREATE_PROPERTY_FAILURE, ex, &err); - outParams = NULL; - free(outParamValues); - return; - } - - outParams = cim_addPropertyToPropertyList(outParams, prop); - if (outParams == NULL) { - ex = cim_getLastError(); - util_handleError(CREATE_OUT_PARAMS, CIM_ERR_FAILED, - ADD_PROP_TO_PROPLIST_FAILURE, ex, &err); - return; - } - -} /* create_outParams_list */ - -/* - * Method: del_all_with_duplicate_path - * - * Description: Deletes all /etc/dfs/dfstab entries having the same path as - * defined with the passed in parameter list. - * - * Parameters: - * - CCIMPropertyList *inParams - The input parameter list containing - * the path of the /etc/dfs/dfstab entries to delete. - * - * Returns: - * - CCIMProperty * - A property defining the success or failure of the - * method. - */ -CCIMProperty * -del_all_with_duplicate_path(CCIMPropertyList *inParams) { - int err = 0; - CCIMProperty *pathProp; - char *path; - - if (inParams == NULL) { - util_handleError(DELETE_DUP_PATHS, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &err); - return ((CCIMProperty *)NULL); - } - - pathProp = inParams->mDataObject; - if (pathProp == NULL) { - util_handleError(DELETE_DUP_PATHS, CIM_ERR_INVALID_PARAMETER, - DEL_DUPLICATE_PATHS_FAILURE, NULL, &err); - return ((CCIMProperty *)NULL); - } - - path = pathProp->mValue; - - if (fs_del_All_DFStab_ents_with_Path(path, &err) == NULL) { - if (err != 0) { - util_handleError(DELETE_DUP_PATHS, CIM_ERR_FAILED, - DEL_DUPLICATE_PATHS_FAILURE, NULL, &err); - return ((CCIMProperty *)NULL); - } - } - return (cim_createProperty("Status", sint32, "0", NULL, cim_false)); -} - -/* - * Method: get_default_secmode - * - * Description: Retrieves the default security mode for the system and places - * it in the passed in outParams property list. - * - * Parameters: - * - CCIMPropertyList *outParams - The property list for which to add the - * security mode property. - * - * Returns: - * - CCIMProperty * - A property defining the success or failure of the - * method. - */ -CCIMProperty * -get_default_secmode(CCIMPropertyList *outParams) { - char *defmode; - int err = 0; - - defmode = nfssec_get_default_secmode(&err); - if (defmode == NULL) { - util_handleError(GET_DEF_SECMODE, CIM_ERR_FAILED, - GET_DEFAULT_SECMODE_FAILURE, NULL, &err); - return ((CCIMProperty *)NULL); - } - - create_outParams_list(outParams, NULL, NULL, defmode); - if (outParams == NULL) { - /* - * An error occurred in create_outParams_list. - */ - free(defmode); - return ((CCIMProperty *)NULL); - } - - free(defmode); - return (cim_createProperty("Status", sint32, "0", NULL, cim_false)); -} /* get_default_secmode */ - -/* - * Method: get_netconfig_list - * - * Description: Retrieves the network id list from /etc/netconfig and places - * it in the passed in outParams property list. - * - * Parameters: - * - CCIMPropertyList *outParams - The property list for which to add the - * network id list. - * - * Returns: - * - CCIMProperty * - A property defining the success or failure of the - * method. - */ -CCIMProperty * -get_netconfig_list(CCIMPropertyList *outParams) { - char **netid_list; - int num_elements = 0; - int err = 0; - - netid_list = netcfg_get_networkid_list(&num_elements, &err); - if (netid_list == NULL) { - util_handleError(GET_NETCFG_LIST, CIM_ERR_FAILED, - GET_NETID_LIST_FAILURE, NULL, &err); - return ((CCIMProperty *)NULL); - } - - create_outParams_list(outParams, netid_list, num_elements, NULL); - netcfg_free_networkid_list(netid_list, num_elements); - if (outParams == NULL) { - /* - * An error occurred in create_outParams_list. It was - * handled in that function so just return NULL. - */ - return ((CCIMProperty *)NULL); - } - - return (cim_createProperty("Status", sint32, "0", NULL, - cim_false)); -} /* get_netconfig_list */ - -/* - * Method: get_nfssec_list - * - * Description: Retrieves the list of nfs security modes from /etc/nfssec.conf - * and places it in the passed in outParams property list. - * - * Parameters: - * - CCIMPropertyList *outParams - The property list for which to add the - * nfs security modes list. - * - * Returns: - * - CCIMProperty * - A property defining the success or failure of the - * method. - */ -CCIMProperty * -get_nfssec_list(CCIMPropertyList *outParams) { - char **secmode_list; - int num_elements = 0; - int err = 0; - - secmode_list = nfssec_get_nfs_secmode_list(&num_elements, &err); - if (secmode_list == NULL) { - util_handleError(GET_NFSSEC_LIST, CIM_ERR_FAILED, - GET_SECMODE_LIST_FAILURE, NULL, &err); - return ((CCIMProperty *)NULL); - } - - create_outParams_list(outParams, secmode_list, num_elements, NULL); - if (outParams == NULL) { - /* - * An error occurred in create_outParams_list. - */ - nfssec_free_secmode_list(secmode_list, num_elements); - return ((CCIMProperty *)NULL); - } - - nfssec_free_secmode_list(secmode_list, num_elements); - - return (cim_createProperty("Status", sint32, "0", NULL, cim_false)); - -} /* get_nfssec_list */ - -/* - * Method: mountall - * - * Description: Executes the mountall command with the options given in the - * inParams property list. - * - * Parameters: - * - CCIMPropertyList *inParams - The property list containing the options - * to be used when executing the mountall command. - * - * Returns: - * - CCIMProperty * - A property defining the success or failure of the - * method. - */ -CCIMProperty * -mountall(CCIMPropertyList *inParams) { - CCIMProperty *retVal; - char *cmd = NULL; - int err = 0; - - cmd = cmdgen_generate_command(CMDGEN_MOUNTALL, NULL, NULL, inParams, - &err); - if (cmd == NULL || err != 0) { - cim_logDebug("mountall", "cmdgen_generate_command failed."); - util_handleError(MOUNTALL_INVOKE_METH, CIM_ERR_FAILED, - CMDGEN_GEN_CMD_FAILURE, NULL, &err); - return ((CCIMProperty *)NULL); - } - - cim_logDebug("mountall", "Command generated is: %s", cmd); - - retVal = exec_command(cmd); - free(cmd); - return (retVal); -} /* mountall */ - -/* - * Method: shareall - * - * Description: Executes the shareall command with the options given in the - * inParams property list. - * - * Parameters: - * - CCIMPropertyList *inParams - The property list containing the options - * to be used when executing the shareall command. - * - * Returns: - * - CCIMProperty * - A property defining the success or failure of the - * method. - */ -CCIMProperty * -shareall(CCIMPropertyList *inParams) { - CCIMProperty *retVal; - char *cmd = NULL; - int err = 0; - - cmd = cmdgen_generate_command(CMDGEN_SHAREALL, NULL, NULL, inParams, - &err); - if (cmd == NULL || err != 0) { - util_handleError(SHAREALL_INVOKE_METH, CIM_ERR_FAILED, - CMDGEN_GEN_CMD_FAILURE, NULL, &err); - return ((CCIMProperty *)NULL); - } - - cim_logDebug("shareall", "Command returned: %s", cmd); - - retVal = exec_command(cmd); - free(cmd); - return (retVal); -} /* shareall */ - -/* - * Method: unmountall - * - * Description: Executes the umountall command with the options given in the - * inParams property list. - * - * Parameters: - * - CCIMPropertyList *inParams - The property list containing the options - * to be used when executing the umountall command. - * - * Returns: - * - CCIMProperty * - A property defining the success or failure of the - * method. - */ -CCIMProperty * -unmountall(CCIMPropertyList *inParams) { - CCIMProperty *retVal; - char *cmd = NULL; - int err = 0; - - cmd = cmdgen_generate_command(CMDGEN_UMOUNTALL, NULL, NULL, inParams, - &err); - if (cmd == NULL || err != 0) { - util_handleError(UNMOUNTALL_INVOKE_METH, CIM_ERR_FAILED, - CMDGEN_GEN_CMD_FAILURE, NULL, &err); - return ((CCIMProperty *)NULL); - } - - cim_logDebug("unmountall", "Command returned: %s", cmd); - - retVal = exec_command(cmd); - free(cmd); - return (retVal); -} /* unmountall */ - -/* - * Method: unshareall - * - * Description: Executes the unshareall command with the options given in the - * inParams property list. - * - * Parameters: - * - CCIMPropertyList *inParams - The property list containing the options - * to be used when executing the unshareall command. - * - * Returns: - * - CCIMProperty * - A property defining the success or failure of the - * method. - */ -CCIMProperty * -unshareall(CCIMPropertyList *inParams) { - CCIMProperty *retVal; - char *cmd = NULL; - int err = 0; - - cmd = cmdgen_generate_command(CMDGEN_UNSHAREALL, NULL, NULL, inParams, - &err); - if (cmd == NULL || err != 0) { - util_handleError(UNSHAREALL_INVOKE_METH, CIM_ERR_FAILED, - CMDGEN_GEN_CMD_FAILURE, NULL, &err); - return ((CCIMProperty *)NULL); - } - - cim_logDebug("unshareall", "Command returned: %s", cmd); - - retVal = exec_command(cmd); - free(cmd); - return (retVal); -} /* unshareall */ - -/* - * Private Methods - */ - -/* - * Method: exec_command - * - * Description: Executes the given command, returns a success/failure property - * and handles errors from the execution of the command if needed. - * - * Parameters: - * - char *cmd - The command to execute. - * - * Returns: - * - CCIMProperty * - A property defining the success or failure of the - * method. - * - NULL if an error occurred. - */ -CCIMProperty * -exec_command(char *cmd) { - char *cmd_return = NULL; - int err = 0; - - cmd_return = cmd_execute_command_and_retrieve_string(cmd, &err); - if (err != 0) { - if (cmd_return != NULL) { - util_handleError(EXEC_CMD, CIM_ERR_FAILED, - cmd_return, NULL, &err); - free(cmd_return); - return ((CCIMProperty *)NULL); - } else { - util_handleError(EXEC_CMD, CIM_ERR_FAILED, - CMD_EXEC_RETR_STR_FAILURE, NULL, &err); - return ((CCIMProperty *)NULL); - } - } - - if (cmd_return != NULL) { - cim_logDebug("exec_command", "Exec command return =%s", - cmd_return); - free(cmd_return); - } - - return (cim_createProperty("Status", sint32, "0", NULL, cim_false)); -} /* exec_command */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/common/nfsprov_methods.h b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/common/nfsprov_methods.h deleted file mode 100644 index a73a479b27..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/common/nfsprov_methods.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _NFSPROV_METHODS_H -#define _NFSPROV_METHODS_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> - -/* - * Method declarations - */ -void create_outParams_list(CCIMPropertyList *outParams, - char **list, int num_elements, char *single_value); -CCIMProperty *del_all_with_duplicate_path(CCIMPropertyList *inParams); -CCIMProperty *get_default_secmode(CCIMPropertyList *outParams); -CCIMProperty *get_netconfig_list(CCIMPropertyList *outParams); -CCIMProperty *get_nfssec_list(CCIMPropertyList *outParams); -CCIMProperty *mountall(CCIMPropertyList *inParams); -CCIMProperty *shareall(CCIMPropertyList *inParams); -CCIMProperty *unmountall(CCIMPropertyList *inParams); -CCIMProperty *unshareall(CCIMPropertyList *inParams); - -#ifdef __cplusplus -} -#endif - -#endif /* _NFSPROV_METHODS_H */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/include/nfs_keys.h b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/include/nfs_keys.h deleted file mode 100644 index 72a6c9b3af..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/include/nfs_keys.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _NFS_KEYS_H -#define _NFS_KEYS_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * NOT DEFINED IN cimKeys.h - */ - -#define CS_CREATION_CLASS "CSCreationClassName" -#define CSNAME "CSName" -#define FS_CREATION_CLASS "FSCreationClassName" -#define FSNAME "FSName" -#define SAME_ELEMENT "SameElement" -/* - * We must define two SettingID keys. - * SettingID is for Solaris_PersistentShare.SettingID (CIM_SystemSetting) and - * SettingId is for Solaris_NFSShareSecurity.SettingId (CIM_Setting) - */ -#define SETTING_ID "SettingID" -#define SETTING_ID_LOWCASE "SettingId" -#define SYS_ELEMENT "SystemElement" - -/* - * Defined in cimKeys.h - */ - -#define SYS_CREATION_CLASS "SystemCreationClassName" -#define CREATION_CLASS "CreationClassName" -#define SYSTEM "SystemName" -#define DEVICEID "DeviceID" -#define NAME "Name" -#define SYSTEM_ELEMENT "SystemElement" -#define SAME_ELEMENT "SameElement" -#define ANTECEDENT "Antecedent" -#define DEPENDENT "Dependent" -#define GROUP "GroupComponent" -#define PART "PartComponent" -#define TAG "Tag" -#define MODE "Mode" - -#ifdef __cplusplus -} -#endif - -#endif /* _NFS_KEYS_H */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/include/nfs_provider_names.h b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/include/nfs_provider_names.h deleted file mode 100644 index f2b8f8cec1..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/include/nfs_provider_names.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _NFS_PROVIDER_NAMES_H -#define _NFS_PROVIDER_NAMES_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * NFS provider classes. - */ -#define SOLARIS_HOSTEDSHARE "Solaris_HostedShare" -#define SOLARIS_NFS "Solaris_NFS" -#define SOLARIS_NFSMOUNT "Solaris_NFSMount" -#define SOLARIS_NFSSHARE "Solaris_NFSShare" -#define SOLARIS_NFSSHAREENT "Solaris_NFSShareEntry" -#define SOLARIS_NFSSHAREDEFSECMODES "Solaris_NFSShareDefSecurityModes" -#define SOLARIS_NFSSHARESEC "Solaris_NFSShareSecurity" -#define SOLARIS_NFSSHARESECMODES "Solaris_NFSShareSecurityModes" -#define SOLARIS_NFSSHARESECURITY "Solaris_NFSShareSecurity" -#define SOLARIS_PERSISTSHARE "Solaris_PersistentShare" -#define SOLARIS_SHAREDFS "Solaris_SharedFileSystem" -#define SOLARIS_SHARESERV "Solaris_ShareService" -#define SOLARIS_SYSPERSISTSHARE "Solaris_PersistentShareForSystem" - -/* - * Other referenced Solaris classes - */ -#define SOLARIS_CS "Solaris_ComputerSystem" -#define SOLARIS_DIR "Solaris_Directory" - -/* - * These are nfs providers specific functions. - */ -#define ADD_PROP_TO_INST "add_property_to_instance" -#define ADD_PROP_TO_LIST "add_property_to_list" -#define COMMAND_GEN "cmdgen_generate_command" -#define CREATE_HOSTEDSHARE_ASSOC \ - "create_hostedShare_associations" -#define CREATE_OUT_PARAMS "create_outParams_list" -#define CREATE_PSFORSYS_ASSOC "create_persistShareForSys_associations" -#define CREATE_SHAREDFS_ASSOC "create_sharedFS_associations" -#define DELETE_DUP_PATHS "del_all_with_duplicate_path" -#define DELETE_VFSTAB_ENT "delete_vfstab_entry" -#define ENUM_MOUNTS "enumerate_mounts" -#define EXEC_CMD "exec_command" -#define GET_ANT "get_Antecedent" -#define GET_ASSOC_DIR "get_associated_directory" -#define GET_ASSOC_INST "get_associated_instances" -#define GET_ASSOC_NFSMNTS "get_associated_nfs_mntlist" -#define GET_ASSOC_SEC_INSTLIST "get_associated_nfsShareSec_instList" -#define GET_ASSOC_SEC_OPLIST "get_associated_nfsShareSec_OPList" -#define GET_ASSOC_SEC_PROPLIST "get_associated_nfsShareSec_propList" -#define GET_ASSOC_SP_INSTLIST "get_associated_sharePersist_instList" -#define GET_ASSOC_SP_OPLIST "get_associated_sharePersist_OPList" -#define GET_ASSOC_SP_PROPLIST "get_associated_sharePersist_propList" -#define GET_DEF_SECMODE "get_default_secmode" -#define GET_DEP "get_Dependent" -#define GET_NETCFG_LIST "get_netconfig_list" -#define GET_NFSSEC_LIST "get_nfssec_list" -#define GET_NFSSHARESEC_INST "get_Solaris_NFSShareSecurity_Inst" -#define GET_NFSSHARE_0P "get_Solaris_NFSShare_OP" -#define GET_PROP_FROM_OPTS "get_property_from_opt_string" -#define GET_SHAREPERSIST_INST "get_Solaris_PersistentShare_Inst" -#define MOUNTALL_INVOKE_METH "mountall" -#define POPULATE_PROPLIST "populate_property_list" -#define SHAREALL_INVOKE_METH "shareall" -#define SHARE_EXISTS "does_share_exist" -#define SHOW_EXPORTS "show_exports" -#define UNMOUNTALL_INVOKE_METH "unmountall" -#define UNSHAREALL_INVOKE_METH "unshareall" -#ifdef __cplusplus -} -#endif - -#endif /* _NFS_PROVIDER_NAMES_H */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/include/nfs_providers_msgstrings.h b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/include/nfs_providers_msgstrings.h deleted file mode 100644 index 2ad1889445..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/include/nfs_providers_msgstrings.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _NFS_PROVIDERS_MSGSTRINGS_H -#define _NFS_PROVIDERS_MSGSTRINGS_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * dgettext is normally defined by including libintl.h. However, the file - * /usr/sadm/lib/wbem/include/cimapi.h erroneously defines gettext so that - * they can play games with L10N in the CIM functions. If we try to undef - * gettext before we include libintl.h we get a complaint from hdrchk. So, - * just declare the extern here to work around this mess. - */ -extern char *dgettext(const char *, const char *); - -/* - * This include file defines all messages that are used for error reporting - * in the nfs providers. Other messages about CIM specific failures are - * defined in $(SRC)/cmd/wbem/provider/c/include/messageStrings.h - */ - -/* - * CIM failures - These should be moved to - * $(SRC)/cmd/wbem/provider/c/include/messageStrings.h - */ -#define ADD_PROP_TO_PROPLIST_FAILURE \ - util_routineFailureMessage("cim_addPropertyToPropertyList") -#define ADD_PROP_TO_OBJPATH_FAILURE \ - util_routineFailureMessage("cim_addPropertyListToObjectPath") -#define CIMOM_ENUM_INST_FAILURE \ - util_routineFailureMessage("cimom_enumerateInstances") -#define CIMOM_ENUM_INSTNAMES_FAILURE \ - util_routineFailureMessage("cimom_enumerateInstanceNames") -#define CIMOM_GET_INST_FAILURE \ - util_routineFailureMessage("cimom_getInstance") -#define CREATE_EMPTY_OBJPATH_FAILURE \ - util_routineFailureMessage("cim_createEmptyObjectPath") -#define CREATE_PROPLIST_FAILURE \ - util_routineFailureMessage("cim_createPropertyList") -#define ENCODE_STRING_ARRAY_FAILURE \ - util_routineFailureMessage("cim_encodeStringArray") -#define GET_PROPERTY_FAILURE \ - util_routineFailureMessage("cim_getProperty") -#define PREPEND_INSTANCE_FAILURE \ - util_routineFailureMessage("cim_prependInstance") -#define PROPLIST_TO_INSTANCE_FAILURE \ - util_routineFailureMessage("cim_addPropertyListToInstance") - -/* - * NFS provider failures - */ -#define CMD_EXEC_RETR_STR_FAILURE \ - util_routineFailureMessage("cmd_execute_command_and_retrieve_string") -#define CMDGEN_GEN_CMD_FAILURE \ - util_routineFailureMessage("cmdgen_generate_command") -#define CREATE_NFSMOUNT_ASSOC_FAILURE \ - util_routineFailureMessage("create_nfsMount_associations") -#define DEL_DUPLICATE_PATHS_FAILURE \ - util_routineFailureMessage("del_all_with_duplicate_path") -#define FS_ADD_DFSTAB_ENT_FAILURE \ - util_routineFailureMessage("fs_add_DFStab_ent") -#define FS_CHECK_DUP_PATHS \ - util_routineFailureMessage("fs_check_for_duplicate_DFStab_paths") -#define FS_DEL_MNT_DEFAULT_FAILURE \ - util_routineFailureMessage("fs_del_mount_default_ent") -#define FS_DEL_DFSTAB_ENT_FAILURE \ - util_routineFailureMessage("fs_del_DFStab_ent") -#define FS_EDIT_DFSTAB_ENT_FAILURE \ - util_routineFailureMessage("fs_edit_DFStab_ent") -#define FS_GET_DFSTAB_ENT_FAILURE \ - util_routineFailureMessage("fs_get_DFStab_ents") -#define FS_GET_DFSTAB_ENT_NUM_FAILURE \ - util_routineFailureMessage("fs_get_DFStab_ent_num") -#define FS_GET_FILTERED_MNTDEFAULTS_FAILURE \ - util_routineFailureMessage("fs_get_filtered_mount_defaults") -#define FS_GET_MAXFILENMLEN_FAILURE \ - util_routineFailureMessage("fs_get_maxfilenamelen") -#define FS_GET_SHARE_FAILURE \ - util_routineFailureMessage("fs_get_share_list") -#define FS_PARSE_OPTS_FOR_SEC_MODES_FAILURE \ - util_routineFailureMessage("fs_parse_opts_for_sec_modes") -#define FS_PARSE_OPTLIST_FAILURE \ - util_routineFailureMessage("fs_parse_optlist_for_option") -#define GET_DEFAULT_SECMODE_FAILURE \ - util_routineFailureMessage("nfssec_get_default_secmode") -#define GET_DEVID_FAILURE \ - util_routineFailureMessage("get_devid") -#define GET_HOSTNAME_FAILURE \ - util_routineFailureMessage("sys_get_hostname") -#define GET_NETID_LIST_FAILURE \ - util_routineFailureMessage("netcfg_get_networkid_list") -#define GET_RESOURCE_FAILURE \ - util_routineFailureMessage("get_resource") -#define GET_SECMODE_LIST_FAILURE \ - util_routineFailureMessage("nfssec_get_nfs_secmode_list") -#define NFS_GET_FILTERED_MOUNTS_FAILURE \ - util_routineFailureMessage("nfs_get_filtered_mount_list") -#define NFS_GET_MNTLIST_FAILURE \ - util_routineFailureMessage("nfs_get_mount_list") -#define NFS_GET_MNTS_BY_MNTOPT_FAILURE \ - util_routineFailureMessage("nfs_get_mounts_by_mntopt") - -/* - * NFS provider messages - */ -#define NFSD_START_FAILURE \ - util_routineStartDaemonMessage("nfsd") -#define NO_SHARES_ON_SYSTEM \ - dgettext(TEXT_DOMAIN, \ - "/etc/dfs/sharetab does not exist. No shares on system") -#define MOUNTD_START_FAILURE \ - util_routineStartDaemonMessage("mountd") - -#ifdef __cplusplus -} -#endif - -#endif /* _NFS_PROVIDERS_MSGSTRINGS_H */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/include/nfsprov_include.h b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/include/nfsprov_include.h deleted file mode 100644 index 6952f6313c..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/include/nfsprov_include.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _NFSPROV_INCLUDE_H -#define _NFSPROV_INCLUDE_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#define MAXSIZE 256 -#define NFS "nfs" -/* - * This constant is the same as the NFS_PORT constant in nfs/nfs.h. nfs/nfs.h - * was not included because it defines some of the same data types - * as defined in cimapi.h and therefore sets data types such as uint64 to - * a value not expected or understood by cim. - */ -#define NFS_PORT 2049 - -typedef struct { - char *name; - CIMBool isKey; - CIMType type; -} nfs_prov_prop_t; - -typedef struct { - char *name; - CIMBool isKey; - CIMType type; - char *true_opt_value; - char *false_opt_value; - char *string_opt_value; -} nfs_prov_prop_plus_optVals_t; - -#ifdef __cplusplus -} -#endif - -#endif /* _NFSPROV_INCLUDE_H */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/lib/Makefile b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/lib/Makefile deleted file mode 100644 index 8b67697ce8..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/lib/Makefile +++ /dev/null @@ -1,159 +0,0 @@ -# -# 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 2008 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -LIBNAME = libWBEMnfs -LIBRARY = $(LIBNAME).so -PROG = $(LIBRARY) -MSG_DOMAIN = CIM_$(LIBNAME) -TMPFILE = classes.tmp -TMPFILE1 = assocclasses.tmp - -PROV_OBJECTS = \ - ../nfs_filesystem/Solaris_NFS.o \ - ../assoc/Solaris_PersistentShareForSystem.o \ - ../assoc/Solaris_HostedShare.o \ - ../assoc/Solaris_NFSMount.o \ - ../assoc/Solaris_NFSShareEntry.o \ - ../assoc/Solaris_SharedFileSystem.o \ - ../assoc/Solaris_NFSShareSecurityModes.o \ - ../assoc/common_functions.o \ - ../nfs_share/Solaris_NFSShare.o \ - ../nfs_share/Solaris_NFSShareSecurity.o \ - ../nfs_share/Solaris_PersistentShare.o \ - ../nfs_share/Solaris_ShareService.o \ - ../nfs_mount/Solaris_MountService.o \ - ../common/nfsprov_methods.o \ - ../common/createprop_methods.o \ - ../../common/mount_methods/mountprov_methods.o \ - ../../common/cmdgeneration/cmdgen.o \ - ../../common/cmdgeneration/mount/cmdgen_mount.o \ - ../../common/cmdgeneration/mount/nfs/cmdgen_mount_nfs.o \ - ../../common/cmdgeneration/mount/cmdgen_mountall.o \ - ../../common/cmdgeneration/umount/cmdgen_umount.o \ - ../../common/cmdgeneration/umount/cmdgen_umountall.o \ - ../../common/cmdgeneration/share/cmdgen_share.o \ - ../../common/cmdgeneration/share/cmdgen_shareall.o \ - ../../common/cmdgeneration/share/nfs/cmdgen_share_nfs.o \ - ../../common/cmdgeneration/unshare/cmdgen_unshare.o \ - ../../common/cmdgeneration/unshare/cmdgen_unshareall.o \ - ../../common/cmdgeneration/unshare/nfs/cmdgen_unshare_nfs.o \ - ../../../wbem_disk/common/util.o - -# Just add the name of your provider -# to this list. -# IMPORTANT: -# $(LIBNAME) MUST be the last entry - -# Add All providers here -WBEM_NFS_CLASSES = Solaris_NFS \ - Solaris_NFSMount \ - Solaris_NFSShareEntry \ - Solaris_SharedFileSystem \ - Solaris_NFSShareSecurityModes \ - Solaris_NFSShare \ - Solaris_NFSShareSecurity \ - Solaris_PersistentShare \ - Solaris_MountService \ - Solaris_ShareService \ - Solaris_PersistentShareForSystem \ - Solaris_HostedShare \ - $(LIBNAME) - -# Add all association providers here -WBEM_NFS_ASSOC_CLASSES = Solaris_PersistentShareForSystem \ - Solaris_HostedShare \ - Solaris_NFSMount \ - Solaris_NFSShareEntry \ - Solaris_SharedFileSystem \ - Solaris_NFSShareSecurityModes \ - $(LIBNAME) - -OBJECTS = libDispatch.o \ - localFunc.o - -LINT_OBJS = $(OBJECTS:%.o=%.ln) - -GENERAL = $(ROOTWBEMINC) \ - $(SRC)/cmd/wbem/provider/c/include - -CPPFLAGS += -I. $(GENERAL:%=-I%) -DPORTMAP -D_REENTRANT -Dpic -D_TS_ERRNO - -CFLAGS += $(XREGSFLAG) $(C_PICFLAGS) - -LINTFLAGS += -um -LINTLIBS = $(LDLIBS.cmd) - -LDFLAGS += -Mmapfile $(GSHARED) -R/usr/sadm/lib/wbem \ - $(ZTEXT) $(ZDEFS) $(SOFLAGS) - -LDLIBS += -L/usr/sadm/lib/wbem -lc -lcimapi -lfsmgt - -POFILE = _lib.po -MSGFILES = $(OBJECTS:%.o=%.i) - -CLOBBERFILES += $(POFILE) - -CLEANFILES = *.tmp master.h classes assocclasses Make.obj libname $(MSGFILES) - - -all:= TARGET = all -install:= TARGET = install - -.KEEP_STATE: - -all: master.h $(LIBRARY) - -$(LIBRARY): $(OBJECTS) - $(CC) -o $@ $(LDFLAGS) \ - $(PROV_OBJECTS) $(OBJECTS) $(LDLIBS) - $(POST_PROCESS_SO) - -master.h: Makefile header.sh - @echo ${WBEM_NFS_CLASSES} > ${TMPFILE} - @echo ${WBEM_NFS_ASSOC_CLASSES} > ${TMPFILE1} - sh header.sh - -install: all $(ROOTWBEMPROG) - -lint: $(LINT_OBJS) - $(LINT.c) $(LINTFLAGS) $(LINT_OBJS) $(LINTLIBS) - -clean: - $(RM) $(OBJECTS) $(LIBRARY) $(CLEANFILES) $(LINT_OBJS) - -check: - $(CSTYLE) -p -P $(OBJECTS:%.o=%.c) - -catalog: master.h $(POFILE) - -$(POFILE): $(MSGFILES) - $(BUILDPO.msgfiles) - -include $(SRC)/cmd/Makefile.targ -include $(SRC)/Makefile.msg.targ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/lib/header.sh b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/lib/header.sh deleted file mode 100644 index b82a0ba971..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/lib/header.sh +++ /dev/null @@ -1,426 +0,0 @@ -#! /usr/bin/sh -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 -# -# -# ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -INFILE=classes.tmp -INFILE1=assocclasses.tmp -CLASSFILE=classes -ASSOCCLASSFILE=assocclasses -LIBFILE=libname -TMPFILE=tmp.tmp -TMPFILE1=tmp1.tmp -PWD=`pwd` - -HEADER=${PWD}/master.h - - -rm -f $HEADER $TMPFILE $TMPFILE1 $CLASSFILE $ASSOCCLASSFILE $LIBFILE - -# Convert into separate lines per class -for x in `cat $INFILE` -do - echo $x >> $TMPFILE -done - -# Convert into separate lines per class -for x in `cat $INFILE1` -do - echo $x >> $TMPFILE1 -done -##################################################### -# Create file containing only the library name -tail -1 $TMPFILE > $LIBFILE -LIBNAME=`cat $LIBFILE` - -# Create file containing only the class names -COUNT=`cat $TMPFILE | wc -l` -COUNT=`expr $COUNT - 1` -head -n $COUNT $TMPFILE > $CLASSFILE - -# Create file containing only the class names -COUNT=`cat $TMPFILE1 | wc -l` -COUNT=`expr $COUNT - 1` -head -n $COUNT $TMPFILE1 > $ASSOCCLASSFILE -############################################################## -# -# Create the header file -# -echo "#include <cimapi.h>" > $HEADER -echo "#include <cimlogsvc.h>" > $HEADER - -# -# Create the externs -# cp_enumInstances -# - -echo "" >> $HEADER -for x in `cat $TMPFILE` -do - echo "extern CCIMInstanceList*" >> $HEADER - echo "cp_enumInstances_$x(CCIMObjectPath* pOP);" >> $HEADER -done - - -# -# Create the externs -# cp_enumInstanceNames -# - -echo "" >> $HEADER -for x in `cat $TMPFILE` -do - echo "extern CCIMObjectPathList*" >> $HEADER - echo "cp_enumInstanceNames_$x(CCIMObjectPath* pOP);" >> $HEADER -done - -# -# cp_createInstance -# - -echo "" >> $HEADER -for x in `cat $TMPFILE` -do - echo "extern CCIMObjectPath*" >> $HEADER - echo "cp_createInstance_$x(CCIMObjectPath* pOP, CCIMInstance* pInst);" >> $HEADER -done - -# -# cp_deleteInstance -# - -echo "" >> $HEADER -for x in `cat $TMPFILE` -do - echo "extern CIMBool" >> $HEADER - echo "cp_deleteInstance_$x(CCIMObjectPath* pOP);" >> $HEADER -done - -# -# cp_getInstance -# - -echo "" >> $HEADER -for x in `cat $TMPFILE` -do - echo "extern CCIMInstance*" >> $HEADER - echo "cp_getInstance_$x(CCIMObjectPath* pOP);" >> $HEADER -done - -# -# cp_setInstance -# - -echo "" >> $HEADER -for x in `cat $TMPFILE` -do - echo "extern CIMBool" >> $HEADER - echo "cp_setInstance_$x(CCIMObjectPath* pOP, CCIMInstance* pInst);" >> $HEADER -done - -# -# cp_setProperty -# - -echo "" >> $HEADER -for x in `cat $TMPFILE` -do - echo "extern CIMBool" >> $HEADER - echo "cp_setProperty_$x(CCIMObjectPath* pOP, CCIMProperty* pProp);" >> $HEADER -done - -# -# cp_invokeMethod -# - -echo "" >> $HEADER -for x in `cat $TMPFILE` -do - echo "extern CCIMProperty*" >> $HEADER - echo "cp_invokeMethod_$x(CCIMObjectPath* pOP, cimchar* pName,CCIMPropertyList* pInParams,CCIMPropertyList* pInOutParams);" >> $HEADER -done - -# -# cp_execQuery -# - -echo "" >> $HEADER -for x in `cat $TMPFILE` -do - echo "extern CCIMInstanceList *" >> $HEADER - echo "cp_execQuery_$x(CCIMObjectPath* pOP, char *selectList,char *nonJoinExp, char *queryExp, char *queryType);" >> $HEADER -done - - -# -# cp_associators -# - -echo "" >> $HEADER -for x in `cat $TMPFILE1` -do - echo "extern CCIMInstanceList *" >> $HEADER - echo "cp_associators_$x(CCIMObjectPath* pAssocName, CCIMObjectPath *pObjectName, char *pResultClass, char *pRole, char *pResultRole);" >> $HEADER -done - -# -# cp_associatorNames -# - -echo "" >> $HEADER -for x in `cat $TMPFILE1` -do - echo "extern CCIMObjectPathList *" >> $HEADER - echo "cp_associatorNames_$x(CCIMObjectPath* pAssocName, CCIMObjectPath *pObjectName, char *pResultClass, char *pRole, char *pResultRole);" >> $HEADER -done - -# -# cp_reference -# - -echo "" >> $HEADER -for x in `cat $TMPFILE1` -do - echo "extern CCIMObjectPathList *" >> $HEADER - echo "cp_references_$x(CCIMObjectPath* pAssocName, CCIMObjectPath *pObjectName, char *pRole);" >> $HEADER -done - -# -# cp_referenceNames -# - -echo "" >> $HEADER -for x in `cat $TMPFILE1` -do - echo "extern CCIMObjectPathList *" >> $HEADER - echo "cp_referenceNames_$x(CCIMObjectPath* pAssocName, CCIMObjectPath *pObjectName, char *pRole);" >> $HEADER -done - -############################################################## -# -# Create the dispatch tables -# -############################################################## - - -# -# *cpInvokeMethodTable -# - -echo "" >> $HEADER -echo "CCIMProperty *" >> $HEADER -echo "(*cpInvokeMethodTable[])(CCIMObjectPath *, cimchar *, CCIMPropertyList *, CCIMPropertyList *) = {" >> $HEADER -for x in `cat $CLASSFILE` -do - echo "cp_invokeMethod_$x," >> $HEADER -done - -echo "cp_invokeMethod_$LIBNAME};" >> $HEADER - - -# -# *createInstanceTable -# - -echo "" >> $HEADER -echo "CCIMObjectPath *" >> $HEADER -echo "(*createInstanceTable[])(CCIMObjectPath *, CCIMInstance *) = {" >> $HEADER -for x in `cat $CLASSFILE` -do - echo "cp_createInstance_$x," >> $HEADER -done -echo "cp_createInstance_$LIBNAME};" >> $HEADER - -# -# *deleteInstanceTable -# - -echo "" >> $HEADER -echo "CIMBool" >> $HEADER -echo "(*deleteInstanceTable[])( CCIMObjectPath *) = {" >> $HEADER -for x in `cat $CLASSFILE` -do - echo "cp_deleteInstance_$x," >> $HEADER -done -echo "cp_deleteInstance_$LIBNAME};" >> $HEADER - -# -# *enumInstanceTable -# - -echo "" >> $HEADER -echo "CCIMInstanceList *" >> $HEADER -echo "(*enumInstanceTable[])(CCIMObjectPath *) = {" >> $HEADER -for x in `cat $CLASSFILE` -do - echo "cp_enumInstances_$x," >> $HEADER -done -echo "cp_enumInstances_$LIBNAME};" >> $HEADER - -# -# *enumInstanceNamesTable -# - -echo "" >> $HEADER -echo "CCIMObjectPathList *" >> $HEADER -echo "(*enumInstanceNamesTable[])(CCIMObjectPath *) = {" >> $HEADER -for x in `cat $CLASSFILE` -do - echo "cp_enumInstanceNames_$x," >> $HEADER -done -echo "cp_enumInstanceNames_$LIBNAME};" >> $HEADER - -# -# *getInstanceTable -# - -echo "" >> $HEADER -echo "CCIMInstance *" >> $HEADER -echo "(*getInstanceTable[])(CCIMObjectPath *) = {" >> $HEADER -for x in `cat $CLASSFILE` -do - echo "cp_getInstance_$x," >> $HEADER -done -echo "cp_getInstance_$LIBNAME};" >> $HEADER - -# -# *setInstanceTable -# - -echo "" >> $HEADER -echo "CIMBool" >> $HEADER -echo "(*setInstanceTable[])(CCIMObjectPath *, CCIMInstance *) = {" >> $HEADER -for x in `cat $CLASSFILE` -do - echo "cp_setInstance_$x," >> $HEADER -done -echo "cp_setInstance_$LIBNAME};" >> $HEADER - -# -# *setPropertyTable -# - -echo "" >> $HEADER -echo "CIMBool" >> $HEADER -echo "(*setPropertyTable[])(CCIMObjectPath *, CCIMProperty *) = {" >> $HEADER -for x in `cat $CLASSFILE` -do - echo "cp_setProperty_$x," >> $HEADER -done -echo "cp_setProperty_$LIBNAME};" >> $HEADER - -# -# *execQueryTable -# - -echo "" >> $HEADER -echo "CCIMInstanceList*" >> $HEADER -echo "(*execQueryTable[])(CCIMObjectPath *, char *, char *, char *, char*) = {" >> $HEADER -for x in `cat $CLASSFILE` -do - echo "cp_execQuery_$x," >> $HEADER -done -echo "cp_execQuery_$LIBNAME};" >> $HEADER - - -# -# *associatorsTable -# - -echo "" >> $HEADER -echo "CCIMInstanceList*" >> $HEADER -echo "(*associatorsTable[])(CCIMObjectPath *, CCIMObjectPath *, char *, char *, char*) = {" >> $HEADER -for x in `cat $ASSOCCLASSFILE` -do - echo "cp_associators_$x," >> $HEADER -done -echo "cp_associators_$LIBNAME};" >> $HEADER - -############################################################## -# -# *associatorNamesTable -# - -echo "" >> $HEADER -echo "CCIMObjectPathList*" >> $HEADER -echo "(*associatorNamesTable[])(CCIMObjectPath *, CCIMObjectPath *, char *, char *, char*) = {" >> $HEADER -for x in `cat $ASSOCCLASSFILE` -do - echo "cp_associatorNames_$x," >> $HEADER -done -echo "cp_associatorNames_$LIBNAME};" >> $HEADER - - -############################################################## -# -# *referencesTable -# - -echo "" >> $HEADER -echo "CCIMObjectPathList*" >> $HEADER -echo "(*referencesTable[])(CCIMObjectPath *, CCIMObjectPath *, char *) = {" >> $HEADER -for x in `cat $ASSOCCLASSFILE` -do - echo "cp_references_$x," >> $HEADER -done -echo "cp_references_$LIBNAME};" >> $HEADER - -############################################################## -# -# *referenceNamesTable -# - -echo "" >> $HEADER -echo "CCIMObjectPathList*" >> $HEADER -echo "(*referenceNamesTable[])(CCIMObjectPath *, CCIMObjectPath *, char *) = {" >> $HEADER -for x in `cat $ASSOCCLASSFILE` -do - echo "cp_referenceNames_$x," >> $HEADER -done -echo "cp_referenceNames_$LIBNAME};" >> $HEADER -# -# Create Class Name table -# -echo "" >> $HEADER -echo "static char *classNameTable [] = {" >> $HEADER -for x in `cat $CLASSFILE` -do - echo "\"$x\"," >> $HEADER -done -echo "\"$LIBNAME\"};" >> $HEADER - -############################################################## -# -# Create Assoc Class Name table -# -echo "" >> $HEADER -echo "static char *assocclassNameTable [] = {" >> $HEADER -for x in `cat $ASSOCCLASSFILE` -do - echo "\"$x\"," >> $HEADER -done -echo "\"$LIBNAME\"};" >> $HEADER diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/lib/libDispatch.c b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/lib/libDispatch.c deleted file mode 100644 index b0f61f9d32..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/lib/libDispatch.c +++ /dev/null @@ -1,708 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <pthread.h> - -#include "master.h" -#include "util.h" -#include "providerNames.h" -#include "messageStrings.h" - -/* local function declarations */ -static int FindClassEntry(char *className); -static int FindAssocClassEntry(char *className); - - -/* - * Encodes the CIM schema and provider version - * into an unsigned long, use - * getProviderVersion & getCimVersion to decode - */ - -unsigned long -cp_getVersion() -{ - return (MAKEVERSION(1.0, 2.3)); -} - - -/* - * The function will take CCIMObjectPath - * and search the classNameTable[] - * for a className match, and then - * call the corresponding cp_enumInstance - * for that provider - */ - -CCIMInstanceList* -cp_enumInstances(CCIMObjectPath* pOP) -{ - CCIMInstanceList *instList = NULL; - int index = 0; - int error; - - cim_logDebug("cp_enumInstances", "In libDispatch"); - /* Check if ObjectPath is NULL before continuing */ - if (pOP == NULL) { - /* Set error exception with localized message */ - util_handleError(ENUM_INSTANCES, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return (NULL); - } - - /* Object path is NOT NULL, so find the entry in the table */ - index = FindClassEntry(pOP->mName); - - /* check for error (-1) */ - if (index < 0) { - util_handleError(ENUM_INSTANCES, CIM_ERR_INVALID_CLASS, - NULL, NULL, &error); - return (NULL); - } - - /* OK, Find enumInstance */ - instList = (*enumInstanceTable[index])(pOP); - return ((CCIMInstanceList*)instList); - -} /* cp_enumInstances */ - -/* creates an instance */ - -/* - * The function will take CCIMObjectPath & CCIMInstance - * and search the classNameTable[] - * for a className match, and then - * call the corresponding cp_createInstance - * for that provider - */ - -CCIMObjectPath* -cp_createInstance(CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - CCIMObjectPath *objPath = NULL; - int index = 0; - int error; - - /* check if NULL before finding the Instance to create */ - if (pInst == NULL) { - util_handleError(CREATE_INSTANCE, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return (NULL); - } - - /* find entry in the table */ - index = FindClassEntry(pInst->mClassName); - - /* check for error (-1) */ - if (index < 0) { - util_handleError(CREATE_INSTANCE, - CIM_ERR_INVALID_CLASS, NULL, NULL, &error); - return (NULL); - } - - objPath = (*createInstanceTable[index])(pOP, pInst); - - return ((CCIMObjectPath*) objPath); - -} /* cp_createInstances */ - - -/* - * returns an array of CCIMObjectPaths for the class - * params: - * char* - the classname to enum - */ - -CCIMObjectPathList* -cp_enumInstanceNames(CCIMObjectPath* pOP) -{ - CCIMObjectPathList *objList = NULL; - CCIMInstanceList *instList = NULL; - int error = 0; - - /* - * create an instance list which contains all of the - * instances this provider will produce First check - * for valid ObjectPath - */ - if (pOP == NULL) { - util_handleError(ENUM_INSTANCENAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return (NULL); - } - - instList = cp_enumInstances(pOP); - - if (instList == NULL) { - return ((CCIMObjectPathList *)NULL); - } - - objList = cim_createObjectPathList(instList); - - /* - * we no longer need the instList so free - * the memory allocated for it - */ - - cim_freeInstanceList(instList); - return (objList); -} - -/* get an instance */ - -CCIMInstance* -cp_getInstance(CCIMObjectPath* pOP) -{ - CCIMInstance* inst = NULL; - int index = 0; - int error; - - /* Check if ObjectPath is NULL before continuing */ - if (pOP == NULL) { - util_handleError(GET_INSTANCE, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return (NULL); - } - - /* Object path is NOT NULL, so find the entry in the table */ - index = FindClassEntry(pOP->mName); - - /* check for error (-1) */ - if (index < 0) { - util_handleError(GET_INSTANCE, CIM_ERR_INVALID_CLASS, NULL, - NULL, &error); - return (NULL); - } - - inst = (*getInstanceTable[index])(pOP); - return ((CCIMInstance *)inst); -} - -/* - * returns the specified property, - * should return NULL if not found - * - * params: - * CCIMObjectPath* - ObjectPath to get the property from - * char* - The property name to get - * - */ - -CCIMProperty* -cp_getProperty(CCIMObjectPath *pOP, char *pPropName) -{ - CCIMProperty* prop = NULL; - CCIMInstance* inst = NULL; - int error; - - /* See if ObjectPath is OK */ - if (pOP == NULL) { - util_handleError(GET_PROPERTY, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return (NULL); - } - - /* Make sure property name isn't NULL */ - if (pPropName == NULL) { - util_handleError(GET_PROPERTY, CIM_ERR_INVALID_CLASS, - NULL, NULL, &error); - return (NULL); - } - - /* see if we have any instances which match the obj path */ - inst = cp_getInstance(pOP); - - /* check for valid instance */ - if (inst == NULL) { - util_handleError(GET_PROPERTY, CIM_ERR_FAILED, - NULL, NULL, &error); - return (NULL); - } - - /* see if it has the specified property */ - prop = cim_getProperty(inst, pPropName); - - /* free memory allocated for the instance */ - cim_freeInstance(inst); - - /* return the property */ - return ((CCIMProperty *)prop); -} - -/* - * Sets the property in the passed in - * instance to the new values of the - * passed in property - * - * params: - * CCIMObjectPath* - the Object Path in which the property should be changed - * CCIMProperty* - a property structure which contains the new values - * - * return: - * cim_true if property was updated otherwise cim_false - * - * - * The function will take CCIMObjectPath & CCIMProperty - * and search the classNameTable[] - * for a className match, and then - * call the corresponding setProperty - * for that provider - */ - -CIMBool -cp_setProperty(CCIMObjectPath* pObjPath, CCIMProperty* pProp) -{ - CIMBool retVal; - int index = 0; - int error; - - if (pObjPath == NULL) { - util_handleError(SET_PROPERTY, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return (NULL); - } - - index = FindClassEntry(pObjPath->mName); - - /* check for error (-1) */ - if (index < 0) { - util_handleError(SET_PROPERTY, CIM_ERR_INVALID_CLASS, - NULL, NULL, &error); - return (NULL); - } - - retVal = (*setPropertyTable[index])(pObjPath, pProp); - return ((CIMBool)retVal); -} - - -/* sets an instance */ - -/* - * The function will take CCIMObjectPath & CCIMInstance - * and search the classNameTable[] - * for a className match, and then - * call the corresponding cp_setInstance - * for that provider - */ - -CIMBool -cp_setInstance(CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - CIMBool retVal; - int index = 0; - int error; - - if (pOP == NULL) { - util_handleError(SET_INSTANCE, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return (NULL); - } - - if (pInst == NULL) { - util_handleError(SET_INSTANCE, CIM_ERR_INVALID_CLASS, - NULL, NULL, &error); - return (NULL); - } - - /* get the index into the table */ - index = FindClassEntry(pInst->mClassName); - - /* check for error (-1) */ - if (index < 0) { - util_handleError(SET_INSTANCE, CIM_ERR_INVALID_CLASS, - NULL, NULL, &error); - return (NULL); - } - - retVal = (*setInstanceTable[index])(pOP, pInst); - return ((CIMBool)retVal); -} - - -/* - * deletes an instance - * - * The function will take CCIMObjectPath - * and search the classNameTable[] - * for a className match, and then - * call the corresponding cp_deleteInstance - * for that provider - */ - -CIMBool -cp_deleteInstance(CCIMObjectPath* pOP) -{ - CIMBool retVal; - int index = 0; - int error; - - /* Verify ObjectPath is NOT NULL */ - if (pOP == NULL) { - util_handleError(DELETE_INSTANCE, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return (NULL); - } - - /* find Entry in table */ - index = FindClassEntry(pOP->mName); - - /* check for error (-1) */ - if (index < 0) { - util_handleError(DELETE_INSTANCE, CIM_ERR_INVALID_CLASS, - NULL, NULL, &error); - return (NULL); - } - - retVal = (*deleteInstanceTable[index])(pOP); - return ((CIMBool)retVal); -} - -/* - * Invokes the method and returns the results - * The caller is responsible for freeing the - * memory allocated for the returned object - * - * params: - * CCIMObjectPath* - An object path of the instance - * to invoke the function on - * char* - name of the method to invoke - * CCIMPropertyList* - input parameters to the function - * CCIMPropertyList* - input/output parameters to the function - * - * returns: - * NULL if it failed otherwise a CCIMProperty* - * which represents the return value of the function - */ - -CCIMProperty* -cp_invokeMethod(CCIMObjectPath* pOP, cimchar* pName, - CCIMPropertyList* pInParams, CCIMPropertyList* pInOutParams) -{ - CCIMProperty *prop; - int index = 0; - int error; - - /* First check for valid ObjectPath */ - if (pOP == NULL) { - util_handleError(INVOKE_METHOD, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return (NULL); - } - - /* find entry in the table */ - index = FindClassEntry(pOP->mName); - - /* check for error (-1) */ - if (index < 0) { - util_handleError(INVOKE_METHOD, CIM_ERR_INVALID_CLASS, - NULL, NULL, &error); - return (NULL); - } - - prop = (*cpInvokeMethodTable[index]) - (pOP, pName, pInParams, pInOutParams); - - return ((CCIMProperty*)prop); -} - -/* - * cp_execQuery - */ - -CCIMInstanceList* -cp_execQuery(CCIMObjectPath *pOP, char *selectList, - char *nonJoinExp, char *queryExp, char *queryType) -{ - CCIMInstanceList *instList = NULL; - int index = 0; - int error = 0; - - - /* First check for valid ObjectPath */ - if (pOP == NULL) { - util_handleError(EXEC_QUERY, CIM_ERR_INVALID_PARAMETER, NULL, NULL, - &error); - return ((CCIMInstanceList *)NULL); - } - - /* find entry in the table */ - index = FindClassEntry(pOP->mName); - - /* check for error (-1) */ - if (index < 0) { - /* Set error exception with localized message */ - util_handleError(EXEC_QUERY, CIM_ERR_INVALID_CLASS, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - instList = (*execQueryTable[index])(pOP, selectList, nonJoinExp, - queryExp, queryType); - - return (instList); -} - -/* - * cp_associators - */ - -CCIMInstanceList* -cp_associators(CCIMObjectPath *pAssocName, CCIMObjectPath *pObjectName, - char *pResultClass, char *pRole, char *pResultRole) -{ - CCIMInstanceList *instList; - int index = 0; - int error = 0; - - /* First check for valid ObjectPath */ - if (pAssocName == NULL) { - /* Set error exception with localized message */ - util_handleError(ASSOCIATORS, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* find entry in the table */ - index = FindAssocClassEntry(pAssocName->mName); - - /* check for error (-1) */ - if (index < 0) { - /* Set error exception with localized message */ - util_handleError(ASSOCIATORS, CIM_ERR_INVALID_CLASS, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* - * Call the appropriate associator function. Let the specific function - * in the c provider handle the checking for correctness of the - * other parameters. - */ - - instList = (*associatorsTable[index])(pAssocName, pObjectName, - pResultClass, pRole, pResultRole); - return ((CCIMInstanceList *)instList); -} - -/* - * cp_associatorNames - */ - -CCIMObjectPathList* -cp_associatorNames(CCIMObjectPath *pAssocName, CCIMObjectPath *pObjectName, - char *pResultClass, char *pRole, char *pResultRole) -{ - CCIMObjectPathList *objList; - int index = 0; - int error = 0; - - /* First check for valid ObjectPath */ - if (pAssocName == NULL) { - /* Set error exception with localized message */ - util_handleError(ASSOCIATORS, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - /* find entry in the table */ - index = FindAssocClassEntry(pAssocName->mName); - - /* check for error (-1) */ - if (index < 0) { - /* Set error exception with localized message */ - util_handleError(ASSOCIATORS, CIM_ERR_INVALID_CLASS, NULL, - NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - /* - * Call the appropriate associatorName function. Let the specific - * function in the c provider handle the checking for correctness of - * the other parameters. - */ - - objList = (*associatorNamesTable[index])(pAssocName, pObjectName, - pResultClass, pRole, pResultRole); - return ((CCIMObjectPathList *)objList); -} - -/* - * cp_references - */ - -CCIMInstanceList* -cp_references(CCIMObjectPath *pAssocName, CCIMObjectPath *pObjectName, - char *pRole) -{ - CCIMInstanceList *instList; - int index = 0; - int error = 0; - - /* First check for valid ObjectPath */ - if (pAssocName == NULL) { - /* Set error exception with localized message */ - util_handleError(REFERENCES, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* find entry in the table */ - index = FindAssocClassEntry(pAssocName->mName); - - /* check for error (-1) */ - if (index < 0) { - /* Set error exception with localized message */ - util_handleError(REFERENCES, CIM_ERR_INVALID_CLASS, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* - * Call the appropriate references function. Let the specific function - * in the c provider handle the checking for correctness of the - * other parameters. - */ - - instList = (*referencesTable[index])(pAssocName, pObjectName, pRole); - return ((CCIMInstanceList *)instList); -} - -/* - * InParam: Class Name - * Returns: Index into Name Table - * If it hit libWBEMnfs, then we - * have hit bottom, return err (-1) - */ - -static int -FindClassEntry(char *className) -{ - int i = 0; - - while (strcasecmp(className, classNameTable[i])) { - if (!strcasecmp(classNameTable[i], "libWBEMnfs")) { - i = -1; - break; - } - i++; - } - - return (i); -} -/* - * InParam: Class Name - * Returns: Index into Name Table - * If it hit libWBEMnfs, then we - * have hit bottom, return err (-1) - */ - -static int -FindAssocClassEntry(char *className) -{ - int i = 0; - - while (strcasecmp(className, assocclassNameTable[i])) { - if (!strcasecmp(assocclassNameTable[i], "libWBEMnfs")) { - i = -1; - break; - } - i++; - } - - return (i); -} - -/* - * cp_referenceNames - */ - -CCIMObjectPathList* -cp_referenceNames(CCIMObjectPath *pAssocName, CCIMObjectPath *pObjectName, - char *pRole) -{ - CCIMObjectPathList *objList; - int index = 0; - int error = 0; - - /* First check for valid ObjectPath */ - if (pAssocName == NULL) { - /* Set error exception with localized message */ - util_handleError(REFERENCE_NAMES, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - /* find entry in the table */ - index = FindAssocClassEntry(pAssocName->mName); - - /* check for error (-1) */ - if (index < 0) { - /* Set error exception with localized message */ - util_handleError(REFERENCE_NAMES, CIM_ERR_INVALID_CLASS, - NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - /* - * Call the appropriate referenceName function. Let the specific - * function in the c provider handle the checking for correctness of - * the other parameters. - */ - - objList = (*referenceNamesTable[index])(pAssocName, pObjectName, pRole); - return ((CCIMObjectPathList *)objList); -} - -CIMBool -cp_isAssociatorProvider(CCIMObjectPath *pOp) -{ - - int index = 0; - int error = 0; - - /* - * If the object path coming in matches any in the associator table, - * return true, otherwise, return false. - */ - - /* First check for valid ObjectPath */ - if (pOp == NULL) { - /* Set error exception with localized message */ - util_handleError(REFERENCE_NAMES, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return (cim_false); - } - - /* find entry in the table */ - index = FindAssocClassEntry(pOp->mName); - - if (index < 0) { - return (cim_false); - } - return (cim_true); -} diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/lib/localFunc.c b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/lib/localFunc.c deleted file mode 100644 index 9d8a8550d5..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/lib/localFunc.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * this is a place holder file - * for the following functions. - * They should never be called - */ -/* everything is in here */ - -#include <cimapi.h> -#include <cp_associator.h> - -/* ARGSUSED */ -CCIMInstanceList* -cp_enumInstances_libWBEMnfs(CCIMObjectPath* pOP) -{ - return ((CCIMInstanceList*) NULL); -} - -/* ARGSUSED */ -CCIMObjectPathList* -cp_enumInstanceNames_libWBEMnfs(CCIMObjectPath* pOP) -{ - return ((CCIMObjectPathList*) NULL); -} - -/* creates an instance */ -/* ARGSUSED */ -CCIMObjectPath* -cp_createInstance_libWBEMnfs(CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - return ((CCIMObjectPath*)NULL); -} - -/* ARGSUSED */ -CCIMProperty* -cp_invokeMethod_libWBEMnfs(CCIMObjectPath* pOP, cimchar* pName, - CCIMPropertyList* pInParams, - CCIMPropertyList* pInOutParams) -{ - return ((CCIMProperty*)NULL); -} - -/* ARGSUSED */ -CIMBool -cp_setInstance_libWBEMnfs(CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - return (cim_false); -} - -/* ARGSUSED */ -CCIMInstance * -cp_getInstance_libWBEMnfs(CCIMObjectPath * pOP) -{ - return ((CCIMInstance *)NULL); -} - - -/* deletes an instance */ -/* ARGSUSED */ -CIMBool -cp_deleteInstance_libWBEMnfs(CCIMObjectPath *pOP) -{ - return (cim_false); -} - -/* ARGSUSED */ -CIMBool -cp_setProperty_libWBEMnfs(CCIMObjectPath* pObjPath, CCIMProperty* pProp) -{ - return (cim_false); -} - -/* ARGSUSED */ -CCIMProperty* -cp_getProperty_libWBEMnfs(CCIMObjectPath *pOP, char *pPropName) -{ - return ((CCIMProperty*) NULL); -} - -/* ARGSUSED */ -CCIMInstanceList* -cp_execQuery_libWBEMnfs(CCIMObjectPath *pOP, char *selectList, - char *nonJoinExp, char *queryExp, char *queryType) -{ - return ((CCIMInstanceList *) NULL); -} - -/* ARGSUSED */ -CCIMInstanceList* -cp_associators_libWBEMnfs(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pResultClass, char *pRole, - char *pResultRole) -{ - return ((CCIMInstanceList *) NULL); -} - -/* ARGSUSED */ -CCIMObjectPathList* -cp_associatorNames_libWBEMnfs(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pResultClass, char *pRole, - char *pResultRole) -{ - return ((CCIMObjectPathList *) NULL); -} - -/* ARGSUSED */ -CCIMInstanceList* -cp_references_libWBEMnfs(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pRole) -{ - return ((CCIMInstanceList *) NULL); -} - -/* ARGSUSED */ -CCIMObjectPathList* -cp_referenceNames_libWBEMnfs(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pRole) -{ - return ((CCIMObjectPathList *) NULL); -} diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/lib/mapfile b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/lib/mapfile deleted file mode 100644 index 207df3fa2f..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/lib/mapfile +++ /dev/null @@ -1,61 +0,0 @@ -# -# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. -# -# 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 -# - -# -# 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 -# - -$mapfile_version 2 - -SYMBOL_VERSION SUNWprivate_1.1 { - global: - cp_associatorNames ; - cp_associators ; - cp_createInstance ; - cp_deleteInstance ; - cp_enumInstanceNames ; - cp_enumInstances ; - cp_execQuery ; - cp_getInstance ; - cp_getProperty ; - cp_getLastError ; - cp_getVersion ; - cp_invokeMethod ; - cp_isAssociatorProvider ; - cp_referenceNames ; - cp_references ; - cp_setInstance ; - cp_setProperty ; - local: - *; -}; diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_filesystem/Makefile b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_filesystem/Makefile deleted file mode 100644 index fd914420de..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_filesystem/Makefile +++ /dev/null @@ -1,73 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -OBJECTS = Solaris_NFS.o - -LINT_OBJS = $(OBJECTS:%.o=%.ln) - -GENERAL = $(ROOTWBEMINC) \ - $(SRC)/lib/libfsmgt/common \ - $(SRC)/cmd/wbem/provider/c/include \ - $(SRC)/cmd/wbem/provider/c/filesystems/wbem_nfs/common \ - $(SRC)/cmd/wbem/provider/c/filesystems/wbem_nfs/include - - -CPPFLAGS += -I. $(GENERAL:%=-I%) -D_REENTRANT -DPIC -D_TS_ERRNO - -CFLAGS += $(XREGSFLAG) $(C_BIGPICFLAGS) - -LINTFLAGS += -um -LINTLIBS = $(LDLIBS.cmd) - -POFILE = _nfs_filesystem.po -MSGFILES = $(OBJECTS:%.o=%.i) - -CLOBBERFILES += $(POFILE) - -.KEEP_STATE: - -all: $(OBJECTS) -catalog: $(POFILES) -check: - $(CSTYLE) -p -P $(OBJECTS:%.o=%.c) *.h - $(HDRCHK) *.h -clean: - $(RM) $(OBJECTS) $(LINT_OBJS) $(MSGFILES) -install: all -lint: $(LINT_OBJS) - $(LINT.c) $(LINTFLAGS) $(LINT_OBJS) $(LINTLIBS) - -catalog: $(POFILE) - -$(POFILE): $(MSGFILES) - $(BUILDPO.msgfiles) - -include $(SRC)/cmd/Makefile.targ -include $(SRC)/Makefile.msg.targ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_filesystem/Solaris_NFS.c b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_filesystem/Solaris_NFS.c deleted file mode 100644 index 44cc98770c..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_filesystem/Solaris_NFS.c +++ /dev/null @@ -1,1239 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "Solaris_NFS.h" -#include "util.h" /* Error handling */ -#include "nfs_provider_names.h" -#include "nfs_providers_msgstrings.h" -#include "messageStrings.h" -#include "libfsmgt.h" -#include "nfsprov_methods.h" -#include "createprop_methods.h" -#include <errno.h> -#include <sys/types.h> -#include <string.h> - -#define GET_DEF_SECMODE_METHOD "getDefaultNfsSecMode" -#define GET_NET_CFG_LIST_METHOD "getNetCfgList" -#define GET_NFS_SEC_LIST_METHOD "getNfsSecList" -#define UNKNOWN "Unknown" -/* - * Private method declarations - */ -static CCIMInstanceList* enumerate_nfs_mounts(); -static CCIMPropertyList* populate_property_list(nfs_mntlist_t *nfs_mount); -static CIMBool populate_property_values(nfs_mntlist_t *nfs_mount, - cimchar **propValues); -/* - * Instance provider methods - */ - -/* - * Method: cp_createInstance_Solaris_NFS - * - * Description: This method is not supported. A Solaris_NFS instance is only - * created upon the creation of a corresponding NFS mount. - * - * Parameters: - * - CCIMObjectPath *nfsOP - An object path containing the name of - * the class of which to enumerate the instances of. - * - * Returns: - * - Always returns NULL because the method is not supported. - */ -/* ARGSUSED */ -CCIMObjectPath * -cp_createInstance_Solaris_NFS(CCIMObjectPath *nfsOP, - CCIMInstance *nfsInst) { - - int err = 0; - - util_handleError("SOLARIS_NFS::CREATE_INSTANCE", CIM_ERR_NOT_SUPPORTED, - NULL, NULL, &err); - - return ((CCIMObjectPath *)NULL); -} /* cp_createInstance_Solaris_NFS */ - -/* - * Method: cp_deleteInstance_Solaris_NFS - * - * Description: This method is not supported. A Solaris_NFS instance is - * only deleted upon the deletion of the corresponding NFS mount. - * - * Parameters: - * - CCIMObjectPath *pOP - An object path containing the - * information about the class of which to delete the instance of. - * - * Returns: - * - Always returns cim_false because the method is not supported. - */ -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_NFS(CCIMObjectPath *nfsOP) { - - int err = 0; - - util_handleError("SOLARIS_NFS::DELETE_INSTANCE", CIM_ERR_NOT_SUPPORTED, - NULL, NULL, &err); - - return (cim_false); -} /* cp_deleteInstance_Solaris_NFS */ - -/* - * Method: cp_enumInstances_Solaris_NFS - * - * Description: Enumerates the instances of Solaris_NFS mount on the host. - * - * Parameters: - * - CCIMObjectPath *nfsOP - An object path containing the name of - * the class of which to enumerate the instances of. - * - * Returns: - * - A pointer to a list of Solaris_NFS instances. - * - NULL if an error occurred or if there aren't any instances of - * Solaris_NFS on the host. In the case of an error, the error will be - * logged. - */ -CCIMInstanceList * -cp_enumInstances_Solaris_NFS(CCIMObjectPath *nfsOP) { - CCIMInstanceList *instList; - int err = 0; - - /* - * First check if the CCIMObjectPath passed in is NULL. - */ - if (nfsOP == NULL) { - util_handleError("SOLARIS_NFS::ENUM_INSTANCES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - - return ((CCIMInstanceList *)NULL); - } - - /* - * An nfs file system instance is equivalent to a nfs mount on the - * host. - */ - instList = enumerate_nfs_mounts(); - - return (instList); -} /* cp_enumInstances_Solaris_NFS */ - -/* - * Method: cp_enumInstanceNames_Solaris_NFS - * - * Description: Enumerates the object paths of the instances of Solaris_NFS - * on the host. - * - * Parameters: - * - CCIMObjectPath *nfsOP - An object path containing the name of - * the class of which to enumerate the instance names of. - * - * Returns: - * - A pointer to a list of Solaris_NFS object paths. - * - NULL if an error occurred or if there aren't any instances of - * Solaris_NFS on the host. In the case of an error, the error will be - * logged. - */ -CCIMObjectPathList * -cp_enumInstanceNames_Solaris_NFS(CCIMObjectPath *nfsOP) { - CCIMInstanceList *instList; - CCIMObjectPathList *objPathList; - int err = 0; - - /* - * First check if the object path is null. - */ - if (nfsOP == NULL) { - util_handleError("SOLARIS_NFS::ENUM_INSTANCENAMES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - - return ((CCIMObjectPathList *)NULL); - } - - instList = cp_enumInstances_Solaris_NFS(nfsOP); - if (instList == NULL) { - return ((CCIMObjectPathList *)NULL); - } - - objPathList = cim_createObjectPathList(instList); - - cim_freeInstanceList(instList); - /* - * If an error occurred in cim_createObjectPathList it will be handled - * there. - */ - return (objPathList); -} /* cp_enumInstanceNames_Solaris_NFS */ - -/* - * Method: cp_execQuery_Solaris_NFS - * - * Description: Queries the nfs instances on the host to find those that meet - * the search criteria. - * - * Parameters: - * - CCIMObjectPath *nfsOP - An object path containing the name of - * the class of which to query. - * - char *selectClause - Not used. - * - char *nonJoinExp - Not used. - * - char *queryExp - Not used. - * - char *queryLang - Not used. - * - * Returns: - * - A pointer to a list of Solaris_NFS instances that match the criteria. - * - NULL if an error occurred or if there are no Solaris_NFS instances - * that match the criteria. In the case of an error, the error will be - * logged. - * - * NOTE: Currently, there is no WQL parser for the C providers. As a result, - * what is returned to the CIMOM is a list of instances with - * a NULL value at the beginning of the list. This NULL value indicates - * to the CIMOM that it must do the filtering for the client. - */ -/* ARGSUSED */ -CCIMInstanceList * -cp_execQuery_Solaris_NFS(CCIMObjectPath *nfsOP, char *selectClause, - char *nonJoinExp, char *queryExp, char *queryLang) { - - CCIMInstance *emptyInst; - CCIMInstanceList *nfsInstList; - CCIMException *ex; - int err = 0; - - if (nfsOP == NULL) { - util_handleError("SOLARIS_NFS::EXEC_QUERY", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - nfsInstList = cp_enumInstances_Solaris_NFS(nfsOP); - if (nfsInstList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFS::EXEC_QUERY", - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, &err); - cim_freeInstanceList(nfsInstList); - return ((CCIMInstanceList *)NULL); - } - - nfsInstList = cim_prependInstance(nfsInstList, emptyInst); - if (nfsInstList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFS::EXEC_QUERY", - CIM_ERR_FAILED, PREPEND_INSTANCE_FAILURE, ex, &err); - cim_freeInstance(emptyInst); - return ((CCIMInstanceList *)NULL); - } - - return (nfsInstList); -} /* cp_execQuery_Solaris_NFS */ - -/* - * Method: cp_getInstance_Solaris_NFS - * - * Description: Gets the Solaris_NFS instance that corresponds to the object - * path passed in. - * - * Parameters: - * - CCIMObjectPath *nfsOP - The object path containing all the - * keys of the instance that is supposed to be returned. - * - * Returns: - * - A pointer to an instance of Solaris_NFS which corresponds to the - * object path passed in. - * - NULL if an error occurred or if there is no Solaris_NFS instance - * corresponding to the object path passed in. In the case of an error, - * the error will be logged. - */ -CCIMInstance * -cp_getInstance_Solaris_NFS(CCIMObjectPath *nfsOP) { - CCIMInstanceList *instList; - CCIMInstance *inst; - CCIMException *ex; - int err = 0; - - /* - * First check to see if the object path is null. - */ - if (nfsOP == NULL || nfsOP->mKeyProperties == NULL) { - util_handleError("SOLARIS_NFS::GET_INSTANCE", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstance *)NULL); - } - - instList = cp_enumInstances_Solaris_NFS(nfsOP); - if (instList == NULL) { - /* - * Either an error occurred or we simply don't have any - * instances of Solaris_NFS on the system. In the case that - * an error occurred, it will be handled in - * cp_enumInstances_Solaris_NFS. - */ - return ((CCIMInstance *)NULL); - } - - inst = cim_getInstance(instList, nfsOP); - if (inst == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFS::GET_INSTANCE", - CIM_ERR_INVALID_PARAMETER, GET_INSTANCE_FAILURE, - ex, &err); - cim_freeInstanceList(instList); - return ((CCIMInstance *)NULL); - } - - cim_freeInstanceList(instList); - return (inst); -} /* cp_getInstance_Solaris_NFS */ - -/* - * Method: cp_setInstance_Solaris_NFS - * - * Description: This method is not supported. This is not allowed because in - * order to change the properties of a Solaris_NFS instance underlying file - * system or file system mount would have to be modified. - * - * Parameters: - * - CCIMObjectPath *pOP - An object path containing the name of the class - * of which to set the instance. - * - CCIMInstance *pInst - Not used. - * - * Returns: - * - Always returns cim_false since the method is not supported. - */ -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_NFS(CCIMObjectPath *nfsOP, CCIMInstance *nfsInst) { - - int err = 0; - - util_handleError("SOLARIS_NFS::SET_INSTANCE", CIM_ERR_NOT_SUPPORTED, - NULL, NULL, &err); - - return (cim_false); -} /* cp_setInstance_Solaris_NFS */ - -/* - * Method: cp_setInstanceWithList_Solaris_NFS - * - * Description: This method is not supported. This is not allowed because in - * order to change the properties of a Solaris_NFS instance underlying file - * system or file system mount would have to be modified. - * - * Parameters: - * - CCIMObjectPath *nfsOP - The object path containing the name - * of the class of which to set the instance. - * - CCIMInstance *nfsInst - Not used. - * - char **props - Not used. - * - int num_props - Not used. - * - * Returns: - * - Always returns cim_false since the method is not supported. - */ -/* ARGSUSED */ -CIMBool -cp_setInstanceWithList_Solaris_NFS(CCIMObjectPath *nfsOP, CCIMInstance *nfsInst, - char **props, int num_props) { - - int err = 0; - - util_handleError("SOLARIS_NFS::SET_INSTANCE", CIM_ERR_NOT_SUPPORTED, - NULL, NULL, &err); - - return (cim_false); -} /* cp_setInstanceWithList_Solaris_NFS */ - - -/* - * Property provider methods - */ - -/* - * Method: cp_getProperty_Solaris_NFS - * - * Description: Retrieves the property with the name matching the passed in - * parameter, pPropName, along with the value and descriptive other information. - * - * Parameters: - * - CCIMObjectPath *nfsOP - The object path containing all the - * information needed to find the instance in which the property is to - * be returned. - * - cimchar *pPropName - The name of the property to be found. - * - * Returns: - * - A pointer to a the property corresponding to the property name passed - * in with pPropName. - * - NULL if an error occurred or if there is no property corresponding to - * pPropName. In the case of an error, the error will be logged. - */ -CCIMProperty * -cp_getProperty_Solaris_NFS(CCIMObjectPath *nfsOP, cimchar *pPropName) { - CCIMInstance *nfsInst; - CCIMProperty *nfsProp; - int err = 0; - - if (nfsOP == NULL || pPropName == NULL) { - util_handleError("SOLARIS_NFS::GET_PROPERTY", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMProperty *)NULL); - } - - nfsInst = cp_getInstance_Solaris_NFS(nfsOP); - if (nfsInst == NULL) { - return ((CCIMProperty *)NULL); - } - - nfsProp = cim_getProperty(nfsInst, pPropName); - - cim_freeInstance(nfsInst); - /* - * If an error occurred in cim_getProperty it will be handled there. - */ - return (nfsProp); -} /* cp_getProperty_Solaris_NFS */ - -/* - * Method: cp_setProperty_Solaris_NFS - * - * Description: This method is not supported. This is not allowed because in - * order to change the properties of a Solaris_NFS instance underlying file - * system or file system mount would have to be modified. - * - * Parameters: - * - CCIMObjectPath *nfsOP - Not used. - * - CCIMProperty *pProp - Not used. - * - * Returns: - * - Always returns cim_false because the method is not supported. - */ -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_NFS(CCIMObjectPath *nfsOP, CCIMProperty *pProp) { - int err = 0; - - util_handleError("SOLARIS_NFS::SET_PROPERTY", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_setProperty_Solaris_NFS */ - -/* - * Method provider methods - */ - -/* - * Method: cp_invokeMethod_Solaris_NFS - * - * Description: Routes the cp_invokeMethod_Solaris_NFS calls to the correct - * Solaris_NFS methods. - * - * Parameters: - * - CCIMObjectPath *pOP - The object path containing needed information - * about the class that is to getting methods invoked. - * - cimchar *functionName - The name of the function to be invoked. - * - CCIMPropertyList *inParams - The input parameters to the function. - * - CCIMPropertyList *outParams - The output parameters from the function. - * - * Returns: - * - A property having a value which indicates success or failure of the - * function. 1 for success, 0 for failure. - * - Upon error, NULL is returned and the error is logged. - * - * NOTE: All methods of Solaris_NFS are deprecated, but are still to be - * supported until they are EOL'd. EOL date is to be determined. - */ -/* ARGSUSED */ -CCIMProperty * -cp_invokeMethod_Solaris_NFS(CCIMObjectPath *pOP, cimchar *functionName, - CCIMPropertyList *inParams, CCIMPropertyList *outParams) { - - int err = 0; - CCIMProperty *retVal; - - if (pOP == NULL || functionName == NULL) { - util_handleError("SOLARIS_NFS::INVOKE_METHOD", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMProperty *)NULL); - } - /* - * Determine what method is being called. - */ - if (strcasecmp(functionName, GET_NET_CFG_LIST_METHOD) == 0) { - retVal = get_netconfig_list(outParams); - } else if (strcasecmp(functionName, GET_NFS_SEC_LIST_METHOD) == 0) { - retVal = get_nfssec_list(outParams); - } else if (strcasecmp(functionName, GET_DEF_SECMODE_METHOD) == 0) { - retVal = get_default_secmode(outParams); - } else { - /* - * No such method name. - */ - util_handleError("SOLARIS_NFS::INVOKE_METHOD", - CIM_ERR_FAILED, NO_SUCH_METHOD, NULL, &err); - return ((CCIMProperty *)NULL); - } - - return (retVal); -} /* cp_invokeMethod_Solaris_NFS */ - -/* - * Private methods - */ - -/* - * Method: enumerate_nfs_mounts - * - * Description: Enumerates all the NFS file systems on the host. - * - * Parameters: - * - NONE - * - * Returns: - * - A pointer to a list of Solaris_NFS instances on the host. - * - NULL if an error occurred or if there aren't any Solaris_NFS - * instances on the host. In the case of an error, the error will be - * logged. - */ -static CCIMInstanceList * -enumerate_nfs_mounts() { - int err = 0; - nfs_mntlist_t *nfs_mount_list, *currentMnt; - CCIMException *ex; - - nfs_mount_list = nfs_get_mount_list(&err); - if (nfs_mount_list == NULL) { - /* - * Check whether an error was returned or if we simply don't - * have any nfs file systems on the system. If err is not - * equal to 0, an error was encountered. - */ - if (err != 0) { - /* - * Determine the error and log it. - */ - if (err == ENOMEM || err == EAGAIN) { - util_handleError("SOLARIS_NFS::ENUM_MOUNTS", - CIM_ERR_LOW_ON_MEMORY, - NFS_GET_MNTLIST_FAILURE, - NULL, &err); - - return ((CCIMInstanceList *)NULL); - } else { - /* - * If any other errors were encountered it - * can be handled as a general error. We may - * not know exactly what the error is. - */ - util_handleError("SOLARIS_NFS::ENUM_MOUNTS", - CIM_ERR_FAILED, NFS_GET_MNTLIST_FAILURE, - NULL, &err); - - return ((CCIMInstanceList *)NULL); - } - } - /* - * There are simply no nfs mounts on the host. - */ - return ((CCIMInstanceList *)NULL); - } else { - /* - * At this point, one or more nfs mounts were found on the - * system, create the instance list from the nfs_mount_list. - */ - CCIMInstanceList *nfsInstList; - - nfsInstList = cim_createInstanceList(); - if (nfsInstList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFS::ENUM_MOUNTS", - CIM_ERR_FAILED, CREATE_INSTANCE_LIST_FAILURE, - ex, &err); - nfs_free_mntinfo_list(nfs_mount_list); - return ((CCIMInstanceList *)NULL); - } - - /* - * Loop through the nfs mounts to retrieve their properties - * and create an instance list containing all the nfs file - * systems and their properties. - */ - for (currentMnt = nfs_mount_list; currentMnt != NULL; - currentMnt = currentMnt->next) { - - CCIMInstance *solarisNFSInstance; - CCIMPropertyList *solarisNFSPropList; - - /* - * Create the Solaris_NFS CCIMInstance - */ - solarisNFSInstance = - cim_createInstance(SOLARIS_NFS); - if (solarisNFSInstance == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFS::ENUM_MOUNTS", - CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, &err); - - cim_freeInstanceList(nfsInstList); - nfs_free_mntinfo_list(nfs_mount_list); - return ((CCIMInstanceList *)NULL); - } - - solarisNFSPropList = - populate_property_list(currentMnt); - if (solarisNFSPropList == NULL) { - /* - * An error occurred in populate_property_list - * and was logged there. - */ - cim_freeInstanceList(nfsInstList); - cim_freeInstance(solarisNFSInstance); - return ((CCIMInstanceList *)NULL); - } - - solarisNFSInstance = cim_addPropertyListToInstance( - solarisNFSInstance, solarisNFSPropList); - if (solarisNFSInstance == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFS::ENUM_MOUNTS", - CIM_ERR_FAILED, - PROPLIST_TO_INSTANCE_FAILURE, ex, - &err); - cim_freeInstanceList(nfsInstList); - cim_freePropertyList(solarisNFSPropList); - nfs_free_mntinfo_list(nfs_mount_list); - return ((CCIMInstanceList *)NULL); - } - - nfsInstList = cim_addInstance(nfsInstList, - solarisNFSInstance); - if (nfsInstList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFS::ENUM_MOUNTS", - CIM_ERR_FAILED, ADD_INSTANCE_FAILURE, - ex, &err); - /* - * Freeing the instance will also free the - * property list added to the instance. - */ - cim_freeInstance(solarisNFSInstance); - nfs_free_mntinfo_list(nfs_mount_list); - return ((CCIMInstanceList *)NULL); - } - } /* end for */ - - nfs_free_mntinfo_list(nfs_mount_list); - return (nfsInstList); - } - -} /* enumerate_nfs_mounts */ - -/* - * Method:populate_property_list - * - * Description: Populates a property list with the properties of the nfs mounted - * file system that is passed in with the nfs_mount parameter. - * - * Parameters: - * - The nfs mount from which to extract the properties from. - * - * Returns: - * - A pointer to a list of properties corresponding to the NFS mounted - * file system passed in with the nfs_mount parameter. - * - Upon error, NULL is returned and an error is logged. - */ -static CCIMPropertyList * -populate_property_list(nfs_mntlist_t *nfs_mount) { - CCIMPropertyList *nfsPropList; - CCIMException *ex; - cimchar **propValues; - int err = 0, i = 0; - - nfsPropList = cim_createPropertyList(); - if (nfsPropList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFS::POPULATE_PROPLIST", - CIM_ERR_FAILED, CREATE_PROPLIST_FAILURE, ex, &err); - return ((CCIMPropertyList *)NULL); - } - - propValues = calloc((size_t)PROPCOUNT, (size_t)sizeof (cimchar *)); - if (propValues == NULL) { - util_handleError("SOLARIS_NFS::POPULATE_PROPLIST", - CIM_ERR_LOW_ON_MEMORY, LOW_MEMORY, NULL, &err); - return ((CCIMPropertyList *)NULL); - } - - if (populate_property_values(nfs_mount, propValues) == cim_false) { - cim_freePropertyList(nfsPropList); - fileutil_free_string_array(propValues, PROPCOUNT); - return ((CCIMPropertyList *)NULL); - } - - for (i = 0; i < PROPCOUNT; i++) { - nfsPropList = add_property_to_list(nfsProps[i].name, - nfsProps[i].type, propValues[i], NULL, - nfsProps[i].isKey, nfsPropList); - if (nfsPropList == NULL) { - fileutil_free_string_array(propValues, PROPCOUNT); - return ((CCIMPropertyList *)NULL); - } - } - - fileutil_free_string_array(propValues, PROPCOUNT); - return (nfsPropList); -} /* populate_property_list */ - -static CIMBool -populate_property_values(nfs_mntlist_t *nfs_mount, - cimchar **propValues) { - - unsigned long long availablesize; - unsigned long long blocksize; - unsigned long long totalsize; - unsigned long long usedsize; - unsigned long maxfilenamelen; - unsigned long fragsize; - unsigned int codeSet[1] = { 0 }; - boolean_t readonly; - boolean_t optHasEquals; - cimchar *codeSetValue; - cimchar propValue[MAXSIZE]; - char *hostname; - char *devid; - char *resourceStr = "resource:="; - char *devidStr = "devid:="; - char *noSuid, *posix, *public, *quota, *port; - int err = 0, defaultValue = 0, nameLen = 0; - - /* - * AttributeCaching - */ - (void) snprintf(propValue, MAXSIZE, "%d", (!nfs_mount->nml_noac)); - propValues[ATTRCACHE] = strdup(propValue); - if (propValues[ATTRCACHE] == NULL) { - return (cim_false); - } - - /* - * AttributeCachingForDirectoriesMax - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_acdirmax); - propValues[ATTRCACHEDIRMAX] = strdup(propValue); - if (propValues[ATTRCACHEDIRMAX] == NULL) { - return (cim_false); - } - - /* - * AttributeCachingForDirectoriesMin - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_acdirmin); - propValues[ATTRCACHEDIRMIN] = strdup(propValue); - if (propValues[ATTRCACHEDIRMIN] == NULL) { - return (cim_false); - } - - /* - * AttributeCachingForRegularFilesMax - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_acregmax); - propValues[ATTRCACHEFILESMAX] = strdup(propValue); - if (propValues[ATTRCACHEFILESMAX] == NULL) { - return (cim_false); - } - - /* - * AttributeCachingForRegularFilesMin - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_acregmin); - propValues[ATTRCACHEFILESMIN] = strdup(propValue); - if (propValues[ATTRCACHEFILESMIN] == NULL) { - return (cim_false); - } - - /* - * AvailableSpace - */ - availablesize = fs_get_availablesize(nfs_mount->nml_mountp, &err); - if (err != 0) { - return (cim_false); - } - (void) snprintf(propValue, MAXSIZE, "%lld", availablesize); - propValues[AVAILSPACE] = strdup(propValue); - if (propValues[AVAILSPACE] == NULL) { - return (cim_false); - } - - /* - * BlockSize - */ - blocksize = fs_get_blocksize(nfs_mount->nml_mountp, &err); - if (err != 0) { - return (cim_false); - } - (void) snprintf(propValue, MAXSIZE, "%lld", blocksize); - propValues[BLKSIZE] = strdup(propValue); - if (propValues[BLKSIZE] == NULL) { - return (cim_false); - } - - /* - * Caption - Nothing top populate here. - */ - - /* - * CasePreserved - True - */ - (void) snprintf(propValue, MAXSIZE, "%d", B_TRUE); - propValues[CASEPRES] = strdup(propValue); - if (propValues[CASEPRES] == NULL) { - return (cim_false); - } - - /* - * CaseSensitive - True - */ - (void) snprintf(propValue, MAXSIZE, "%d", B_TRUE); - propValues[CASESENS] = strdup(propValue); - if (propValues[CASESENS] == NULL) { - return (cim_false); - } - - /* - * ClusterSize - As defined in CIM_FileSystem: - * The minimum file allocation size (an integral number of - * blocks), imposed by the FileSystem. (The size of a block is - * specified in the BlockSize property for the FileSystem.) - * Minimum allocation size is the smallest amount of storage - * allocated to a LogicalFile by the FileSystem. This is not a - * mandatory minimum allocation for all FileSystems. Under - * stress conditions, some FileSystems may allocate storage - * in amounts smaller than the ClusterSize. - */ - fragsize = fs_get_fragsize(nfs_mount->nml_mountp, &err); - if (err != 0) { - return (cim_false); - } - (void) snprintf(propValue, MAXSIZE, "%ld", fragsize); - propValues[CLUSTERSZ] = strdup(propValue); - if (propValues[CLUSTERSZ] == NULL) { - return (cim_false); - } - - /* - * CodeSet - */ - codeSetValue = cim_encodeUint16Array(codeSet, 1); - if (codeSetValue == NULL) { - return (cim_false); - } - propValues[CODESET] = strdup(codeSetValue); - if (propValues[CODESET] == NULL) { - return (cim_false); - } - free(codeSetValue); - - /* - * CompressionMethod - */ - (void) snprintf(propValue, MAXSIZE, "%s", UNKNOWN); - propValues[COMPRESSMETH] = strdup(propValue); - if (propValues[COMPRESSMETH] == NULL) { - return (cim_false); - } - - /* - * CSCreationClassName -- KEY - */ - propValues[CSCREATCLASSNM] = strdup(SOLARIS_CS); - if (propValues[CSCREATCLASSNM] == NULL) { - return (cim_false); - } - - /* - * CSName -- KEY - */ - hostname = sys_get_hostname(&err); - if (hostname == NULL) { - util_handleError("SOLARIS_NFS::POPULATE_PROPVALUES", - CIM_ERR_FAILED, GET_HOSTNAME_FAILURE, NULL, &err); - return (cim_false); - } - propValues[CSNAME] = strdup(hostname); - if (propValues[CSNAME] == NULL) { - return (cim_false); - } - free(hostname); - - /* - * CreationClassName -- KEY - */ - propValues[CREATCLASSNM] = strdup(SOLARIS_NFS); - if (propValues[CREATCLASSNM] == NULL) { - return (cim_false); - } - - /* - * Description - Nothing to populate here. - */ - - /* - * EncryptionMethod - */ - propValues[ENCRYPTMETH] = strdup(UNKNOWN); - if (propValues[ENCRYPTMETH] == NULL) { - return (cim_false); - } - - /* - * FileSystemSize - */ - totalsize = fs_get_totalsize(nfs_mount->nml_mountp, &err); - if (err != 0) { - return (cim_false); - } - (void) snprintf(propValue, MAXSIZE, "%lld", totalsize); - propValues[FSSIZE] = strdup(propValue); - if (propValues[FSSIZE] == NULL) { - return (cim_false); - } - - /* - * FileSystemType - */ - propValues[FSTYPE] = strdup(nfs_mount->nml_fstype); - if (propValues[FSTYPE] == NULL) { - return (cim_false); - } - - /* - * ForegroundMount - This property is not populated because it is only - * valid upon creation of a nfs mounted file system. This is actually - * a mount process option and not a mount option. - */ - - /* - * Global - this doesn't really make sense for a nfs file system. - * An nfs file system can't be mounted globally on all nodes of a - * cluster so this will always be false. - */ - (void) snprintf(propValue, MAXSIZE, "%d", B_FALSE); - propValues[GLOBAL] = strdup(propValue); - if (propValues[GLOBAL] == NULL) { - return (cim_false); - } - - /* - * GrpId - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_grpid); - propValues[GRPID] = strdup(propValue); - if (propValues[GRPID] == NULL) { - return (cim_false); - } - - /* - * HardMount - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_hard); - propValues[HARDMNT] = strdup(propValue); - if (propValues[HARDMNT] == NULL) { - return (cim_false); - } - - /* - * InstallDate - Nothing to populate here. - */ - - /* - * Interrupt - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_intr); - propValues[INTR] = strdup(propValue); - if (propValues[INTR] == NULL) { - return (cim_false); - } - - /* - * MaxFileNameLength - */ - maxfilenamelen = fs_get_maxfilenamelen(nfs_mount->nml_mountp, &err); - if (err != 0) { - util_handleError("SOLARIS_NFS::POPULATE_PROPVALUES", - CIM_ERR_FAILED, FS_GET_MAXFILENMLEN_FAILURE, NULL, - &err); - return (cim_false); - } - (void) snprintf(propValue, MAXSIZE, "%ld", maxfilenamelen); - propValues[MAXFILENMLN] = strdup(propValue); - if (propValues[MAXFILENMLN] == NULL) { - return (cim_false); - } - - /* - * MountFailureRetries - This value is only valid upon creation of a - * nfs mount. This is actually a mount process option and not a mount - * option. - */ - - /* - * Name -- KEY, Populated with the string: - * "resource:=<resource> devid:=<devid>" in order to create a unique - * yet readable key. - */ - devid = fs_parse_optlist_for_option(nfs_mount->nml_mntopts, - "dev=", &err); - if (devid == NULL) { - util_handleError("SOLARIS_NFS::POPULATE_PROPVALUES", - CIM_ERR_FAILED, FS_PARSE_OPTLIST_FAILURE, NULL, &err); - return (cim_false); - } - /* - * + 2 is for space and null terminating character. - */ - nameLen = strlen(resourceStr) + strlen(nfs_mount->nml_resource) + - strlen(devidStr) + strlen(devid) + 2; - - propValues[NAME] = calloc((size_t)nameLen, (size_t)sizeof (cimchar)); - if (propValues[NAME] == NULL) { - return (cim_false); - } - - (void) snprintf(propValues[NAME], nameLen, "%s%s%s%s%s", resourceStr, - nfs_mount->nml_resource, " ", devidStr, devid); - free(devid); - - /* - * NoMnttabEntry - This will always be false for every file system - * that is shown in the CIM/WBEM interface because there is no way - * to programatically determine a file system that is mounted if it - * is not in /etc/mnttab. If it is not in /etc/mnttab, it is like - * that for a reason and is also an argument for not showing the - * existence of those file systems. - */ - (void) snprintf(propValue, MAXSIZE, "%d", B_FALSE); - propValues[NOMNTTABENT] = strdup(propValue); - if (propValues[NOMNTTABENT] == NULL) { - return (cim_false); - } - - /* - * NoSuid - */ - optHasEquals = B_FALSE; - noSuid = get_property_from_opt_string(nfs_mount->nml_mntopts, - "nosuid", optHasEquals, defaultValue); - if (noSuid == NULL) { - return (cim_false); - } - propValues[NOSUID] = strdup(noSuid); - if (propValues[NOSUID] == NULL) { - return (cim_false); - } - free(noSuid); - - /* - * Overlay - This is a property which is only valid upon creation of a - * nfs mount. It specifies that the file system is to be mounted on - * top of another existing mounted file system. - */ - - /* - * Posix - */ - optHasEquals = B_FALSE; - posix = get_property_from_opt_string(nfs_mount->nml_mntopts, - "posix", optHasEquals, defaultValue); - if (posix == NULL) { - return (cim_false); - } - propValues[POSIX] = strdup(posix); - if (propValues[POSIX] == NULL) { - return (cim_false); - } - free(posix); - - /* - * Proto - */ - propValues[PROTO] = strdup(nfs_mount->nml_proto); - if (propValues[PROTO] == NULL) { - return (cim_false); - } - - /* - * Public - */ - optHasEquals = B_FALSE; - public = get_property_from_opt_string(nfs_mount->nml_mntopts, - "public", optHasEquals, defaultValue); - if (public == NULL) { - return (cim_false); - } - propValues[PUBLIC] = strdup(public); - if (propValues[PUBLIC] == NULL) { - return (cim_false); - } - free(public); - - /* - * Quota - */ - optHasEquals = B_FALSE; - quota = get_property_from_opt_string(nfs_mount->nml_mntopts, - "quota", optHasEquals, defaultValue); - if (quota == NULL) { - return (cim_false); - } - propValues[QUOTA] = strdup(quota); - if (propValues[QUOTA] == NULL) { - return (cim_false); - } - free(quota); - - /* - * ReadBufferSize - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_curread); - propValues[READBUFFSIZE] = strdup(propValue); - if (propValues[READBUFFSIZE] == NULL) { - return (cim_false); - } - - /* - * ReadOnly - */ - readonly = fs_is_readonly(nfs_mount->nml_mountp, &err); - if (err != 0) { - return (cim_false); - } - (void) snprintf(propValue, MAXSIZE, "%d", readonly); - propValues[READONLY] = strdup(propValue); - if (propValues[READONLY] == NULL) { - return (cim_false); - } - - /* - * Remount - This is a property that is only valid upon creation of a - * nfs file system mount. This should not be populated upon the - * enumeration of the Solaris_NFS class instances or instanceNames. - */ - - /* - * RetransmissionAttempts - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_retrans); - propValues[RETRANSATTEMPTS] = strdup(propValue); - if (propValues[RETRANSATTEMPTS] == NULL) { - return (cim_false); - } - - /* - * RetransmissionTimeout - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_timeo); - propValues[RETRANSTIMEO] = strdup(propValue); - if (propValues[RETRANSTIMEO] == NULL) { - return (cim_false); - } - - /* - * Root - */ - propValues[ROOT] = strdup(nfs_mount->nml_mountp); - if (propValues[ROOT] == NULL) { - return (cim_false); - } - - /* - * SecurityMode - */ - if (nfs_mount->nml_securitymode != NULL) { - propValues[SECMODE] = strdup(nfs_mount->nml_securitymode); - if (propValues[SECMODE] == NULL) { - return (cim_false); - } - } - - /* - * ServerCommunicationPort - */ - optHasEquals = B_TRUE, - defaultValue = NFS_PORT; - port = get_property_from_opt_string(nfs_mount->nml_mntopts, - "port=", optHasEquals, defaultValue); - if (port == NULL) { - return (cim_false); - } - propValues[SERVERCOMMPORT] = strdup(port); - if (propValues[SERVERCOMMPORT] == NULL) { - return (cim_false); - } - free(port); - - /* - * Status - Nothing to populate here. - */ - - /* - * UsedSpace - */ - usedsize = fs_get_usedsize(nfs_mount->nml_mountp, &err); - if (err != 0) { - return (cim_false); - } - (void) snprintf(propValue, MAXSIZE, "%lld", usedsize); - propValues[USEDSPACE] = strdup(propValue); - if (propValues[USEDSPACE] == NULL) { - return (cim_false); - } - - /* - * Version - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_vers); - propValues[VERS] = strdup(propValue); - if (propValues[VERS] == NULL) { - return (cim_false); - } - - /* - * WriteBufferSize - */ - (void) snprintf(propValue, MAXSIZE, "%d", nfs_mount->nml_curwrite); - propValues[WRITEBUFFSIZE] = strdup(propValue); - if (propValues[WRITEBUFFSIZE] == NULL) { - return (cim_false); - } - - return (cim_true); -} /* populate_property_values */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_filesystem/Solaris_NFS.h b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_filesystem/Solaris_NFS.h deleted file mode 100644 index b9dd6c1b25..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_filesystem/Solaris_NFS.h +++ /dev/null @@ -1,196 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOLARIS_NFS_H -#define _SOLARIS_NFS_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> -#include <cimprovider.h> -#include <cimomhandle.h> -#include <cimlogsvc.h> -#include <cimstructs.h> -#include "nfsprov_include.h" - - -#define PROPCOUNT 48 - -static nfs_prov_prop_t nfsProps[] = { -#define ATTRCACHE 0 - {"AttributeCaching", cim_false, boolean}, - -#define ATTRCACHEDIRMAX (ATTRCACHE + 1) - {"AttributeCachingForDirectoriesMax", cim_false, uint16}, - -#define ATTRCACHEDIRMIN (ATTRCACHEDIRMAX + 1) - {"AttributeCachingForDirectoriesMin", cim_false, uint16}, - -#define ATTRCACHEFILESMAX (ATTRCACHEDIRMIN + 1) - {"AttributeCachingForRegularFilesMax", cim_false, uint16}, - -#define ATTRCACHEFILESMIN (ATTRCACHEFILESMAX + 1) - {"AttributeCachingForRegularFilesMin", cim_false, uint16}, - -#define AVAILSPACE (ATTRCACHEFILESMIN + 1) - {"AvailableSpace", cim_false, uint64}, - -#define BLKSIZE (AVAILSPACE + 1) - {"BlockSize", cim_false, uint64}, - -#define CAPTION (BLKSIZE + 1) - {"Caption", cim_false, string}, - -#define CASEPRES (CAPTION + 1) - {"CasePreserved", cim_false, boolean}, - -#define CASESENS (CASEPRES + 1) - {"CaseSensitive", cim_false, boolean}, - -#define CLUSTERSZ (CASESENS + 1) - {"ClusterSize", cim_false, uint32}, - -#define CODESET (CLUSTERSZ + 1) - {"CodeSet", cim_false, uint16_array}, - -#define COMPRESSMETH (CODESET + 1) - {"CompressionMethod", cim_false, string}, - -#define CSCREATCLASSNM (COMPRESSMETH + 1) - {"CSCreationClassName", cim_true, string}, - -#define CSNAME (CSCREATCLASSNM + 1) - {"CSName", cim_true, string}, - -#define CREATCLASSNM (CSNAME + 1) - {"CreationClassName", cim_true, string}, - -#define DESCRIP (CREATCLASSNM + 1) - {"Description", cim_false, string}, - -#define ENCRYPTMETH (DESCRIP + 1) - {"EncryptionMethod", cim_false, string}, - -#define FSSIZE (ENCRYPTMETH + 1) - {"FileSystemSize", cim_false, uint64}, - -#define FSTYPE (FSSIZE + 1) - {"FileSystemType", cim_false, string}, - -#define FGMOUNT (FSTYPE + 1) - {"ForegroundMount", cim_false, boolean}, - -#define GLOBAL (FGMOUNT + 1) - {"Global", cim_false, boolean}, - -#define GRPID (GLOBAL + 1) - {"GrpId", cim_false, boolean}, - -#define HARDMNT (GRPID + 1) - {"HardMount", cim_false, boolean}, - -#define INSTALLDATE (HARDMNT + 1) - {"InstallDate", cim_false, datetime}, - -#define INTR (INSTALLDATE + 1) - {"Interrupt", cim_false, boolean}, - -#define MAXFILENMLN (INTR + 1) - {"MaxFileNameLength", cim_false, uint32}, - -#define MNTFAILRETRIES (MAXFILENMLN + 1) - {"MountFailureRetries", cim_false, uint16}, - -#define NAME (MNTFAILRETRIES + 1) - {"Name", cim_true, string}, - -#define NOMNTTABENT (NAME + 1) - {"NoMnttabEntry", cim_false, boolean}, - -#define NOSUID (NOMNTTABENT + 1) - {"NoSuid", cim_false, boolean}, - -#define OVERLAY (NOSUID + 1) - {"Overlay", cim_false, boolean}, - -#define POSIX (OVERLAY + 1) - {"Posix", cim_false, boolean}, - -#define PROTO (POSIX + 1) - {"Proto", cim_false, string}, - -#define PUBLIC (PROTO + 1) - {"Public", cim_false, boolean}, - -#define QUOTA (PUBLIC + 1) - {"Quota", cim_false, boolean}, - -#define READBUFFSIZE (QUOTA + 1) - {"ReadBufferSize", cim_false, uint64}, - -#define READONLY (READBUFFSIZE + 1) - {"ReadOnly", cim_false, boolean}, - -#define REMNT (READONLY + 1) - {"Remount", cim_false, boolean}, - -#define RETRANSATTEMPTS (REMNT + 1) - {"RetransmissionAttempts", cim_false, uint16}, - -#define RETRANSTIMEO (RETRANSATTEMPTS + 1) - {"RetransmissionTimeout", cim_false, uint32}, - -#define ROOT (RETRANSTIMEO + 1) - {"Root", cim_false, string}, - -#define SECMODE (ROOT + 1) - {"SecurityMode", cim_false, string}, - -#define SERVERCOMMPORT (SECMODE + 1) - {"ServerCommunicationPort", cim_false, uint32}, - -#define STATUS (SERVERCOMMPORT + 1) - {"Status", cim_false, string}, - -#define USEDSPACE (STATUS + 1) - {"UsedSpace", cim_false, uint64}, - -#define VERS (USEDSPACE + 1) - {"Version", cim_false, string}, - -#define WRITEBUFFSIZE (VERS + 1) - {"WriteBufferSize", cim_false, uint64} -}; - -#ifdef __cplusplus -} -#endif - -#endif /* _SOLARIS_NFS_H */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_mount/Makefile b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_mount/Makefile deleted file mode 100644 index e9a25e29d2..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_mount/Makefile +++ /dev/null @@ -1,78 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -OBJECTS = Solaris_MountService.o - -LINT_OBJS = $(OBJECTS:%.o=%.ln) - -GENERAL = $(ROOTWBEMINC) \ - $(SRC)/lib/libfsmgt/common \ - $(SRC)/cmd/wbem/provider/c/include \ - $(SRC)/cmd/wbem/provider/c/filesystems/wbem_nfs/include \ - $(SRC)/cmd/wbem/provider/c/filesystems/common/cmdgeneration \ - $(SRC)/cmd/wbem/provider/c/filesystems/wbem_nfs/common - -CPPFLAGS += -I. $(GENERAL:%=-I%) -D_REENTRANT -DPIC -D_TS_ERRNO - -CFLAGS += $(XREGSFLAG) $(C_BIGPICFLAGS) - -LINTFLAGS += -um -LINTLIBS = $(LDLIBS.cmd) - -POFILE = _nfs_mount.po -MSGFILES = $(OBJECTS:%.o=%.i) - -CLOBBERFILES += $(POFILE) - -.KEEP_STATE: - -all: $(OBJECTS) - -catalog: $(POFILES) - -install: all - -lint: $(LINT_OBJS) - $(LINT.c) $(LINTFLAGS) $(LINT_OBJS) $(LINTLIBS) - -clean: - $(RM) $(OBJECTS) $(LINT_OBJS) $(MSGFILES) - -check: - $(CSTYLE) -p -P $(OBJECTS:%.o=%.c) *.h - $(HDRCHK) *.h - -catalog: $(POFILE) - -$(POFILE): $(MSGFILES) - $(BUILDPO.msgfiles) - -include $(SRC)/cmd/Makefile.targ -include $(SRC)/Makefile.msg.targ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_mount/Solaris_MountService.c b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_mount/Solaris_MountService.c deleted file mode 100644 index 5606712353..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_mount/Solaris_MountService.c +++ /dev/null @@ -1,220 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "util.h" -#include "nfs_providers_msgstrings.h" -#include "messageStrings.h" -#include "nfs_provider_names.h" -#include "nfsprov_methods.h" -#include <cimapi.h> -#include <cp_method.h> - - -/* - * Constants - */ -#define MOUNTALL "mountall" -#define UMOUNTALL "unmountall" - -/* - * Instance provider methods - */ - -/* ARGSUSED */ -CCIMObjectPath * -cp_createInstance_Solaris_MountService(CCIMObjectPath *pOP, - CCIMInstance *pInst) { - - int err = 0; - - util_handleError("SOLARIS_MNTSERV::CREATE_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return ((CCIMObjectPath *)NULL); -} /* cp_createInstance_Solaris_MountService */ - -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_MountService(CCIMObjectPath *pOP) { - int err = 0; - - util_handleError("SOLARIS_MNTSERV::DELETE_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_deleteInstance_Solaris_MountService */ - -/* ARGSUSED */ -CCIMInstanceList * -cp_enumInstances_Solaris_MountService(CCIMObjectPath *pOP) { - int err = 0; - - util_handleError("SOLARIS_MNTSERV::ENUM_INSTANCES", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return ((CCIMInstanceList *)NULL); -} /* cp_enumInstances_Solaris_MountService */ - -/* ARGSUSED */ -CCIMObjectPathList * -cp_enumInstanceNames_Solaris_MountService(CCIMObjectPath *pOP) { - int err = 0; - - util_handleError("SOLARIS_MNTSERV::ENUM_INSTANCENAMES", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return ((CCIMObjectPathList *)NULL); -} /* cp_enumInstanceNames_Solaris_MountService */ - -/* ARGSUSED */ -CCIMInstanceList * -cp_execQuery_Solaris_MountService(CCIMObjectPath *pOP, char *selectClause, - char *nonJoinExp, char *queryExp, char *queryLang) { - - int err = 0; - - util_handleError("SOLARIS_MNTSERV::EXEC_QUERY", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return ((CCIMInstanceList *)NULL); -} /* cp_execQuery_Solaris_MountService */ - -/* ARGSUSED */ -CCIMInstance * -cp_getInstance_Solaris_MountService(CCIMObjectPath *pOP) { - int err = 0; - - util_handleError("SOLARIS_MNTSERV::GET_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return ((CCIMInstance *)NULL); -} /* cp_getInstance_Solaris_MountService */ - -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_MountService(CCIMObjectPath *pOP, CCIMInstance *pInst) { - int err = 0; - - util_handleError("SOLARIS_MNTSERV::SET_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_setInstance_Solaris_MountService */ - -/* ARGSUSED */ -CIMBool -cp_setInstanceWithList_Solaris_MountService(CCIMObjectPath *pOP, - CCIMInstance *pInst, char **props, int num_props) { - - int err = 0; - - util_handleError("SOLARIS_MNTSERV::SET_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_setInstanceWithList_Solaris_MountService */ - -/* - * Property provider methods - */ -/* ARGSUSED */ -CCIMProperty * -cp_getProperty_Solaris_MountService(CCIMObjectPath *pOP, cimchar *pPropName) { - int err = 0; - - util_handleError("SOLARIS_MNTSERV::GET_PROPERTY", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return ((CCIMProperty *)NULL); -} /* cp_getProperty_Solaris_MountService */ - -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_MountService(CCIMObjectPath *pOP, CCIMProperty *pProp) { - int err = 0; - - util_handleError("SOLARIS_MNTSERV::SET_PROPERTY", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_setProperty_Solaris_MountService */ - - -/* - * Method provider methods - */ -/* - * Method: cp_invokeMethod_Solaris_MountService - * - * Description: Routes the cp_invokeMethod_Solaris_MountService calls to the - * correct Solaris_MountService methods. - * - * Parameters: - * - CCIMObjectPath *pOP - The object path containing needed information - * about the class that is to getting methods invoked. - * - cimchar *functionName - The name of the function to be invoked. - * - CCIMPropertyList *inParams - The input parameters to the function. - * - CCIMPropertyList *outParams - The output parameters from the function. - * - * Returns: - * - A pointer to a property which indicates success or failure of the - * function. 1 for success, 0 for failure. - * - Upon error, NULL is returned and the error is logged. - */ -/* ARGSUSED */ -CCIMProperty * -cp_invokeMethod_Solaris_MountService(CCIMObjectPath *pOP, cimchar *functionName, - CCIMPropertyList *inParams, CCIMPropertyList *outParams) { - - CCIMProperty *retVal; - int err = 0; - - if (pOP == NULL) { - util_handleError("SOLARIS_MNTSERV::INVOKE_METHOD", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMProperty *)NULL); - } - - /* - * Determine what method is being called. - */ - if (strcasecmp(functionName, MOUNTALL) == 0) { - retVal = mountall(inParams); - } else if (strcasecmp(functionName, UMOUNTALL) == 0) { - retVal = unmountall(inParams); - } else { - /* - * No such method name. - */ - util_handleError("SOLARIS_MNTSERV::INVOKE_METHOD", - CIM_ERR_FAILED, NO_SUCH_METHOD, NULL, &err); - return ((CCIMProperty *)NULL); - } - - return (retVal); -} /* cp_invokeMethod_Solaris_MountService */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Makefile b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Makefile deleted file mode 100644 index b419638937..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Makefile +++ /dev/null @@ -1,79 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -OBJECTS = Solaris_NFSShare.o \ - Solaris_NFSShareSecurity.o \ - Solaris_PersistentShare.o \ - Solaris_ShareService.o - -LINT_OBJS = $(OBJECTS:%.o=%.ln) - -WBEM_PROV = cmd/wbem/provider/c - -GENERAL = $(ROOTWBEMINC) \ - $(SRC)/lib/libfsmgt/common \ - $(SRC)/$(WBEM_PROV)/include \ - $(SRC)/$(WBEM_PROV)/filesystems/common/cmdgeneration \ - $(SRC)/$(WBEM_PROV)/filesystems/wbem_nfs/include \ - $(SRC)/$(WBEM_PROV)/filesystems/wbem_nfs/common - - -CPPFLAGS += -I. $(GENERAL:%=-I%) -D_REENTRANT -DPIC -D_TS_ERRNO - -CFLAGS += $(XREGSFLAG) $(C_BIGPICFLAGS) - -LINTFLAGS += -um -LINTLIBS = $(LDLIBS.cmd) - -POFILE = _nfs_share.po -MSGFILES = $(OBJECTS:%.o=%.i) - -CLOBBERFILES += $(POFILE) - -.KEEP_STATE: - -all: $(OBJECTS) -check: - $(CSTYLE) -p -P $(OBJECTS:%.o=%.c) *.h - $(HDRCHK) *.h -clean: - $(RM) $(OBJECTS) $(LINT_OBJS) $(MSGFILES) - -install: all -lint: $(LINT_OBJS) - $(LINT.c) $(LINTFLAGS) $(LINT_OBJS) $(LINTLIBS) - -catalog: $(POFILE) - -$(POFILE): $(MSGFILES) - $(BUILDPO.msgfiles) - -include $(SRC)/cmd/Makefile.targ -include $(SRC)/Makefile.msg.targ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_NFSShare.c b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_NFSShare.c deleted file mode 100644 index 6221255bc9..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_NFSShare.c +++ /dev/null @@ -1,1184 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "Solaris_NFSShare.h" -#include "nfs_keys.h" -#include "nfs_provider_names.h" -#include "nfs_providers_msgstrings.h" -#include "messageStrings.h" -#include "cmdgen.h" -#include "util.h" -#include "libfsmgt.h" -#include "createprop_methods.h" -#include <string.h> -#include <errno.h> -#include <sys/utsname.h> -#include <sys/types.h> -#include <signal.h> -#include <sys/stat.h> -#include <fcntl.h> - -/* - * Constants - */ -/* #define SOLARIS_NFSSHARE "Solaris_NFSShare" */ -#define NFSD 0 -#define MOUNTD 1 - - -/* - * Private method declarations - */ - -static CIMBool check_for_PersistentShareEnt( - fs_sharelist_t *nfs_sharelist, int *err); -static CCIMInstanceList *enumerate_shares(); -static CCIMPropertyList *populate_Solaris_NFSShare_property_list( - char *hostname, - fs_sharelist_t *nfs_share); -static CIMBool populate_Solaris_NFSShare_property_Values( - char *hostname, - fs_sharelist_t *nfs_sharelist, - cimchar propValues[PROPCOUNT][MAXSIZE], - int *err); -static char *start_daemons(int which_daemon, int *err); - -/* - * Public methods - */ - -/* - * Instance provider methods - */ - -/* - * Solaris_NFSShare provider - * - * It is important to note that all memory allocated by these functions - * and passed to the CIMOM, is freed by the CIMOM as the caller. - */ - -/* - * Name: cp_enumInstances_Solaris_NFSShare - * - * Description: Creates a list of instances and returns that list. - * - * Parameters: - * shareOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstanceList * if matched instance is found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMInstanceList * -cp_enumInstances_Solaris_NFSShare(CCIMObjectPath* shareOP) -{ - CCIMInstanceList *instList; - int err = 0; - - cim_logDebug("cp_enumInstances_Solaris_NFSShare", "just entering..."); - /* - * Check object path for NULL value - */ - if (shareOP == NULL) { - util_handleError( - "SOLARIS_NFSSHARE::ENUM_INSTANCES", - CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - cim_logDebug("cp_enumInstances_Solaris_NFSShare", - "Calling enumerate_shares"); - instList = enumerate_shares(); - if (instList == NULL) { - cim_logDebug("cp_enumInstances_Solaris_NFSShare", - "Call from enumerate_sharesreturned NULL"); - } - return (instList); -} - -/* - * Name: cp_enumInstanceNames_Solaris_NFSShare - * - * Description: Returns a list of instances if found. - * - * Parameters: - * shareOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMObjectPathList * if matched instance is found. Otherwise, NULL. - */ -CCIMObjectPathList * -cp_enumInstanceNames_Solaris_NFSShare(CCIMObjectPath* shareOP) -{ - CCIMInstanceList *instList; - CCIMObjectPathList *ObjPathList; - int err = 0; - - /* - * Check object path for NULL value - */ - if (shareOP == NULL) { - util_handleError("SOLARIS_NFSSHARE::ENUM_INSTANCENAMES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMObjectPathList *)NULL); - } - - instList = cp_enumInstances_Solaris_NFSShare(shareOP); - if (instList == NULL) { - return ((CCIMObjectPathList *)NULL); - } - - ObjPathList = cim_createObjectPathList(instList); - - cim_freeInstanceList(instList); - return (ObjPathList); -} - -/* - * Name: cp_getInstance_Solaris_NFSShare - * - * Description: Returns an instance which matches the passed in object path - * if found. - * - * Parameters: - * shareOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ -/* ARGSUSED */ -CCIMInstance * -cp_getInstance_Solaris_NFSShare(CCIMObjectPath* shareOP) -{ - CCIMInstanceList *instList; - CCIMInstance *inst; - CCIMException *ex; - int err = 0; - - /* - * Check object path for NULL value - */ - if (shareOP == NULL) { - util_handleError("SOLARIS_NFSSHARE::ENUM_INSTANCENAMES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstance *)NULL); - } - - instList = cp_enumInstances_Solaris_NFSShare(shareOP); - if (instList == NULL) { - return ((CCIMInstance *)NULL); - } - - inst = cim_getInstance(instList, shareOP); - if (inst == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHARE::ENUM_INSTANCE", - CIM_ERR_INVALID_CLASS, GET_INSTANCE_FAILURE, ex, &err); - cim_freeInstanceList(instList); - return ((CCIMInstance *)NULL); - } - - cim_freeInstanceList(instList); - return (inst); -} - -/* - * cp_setInstanceWithList not supported - */ -/* ARGSUSED */ -CIMBool -cp_setInstanceWithList_Solaris_NFSShare(CCIMObjectPath *shareOP, - CCIMInstance *shareInst, char **props, int num_props) -{ - int err = 0; - util_handleError("SOLARIS_NFSSHARE::SET_INSTANCEWITHLIST", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - return (cim_false); -} - -/* - * cp_setInstance not supported - */ -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_NFSShare(CCIMObjectPath *shareOP, - CCIMInstance *shareInst, char **props, int num_props) -{ - int err = 0; - util_handleError("SOLARIS_NFSSHARE::SET_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - return (cim_false); -} - -/* - * cp_invokeMethod not supported - */ -/* ARGSUSED */ -CCIMProperty * -cp_invokeMethod_Solaris_NFSShare( - CCIMObjectPath* shareOP, - cimchar *functionName, - CCIMPropertyList *inParams, - CCIMPropertyList *outParams) -{ - int err = 0; - util_handleError("SOLARIS_NFSSHARE::INVOKE_METHOD", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - return ((CCIMProperty *)NULL); -} - -/* - * cp_setProperty not supported - */ -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_NFSShare(CCIMObjectPath *pOP, CCIMProperty *pProp) -{ - int err = 0; - util_handleError("SOLARIS_NFSSHARE::SET_PROPERTY", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - return (cim_false); -} - -/* - * Name: cp_createInstance_Solaris_NFSShare - * - * Description: Returns the instance created based on the instance - * inforamtion passed in. A create instance will actually - * share a file system on the current host by calling - * cmd_execute_command_and_retrieve_string() from the cmd - * interface. - * - * Parameters: - * shareOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * shareInst - an instance that contains the properties for the share - * to be created. - * Returns: - * CCIMObjectPath * - Object path containing the new instance. On - * failure NULL is returned. - */ -CCIMObjectPath * -cp_createInstance_Solaris_NFSShare(CCIMObjectPath* shareOP, - CCIMInstance *shareInst) -{ - - char *cmd_return, *cmd; - int err = 0; - - CCIMInstance *nfsShareInstance; - CCIMObjectPath *nfsShareObjectPath; - CCIMProperty *share_Prop; - CCIMException *ex; - - cim_logDebug("cp_createInstance_Solaris_NFSShare", - "Entering create instance..."); - - if (shareOP == NULL || shareInst == NULL) { - err = EINVAL; - util_handleError( - "SOLARIS_NFSSHARE::CREATE_INSTANCE", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMObjectPath *)NULL); - } - - cmd = cmdgen_generate_command(CMDGEN_NFS_SHARE, shareInst, NULL, NULL, - &err); - - if (err != 0 || cmd == NULL) { - util_handleError( - "SOLARIS_NFSSHARE::CREATE_INSTANCE", - CIM_ERR_FAILED, CMDGEN_GEN_CMD_FAILURE, NULL, &err); - return ((CCIMObjectPath *)NULL); - } - - cmd_return = cmd_execute_command_and_retrieve_string(cmd, &err); - - free(cmd); - - if (err != 0) { - /* - * An error occured while executing the command. - */ - if (cmd_return != NULL) { - util_handleError( - "SOLARIS_NFSSHARE::CREATE_INSTANCE", - CIM_ERR_FAILED, cmd_return, NULL, &err); - free(cmd_return); - return ((CCIMObjectPath *)NULL); - } else { - util_handleError( - "SOLARIS_NFSSHARE::CREATE_INSTANCE", - CIM_ERR_FAILED, CMD_EXEC_RETR_STR_FAILURE, - NULL, &err); - return ((CCIMObjectPath *)NULL); - } - } - - free(cmd_return); - - nfsShareInstance = cp_getInstance_Solaris_NFSShare(shareOP); - - if (nfsShareInstance == NULL) { - /* - * The share instance was not found. The create - * instance failed. - */ - util_handleError( - "SOLARIS_NFSSHARE::CREATE_INSTANCE", - CIM_ERR_FAILED, CIMOM_GET_INST_FAILURE, NULL, &err); - return ((CCIMObjectPath *)NULL); - } - if ((nfsShareObjectPath = - cim_createObjectPath(nfsShareInstance)) == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHARE::CREATE_INSTANCE", - CIM_ERR_FAILED, CREATE_OBJECT_PATH_FAILURE, ex, &err); - cim_freeInstance(nfsShareInstance); - return ((CCIMObjectPath *)NULL); - } - - share_Prop = cim_getProperty(nfsShareInstance, - nfsShareProps[STARTDAEMONS].name); - if ((share_Prop != NULL) && - (strcmp(share_Prop->mValue, "true") != 0)) { - cmd_return = start_daemons(NFSD, &err); - if (err != 0 && err != EEXIST) { - char error_string[MAXSIZE]; - (void) strlcpy(error_string, NFSD_START_FAILURE, - MAXSIZE); - if (cmd_return == NULL) { - util_handleError( - "SOLARIS_NFSSHARE::CREATE_INSTANCE", - NULL, error_string, NULL, &err); - } else { - char return_string[MAXSIZE]; - (void) strlcat(error_string, cmd_return, - MAXSIZE); - (void) strlcpy(return_string, error_string, - MAXSIZE); - util_handleError( - "SOLARIS_NFSSHARE::CREATE_INSTANCE", - NULL, return_string, NULL, &err); - } - } - free(cmd_return); - err = 0; - cmd_return = start_daemons(MOUNTD, &err); - if (err != 0 && err != EEXIST) { - char error_string[MAXSIZE]; - (void) strlcpy(error_string, MOUNTD_START_FAILURE, - MAXSIZE); - if (cmd_return == NULL) { - util_handleError( - "SOLARIS_NFSSHARE::CREATE_INSTANCE", - NULL, error_string, NULL, &err); - } else { - char return_string[MAXSIZE]; - (void) strlcat(error_string, cmd_return, - MAXSIZE); - (void) strlcpy(return_string, error_string, - MAXSIZE); - util_handleError( - "SOLARIS_NFSSHARE::CREATE_INSTANCE", - NULL, return_string, NULL, &err); - } - } - - free(cmd_return); - } - - cim_freeInstance(nfsShareInstance); - return (nfsShareObjectPath); -} /* cp_createInstance_Solaris_NFSShare */ - - -/* - * Name: cp_deleteInstance_Solaris_NFSShare - * - * Description: The delete instance will unshare a file system on the - * current host by calling - * cmd_execute_command_and_retrieve_string() from the cmd - * interface. - * - * Parameters: - * shareOP - An CCIMObjectPath * - The object path coresponding to the - * instance to be removed. - * Returns: - * CIMBool - Returns cim_true on successful completion. On failure - * cim_false is returned. - */ -CIMBool -cp_deleteInstance_Solaris_NFSShare(CCIMObjectPath *shareOP) -{ - char *cmd, *cmd_return; - int err = 0; - - cim_logDebug("cp_deleteInstance_Solaris_NFSShare", "Just entering..."); - if (shareOP == NULL) { - util_handleError("SOLARIS_NFSSHARE::DELETE_INSTANCE", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return (cim_false); - } - - /* - * Get the share that is to be deleted and generatel the - * unshare command. - */ - cmd = cmdgen_generate_command(CMDGEN_NFS_UNSHARE, NULL, shareOP, NULL, - &err); - if (err != 0 || cmd == NULL) { - util_handleError( - "SOLARIS_NFSSHARE::CREATE_INSTANCE", - CIM_ERR_FAILED, CMDGEN_GEN_CMD_FAILURE, NULL, &err); - if (cmd == NULL) { - free(cmd); - } - return (cim_false); - } - - /* - * Execute the unshare command. - */ - cmd_return = cmd_execute_command_and_retrieve_string(cmd, &err); - free(cmd); - if (err != 0) { - /* - * The unshare command execution failed. - */ - if (cmd_return != NULL) { - util_handleError("SOLARIS_NFSSHARE::DELETE_INSTANCE", - CIM_ERR_FAILED, CMD_EXEC_RETR_STR_FAILURE, - NULL, &err); - free(cmd_return); - return (cim_false); - } else { - util_handleError("SOLARIS_NFSSHARE::DELETE_INSTANCE", - CIM_ERR_FAILED, CMD_EXEC_RETR_STR_FAILURE, - NULL, &err); - return (cim_false); - } - } - free(cmd_return); - return (cim_true); -} - -/* - * Name: cp_execQuery_Solaris_NFSShare - * - * Description: Builds a list of all instances, prepends the list with an - * empty instance, and returns the instance list. The CIMOM - * interprets the initial empty instance to mean that it has - * to do the filtering. The caller is responsible for freeing - * the memory allocated for the returned object. - * - * Parameters: - * CCIMObjectPath *shareOP - An objectpath which represents the class to - * work on - * char *electClause - The select clause - * char *nonJoinExp - The non join expression - * char *queryExp - The query Expression - * char *queryLang - The Query Language used (s/b "WQL") - * - * Returns: - * Returns the prepended instance list. On error NULL is returned. - */ -/* ARGSUSED */ -CCIMInstanceList * -cp_execQuery_Solaris_NFSShare(CCIMObjectPath *shareOP, char *electClause, - char *nonJoinExp, char *queryExp, char *queryLang) -{ - - CCIMInstance *emptyInst; - CCIMInstanceList *nfsShareInstList; - CCIMException *ex; - int err = 0; - - if (shareOP == NULL) { - return ((CCIMInstanceList *)NULL); - } - - if ((nfsShareInstList = - cp_enumInstances_Solaris_NFSShare(shareOP)) == NULL) { - util_handleError("SOLARIS_NFSSHARE::EXEC_QUERY", - CIM_ERR_FAILED, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - if ((emptyInst = cim_createInstance("")) == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHARE::EXEC_QUERY", - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, &err); - cim_freeInstanceList(nfsShareInstList); - return ((CCIMInstanceList *)NULL); - } - - if ((nfsShareInstList = - cim_prependInstance(nfsShareInstList, emptyInst)) == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHARE::EXEC_QUERY", - CIM_ERR_FAILED, PREPEND_INSTANCE_FAILURE, ex, &err); - cim_freeInstance(emptyInst); - cim_freeInstanceList(nfsShareInstList); - return ((CCIMInstanceList *)NULL); - } - return (nfsShareInstList); -} /* cp_execQuery_Solaris_NFSShare */ - -/* - * Property provider methods - */ -CCIMProperty * -cp_getProperty_Solaris_NFSShare(CCIMObjectPath *pOP, cimchar *pPropName) -{ - CCIMInstance *nfsShareInst; - CCIMProperty *nfsShareProp; - int err = 0; - - if (pOP == NULL || pPropName == NULL) { - util_handleError("SOLARIS_NFSSHARE::GET_PROPERTY", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMProperty *)NULL); - } - - if ((nfsShareInst = cp_getInstance_Solaris_NFSShare(pOP)) == NULL) { - return ((CCIMProperty *)NULL); - } - - nfsShareProp = cim_getProperty(nfsShareInst, pPropName); - cim_freeInstance(nfsShareInst); - return (nfsShareProp); -} /* cp_getProperty_Solaris_NFSShare */ - -/* - * Not supported - */ -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_NFShare(CCIMObjectPath *pOP, CCIMProperty *pProp) -{ - int err = 0; - - util_handleError("SOLARIS_NFSSHARE::SET_PROPERTY", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - return (cim_false); -} /* cp_setProperty_Solaris_NFShare */ - -/* - * Private Methods - */ - -/* - * Checks for a persistent share entry for the current share. - */ -CIMBool -check_for_PersistentShareEnt(fs_sharelist_t *nfs_sharelist, int *err) -{ - CCIMException *ex; - CCIMObjectPath *nfsPersistentShareOP; - CCIMObjectPathList *nfsPersistShareOPList; - CCIMObjectPathList *tmpOPList; - CIMBool nfsPersistValue = cim_false; - - nfsPersistentShareOP = cim_createEmptyObjectPath(SOLARIS_PERSISTSHARE); - if (nfsPersistentShareOP == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSSHARE::POPULATE_PROPLIST", - CIM_ERR_FAILED, CREATE_EMPTY_OBJPATH_FAILURE, ex, err); - } else { - nfsPersistShareOPList = cimom_enumerateInstanceNames( - nfsPersistentShareOP, cim_false); - if (nfsPersistShareOPList != NULL) { - CCIMProperty *nfsPersistShareProp; - tmpOPList = nfsPersistShareOPList; - while (tmpOPList != NULL) { - nfsPersistentShareOP = tmpOPList->mDataObject; - tmpOPList = tmpOPList->mNext; - nfsPersistShareProp = cp_getProperty( - nfsPersistentShareOP, SETTING_ID); - if (nfsPersistShareProp == NULL) { - cim_freeObjectPath( - nfsPersistentShareOP); - cim_freeProperty(nfsPersistShareProp); - continue; - } - if (strcmp(nfs_sharelist->path, - nfsPersistShareProp->mValue) == 0) { - nfsPersistValue = cim_true; - cim_freeObjectPath( - nfsPersistentShareOP); - cim_freeProperty(nfsPersistShareProp); - break; - } - cim_freeObjectPath(nfsPersistentShareOP); - cim_freeProperty(nfsPersistShareProp); - } - } else { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSSHARE::", - CIM_ERR_FAILED, CIMOM_ENUM_INSTNAMES_FAILURE, - ex, err); - } - } - return (nfsPersistValue); -} /* check_for_PersistentShareEnt */ - -/* - * Enumerate the nfs shares by using the fs_shares fs_get_share_list - * method - */ -static CCIMInstanceList * -enumerate_shares() -{ - - CCIMException *ex; - CCIMInstanceList *nfsShareInstList; - int err = 0; - fs_sharelist_t *nfs_share_list; - fs_sharelist_t *tmp_nfs_share_list; - char *hostname; - - /* - * retrieve system name - */ - hostname = sys_get_hostname(&err); - if (err != 0 || hostname == NULL || strcmp(hostname, "unknown") == 0) { - util_handleError( - "SOLARIS_NFSSHARE::POPULATE_PROPVALUES", - CIM_ERR_FAILED, GET_HOSTNAME_FAILURE, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - nfs_share_list = fs_get_share_list(&err); - if (nfs_share_list == NULL) { - /* - * Check whether an error was returned or if we simply don't - * have any nfs shares on the system. If err is not - * equal to 0, an error was encountered. - */ - if (err != 0) { - /* - * Determine the error and log it. - */ - if (err == ENOMEM || err == EAGAIN) { - util_handleError( - "SOLARIS_NFSSHARE::ENUMERATE_SHARES", - CIM_ERR_LOW_ON_MEMORY, - FS_GET_SHARE_FAILURE, NULL, &err); - free(hostname); - return ((CCIMInstanceList *)NULL); - } else if (err == ENOENT) { - util_handleError( - "SOLARIS_NFSSHARE::ENUMERATE_SHARES", - CIM_ERR_FAILED, NO_SHARES_ON_SYSTEM, NULL, - &err); - free(hostname); - /* - * We don't have any nfs shares - */ - cim_logDebug("enumerate_shares", - "There are no shares on the host."); - return ((CCIMInstanceList *)NULL); - } else { - /* - * If any other errors were encountered it - * can be handled as a general error. We may - * not know exactly what the error is. - */ - util_handleError( - "SOLARIS_NFSSHARE::enumerate_shares", - CIM_ERR_FAILED, FS_GET_SHARE_FAILURE, - NULL, &err); - free(hostname); - return ((CCIMInstanceList *)NULL); - } - } - return ((CCIMInstanceList *)NULL); - } else { - /* - * At this point, one or more nfs shares were found on the - * system, create the instance list from the nfs_share_list. - */ - - cim_logDebug("enumerate_shares", - "There were shares found on the system."); - nfsShareInstList = cim_createInstanceList(); - if (nfsShareInstList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHARE::enumerate_shares", - CIM_ERR_FAILED, CREATE_INSTANCE_LIST_FAILURE, - ex, &err); - fs_free_share_list(nfs_share_list); - free(hostname); - return ((CCIMInstanceList *)NULL); - } - - tmp_nfs_share_list = nfs_share_list; - - /* - * Loop through the nfs shares to retrieve their properties - * and create an instance list containing all the shares and - * their properties. - */ - while (nfs_share_list != NULL) { - CCIMInstance *solaris_NFSShare_instance; - CCIMPropertyList *solaris_NFSShare_prop_list; - - /* - * Create the Solaris_NFSShare CCIMInstance - */ - solaris_NFSShare_instance = - cim_createInstance(SOLARIS_NFSSHARE); - if (solaris_NFSShare_instance == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSSHARE::enumerate_shares", - CIM_ERR_FAILED, GET_INSTANCE_FAILURE, - ex, &err); - cim_freeInstanceList(nfsShareInstList); - fs_free_share_list(tmp_nfs_share_list); - free(hostname); - return ((CCIMInstanceList *)NULL); - } - - solaris_NFSShare_prop_list = - populate_Solaris_NFSShare_property_list( - hostname, nfs_share_list); - if (solaris_NFSShare_prop_list == NULL) { - /* - * populatePropertyList already logged this - * error so there is no need to log it here. - */ - cim_freeInstanceList(nfsShareInstList); - cim_freeInstance(solaris_NFSShare_instance); - fs_free_share_list(tmp_nfs_share_list); - free(hostname); - return ((CCIMInstanceList *)NULL); - } - - /* - * Add the property list to the instance - */ - solaris_NFSShare_instance = - cim_addPropertyListToInstance( - solaris_NFSShare_instance, - solaris_NFSShare_prop_list); - if (solaris_NFSShare_instance == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSSHARE::enumerate_shares", - CIM_ERR_FAILED, - PROPLIST_TO_INSTANCE_FAILURE, ex, &err); - fs_free_share_list(tmp_nfs_share_list); - cim_freeInstanceList(nfsShareInstList); - cim_freePropertyList( - solaris_NFSShare_prop_list); - free(hostname); - return ((CCIMInstanceList *)NULL); - } - - - /* - * Add the instance to the instance list - */ - nfsShareInstList = cim_addInstance(nfsShareInstList, - solaris_NFSShare_instance); - if (nfsShareInstList == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSSHARE::enumerate_shares", - CIM_ERR_FAILED, ADD_INSTANCE_FAILURE, - ex, &err); - fs_free_share_list(tmp_nfs_share_list); - cim_freeInstanceList(nfsShareInstList); - free(hostname); - return ((CCIMInstanceList *)NULL); - } - nfs_share_list = nfs_share_list->next; - } /* while (nfs_share_list != NULL) */ - - fs_free_share_list(tmp_nfs_share_list); - } /* if (nfs_share_list == NULL) */ - - free(hostname); - return (nfsShareInstList); -} /* enumerate_shares() */ - -/* - * Populates the property list with that share information for each - * instance in the instance list. - */ -/* ARGSUSED */ -static CCIMPropertyList * -populate_Solaris_NFSShare_property_list( - char *hostname, fs_sharelist_t *nfs_sharelist) -{ - - CCIMException *ex; - CCIMPropertyList *nfsSharePropList; - char propValues[PROPCOUNT][MAXSIZE]; - int i, err = 0; - - cim_logDebug("populate_Solaris_NFSShare_property_list", - "Just entering..."); - - nfsSharePropList = cim_createPropertyList(); - if (nfsSharePropList == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSSHARE::POPULATE_PROPLIST", - CIM_ERR_FAILED, CREATE_PROPLIST_FAILURE, ex, &err); - return ((CCIMPropertyList *)NULL); - } - - /* - * Create the CCIMProperties for this instance - */ - if (!populate_Solaris_NFSShare_property_Values(hostname, - nfs_sharelist, propValues, &err)) { - util_handleError( - "SOLARIS_NFSSHARE::POPULATE_PROPLIST", - CIM_ERR_FAILED, CREATE_PROPLIST_FAILURE, NULL, &err); - return ((CCIMPropertyList *)NULL); - } - for (i = 0; i < PROPCOUNT; i++) { - cim_logDebug("populate_Solaris_NFSShare_property_list", - "propValues[%d] = %s", i, propValues[i]); - nfsSharePropList = add_property_to_list(nfsShareProps[i].name, - nfsShareProps[i].type, propValues[i], NULL, - nfsShareProps[i].isKey, nfsSharePropList); - if (nfsSharePropList == NULL) { - break; - } - } - return (nfsSharePropList); - -} /* populate_Solaris_NFSShare_property_list */ - -/* - * populate_Solaris_NFSShare_property_Values - * Populates the property array for use in the populate_property_list function - */ -static CIMBool -populate_Solaris_NFSShare_property_Values( - char *hostname, - fs_sharelist_t *nfs_sharelist, - cimchar propValues[PROPCOUNT][MAXSIZE], - int *err) -{ - - CIMBool nfsPersistValue = cim_false; - boolean_t hasEquals; - int defaultValue = 0; - char *optValue; - - - cim_logDebug("populate_Solaris_NFSShare_property_Values", - "Just entering..."); - /* - * Allow access control - */ - hasEquals = B_FALSE; - optValue = get_property_from_opt_string(nfs_sharelist->options, - "aclok", hasEquals, defaultValue); - if (optValue != NULL) { - (void) snprintf(propValues[ALLOWACCESSCONTROL], MAXSIZE, "%s", - optValue); - free(optValue); - } else { - return (cim_false); - } - cim_logDebug("populate_Solaris_NFSShare_property_Values", "%s= %s", - nfsShareProps[ALLOWACCESSCONTROL].name, - propValues[ALLOWACCESSCONTROL]); - - /* - * Key - creation class name - */ - (void) snprintf(propValues[CREATIONCLASSNAME], MAXSIZE, "%s", - SOLARIS_NFSSHARE); - cim_logDebug("populate_Solaris_NFSShare_property_Values", "%s= %s", - nfsShareProps[CREATIONCLASSNAME].name, - propValues[CREATIONCLASSNAME]); - - /* - * Description - */ - if (nfs_sharelist->description != NULL) { - (void) snprintf(propValues[DESCRIPTION], MAXSIZE, "%s", - nfs_sharelist->description); - } else { - (void) snprintf(propValues[DESCRIPTION], MAXSIZE, "\0"); - } - - cim_logDebug("populate_Solaris_NFSShare_property_Values", "%s= %s", - nfsShareProps[DESCRIPTION].name, - propValues[DESCRIPTION]); - /* - * Effective user ID "anon" - */ - hasEquals = B_TRUE; - defaultValue = UID_NOBODY; - optValue = get_property_from_opt_string(nfs_sharelist->options, - "anon=", hasEquals, defaultValue); - if (optValue != NULL) { - (void) snprintf(propValues[EFFECTIVEUID], MAXSIZE, "%s", - optValue); - free(optValue); - } else { - return (cim_false); - } - cim_logDebug("populate_Solaris_NFSShare_property_Values", "%s= %s", - nfsShareProps[EFFECTIVEUID].name, - propValues[EFFECTIVEUID]); - - /* - * Ignore setuid "nosuid" - */ - hasEquals = B_FALSE; - defaultValue = B_FALSE; - optValue = get_property_from_opt_string(nfs_sharelist->options, - "nosuid", hasEquals, defaultValue); - if (optValue != NULL) { - (void) snprintf(propValues[IGNORESETID], MAXSIZE, "%s", - optValue); - free(optValue); - } else { - return (cim_false); - } - cim_logDebug("populate_Solaris_NFSShare_property_Values", "%s= %s", - nfsShareProps[IGNORESETID].name, - propValues[IGNORESETID]); - - /* - * Enable logging, use log file tag "log" - */ - hasEquals = B_FALSE; - defaultValue = B_FALSE; - optValue = get_property_from_opt_string(nfs_sharelist->options, - "log", hasEquals, defaultValue); - if (optValue != NULL) { - if (strcmp(optValue, "1") == 0) { - (void) strlcpy(propValues[LOGFILETAG], "global", - MAXSIZE); - free(optValue); - } else { - free(optValue); - hasEquals = B_TRUE; - optValue = get_property_from_opt_string( - nfs_sharelist->options, - "log=", hasEquals, defaultValue); - if (strcmp(optValue, "0") == 0) { - /* - * Logging not enabled - */ - (void) snprintf(propValues[LOGFILETAG], - MAXSIZE, "%s", "\0"); - cim_logDebug( - "populate_Solaris_NFSShare_property_Values", - "No log property for this share"); - } else { - (void) snprintf(propValues[LOGFILETAG], - MAXSIZE, "%s", optValue); - } - free(optValue); - } - } else { - return (cim_false); - } - cim_logDebug("populate_Solaris_NFSShare_property_Values", "%s= %s", - nfsShareProps[LOGFILETAG].name, - propValues[LOGFILETAG]); - - /* - * Key - Shared Path - */ - (void) snprintf(propValues[SHAREDNAME], MAXSIZE, "%s", - nfs_sharelist->path); - cim_logDebug("populate_Solaris_NFSShare_property_Values", "%s= %s", - nfsShareProps[SHAREDNAME].name, - propValues[SHAREDNAME]); - - /* - * Persistent share entry - */ - nfsPersistValue = check_for_PersistentShareEnt(nfs_sharelist, err); - (void) snprintf(propValues[PERSISTENT], MAXSIZE, "%d", nfsPersistValue); - cim_logDebug("populate_Solaris_NFSShare_property_Values", "%s= %s", - nfsShareProps[PERSISTENT].name, propValues[PERSISTENT]); - - /* - * No subdirectory mounts "nosub" - */ - hasEquals = B_FALSE; - defaultValue = B_FALSE; - optValue = get_property_from_opt_string(nfs_sharelist->options, - "nosub", hasEquals, defaultValue); - if (optValue != NULL) { - (void) snprintf(propValues[PREVENTSUBDIRMOUNT], MAXSIZE, "%s", - optValue); - free(optValue); - } else { - return (cim_false); - } - cim_logDebug("populate_Solaris_NFSShare_property_Values", "%s= %s", - nfsShareProps[PREVENTSUBDIRMOUNT].name, - propValues[PREVENTSUBDIRMOUNT]); - - /* - * Public filehandle "public" - */ - hasEquals = B_FALSE; - defaultValue = B_FALSE; - optValue = get_property_from_opt_string(nfs_sharelist->options, - "public", hasEquals, defaultValue); - if (optValue != NULL) { - (void) snprintf(propValues[PUBLIC], MAXSIZE, "%s", optValue); - free(optValue); - } else { - return (cim_false); - } - cim_logDebug("populate_Solaris_NFSShare_property_Values", "%s= %s", - nfsShareProps[PUBLIC].name, propValues[PUBLIC]); - - /* - * Share option string - */ - (void) snprintf(propValues[SHAREOPTS], MAXSIZE, "%s", - nfs_sharelist->options); - cim_logDebug("populate_Solaris_NFSShare_property_Values", "%s= %s", - nfsShareProps[SHAREOPTS].name, propValues[SHAREOPTS]); - - /* - * Key - System Creation class name - */ - (void) snprintf(propValues[SYSTEMCREATIONCLASSNAME], MAXSIZE, "%s", - SOLARIS_CS); - cim_logDebug("populate_Solaris_NFSShare_property_Values", "%s= %s", - nfsShareProps[SYSTEMCREATIONCLASSNAME].name, - propValues[SYSTEMCREATIONCLASSNAME]); - - /* - * Key - System name - */ - (void) snprintf(propValues[SYSTEMNAME], MAXSIZE, "%s", - hostname); - cim_logDebug("populate_Solaris_NFSShare_property_Values", "%s= %s", - nfsShareProps[SYSTEMNAME].name, propValues[SYSTEMNAME]); - - return (cim_true); - -} /* populate_Solaris_NFSShare_property_Values */ - -/* - * start_daemons - * - * Starts the nfsd and mountd daemons based on which daemon is requested - * in which_daemon. The string returned from the execution of the damon - * command is returned. - */ -static char * -start_daemons(int which_daemon, int *err) -{ - FILE *fd; - pid_t pid; - char *pidfile; - char *cmd_return = NULL; - char *cmd = NULL; - char pid_str[MAXSIZE]; - int pid_kill = 0; - - switch (which_daemon) { - case NFSD: - pidfile = "/etc/svc/volatile/nfs-server.lock"; - cmd = "/usr/lib/nfs/nfsd"; - break; - - case MOUNTD: - pidfile = "/etc/svc/volatile/nfs-mountd.lock"; - cmd = "/usr/lib/nfs/mountd"; - break; - - default: - cim_logDebug("start_daemons", "Invalid command"); - *err = EINVAL; - return (NULL); - } - - if ((fd = fopen(pidfile, "r")) == NULL) { - *err = errno; - if (*err == ENOENT) { - *err = 0; - cmd_return = - cmd_execute_command_and_retrieve_string(cmd, - err); - return (cmd_return); - } else { - return (cmd_return); - } - } - if (fgets(pid_str, MAXSIZE, fd) == NULL) { - *err = errno; - (void) fclose(fd); - cim_logDebug("start_daemons", - "Can not read from file %s - %s\n", - pidfile, strerror(*err)); - return (NULL); - } - - (void) fclose(fd); - pid = (pid_t)strtoll(pid_str, NULL, 0); - pid_kill = kill(pid, 0); - *err = errno; - if (pid_kill == 0) { - /* - * Setting error to EEXIST so that the error returned - * tells the caller that the daemon already exists. - */ - *err = EEXIST; - cim_logDebug("start_daemon", - "Terminated - nfsd(%ld) already running.\n", pid); - } else if (*err == ESRCH) { - /* - * ESRCH indicates that there is no such process and - * the daemon needs to be started. - */ - *err = 0; - cmd_return = - cmd_execute_command_and_retrieve_string(cmd, err); - } else { - cim_logDebug("start_daemon", - "Unknown error starting %s (%ld)", cmd, pid); - } - return (cmd_return); -} /* start_daemons */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_NFSShare.h b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_NFSShare.h deleted file mode 100644 index 5c28856366..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_NFSShare.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOLARIS_NFSSHARE_H -#define _SOLARIS_NFSSHARE_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> -#include <cp_required.h> -#include <cp_instance.h> -#include <cp_associator.h> -#include <cp_method.h> -#include <cp_property.h> -#include "nfsprov_include.h" - -static nfs_prov_prop_t nfsShareProps[] = { - -#define ALLOWACCESSCONTROL 0 - {"AllowAccessControl", cim_false, boolean}, - -#define CREATIONCLASSNAME (ALLOWACCESSCONTROL + 1) - {"CreationClassName", cim_true, string}, - -#define DESCRIPTION (CREATIONCLASSNAME + 1) - {"Description", cim_false, string}, - -#define EFFECTIVEUID (DESCRIPTION + 1) - {"EffectiveUID", cim_false, uint32}, - -#define IGNORESETID (EFFECTIVEUID + 1) - {"IgnoreSetId", cim_false, boolean}, - -#define LOGFILETAG (IGNORESETID + 1) - {"LogFileTag", cim_false, string}, - -#define SHAREDNAME (LOGFILETAG + 1) - {"Name", cim_true, string}, - -#define PERSISTENT (SHAREDNAME + 1) - {"Persistent", cim_false, boolean}, - -#define PREVENTSUBDIRMOUNT (PERSISTENT + 1) - {"PreventSubDirMount", cim_false, boolean}, - -#define PUBLIC (PREVENTSUBDIRMOUNT + 1) - {"Public", cim_false, boolean}, - -#define SECURITYOPTS (PUBLIC + 1) - {"SecurityOptions", cim_false, string_array}, - -#define SHAREOPTS (SECURITYOPTS + 1) - {"ShareOptions", cim_false, string}, - -#define STARTDAEMONS (SHAREOPTS + 1) - {"StartDaemons", cim_false, boolean}, - -#define SYSTEMCREATIONCLASSNAME (STARTDAEMONS + 1) - {"SystemCreationClassName", cim_true, string}, - -#define SYSTEMNAME (SYSTEMCREATIONCLASSNAME + 1) - {"SystemName", cim_true, string} -}; - -/* - * PROPCOUNT must be set using the last define in the nfsShareProps list. - */ -#define PROPCOUNT (SYSTEMNAME +1) - -#ifdef __cplusplus -} -#endif - -#endif /* _SOLARIS_NFSSHARE_H */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_NFSShareSecurity.c b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_NFSShareSecurity.c deleted file mode 100644 index 74c3f8eb53..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_NFSShareSecurity.c +++ /dev/null @@ -1,820 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "Solaris_NFSShareSecurity.h" -#include "nfs_keys.h" -#include "nfs_provider_names.h" -#include "nfs_providers_msgstrings.h" -#include "messageStrings.h" -#include "util.h" -#include "libfsmgt.h" -#include "createprop_methods.h" -#include <string.h> -#include <errno.h> -#include <sys/utsname.h> - -/* - * Constants - */ -#define SECMODES 5 -#define DEFAULT_MAXLIFE 30000 -#define MAXSIZE 256 - - -/* - * Private variables - */ - -/* - * Private method declarations - */ - -static CCIMInstanceList *create_nfsShareSec_InstList( - fs_sharelist_t *nfs_sharesec_list, int *err); -static CCIMInstanceList *enumerate_sharesecurity(); -static CCIMPropertyList *populate_Solaris_NFSShareSecurity_property_list( - fs_sharelist_t *nfs_share, char *secmode_opts); -static void populate_Solaris_NFSShareSecurity_property_Values( - char *path, - cimchar propValues[PROPCOUNT][MAXSIZE], - char *secmode_opts, int *err); - -/* - * Public methods - */ - -/* - * Instance provider methods - */ - -/* - * Solaris_NFSShareSecurity provider - * - * It is important to note that all memory allocated by these functions - * and passed to the CIMOM, is freed by the CIMOM as the caller. - */ - -/* - * Name: cp_enumInstances_Solaris_NFSShareSecurity - * - * Description: Returns a list of instances if found. - * - * Parameters: - * shareOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstanceList * if matched instance is found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMInstanceList * -cp_enumInstances_Solaris_NFSShareSecurity(CCIMObjectPath* shareOP) { - CCIMInstanceList *instList; - int err = 0; - - cim_logDebug("cp_enumInstances_Solaris_NFSShareSecurity", - "Just entering..."); - /* - * Check object path for NULL value - */ - if (shareOP == NULL) { - util_handleError( - "SOLARIS_NFSSHARESECURITY::ENUM_INSTANCES", - CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - instList = enumerate_sharesecurity(); - if (instList == NULL) { - cim_logDebug("cp_enumInstances_Solaris_NFSShareSecurity", - "Call to enumerate_sharesecurity returned NULL"); - util_handleError( - "SOLARIS_NFSSHARESECURITY::ENUM_INSTANCES", - CIM_ERR_FAILED, CIMOM_ENUM_INST_FAILURE, - NULL, &err); - return ((CCIMObjectPathList *)NULL); - } - - cim_logDebug("cp_enumInstances_Solaris_NFSShareSecurity", - "Returning Solaris_NFSShareSecurity instance"); - return (instList); -} - -/* - * Name: cp_enumInstanceNames_Solaris_NFSShareSecurity - * - * Description: Enumerates all of the security modes and options for all - * of the nfs shares on the host. - * - * Parameters: - * shareOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMObjectPathList * if matched instance is found. Otherwise, NULL. - */ - -/* ARGUSED */ -CCIMObjectPathList * -cp_enumInstanceNames_Solaris_NFSShareSecurity(CCIMObjectPath* shareOP) { - CCIMInstanceList *instList; - CCIMObjectPathList *OPList; - CCIMException *ex; - int err = 0; - - instList = cp_enumInstances_Solaris_NFSShareSecurity(shareOP); - if (instList == NULL) { - util_handleError( - "SOLARIS_NFSSHARESECURITY::ENUM_INSTANCES", - CIM_ERR_FAILED, CIMOM_ENUM_INSTNAMES_FAILURE, - NULL, &err); - return ((CCIMObjectPathList *)NULL); - } - - OPList = cim_createObjectPathList(instList); - if (OPList == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSSHARESECURITY::ENUM_INSTANCENAMES", - CIM_ERR_FAILED, CREATE_OBJECT_LIST_FAILURE, ex, &err); - cim_freeCIMException(ex); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - cim_freeInstanceList(instList); - return (OPList); -} - -/* - * Name: cp_getInstance_Solaris_NFSShareSecurity - * - * Description: Returns an instance which matches the passed in object path - * if found. - * - * Parameters: - * shareOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ - -CCIMInstance * -cp_getInstance_Solaris_NFSShareSecurity(CCIMObjectPath* shareOP) { - CCIMInstanceList *instList; - CCIMInstance *inst; - CCIMException *ex; - int err = 0; - - instList = cp_enumInstances_Solaris_NFSShareSecurity(shareOP); - if (instList == NULL) { - util_handleError( - "SOLARIS_NFSSHARESECURITY::GET_INSTANCE", - CIM_ERR_FAILED, CIMOM_ENUM_INST_FAILURE, - NULL, &err); - return ((CCIMInstance *)NULL); - } - - inst = cim_getInstance(instList, shareOP); - if (inst == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHARESECURITY::GET_INSTANCE", - CIM_ERR_INVALID_CLASS, GET_INSTANCE_FAILURE, ex, &err); - cim_freeInstanceList(instList); - return ((CCIMInstance *)NULL); - } - - cim_freeInstanceList(instList); - cim_logDebug("cp_getInstance_Solaris_NFSShareSecurity", - "Returning instance"); - - return (inst); -} - -/* - * cp_setInstance not supported - */ -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_NFSShareSecurity(CCIMObjectPath *shareOP, - CCIMInstance *shareInst, - char **props, int num_props) { - int err = 0; - - util_handleError("SOLARIS_NFSSHARESECURITY::SET_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - return (cim_false); -} /* cp_setInstance_Solaris_NFSShareSecurity */ - -/* - * cp_setInstanceWithList not supported - */ -/* ARGSUSED */ -CIMBool -cp_setInstanceWithList_Solaris_NFSShareSecurity(CCIMObjectPath *shareOP, - CCIMInstance *shareInst, - char **props, int num_props) { - int err = 0; - - util_handleError("SOLARIS_NFSSHARESECURITY::SET_INSTANCEWITHLIST", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - return (cim_false); -} - -/* - * cp_invokeMethod not supported - */ -/* ARGSUSED */ -CCIMProperty * -cp_invokeMethod_Solaris_NFSShareSecurity( - CCIMObjectPath *pOP, - cimchar *functionName, - CCIMPropertyList *inParams, - CCIMPropertyList *outParams) { - - int err = 0; - util_handleError("SOLARIS_NFSSHARESECURITY::INVOKE_METHOD", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - return ((CCIMProperty *)NULL); -} /* cp_invokeMethod_Solaris_NFSShareSecurity */ - - -/* - * cp_setProperty not supported - */ -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_NFSShareSecurity(CCIMObjectPath *pOP, - CCIMProperty *pProp) { - int err = 0; - util_handleError("SOLARIS_NFSSHARESECURITY::SET_PROPERTY", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - return (cim_false); -} - -/* - * cp_createInstance not supported - */ -/* ARGSUSED */ -CCIMObjectPath * -cp_createInstance_Solaris_NFSShareSecurity(CCIMObjectPath *shareOP, - CCIMInstance *shareInst) { - - int err = 0; - - util_handleError("SOLARIS_NFSSHARESECURITY::CREATE_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - return ((CCIMObjectPath *)NULL); -} - -/* - * cp_deleteInstance not supported - */ -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_NFSShareSecurity(CCIMObjectPath *shareOP) { - - int err = 0; - - util_handleError("SOLARIS_NFSSHARESECURITY::DELETE_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - return (cim_false); -} - -/* - * Name: cp_execQuery_Solaris_NFSShareSecurity - * - * Description: Builds a list of all instances, prepends the list with an - * empty instance, and returns the instance list. The CIMOM - * interprets the initial empty instance to mean that it has - * to do the filtering. The caller is responsible for freeing - * the memory allocated for the returned object. - * - * Parameters: - * CCIMObjectPath *shareOP - An objectpath which represents the class to - * work on - * char *electClause - The select clause - * char *nonJoinExp - The non join expression - * char *queryExp - The query Expression - * char *queryLang - The Query Language used (s/b "WQL") - * - * Returns: - * Returns the prepended instance list. On error NULL is returned. - */ -/* ARGSUSED */ -CCIMInstanceList* -cp_execQuery_Solaris_NFSShareSecurity(CCIMObjectPath *shareOP, - char *selectClause, char *nonJoinExp, char *queryExp, char *queryLang) { - - CCIMInstance *emptyInst; - CCIMInstanceList *shareSecInstList; - CCIMInstanceList *resultInstList; - CCIMException *ex; - int err = 0; - - shareSecInstList = cp_enumInstances_Solaris_NFSShareSecurity(shareOP); - if (shareSecInstList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHARESECURITY::EXEC_QUERY", - CIM_ERR_FAILED, CIMOM_ENUM_INST_FAILURE, ex, &err); - return ((CCIMInstanceList *)NULL); - } - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHARESECURITY::EXEC_QUERY", - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, &err); - cim_freeCIMException(ex); - cim_freeInstanceList(shareSecInstList); - return ((CCIMInstanceList *)NULL); - } - - resultInstList = cim_prependInstance(shareSecInstList, emptyInst); - if (resultInstList == NULL) { - util_handleError("SOLARIS_NFSSHARESECURITY::EXEC_QUERY", - CIM_ERR_FAILED, PREPEND_INSTANCE_FAILURE, ex, &err); - cim_freeInstanceList(shareSecInstList); - cim_freeInstance(emptyInst); - } - return (resultInstList); - -} /* cp_execQuery_Solaris_NFSShareSecurity */ - - -/* - * Private Methods - */ - -/* - * create_nfsShareSec_InstList - * - * Creates the Solaris_NFSShareSecurity instance list from information - * gathered from the shares on the system. The instance list is returned. - */ -static CCIMInstanceList * -create_nfsShareSec_InstList(fs_sharelist_t *nfs_sharesec_list, int *err) { - fs_sharelist_t *currentShare; - CCIMInstanceList *nfsShareSecInstList; - CCIMException *ex; - char **sec_modes; - int count; - - cim_logDebug("create_nfsShareSec_InstList", "Just entering..."); - /* - * At this point, one or more nfs shares were found on the - * system, create the instance list from the nfs_sharesec_list. - */ - nfsShareSecInstList = cim_createInstanceList(); - if (nfsShareSecInstList == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSSHARESECURITY::CREATE_INST_LIST ", - CIM_ERR_FAILED, CREATE_INSTANCE_LIST_FAILURE, - ex, err); - return ((CCIMInstanceList *)NULL); - } - - /* - * Loop through the security modes for the nfs shares to - * retrieve their security properties and create an - * instance list containing all the security modes and - * their properties for each share. - */ - for (currentShare = nfs_sharesec_list; currentShare != NULL; - currentShare = currentShare->next) { - int i; - CCIMInstance *solaris_NFSShareSec_instance; - CCIMPropertyList *solaris_NFSShareSec_prop_list; - - /* - * Parse the the share options list for multiple - * security modes. An array of strings is returned - * that will be used to create the instances for each - * share. - */ - sec_modes = fs_parse_opts_for_sec_modes( - currentShare->options, &count, err); - if (sec_modes == NULL) { - util_handleError( - "SOLARIS_NFSSHARESECURITY::CREATE_INST_LIST ", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, err); - return ((CCIMInstanceList *)NULL); - } - for (i = 0; i < count; i++) { - /* - * Create the Solaris_NFSShareSecurity - * CCIMInstance - */ - solaris_NFSShareSec_instance = - cim_createInstance(SOLARIS_NFSSHARESECURITY); - if (solaris_NFSShareSec_instance == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHARESECURITY:" \ - ":CREATE_INST_LIST", CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, err); - cim_freeInstanceList(nfsShareSecInstList); - fileutil_free_string_array(sec_modes, count); - return ((CCIMInstanceList *)NULL); - } - - solaris_NFSShareSec_prop_list = - populate_Solaris_NFSShareSecurity_property_list( - currentShare, sec_modes[i]); - if (solaris_NFSShareSec_prop_list == NULL) { - /* - * populatePropertyList already logged - * this error so there is no need to - * log it here. - */ - cim_freeInstance(solaris_NFSShareSec_instance); - cim_freeInstanceList(nfsShareSecInstList); - fileutil_free_string_array(sec_modes, count); - return ((CCIMInstanceList *)NULL); - } - - /* - * Add the property list to the instance - */ - solaris_NFSShareSec_instance = - cim_addPropertyListToInstance( - solaris_NFSShareSec_instance, - solaris_NFSShareSec_prop_list); - if (solaris_NFSShareSec_instance == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHARESECURITY:" \ - ":CREATE_INST_LIST", CIM_ERR_FAILED, - PROPLIST_TO_INSTANCE_FAILURE, ex, err); - cim_freePropertyList( - solaris_NFSShareSec_prop_list); - cim_freeInstanceList(nfsShareSecInstList); - fileutil_free_string_array(sec_modes, count); - return ((CCIMInstanceList *)NULL); - } - - /* - * Add the instance to the instance list - */ - nfsShareSecInstList = - cim_addInstance(nfsShareSecInstList, - solaris_NFSShareSec_instance); - if (nfsShareSecInstList == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_NFSSHARESECURITY:" \ - ":CREATE_INST_LIST", CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, err); - cim_freeInstance(solaris_NFSShareSec_instance); - fileutil_free_string_array(sec_modes, count); - return ((CCIMInstanceList *)NULL); - } - } /* for (int i; i < count; i++) */ - - } /* for (currentShare = nfs_sharesec_list; ...) */ - - fileutil_free_string_array(sec_modes, count); - - cim_logDebug("create_nfsShareSec_InstList", "Returning instance list"); - return (nfsShareSecInstList); - -} /* create_nfsShareSec_InstList */ - -/* - * enumerate_sharesecurity - * Enumerate the nfs sharesecurity modes for each share by using the - * fs_shares fs_get_share_list method to get the security modes from - * the option string. - */ -static CCIMInstanceList * -enumerate_sharesecurity() { - - int err; - fs_sharelist_t *nfs_sharesec_list; - - cim_logDebug("enumerate_sharesecurity", "Just entering..."); - nfs_sharesec_list = fs_get_share_list(&err); - if (nfs_sharesec_list == NULL) { - /* - * Check whether an error was returned or if we simply don't - * have any nfs shares on the system. If err is not - * equal to 0, an error was encountered. - */ - if (err != 0) { - /* - * Determine the error and log it. - */ - if (err == ENOMEM || err == EAGAIN) { - util_handleError( - "SOLARIS_NFSSHARESECURITY:" \ - ":ENUM_SHARESECURITY ", - CIM_ERR_LOW_ON_MEMORY, - NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } else { - - /* - * If any other errors were encountered it - * can be handled as a general error. We may - * not know exactly what the error is. - */ - util_handleError( - "SOLARIS_NFSSHARESECURITY:" \ - ":ENUM_SHARESECURITY ", - CIM_ERR_FAILED, - strerror(err), NULL, &err); - return ((CCIMInstanceList *)NULL); - } - } - /* - * There are no nfs shares on the host. - */ - cim_logDebug("enumerate_sharesecurity", "No shares on system"); - return ((CCIMInstanceList *)NULL); - - } else { - - CCIMInstanceList *nfsShareSecInstList; - - nfsShareSecInstList = - create_nfsShareSec_InstList(nfs_sharesec_list, &err); - - fs_free_share_list(nfs_sharesec_list); - - return (nfsShareSecInstList); - } -} /* enumerate_sharesecurity */ - -/* - * populate_Solaris_NFSShareSecurity_property_list - * Populates the property list with that share information for each - * instance in the instance list. - */ -static CCIMPropertyList * -populate_Solaris_NFSShareSecurity_property_list( - fs_sharelist_t *nfs_share, char *secmode_opts) { - - CCIMException *ex; - CCIMPropertyList *nfsShareSecPropList; - char propValues[PROPCOUNT][MAXSIZE]; - int i, err = 0; - - cim_logDebug("populate_Solaris_NFSShareSecurity_property_list", - "Just entering..."); - - nfsShareSecPropList = cim_createPropertyList(); - if (nfsShareSecPropList == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_NFSSHARESECURITY::POPULATE_PROPLIST", - CIM_ERR_FAILED, CREATE_PROPLIST_FAILURE, ex, &err); - cim_freeCIMException(ex); - goto out; - } - - /* - * Create the CCIMProperties for this instance - */ - populate_Solaris_NFSShareSecurity_property_Values( - nfs_share->path, propValues, secmode_opts, &err); - if (err != 0) { - cim_freePropertyList(nfsShareSecPropList); - nfsShareSecPropList = NULL; - } else { - for (i = 0; i < PROPCOUNT; i++) { - cim_logDebug( - "populate_Solaris_NFSShareSecurity_property_list", - "propValues[%d] = %s", i, propValues[i]); - nfsShareSecPropList = - add_property_to_list(nfsShareSecProps[i].name, - nfsShareSecProps[i].type, propValues[i], NULL, - nfsShareSecProps[i].isKey, nfsShareSecPropList); - if (nfsShareSecPropList == NULL) { - goto out; - } - } - } -out: - cim_logDebug("populate_Solaris_NFSShareSecurity_property_list", - "Returning property list"); - return (nfsShareSecPropList); - -} /* populate_Solaris_NFSShareSecurity_property_list */ - -/* - * populate_Solaris_NFSShareSecurity_property_Values - * Populates the property array for use in the populate_property_list function - */ -static void -populate_Solaris_NFSShareSecurity_property_Values(char *path, - cimchar propValues[PROPCOUNT][MAXSIZE], char *secmode_opts, int *err) { - - boolean_t hasEquals; - int defaultValue = B_FALSE; - int count = 0; - char **access_list; - char *optValue; - cimchar *propString; - - - cim_logDebug("populate_Solaris_NFSShareSecurity_property_Values", - "Just entering..."); - /* - * Check for security mode option in option string. - * Key - Mode - */ - hasEquals = B_TRUE; - defaultValue = B_FALSE; - - optValue = get_property_from_opt_string(secmode_opts, - "sec=", hasEquals, defaultValue); - if (strcmp(optValue, "0") != 0) { - (void) snprintf(propValues[SEC_MODE], MAXSIZE, "%s", optValue); - } else { - /* - * The default security mode is set only if no security - * mode is set in the option string. - */ - (void) snprintf(propValues[SEC_MODE], MAXSIZE, "%s", "sys"); - } - cim_logDebug("populate_Solaris_NFSShareSecurity_property_Values", - "%s = %s", nfsShareSecProps[SEC_MODE].name, propValues[SEC_MODE]); - free(optValue); - - /* - * MaxLife - * only used with sec mode of "dh" - */ - if (strcmp(propValues[SEC_MODE], "dh") == 0) { - hasEquals = B_TRUE; - defaultValue = DEFAULT_MAXLIFE; - optValue = - get_property_from_opt_string(secmode_opts, - "window=", hasEquals, defaultValue); - (void) snprintf(propValues[MAXLIFE], MAXSIZE, "%s", optValue); - cim_logDebug( - "populate_Solaris_NFSShareSecurity_property_Values", - "%s = %s", nfsShareSecProps[MAXLIFE].name, - propValues[MAXLIFE]); - } else { - (void) snprintf(propValues[MAXLIFE], MAXSIZE, "\0"); - } - free(optValue); - - /* - * Path - */ - if (path != NULL) { - (void) snprintf(propValues[PATH], MAXSIZE, "%s", - path); - cim_logDebug( - "populate_Solaris_NFSShareSecurity_property_Values", - "%s = %s", nfsShareSecProps[PATH].name, propValues[PATH]); - } else { - (void) snprintf(propValues[PATH], MAXSIZE, "\0"); - cim_logDebug( - "populate_Solaris_NFSShareSecurity_property_Values", - "%s = %s", nfsShareSecProps[PATH].name, "null"); - } - - /* - * ReadOnly - */ - hasEquals = B_FALSE; - defaultValue = B_FALSE; - optValue = get_property_from_opt_string(secmode_opts, - "ro", hasEquals, defaultValue); - (void) snprintf(propValues[READONLY], MAXSIZE, "%s", optValue); - cim_logDebug( - "populate_Solaris_NFSShareSecurity_property_Values", - "%s = %s", nfsShareSecProps[READONLY].name, propValues[READONLY]); - free(optValue); - - /* - * Read Write List - */ - hasEquals = B_TRUE; - defaultValue = B_FALSE; - optValue = get_property_from_opt_string(secmode_opts, "rw=", - hasEquals, defaultValue); - if (strcmp(optValue, "0") != 0) { - access_list = - fs_create_array_from_accesslist(optValue, - &count, err); - propString = cim_encodeStringArray(access_list, count); - if (propString == NULL) { - *err = ENOMEM; - return; - } - free(optValue); - optValue = strdup(propString); - if (optValue == NULL) { - *err = ENOMEM; - return; - } - free(propString); - fileutil_free_string_array(access_list, count); - } else { - optValue = strdup("\0"); - } - (void) snprintf(propValues[READWRITELIST], MAXSIZE, "%s", optValue); - cim_logDebug("populate_Solaris_NFSShareSecurity_property_Values", - "%s = %s", nfsShareSecProps[READWRITELIST].name, - propValues[READWRITELIST]); - free(optValue); - count = 0; - - /* - * Read Only List - */ - hasEquals = B_TRUE; - defaultValue = B_FALSE; - optValue = get_property_from_opt_string(secmode_opts, "ro=", - hasEquals, defaultValue); - - if (strcmp(optValue, "0") != 0) { - access_list = - fs_create_array_from_accesslist(optValue, - &count, err); - propString = cim_encodeStringArray(access_list, count); - if (propString == NULL) { - *err = ENOMEM; - return; - } - free(optValue); - optValue = strdup(propString); - if (optValue == NULL) { - *err = ENOMEM; - return; - } - free(propString); - fileutil_free_string_array(access_list, count); - } else { - optValue = strdup("\0"); - } - (void) snprintf(propValues[READONLYLIST], MAXSIZE, "%s", optValue); - cim_logDebug("populate_Solaris_NFSShareSecurity_property_Values", - "%s = %s", nfsShareSecProps[READONLYLIST].name, - propValues[READONLYLIST]); - free(optValue); - count = 0; - - /* - * root server list - */ - hasEquals = B_TRUE; - defaultValue = B_FALSE; - optValue = get_property_from_opt_string(secmode_opts, - "root=", hasEquals, defaultValue); - if (strcmp(optValue, "0") != 0) { - access_list = - fs_create_array_from_accesslist(optValue, - &count, err); - propString = cim_encodeStringArray(access_list, count); - if (propString == NULL) { - *err = ENOMEM; - return; - } - free(optValue); - optValue = strdup(propString); - if (optValue == NULL) { - *err = ENOMEM; - return; - } - free(propString); - fileutil_free_string_array(access_list, count); - } else { - optValue = strdup("\0"); - } - (void) snprintf(propValues[ROOTSERVERS], MAXSIZE, "%s", optValue); - cim_logDebug("populate_Solaris_NFSShareSecurity_property_Values", - "%s = %s", nfsShareSecProps[ROOTSERVERS].name, - propValues[ROOTSERVERS]); - free(optValue); - - cim_logDebug("populate_Solaris_NFSShareSecurity_property_Values", - "Returning"); - -} /* populate_Solaris_NFSShareSecurity_property_Values */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_NFSShareSecurity.h b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_NFSShareSecurity.h deleted file mode 100644 index 17b1ae37b2..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_NFSShareSecurity.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOLARIS_NFSSHARESECURITY_H -#define _SOLARIS_NFSSHARESECURITY_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> -#include <cp_required.h> -#include <cp_instance.h> -#include <cp_associator.h> -#include <cp_method.h> -#include <cp_property.h> -#include "nfsprov_include.h" - -static nfs_prov_prop_t nfsShareSecProps[] = { - -#define MAXLIFE 0 - {"MaxLife", cim_false, uint32}, - -#define PATH (MAXLIFE + 1) - {"SettingId", cim_true, string}, - -#define READONLY (PATH + 1) - {"ReadOnly", cim_false, boolean}, - -#define READWRITELIST (READONLY + 1) - {"ReadWriteList", cim_false, string_array}, - -#define READONLYLIST (READWRITELIST + 1) - {"ReadOnlyList", cim_false, string_array}, - -#define ROOTSERVERS (READONLYLIST + 1) - {"RootServers", cim_false, string_array}, - -#define SEC_MODE (ROOTSERVERS + 1) - {"Mode", cim_true, string} -}; - -/* - * PROPCOUNT must be set using the last define in the nfsShareSecProps list. - */ -#define PROPCOUNT (SEC_MODE + 1) - -#ifdef __cplusplus -} -#endif - -#endif /* _SOLARIS_NFSSHARESECURITY_H */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_PersistentShare.c b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_PersistentShare.c deleted file mode 100644 index d4efcb4ed1..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_PersistentShare.c +++ /dev/null @@ -1,986 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "Solaris_PersistentShare.h" -#include "nfs_keys.h" -#include "nfs_provider_names.h" -#include "nfs_providers_msgstrings.h" -#include "nfsprov_methods.h" -#include "messageStrings.h" -#include "util.h" -#include "libfsmgt.h" -#include "createprop_methods.h" -#include <string.h> -#include <errno.h> -#include <sys/utsname.h> - -/* - * Constants - */ -const char *DEL_ALL_WITH_DUPLICATE_PATH = "deleteAllWithDuplicatePath"; - -/* - * Private method declarations - */ - -static CCIMInstanceList *create_persistentShare_InstList( - fs_dfstab_entry_t fs_dfstab_ent, - int *err); -static CCIMInstanceList *enumerate_dfstab(); -static CCIMPropertyList *populate_Solaris_PersistentShare_property_list( - char *hostname, - fs_dfstab_entry_t fs_dfstab_ents); -static void populate_Solaris_PersistentShare_property_values( - char *hostname, - fs_dfstab_entry_t fs_dfstab_ents, - cimchar propValues[PROPCOUNT][MAXSIZE], - int *err); - -/* - * Name: cp_enumInstances_Solaris_PersistentShare - * - * Description: Creates a list of instances and returns that list. - * - * Parameters: - * dfstabOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstanceList * if matched instance is found. Otherwise, NULL. - */ -CCIMInstanceList * -cp_enumInstances_Solaris_PersistentShare(CCIMObjectPath* dfstabOP) { - CCIMInstanceList *instList; - int err = 0; - - cim_logDebug("cp_enumInstances_Solaris_PersistentShare", - "Just entering..."); - /* - * First check if the CCIMObjectPath passed in is null. - */ - if (dfstabOP == NULL) { - util_handleError( - "SOLARIS_PERSISTSHARE::ENUM_INSTANCES", - CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - instList = enumerate_dfstab(); - if (instList == NULL) { - return ((CCIMInstanceList *)NULL); - } - cim_logDebug("cp_enumInstances_Solaris_PersistentShare", - "Returning non NULL instance list."); - return (instList); -} /* cp_enumInstances_Solaris_PersistentShare */ - -/* - * Name: cp_enumInstanceNames_Solaris_PersistentShare - * - * Description: Returns a list of instances if found. - * - * Parameters: - * dfstabOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMObjectPathList * if matched instance is found. Otherwise, NULL. - */ -CCIMInstanceList * -cp_enumInstanceNames_Solaris_PersistentShare(CCIMObjectPath *dfstabOP) { - CCIMInstanceList *instList; - CCIMObjectPathList *OPList; - CCIMException *ex; - int err; - - /* - * First check if the CCIMObjectPath parameter is null. - */ - if (dfstabOP == NULL) { - util_handleError("SOLARIS_PERSISTSHARE::ENUM_INSTANCENAMES", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMObjectPathList *)NULL); - } - instList = cp_enumInstances_Solaris_PersistentShare(dfstabOP); - if (instList == NULL) { - /* - * Failure...or there are no dfstab instances. - */ - return ((CCIMObjectPathList *)NULL); - } - - OPList = cim_createObjectPathList(instList); - if (OPList == NULL) { - /* - * Error encountered - */ - ex = cim_getLastError(); - util_handleError( - "SOLARIS_DFSTABEMTRY::ENUM_INSTANCENAMES", - CIM_ERR_FAILED, CREATE_OBJECT_LIST_FAILURE, ex, &err); - cim_freeInstanceList(instList); - return (NULL); - } - - cim_freeInstanceList(instList); - return (OPList); -} /* cp_enumInstanceNames_Solaris_PersistentShare */ - - -/* - * Name: cp_getInstance_Solaris_PersistentShare - * - * Description: Returns an instance which matches the passed in object path - * if found. - * - * Parameters: - * dfstabOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ -CCIMInstance * -cp_getInstance_Solaris_PersistentShare(CCIMObjectPath *dfstabOP) { - CCIMInstanceList *instList; - CCIMInstance *inst; - CCIMException *ex; - int err = 0; - - /* - * First check to see if the object path is null - */ - if (dfstabOP == NULL) { - util_handleError("SOLARIS_PERSISTSHARE::GET_INSTANCE", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstance *)NULL); - } - - instList = cp_enumInstances_Solaris_PersistentShare(dfstabOP); - if (instList == NULL) { - /* - * Either an error occurred or we simply don't have any - * instances of Solaris_PersistentShare on the system. In the - * case, that an error occurred, it will be handled in - * cp_enumInstances_Solaris_PersistentShare. - */ - return ((CCIMInstance *)NULL); - } - - inst = cim_getInstance(instList, dfstabOP); - if (inst == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_PERSISTSHARE::GET_INSTANCE", - CIM_ERR_INVALID_PARAMETER, GET_INSTANCE_FAILURE, - ex, &err); - cim_freeInstanceList(instList); - return ((CCIMInstance *)NULL); - } - cim_freeInstanceList(instList); - return (inst); -} /* cp_getInstance_Solaris_PersistentShare */ - -/* - * cp_setInstance not supported - */ -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_PersistentShare(CCIMObjectPath *pOP, - CCIMInstance *pInst, char **props, int num_props) { - - int err = 0; - - util_handleError("SOLARIS_PERSISTSHARE::SET_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_setInstance_Solaris_PersistentShare */ - -/* - * cp_setProperty not supported - */ -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_PersistentShare(CCIMObjectPath *pOP, - CCIMInstance *pInst, char **props, int num_props) { - int err = 0; - - util_handleError("SOLARIS_PERSISTSHARE::SET_PROPERTY", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_setProperty_Solaris_PersistentShare */ - -/* - * Method: cp_setInstanceWithList_Solaris_PersistentShare - * - * Description: This method is used to edit or change a dfstab entry. - * - * Parameters: - * - CCIMObjectPath *dfstabOP - The object path containing the name - * of the class of which to set the instance. - * - CCIMInstance *dfstabInst - The instance containg the information - * of the dfstab entry that will be changed. - * - char **props - Not used. - * - int num_props - Not used. - * - * Returns: - * - cim_true if successful. If an error accures cim_false is returned. - */ -/* ARGSUSED */ -CIMBool -cp_setInstanceWithList_Solaris_PersistentShare(CCIMObjectPath *dfstabOP, - CCIMInstance *dfstabInst, char **props, int num_props) { - - int err = 0; - CCIMProperty *dfstab_prop; - CCIMInstance *fsDfstab_inst; /* XXXX original instance */ - CCIMObjectPath *fsDfstab_OP; - char *new_cmd_value; - - - if (dfstabOP == NULL || dfstabInst == NULL) { - util_handleError("SOLARIS_PERSISTSHARE::SET_INSTANCE", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return (cim_false); - } - - fsDfstab_OP = cim_createObjectPath(dfstabInst); - if (fsDfstab_OP == NULL) { - util_handleError("SOLARIS_PERSISTSHARE::SET_INSTANCE", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return (cim_false); - } - fsDfstab_inst = - cp_getInstance_Solaris_PersistentShare(fsDfstab_OP); - if (fsDfstab_inst == NULL) { - util_handleError("SOLARIS_PERSISTSHARE::SET_INSTANCE", - CIM_ERR_FAILED, CIMOM_GET_INST_FAILURE, NULL, &err); - return (cim_false); - } - - dfstab_prop = cim_getProperty(fsDfstab_inst, - nfsPersistProps[SETTINGID].name); - if (dfstab_prop == NULL) { - return (cim_false); - } else { - int path_count = - fs_check_for_duplicate_DFStab_paths( - dfstab_prop->mValue, &err); - if (path_count > 1 || path_count == -1) { - util_handleError( - "SOLARIS_PERSISTSHARE::SET_INSTANCE", - CIM_ERR_FAILED, FS_CHECK_DUP_PATHS, - NULL, &err); - return (cim_false); - } - } - - dfstab_prop = cim_getProperty(fsDfstab_inst, - nfsPersistProps[COMMAND].name); - if (dfstab_prop == NULL) { - return (cim_false); - } - - new_cmd_value = strdup(dfstab_prop->mValue); - if (new_cmd_value == NULL) { - err = ENOMEM; - util_handleError("SOLARIS_PERSISTSHARE::SET_INSTANCE", - CIM_ERR_LOW_ON_MEMORY, LOW_MEMORY, NULL, &err); - return (cim_false); - } - - dfstab_prop = cim_getProperty(dfstabInst, - nfsPersistProps[COMMAND].name); - if (dfstab_prop == NULL) { - util_handleError("SOLARIS_PERSISTSHARE::SET_INSTANCE", - CIM_ERR_FAILED, GET_PROPERTY_FAILURE, NULL, &err); - cim_freeInstance(fsDfstab_inst); - free(new_cmd_value); - return (cim_false); - } else { - fs_dfstab_entry_t dfstab_ent_list; - char *cmd_value = NULL; - cmd_value = strdup(dfstab_prop->mValue); - if (cmd_value == NULL) { - /* - * Out of memory - */ - err = ENOMEM; - util_handleError("SOLARIS_PERSISTSHARE::SET_INSTANCE", - CIM_ERR_LOW_ON_MEMORY, LOW_MEMORY, NULL, &err); - return (cim_false); - } - - if ((dfstab_ent_list = fs_edit_DFStab_ent(cmd_value, - new_cmd_value, &err)) == NULL) { - util_handleError("SOLARIS_PERSISTSHARE::SET_INSTANCE", - CIM_ERR_FAILED, FS_EDIT_DFSTAB_ENT_FAILURE, - NULL, &err); - return (cim_false); - } - - fs_free_DFStab_ents(dfstab_ent_list); - free(cmd_value); - free(new_cmd_value); - cim_freeInstance(fsDfstab_inst); - } - return (cim_true); -} /* cp_setInstanceWithList_Solaris_PersistentShare */ - -/* - * Name: cp_createInstance_Solaris_PersistentShare - * Description: A create instance will actually add an entry to - * /etc/dfs/dfstab in the current host by calling - * the fs_dfstab interface's fs_set_DFStab_ent - * function. - * Parameters: - * dfstabOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * dfstabInst - an instance that contains the properties for the share - * to be created. - * Returns: - * CCIMObjectPath * - Object path containing the new instance. On - * failure NULL is returned. - */ -CCIMObjectPath * -cp_createInstance_Solaris_PersistentShare(CCIMObjectPath *dfstabOP, - CCIMInstance *dfstabInst) { - - char *cmd = NULL; - int err = 0; - CCIMProperty *dfstab_prop; - CCIMInstance *fsDfstab_inst; - CCIMObjectPath *fsDfstab_OP; - CCIMException *ex; - fs_dfstab_entry_t dfstab_ent_list; - - if (dfstabOP == NULL || dfstabInst == NULL) { - util_handleError("SOLARIS_PERSISTSHARE::CREATE_INSTANCE", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMObjectPath *)NULL); - } - - dfstab_prop = cim_getProperty(dfstabInst, - nfsPersistProps[COMMAND].name); - if (dfstab_prop != NULL) { - CCIMProperty *dfsProp; - - cmd = strdup(dfstab_prop->mValue); - if (cmd == NULL) { - /* - * Out of memory - */ - err = ENOMEM; - util_handleError("SOLARIS_PERSISTSHARE::SET_INSTANCE", - CIM_ERR_LOW_ON_MEMORY, LOW_MEMORY, NULL, &err); - cim_freeProperty(dfstab_prop); - return ((CCIMObjectPath *)NULL); - } else if (strlen(cmd) == NULL) { - util_handleError( - "SOLARIS_PERSISTSHARE::CREATE_INSTANCE", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - cim_freeProperty(dfstab_prop); - return ((CCIMObjectPath *)NULL); - } - - dfsProp = cim_getProperty(dfstabInst, - nfsPersistProps[SETTINGID].name); - if (dfsProp == NULL) { - util_handleError("SOLARIS_PERSISTSHARE::SET_INSTANCE", - CIM_ERR_FAILED, GET_PROPERTY_FAILURE, NULL, &err); - free(cmd); - return ((CCIMObjectPath *)NULL); - } - if (fs_check_for_duplicate_DFStab_paths(dfsProp->mValue, - &err) == 0) { - - dfstab_ent_list = fs_add_DFStab_ent(cmd, &err); - if (dfstab_ent_list == NULL) { - util_handleError( - "SOLARIS_PERSISTSHARE::CREATE_INSTANCE", - CIM_ERR_FAILED, FS_ADD_DFSTAB_ENT_FAILURE, - NULL, &err); - free(cmd); - return ((CCIMObjectPath *)NULL); - } - fs_free_DFStab_ents(dfstab_ent_list); - } else { - util_handleError( - "SOLARIS_PERSISTSHARE::CREATE_INSTANCE", - CIM_ERR_FAILED, FS_CHECK_DUP_PATHS, NULL, &err); - free(cmd); - return ((CCIMObjectPath *)NULL); - } - } - free(cmd); - - fsDfstab_inst = cp_getInstance_Solaris_PersistentShare(dfstabOP); - if (fsDfstab_inst == NULL) { - /* - * The dfstab instance was not found there for the create - * instance failed. - */ - return ((CCIMObjectPath *)NULL); - } - fsDfstab_OP = cim_createObjectPath(fsDfstab_inst); - if (fsDfstab_OP == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_PERSISTSHARE::CREATE_INSTANCE", - CIM_ERR_FAILED, CREATE_OBJECT_PATH_FAILURE, ex, &err); - cim_freeInstance(fsDfstab_inst); - return ((CCIMObjectPath *)NULL); - } - - cim_freeInstance(fsDfstab_inst); - return (fsDfstab_OP); -} /* cp_createInstance_Solaris_PersistentShare */ - -/* - * Name: cp_deleteInstance_Solaris_NFSShare - * - * Description: The delete instance will remove the specified line from dfstab - * on the current host by calling - * cmd_execute_command_and_retrieve_string() from the cmd - * interface. - * - * Parameters: - * dfstabOP - An CCIMObjectPath * - The object path corresponding to the - * instance to be removed. - * Returns: - * CIMBool - Returns cim_true on successful completion. On failure - * cim_false is returned. - */ -CIMBool -cp_deleteInstance_Solaris_PersistentShare(CCIMObjectPath *dfstabOP) { - char *cmd = NULL; - int err = 0; - int len; - CCIMProperty *dfstab_prop; - CCIMInstance *fsDfstab_inst; - CCIMException *ex; - fs_dfstab_entry_t dfstab_ent_list; - - if (dfstabOP == NULL) { - util_handleError("SOLARIS_PERSISTSHARE::CREATE_INSTANCE", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return (cim_false); - } - - fsDfstab_inst = cp_getInstance_Solaris_PersistentShare(dfstabOP); - if (fsDfstab_inst == NULL) { - /* - * The dfstab instance was not found therefore it can't - * be deleted. - */ - return (cim_false); - } - - dfstab_prop = cim_getProperty(fsDfstab_inst, - nfsPersistProps[COMMAND].name); - if (dfstab_prop != NULL) { - cmd = strdup(dfstab_prop->mValue); - if (cmd == NULL) { - /* - * Out of memory - */ - err = ENOMEM; - util_handleError( - "SOLARIS_PERSISTSHARE::CREATE_INSTANCE", - CIM_ERR_LOW_ON_MEMORY, LOW_MEMORY, NULL, &err); - return (cim_false); - } else { - int path_count = 0; - cim_freeProperty(dfstab_prop); - dfstab_prop = cim_getProperty(fsDfstab_inst, - nfsPersistProps[SETTINGID].name); - if (dfstab_prop == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_PERSISTSHARE::CREATE_INSTANCE", - CIM_ERR_FAILED, GET_PROPERTY_FAILURE, - ex, &err); - return (cim_false); - } - path_count = - fs_check_for_duplicate_DFStab_paths( - dfstab_prop->mValue, &err); - if (path_count > 1 || path_count == -1) { - util_handleError( - "SOLARIS_PERSISTSHARE::SET_INSTANCE", - CIM_ERR_INVALID_PARAMETER, - FS_CHECK_DUP_PATHS, NULL, &err); - free(cmd); - cim_freeProperty(dfstab_prop); - return (cim_false); - } - } - cim_freeProperty(dfstab_prop); - - /* - * We're stripping the return char off the end of cmd. - * fs_del_DFStab_ent expects to have no \n at the end - * of the line. The call to cim_getProperty() for the cmd - * will always return the command string with a \n. - */ - len = strlen(cmd); - cmd[len - 1] = '\0'; - dfstab_ent_list = fs_del_DFStab_ent(cmd, &err); - if (dfstab_ent_list == NULL && err != 0) { - util_handleError( - "SOLARIS_PERSISTSHARE::CREATE_INSTANCE", - CIM_ERR_FAILED, FS_DEL_DFSTAB_ENT_FAILURE, - NULL, &err); - free(cmd); - return (cim_false); - } - fs_free_DFStab_ents(dfstab_ent_list); - free(cmd); - } - cim_freeInstance(fsDfstab_inst); - return (cim_true); -} /* cp_deleteInstance_Solaris_PersistentShare */ - -/* - * Name: cp_execQuery_Solaris_PersistentShare - * - * Description: Builds a list of all instances, prepends the list with an - * empty instance, and returns the instance list. The CIMOM - * interprets the initial empty instance to mean that it has - * to do the filtering. The caller is responsible for freeing - * the memory allocated for the returned object. - * - * Parameters: - * CCIMObjectPath *dfstabOP - An objectpath which represents the class to - * work on - * char *electClause - The select clause - * char *nonJoinExp - The non join expression - * char *queryExp - The query Expression - * char *queryLang - The Query Language used (s/b "WQL") - * - * Returns: - * Returns the prepended instance list. On error NULL is returned. - */ -/* ARGSUSED */ -CCIMInstanceList * -cp_execQuery_Solaris_PersistentShare(CCIMObjectPath *dfstabOP, - char *selectClause, char *nonJoinExp, char *queryExp, char *queryLang) { - - CCIMInstance *emptyInst; - CCIMInstanceList *fsDfstabInstList; - CCIMInstanceList *result; - CCIMException *ex; - int err = 0; - - if (dfstabOP == NULL) { - util_handleError("SOLARIS_PERSISTSHARE::EXEC_QUERY", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMInstanceList *)NULL); - } - - fsDfstabInstList = cp_enumInstances_Solaris_PersistentShare(dfstabOP); - if (fsDfstabInstList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_PERSISTSHARE::EXEC_QUERY", - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, &err); - return ((CCIMInstanceList *)NULL); - } - - result = cim_prependInstance(fsDfstabInstList, emptyInst); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError("SOLARIS_PERSISTSHARE::EXEC_QUERY", - CIM_ERR_FAILED, PREPEND_INSTANCE_FAILURE, ex, &err); - cim_freeInstance(emptyInst); - cim_freeInstanceList(fsDfstabInstList); - return ((CCIMInstanceList *)NULL); - } - - return (result); -} /* cp_execQuery_Solaris_PersistentShare */ - -/* - * Provider methods - */ -/* - * Method: cp_invokeMethod_Solaris_PersistentShare - * - * Description: cp_invokeMethod_Solaris_PersistentShare calls to the - * correct Solaris_PersistentShare method. In this case the only method - * available is del_all_with_duplicate_path(). Thsi method checks the - * dfstab file for entries with the same path any found are removed. - * - * Parameters: - * - CCIMObjectPath *pOP - The object path containing needed information - * about the class that is to getting methods invoked. - * - cimchar *functionName - The name of the function to be invoked. - * - CCIMPropertyList *inParams - The input parameters to the function. - * - CCIMPropertyList *outParams - The output parameters from the function. - * - * Returns: - * - A pointer to a property which indicates success or failure of the - * function. 1 for success, 0 for failure. - * - Upon error, NULL is returned and the error is logged. - */ -/* ARGSUSED */ -CCIMProperty * -cp_invokeMethod_Solaris_PersistentShare(CCIMObjectPath *pOP, - cimchar *functionName, CCIMPropertyList *inParams, - CCIMPropertyList *outParams) { - - int err = 0; - CCIMProperty *retVal; - - /* - * Make sure the proper method is being called. - */ - if (strcasecmp(functionName, DEL_ALL_WITH_DUPLICATE_PATH) == 0) { - retVal = del_all_with_duplicate_path(inParams); - } else { - /* - * No such method name. - */ - util_handleError("SOLARIS_PERSISTSHARE::INVOKE_METHOD", - CIM_ERR_FAILED, NO_SUCH_METHOD, NULL, &err); - return (cim_createProperty("Status", sint32, "0", NULL, - cim_false)); - } - - return (retVal); -} /* cp_invokeMethod_Solaris_PersistentShare */ - - -/* - * Private Methods - */ -/* - * create_persistentShare_InstList - * - * Creates the Solaris_NFSShareSecurity instance list from information - * gathered from the shares on the system. The instance list is returned. - */ -static CCIMInstanceList * -create_persistentShare_InstList( - fs_dfstab_entry_t persistentShareList, - int *err) { - - fs_dfstab_entry_t fs_dfstab_ent; - CCIMInstanceList *fsDfstabInstList; - CCIMException *ex; - struct utsname hostname; - - - cim_logDebug("create_persistentShare_InstList", - "Entering function"); - - /* - * retrieve system name - */ - (void) uname(&hostname); - *err = errno; - if (*err != 0) { - util_handleError( - "SOLARIS_PERSISTSHARE::CREATE_INSTLIST", - CIM_ERR_FAILED, GET_HOSTNAME_FAILURE, NULL, err); - return ((CCIMInstanceList *)NULL); - } - - /* - * At this point, one or more dfstab entries were found on the - * system, create the instance list from the fs_dfstab_ent. - */ - fsDfstabInstList = cim_createInstanceList(); - if (fsDfstabInstList == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_PERSISTSHARE::CREATE_INSTLIST", - CIM_ERR_FAILED, CREATE_INSTANCE_LIST_FAILURE, - ex, err); - return ((CCIMInstanceList *)NULL); - } - - /* - * Loop through the dfstab entries to retrieve their properties - * and create an instance list containing all these entries and - * their properties. - */ - fs_dfstab_ent = persistentShareList; - while (fs_dfstab_ent != NULL) { - CCIMInstance *solaris_Dfstab_instance; - CCIMPropertyList *solaris_Dfstab_prop_list; - - /* - * Create the Solaris_PersistentShare CCIMInstance - */ - solaris_Dfstab_instance = - cim_createInstance(SOLARIS_PERSISTSHARE); - if (solaris_Dfstab_instance == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_PERSISTSHARE::CREATE_INSTLIST", - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, - ex, err); - return ((CCIMInstanceList *)NULL); - } - - solaris_Dfstab_prop_list = - populate_Solaris_PersistentShare_property_list( - hostname.nodename, fs_dfstab_ent); - if (solaris_Dfstab_prop_list == NULL) { - /* - * populatePropertyList already logged this - * error so there is no need to log it here. - */ - cim_freeInstance(solaris_Dfstab_instance); - return ((CCIMInstanceList *)NULL); - } - - /* - * Add the property list to the instance - */ - solaris_Dfstab_instance = - cim_addPropertyListToInstance( - solaris_Dfstab_instance, - solaris_Dfstab_prop_list); - if (solaris_Dfstab_instance == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_PERSISTSHARE::CREATE_INSTLIST", - CIM_ERR_FAILED, PROPLIST_TO_INSTANCE_FAILURE, - ex, err); - cim_freePropertyList(solaris_Dfstab_prop_list); - return ((CCIMInstanceList *)NULL); - } - - /* - * Add the instance to the instance list - */ - fsDfstabInstList = cim_addInstance(fsDfstabInstList, - solaris_Dfstab_instance); - if (fsDfstabInstList == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_PERSISTSHARE::CREATE_INSTLIST", - CIM_ERR_FAILED, ADD_INSTANCE_FAILURE, - ex, err); - cim_freeInstance(solaris_Dfstab_instance); - return ((CCIMInstanceList *)NULL); - } - fs_dfstab_ent = fs_get_DFStab_ent_Next(fs_dfstab_ent); - } /* while (fs_dfstab_ent != NULL) */ - - cim_logDebug("create_persistentShare_InstList", - "returning instance list"); - return (fsDfstabInstList); -} /* create_persistentShare_InstList */ - - -/* - * Enumerate the nfs shares by using the fs_shares fs_get_share_list - * method - */ -static CCIMInstanceList * -enumerate_dfstab() { - - int err = 0; - fs_dfstab_entry_t fs_dfstab_ent; - - cim_logDebug("enumerate_dfstab", "Just entering..."); - - fs_dfstab_ent = fs_get_DFStab_ents(&err); - if (fs_dfstab_ent == NULL) { - /* - * Check whether an error was returned or if we simply don't - * have any dfstab entries on the system. If err is not - * equal to 0, an error was encountered. - */ - if (err != 0) { - cim_logDebug("enumerate_dfstab", "An error occurred " \ - "while getting the dfstab entries"); - /* - * Determine the error and log it. - */ - if (err == ENOMEM || err == EAGAIN) { - util_handleError( - "SOLARIS_PERSISTSHARE::ENUM_INSTANCES", - CIM_ERR_LOW_ON_MEMORY, LOW_MEMORY, - NULL, &err); - return ((CCIMInstanceList *)NULL); - } else { - - /* - * If any other errors were encountered it - * can be handled as a general error. We may - * not know exactly what the error is. - */ - util_handleError( - "SOLARIS_PERSISTSHARE::ENUM_INSTANCES", - CIM_ERR_FAILED, FS_GET_DFSTAB_ENT_FAILURE, - NULL, &err); - return ((CCIMInstanceList *)NULL); - } - } - /* - * There are no nfs shares on the host. - */ - cim_logDebug("enumerate_dfstab", - "There are no dfstab entries on the host. Returning NULL"); - return ((CCIMInstanceList *)NULL); - - } else { - - CCIMInstanceList *fsDfstabInstList; - - fsDfstabInstList = - create_persistentShare_InstList(fs_dfstab_ent, &err); - - fs_free_DFStab_ents(fs_dfstab_ent); - - cim_logDebug("enumerate_dfstab", "Returning the instance list"); - return (fsDfstabInstList); - } -} /* enumerate_dfstab */ - -/* - * populate_Solaris_PersistentShare_property_list - * Populates the property list with the share information for each - * instance in the instance list. Returns the instance list. - */ -static CCIMPropertyList * -populate_Solaris_PersistentShare_property_list( - char *hostname, - fs_dfstab_entry_t fs_dfstab_ents) { - - CCIMException *ex; - CCIMPropertyList *fsDfstabPropList; - char propValues[PROPCOUNT][MAXSIZE]; - int i, err = 0; - - cim_logDebug("populate_Solaris_PersistentShare_property_list", - "Just entring..."); - - fsDfstabPropList = cim_createPropertyList(); - if (fsDfstabPropList == NULL) { - ex = cim_getLastError(); - util_handleError( - "SOLARIS_PERSISTSHARE::POPULATE_PROPLIST", - CIM_ERR_FAILED, CREATE_PROPLIST_FAILURE, - ex, &err); - return ((CCIMPropertyList *)NULL); - } - - /* - * Create the CCIMProperties for this instance - */ - - populate_Solaris_PersistentShare_property_values(hostname, - fs_dfstab_ents, propValues, &err); - if (err != 0) { - cim_freePropertyList(fsDfstabPropList); - fsDfstabPropList = NULL; - } else { - for (i = 0; i < PROPCOUNT; i++) { - fsDfstabPropList = add_property_to_list( - nfsPersistProps[i].name, nfsPersistProps[i].type, - propValues[i], NULL, nfsPersistProps[i].isKey, - fsDfstabPropList); - if (fsDfstabPropList == NULL) { - break; - } - } - } - cim_logDebug("populate_Solaris_NFSShareSecurity_property_list", - "Returning property list"); - return (fsDfstabPropList); -} /* populate_Solaris_PersistentShare_property_list */ - -/* - * populate_Solaris_NFSShare_property_Values - * Populates the property array for use in the populate_property_list function - */ -static void -populate_Solaris_PersistentShare_property_values( - char *hostname, - fs_dfstab_entry_t fs_dfstab_ents, - cimchar propValues[PROPCOUNT][MAXSIZE], - int *err) { - - char *optValue; - - cim_logDebug("populate_Solaris_PersistentShare_property_values", - "Just entring..."); - - /* - * Key - System name - */ - (void) snprintf(propValues[SYSTEMNAME], MAXSIZE, "%s", - hostname); - - /* - * Get the dfstab entry string - */ - optValue = fs_get_Dfstab_share_cmd(fs_dfstab_ents, err); - - if (*err == 0) { - (void) snprintf(propValues[COMMAND], MAXSIZE, "%s", optValue); - free(optValue); - } else { - *err = EINVAL; - return; - } - - /* - * Key - creation class name - */ - (void) snprintf(propValues[CREATIONCLASSNAME], MAXSIZE, "%s", - SOLARIS_PERSISTSHARE); - - /* - * Key - Shared Path - */ - optValue = fs_get_DFStab_ent_Path(fs_dfstab_ents); - if (optValue != NULL) { - (void) snprintf(propValues[SETTINGID], MAXSIZE, "%s", optValue); - } else { - *err = EINVAL; - return; - } - - /* - * Key - System Creation class name - */ - (void) snprintf(propValues[SYSTEMCREATIONCLASSNAME], MAXSIZE, "%s", - SOLARIS_CS); - - cim_logDebug("populate_Solaris_PersistentShare_property_values", - "Returning"); - -} /* populate_Solaris_PersistentShare_property_values */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_PersistentShare.h b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_PersistentShare.h deleted file mode 100644 index f108cd8740..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_PersistentShare.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOLARIS_PERSISTENTSHARE_H -#define _SOLARIS_PERSISTENTSHARE_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> -#include <cp_required.h> -#include <cp_instance.h> -#include <cp_associator.h> -#include <cp_method.h> -#include <cp_property.h> -#include "nfsprov_include.h" - -static nfs_prov_prop_t nfsPersistProps[] = { - -#define COMMAND 0 - {"Command", cim_false, string}, - -#define CREATIONCLASSNAME (COMMAND + 1) - {"CreationClassName", cim_true, string}, - -#define SETTINGID (CREATIONCLASSNAME + 1) - {"SettingID", cim_true, string}, - -#define SYSTEMCREATIONCLASSNAME (SETTINGID + 1) - {"SystemCreationClassName", cim_true, string}, - -#define SYSTEMNAME (SYSTEMCREATIONCLASSNAME + 1) - {"SystemName", cim_true, string} -}; - -/* - * PROPCOUNT must be set using the last define in the nfsPersistProps list. - */ -#define PROPCOUNT (SYSTEMNAME + 1) - -#ifdef __cplusplus -} -#endif - -#endif /* _SOLARIS_PERSISTENTSHARE_H */ diff --git a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_ShareService.c b/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_ShareService.c deleted file mode 100644 index aec002dfc6..0000000000 --- a/usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_ShareService.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "nfsprov_methods.h" -#include "nfs_provider_names.h" -#include "util.h" -#include <cimapi.h> -#include <cp_method.h> - - -/* - * Constants - */ -#define SHAREALL "shareall" -#define UNSHAREALL "unshareall" - -/* - * Instance provider methods - */ -/* ARGSUSED */ -CCIMObjectPath * -cp_createInstance_Solaris_ShareService(CCIMObjectPath *pOP, - CCIMInstance *pInst) { - - int err = 0; - - util_handleError("SOLARIS_SHARESERV::CREATE_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return ((CCIMObjectPath *)NULL); -} /* cp_createInstance_Solaris_ShareService */ - -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_ShareService(CCIMObjectPath *pOP) { - int err = 0; - - util_handleError("SOLARIS_SHARESERV::DELETE_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_deleteInstance_Solaris_ShareService */ - -/* ARGSUSED */ -CCIMInstanceList * -cp_enumInstances_Solaris_ShareService(CCIMObjectPath *pOP) { - int err = 0; - - util_handleError("SOLARIS_SHARESERV::ENUM_INSTANCES", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return ((CCIMInstanceList *)NULL); -} /* cp_enumInstances_Solaris_ShareService */ - -/* ARGSUSED */ -CCIMObjectPathList * -cp_enumInstanceNames_Solaris_ShareService(CCIMObjectPath *pOP) { - int err = 0; - - util_handleError("SOLARIS_SHARESERV::ENUM_INSTANCENAMES", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return ((CCIMObjectPathList *)NULL); -} /* cp_enumInstanceNames_Solaris_ShareService */ - -/* ARGSUSED */ -CCIMInstanceList * -cp_execQuery_Solaris_ShareService(CCIMObjectPath *pOP, char *selectClause, - char *nonJoinExp, char *queryExp, char *queryLang) { - - int err = 0; - - util_handleError("SOLARIS_SHARESERV::EXEC_QUERY", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return ((CCIMInstanceList *)NULL); -} /* cp_execQuery_Solaris_ShareService */ - -/* ARGSUSED */ -CCIMInstance * -cp_getInstance_Solaris_ShareService(CCIMObjectPath *pOP) { - int err = 0; - - util_handleError("SOLARIS_SHARESERV::GET_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return ((CCIMInstance *)NULL); -} /* cp_getInstance_Solaris_ShareService */ - -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_ShareService(CCIMObjectPath *pOP, CCIMInstance *pInst) { - int err = 0; - - util_handleError("SOLARIS_SHARESERV::SET_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_setInstance_Solaris_ShareService */ - -/* ARGSUSED */ -CIMBool -cp_setInstanceWithList_Solaris_ShareService(CCIMObjectPath *pOP, - CCIMInstance *pInst, char **props, int num_props) { - - int err = 0; - - util_handleError("SOLARIS_SHARESERV::SET_INSTANCE", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_setInstanceWithList_Solaris_ShareService */ - -/* - * Property provider methods - */ -/* ARGSUSED */ -CCIMProperty * -cp_getProperty_Solaris_ShareService(CCIMObjectPath *pOP, cimchar *pPropName) { - int err = 0; - - util_handleError("SOLARIS_SHARESERV::GET_PROPERTY", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return ((CCIMProperty *)NULL); -} /* cp_getProperty_Solaris_ShareService */ - -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_ShareService(CCIMObjectPath *pOP, CCIMProperty *pProp) { - int err = 0; - - util_handleError("SOLARIS_SHARESERV::SET_PROPERTY", - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); - - return (cim_false); -} /* cp_setProperty_Solaris_ShareService */ - - -/* - * Method provider methods - */ - -/* - * Method: cp_invokeMethod_Solaris_ShareService - * - * Description: Routes the cp_invokeMethod_Solaris_ShareService calls to the - * correct Solaris_ShareService methods. - * - * Parameters: - * - CCIMObjectPath *pOP - The object path containing needed information - * about the class that is to getting methods invoked. - * - cimchar *functionName - The name of the function to be invoked. - * - CCIMPropertyList *inParams - The input parameters to the function - * - CCIMPropertyList *outParams - The output parameters from the function. - * - * Returns: - * - A pointer to a property which indicates success or failure of the - * function. 1 for success, 0 for failure. - * - Upon error, NULL is returned and the error is logged. - */ -/* ARGSUSED */ -CCIMProperty * -cp_invokeMethod_Solaris_ShareService(CCIMObjectPath *pOP, cimchar *functionName, - CCIMPropertyList *inParams, CCIMPropertyList *outParams) { - - CCIMProperty *retVal; - int err = 0; - - if (pOP == NULL) { - util_handleError("SOLARIS_SHARESERV::INVOKE_METHOD", - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); - return ((CCIMProperty *)NULL); - } - - /* - * Determine what method is being called. - */ - if (strcasecmp(functionName, SHAREALL) == 0) { - retVal = shareall(inParams); - } else if (strcasecmp(functionName, UNSHAREALL) == 0) { - retVal = unshareall(inParams); - } else { - util_handleError("SOLARIS_SHARESERV::INVOKE_METHOD", - CIM_ERR_FAILED, NO_SUCH_METHOD, NULL, &err); - return ((CCIMProperty *)NULL); - } - - return (retVal); -} /* cp_invokeMethod_Solaris_ShareService */ diff --git a/usr/src/cmd/wbem/provider/c/include/cimKeys.h b/usr/src/cmd/wbem/provider/c/include/cimKeys.h deleted file mode 100644 index 76a3e12bbd..0000000000 --- a/usr/src/cmd/wbem/provider/c/include/cimKeys.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _CIMKEYS_H -#define _CIMKEYS_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#define SYS_CREATION_CLASS "SystemCreationClassName" -#define CREATION_CLASS "CreationClassName" -#define SYSTEM "SystemName" -#define DEVICEID "DeviceID" -#define NAME "Name" -#define SYSTEM_ELEMENT "SystemElement" -#define SAME_ELEMENT "SameElement" -#define ANTECEDENT "Antecedent" -#define DEPENDENT "Dependent" -#define GROUP "GroupComponent" -#define PART "PartComponent" -#define TAG "Tag" - -#ifdef __cplusplus -} -#endif - -#endif /* _CIMKEYS_H */ diff --git a/usr/src/cmd/wbem/provider/c/include/ctrl_descriptors.h b/usr/src/cmd/wbem/provider/c/include/ctrl_descriptors.h deleted file mode 100644 index b4ea23146a..0000000000 --- a/usr/src/cmd/wbem/provider/c/include/ctrl_descriptors.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _CTRL_DESCRIPTORS_H -#define _CTRL_DESCRIPTORS_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <sys/types.h> -#include <cimapi.h> -#include <cimprovider.h> -#include "libdiskmgt.h" - -CCIMInstance *ctrl_descriptor_toCCIMInstance(char *hostName, - dm_descriptor_t dp, char *providerName, int *errp); - -CCIMInstanceList *ctrl_descriptors_toCCIMInstanceList( - char *providerName, dm_descriptor_t *dp, int *errp, - int, ...); - - -#ifdef __cplusplus -} -#endif - -#endif /* _CTRL_DESCRIPTORS_H */ diff --git a/usr/src/cmd/wbem/provider/c/include/disk_descriptors.h b/usr/src/cmd/wbem/provider/c/include/disk_descriptors.h deleted file mode 100644 index 08e3b56619..0000000000 --- a/usr/src/cmd/wbem/provider/c/include/disk_descriptors.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _DISK_DESCRIPTORS_H -#define _DISK_DESCRIPTORS_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <sys/types.h> -#include <cimapi.h> -#include <cimprovider.h> -#include "libdiskmgt.h" - -CCIMInstance *disk_descriptor_toCCIMInstance(char *hostName, - dm_descriptor_t dp, char *providerName, int *errp); - -CCIMInstanceList *disk_descriptors_toCCIMInstanceList( - char *providerName, dm_descriptor_t *dp, int *errp); - - -#ifdef __cplusplus -} -#endif - -#endif /* _DISK_DESCRIPTORS_H */ diff --git a/usr/src/cmd/wbem/provider/c/include/drive_descriptors.h b/usr/src/cmd/wbem/provider/c/include/drive_descriptors.h deleted file mode 100644 index 75a31ec3bf..0000000000 --- a/usr/src/cmd/wbem/provider/c/include/drive_descriptors.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _DRIVE_DESCRIPTORS_H -#define _DRIVE_DESCRIPTORS_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <sys/types.h> -#include <cimapi.h> -#include <cimprovider.h> -#include "libdiskmgt.h" - -#define DRVTYPE "drvtype" -#define STATUS "status" - -CCIMInstance *drive_descriptor_toCCIMInstance(char *hostName, - dm_descriptor_t dp, char *providerName, int *errp); - -CCIMInstanceList *drive_descriptors_toCCIMInstanceList( - char *providerName, dm_descriptor_t *dp, int *errp); - -/* - * Function for use in association providers to get filtered drives. - * Convert the descriptor list to a CIMInstanceList that will be used - * only for object paths and thus does not need to be fully populated. - * We do the filtering in this function to be sure that we are only - * returning drives that are modeled with this class in CIM. - */ -CCIMInstanceList *drive_descriptors_toCCIMObjPathInstList( - char *providerName, dm_descriptor_t *dp, int *errp); - -#ifdef __cplusplus -} -#endif - -#endif /* _DRIVE_DESCRIPTORS_H */ diff --git a/usr/src/cmd/wbem/provider/c/include/logicaldisk_descriptors.h b/usr/src/cmd/wbem/provider/c/include/logicaldisk_descriptors.h deleted file mode 100644 index 69290a2ba4..0000000000 --- a/usr/src/cmd/wbem/provider/c/include/logicaldisk_descriptors.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _LOGICAL_DISKDESCRIPTORS_H -#define _LOGICAL_DISKDESCRIPTORS_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <sys/types.h> -#include <cimapi.h> -#include <cimprovider.h> -#include "libdiskmgt.h" - -CCIMInstance *logicaldisk_descriptor_toCCIMInstance(char *hostName, - dm_descriptor_t dp, char *providerName, int *errp); - -CCIMInstanceList *logicaldisk_descriptors_toCCIMInstanceList( - char *providerName, dm_descriptor_t *dp, int *errp); - - -#ifdef __cplusplus -} -#endif - -#endif /* _LOGICAL_DISKDESCRIPTORS_H */ diff --git a/usr/src/cmd/wbem/provider/c/include/mediapresent_descriptors.h b/usr/src/cmd/wbem/provider/c/include/mediapresent_descriptors.h deleted file mode 100644 index d959c2126c..0000000000 --- a/usr/src/cmd/wbem/provider/c/include/mediapresent_descriptors.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _MEDIAPRESENT_DESCRIPTORS_H -#define _MEDIAPRESENT_DESCRIPTORS_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <sys/types.h> -#include <cimapi.h> -#include <cimprovider.h> -#include "libdiskmgt.h" - - -CCIMInstance *mediapresent_descriptor_toCCIMInstance(char *hostName, - dm_descriptor_t ant, dm_descriptor_t dep, - char *providerName, int *errp); - -#ifdef __cplusplus -} -#endif - -#endif /* _MEDIAPRESENT_DESCRIPTORS_H */ diff --git a/usr/src/cmd/wbem/provider/c/include/messageStrings.h b/usr/src/cmd/wbem/provider/c/include/messageStrings.h deleted file mode 100644 index d62032fb82..0000000000 --- a/usr/src/cmd/wbem/provider/c/include/messageStrings.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002-2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _MESSAGESTRINGS_H -#define _MESSAGESTRINGS_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * dgettext is normally defined by including libintl.h. However, the file - * /usr/sadm/lib/wbem/include/cimapi.h erroneously defines gettext so that - * they can play games with L10N in the CIM functions. If we try to undef - * gettext before we include libintl.h we get a complaint from hdrchk. So, - * just declare the extern here to work around this mess. - */ -extern char *dgettext(const char *, const char *); - -/* cim failures */ -#define CREATE_PROPERTY_FAILURE \ - util_routineFailureMessage("cim_createProperty") -#define ADD_PROPERTY_FAILURE \ - util_routineFailureMessage("cim_addProperty") -#define ADD_INSTANCE_FAILURE \ - util_routineFailureMessage("cim_addInstance") -#define GET_INSTANCE_FAILURE \ - util_routineFailureMessage("cim_getInstance") -#define CREATE_INSTANCE_LIST_FAILURE \ - util_routineFailureMessage("cim_createInstanceList") -#define CREATE_INSTANCE_FAILURE \ - util_routineFailureMessage("cim_createInstance") -#define CREATE_OBJECT_LIST_FAILURE \ - util_routineFailureMessage("cim_createObjectPathList") -#define CREATE_OBJECT_PATH_FAILURE \ - util_routineFailureMessage("cim_createObjectPath") -#define ENUM_INSTANCES_FAILURE \ - util_routineFailureMessage("cim_enumerateInstances") -#define ENUM_INSTANCENAMES_FAILURE \ - util_routineFailureMessage("cim_enumerateInstanceNames") -#define COPY_OBJPATH_FAILURE \ - util_routineFailureMessage("cim_copyObjectPath") -#define CREATE_REFPROP_FAILURE \ - util_routineFailureMessage("cim_createReferenceProperty") -#define ASSOCIATOR_NAMES_FAILURE \ - util_routineFailureMessage("cim_associatorNames") - -/* dm api failures */ -#define DM_GET_ATTR_FAILURE \ - util_routineFailureMessage("dm_get_attributes") -#define DM_GET_NAME_FAILURE \ - util_routineFailureMessage("dm_get_name") -#define DM_GET_ASSOC_FAILURE \ - util_routineFailureMessage("dm_get_associated_descriptors") -#define DM_GET_DESC_BYNAME_FAILURE \ - util_routineFailureMessage("dm_get_descriptor_by_name") -#define DM_GET_DESCRIPTORS \ - util_routineFailureMessage("dm_get_descriptors") - -/* descriptor function failures */ -#define DRIVE_DESC_TO_INSTANCE_FAILURE \ - util_routineFailureMessage("drive_descriptor_toCCIMInstance") -#define PART_DESC_TO_INSTANCE_FAILURE \ - util_routineFailureMessage("partition_descriptor_toCCIMInstance") -#define DISK_DESC_TO_INSTANCE_FAILURE \ - util_routineFailureMessage("disk_descriptor_toCCIMInstance") -#define LOGICALDISK_DESC_TO_INSTANCE_FAILURE \ - util_routineFailureMessage("logicaldisk_descriptor_toCCIMInstance") -#define SCSICTRL_DESC_TO_INSTANCE_FAILURE \ - util_routineFailureMessage("scsictrl_descriptor_toCCIMInstance") -#define IDECTRL_DESC_TO_INSTANCE_FAILURE \ - util_routineFailureMessage("idectrl_descriptor_toCCIMInstance") -#define USBCTRL_DESC_TO_INSTANCE_FAILURE \ - util_routineFailureMessage("usbctrl_descriptor_toCCIMInstance") -#define FCCTRL_DESC_TO_INSTANCE_FAILURE \ - util_routineFailureMessage("fcctrl_descriptor_toCCIMInstance") -#define MPXIOCTRL_DESC_TO_INSTANCE_FAILURE \ - util_routineFailureMessage("mpxioctrl_descriptor_toCCIMInstance") -#define UCTRL_DESC_TO_INSTANCE_FAILURE \ - util_routineFailureMessage("unknownctrl_descriptor_toCCIMInstance") -#define MPXIOGRP_DESC_TO_INSTANCE_FAILURE \ - util_routineFailureMessage("mpxiogroup_descriptor_toCCIMInstance") -#define PARTBASEDON_DESC_TO_INSTANCE_FAILURE \ - util_routineFailureMessage("diskpartbo_descriptor_toCCIMInstance") -#define REALIZESEXT_DESC_TO_INSTANCE_FAILURE \ - util_routineFailureMessage("realizesextent_descriptor_toCCIMInstance") -#define REALIZESDD_DESC_TO_INSTANCE_FAILURE \ - util_routineFailureMessage( \ - "realizesdiskdrive_descriptor_toCCIMInstance") -#define MEDIAPRES_DESC_TO_INSTANCE_FAILURE \ - util_routineFailureMessage("mediapresent_descriptor_toCCIMInstance") -#define SCSIINT_ASSOC_TO_INSTANCE_FAILURE \ - util_routineFailureMessage("scsiIntAssocToInst") -#define FCINT_ASSOC_TO_INSTANCE_FAILURE \ - util_routineFailureMessage("fcIntAssocToInst") -#define USBINT_ASSOC_TO_INSTANCE_FAILURE \ - util_routineFailureMessage("usbIntAssocToInst") -#define MPXIOINT_ASSOC_TO_INSTANCE_FAILURE \ - util_routineFailureMessage("mpxioIntAssocToInst") -#define IDEINT_ASSOC_TO_INSTANCE_FAILURE \ - util_routineFailureMessage("ideIntAssocToInst") -#define MEDIAPRES_ASSOC_TO_INSTANCE_FAILURE \ - util_routineFailureMessage("MediaPresAssocToInst") -#define UTIL_FILEOPEN_FAILURE \ - util_routineFailureMessage("util_OpenFile") -#define UTIL_FILECLOSE_FAILURE \ - util_routineFailureMessage("util_CloseFile") -#define UTIL_FILEREMOVE_FAILURE \ - util_routineFailureMessage("util_RemoveFile") - -/* General failures */ -#define LOW_MEMORY \ - dgettext(TEXT_DOMAIN, "Not enough memory Failure.") -#define GENERAL_FAILURE \ - dgettext(TEXT_DOMAIN, "General Failure.") -#define NO_SUCH_METHOD \ - dgettext(TEXT_DOMAIN, "No Such Method Defined.") -#define NVLIST_FAILURE \ - dgettext(TEXT_DOMAIN, "The nvlist action failed.") -#define NO_SUCH_CLASS \ - dgettext(TEXT_DOMAIN, "Class Not Found.") - -#ifdef __cplusplus -} -#endif - -#endif /* _MESSAGESTRINGS_H */ diff --git a/usr/src/cmd/wbem/provider/c/include/methods.h b/usr/src/cmd/wbem/provider/c/include/methods.h deleted file mode 100644 index 58fca801bd..0000000000 --- a/usr/src/cmd/wbem/provider/c/include/methods.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _METHODS_H -#define _METHODS_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -/* include the cimapi, this in turn includes the cimstructs.h which we need */ -#include <cimapi.h> -#include <cimlogsvc.h> -#include <cimauthcheck.h> - -/* constant definitions */ -#define PROPTRUE "1" -#define PROPFALSE "0" -#define DISK_WRITE_RIGHT "solaris.admin.diskmgr.write" -#define DISK_READ_RIGHT "solaris.admin.diskmgr.read" - -/* function prototypes */ - -CCIMProperty *create_default_fdisk_partition(CCIMObjectPath *op); -CCIMProperty *create_filesystem(CCIMObjectPath *op); -CCIMProperty *create_fdisk_partitions(CCIMPropertyList *, CCIMObjectPath *); -CCIMProperty *create_partitions(CCIMPropertyList *, CCIMObjectPath *); -CCIMProperty *get_disk_geometry(CCIMPropertyList *, CCIMObjectPath *); -CCIMProperty *getFdisk(CCIMPropertyList *, CCIMObjectPath *); -CCIMProperty *label_disk(CCIMPropertyList *, CCIMObjectPath *); - -#ifdef __cplusplus -} -#endif - -#endif /* _METHODS_H */ diff --git a/usr/src/cmd/wbem/provider/c/include/mpxiogroup_descriptors.h b/usr/src/cmd/wbem/provider/c/include/mpxiogroup_descriptors.h deleted file mode 100644 index ead2aeb79b..0000000000 --- a/usr/src/cmd/wbem/provider/c/include/mpxiogroup_descriptors.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _MPXIOGROUP_DESCRIPTORS_H -#define _MPXIOGROUP_DESCRIPTORS_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <sys/types.h> -#include <cimapi.h> -#include <cimprovider.h> -#include "libdiskmgt.h" - -CCIMInstance *mpxiogroup_descriptor_toCCIMInstance( - dm_descriptor_t dp, char *providerName, int *errp); - -CCIMInstanceList *mpxiogroup_descriptors_toCCIMInstanceList( - char *providerName, dm_descriptor_t *dp, int *errp); - - -#ifdef __cplusplus -} -#endif - -#endif /* _MPXIOGROUP_DESCRIPTORS_H */ diff --git a/usr/src/cmd/wbem/provider/c/include/partbasedon_descriptors.h b/usr/src/cmd/wbem/provider/c/include/partbasedon_descriptors.h deleted file mode 100644 index 140dad0251..0000000000 --- a/usr/src/cmd/wbem/provider/c/include/partbasedon_descriptors.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _PARTBASEDON_DESCRIPTORS_H -#define _PARTBASEDON_DESCRIPTORS_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <sys/types.h> -#include <cimapi.h> -#include <cimprovider.h> -#include "libdiskmgt.h" - - -CCIMInstance *partbasedon_descriptor_toCCIMInstance(char *hostName, - dm_descriptor_t ant, dm_descriptor_t dep, - char *providerName, int *errp); - -#ifdef __cplusplus -} -#endif - -#endif /* _PARTBASEDON_DESCRIPTORS_H */ diff --git a/usr/src/cmd/wbem/provider/c/include/partition_descriptors.h b/usr/src/cmd/wbem/provider/c/include/partition_descriptors.h deleted file mode 100644 index 0f87c1235e..0000000000 --- a/usr/src/cmd/wbem/provider/c/include/partition_descriptors.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _PARTITION_DESCRIPTORS_H -#define _PARTITION_DESCRIPTORS_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <sys/types.h> -#include <cimapi.h> -#include <cimprovider.h> -#include "libdiskmgt.h" - -#define DRVTYPE "drvtype" -#define STATUS "status" - -CCIMInstance *partition_descriptor_toCCIMInstance(char *hostName, - dm_descriptor_t dp, char *providerName, int *errp); - -CCIMInstanceList *partition_descriptors_toCCIMInstanceList( - char *providerName, dm_descriptor_t *dp, - dm_descriptor_t *fdp, int *errp); - - -#ifdef __cplusplus -} -#endif - -#endif /* _PARTITION_DESCRIPTORS_H */ diff --git a/usr/src/cmd/wbem/provider/c/include/providerNames.h b/usr/src/cmd/wbem/provider/c/include/providerNames.h deleted file mode 100644 index 29d56523fa..0000000000 --- a/usr/src/cmd/wbem/provider/c/include/providerNames.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _PROVIDERNAMES_H -#define _PROVIDERNAMES_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Forward declaration of device providers */ - -#define DISK_DRIVE "Solaris_DiskDrive" -#define DISK_PARTITION "Solaris_DiskPartition" -#define LOGICAL_DISK "Solaris_LogicalDisk" -#define DISK "Solaris_Disk" -#define REALIZES_EXTENT "Solaris_RealizesExtent" -#define REALIZES_DISKPART "Solaris_RealizesDiskPartition" -#define REALIZES_DISKDRIVE "Solaris_RealizesDiskDrive" -#define GENERIC_CONTROLLER "Solaris_GenericController" -#define IDE_CONTROLLER "Solaris_IDEController" -#define SCSI_CONTROLLER "Solaris_SCSIController" -#define USBSCSI_CONTROLLER "Solaris_USBSCSIController" -#define MPXIO_CONTROLLER "Solaris_MPXIOController" -#define MPXIO_GROUP "Solaris_MPXIOGroup" -#define MPXIO_COMPONENT "Solaris_MPXIOComponent" -#define MPXIO_LOGICALIDENTITY "Solaris_MPXIOCtrlrLogicalIdentity" -#define MPXIO_INTERFACE "Solaris_MPXIOInterface" -#define SCSI_INTERFACE "Solaris_SCSIInterface" -#define IDE_INTERFACE "Solaris_IDEInterface" -#define MEDIA_PRESENT "Solaris_MediaPresent" -#define DISKPART_BASEDONFDISK "Solaris_DiskPartitionBasedOnFDisk" -#define DISKPART_BASEDONDISK "Solaris_DiskPartitionBasedOnDisk" -#define COMPUTER_SYSTEM "Solaris_ComputerSystem" -#define PHYSICAL_PACKAGE "Solaris_PhysicalPackage" - -/* Forward declaration of function names */ - -#define DRIVE_DESCRIPTOR_FUNC "drive_descriptors_toCCIMInstance" -#define PARTITION_DESCRIPTOR_FUNC "partition_descriptors_toCCIMInstance" -#define DISK_DESCRIPTOR_FUNC "disk_descriptors_toCCIMInstance" -#define LOGICALDISK_DESCRIPTOR_FUNC \ - "logicaldisk_descriptors_toCCIMInstance" -#define MPXIO_DESCRIPTOR_FUNC \ - "mpxiogroup_descriptors_toCCIMInstance" -#define CTRL_DESCRIPTOR_FUNC "ctrl_descriptors_toCCIMInstance" -#define PARTBASEDON_DESCRIPTOR_FUNC \ - "partbasedon_descriptors_toCCIMInstance" -#define REALIZESEXTENT_DESCRIPTOR_FUNC \ - "realizesextent_descriptors_toCCIMInstance" -#define REALIZESDD_DESCRIPTOR_FUNC \ - "realizesdiskdrive_descriptors_toCCIMInstance" -#define MEDIAPRES_DESCRIPTOR_FUNC \ - "mediapresent_descriptors_toCCIMInstance" - -/* utility function names */ -#define UTIL_OPENFILE "Util_OpenFile" -#define UTIL_CLOSEFILE "Util_CloseFile" -#define UTIL_REMOVEFILE "Util_RemoveFile" - - -/* c provider function names */ -#define ENUM_INSTANCES "cp_enumInstances" -#define ENUM_INSTANCENAMES "cp_enumIntanceNames" -#define GET_INSTANCE "cp_getInstance" -#define INVOKE_METHOD "cp_invokeMethod" -#define EXEC_QUERY "cp_execQuery" -#define ASSOCIATORS "cp_associators" -#define ASSOCIATOR_NAMES "cp_associatorNames" -#define REFERENCES "cp_references" -#define REFERENCE_NAMES "cp_referenceNames" -#define CREATE_INSTANCE "cp_createInstance" -#define CREATE_INSTANCELIST "cp_createInstanceList" -#define DELETE_INSTANCE "cp_deleteInstance" -#define SET_INSTANCE "cp_setInstance" -#define GET_PROPERTY "cp_getProperty" -#define SET_PROPERTY "cp_setProperty" -#define CREATE_OBJECT_PATH "cim_createObjectPath" - -#ifdef __cplusplus -} -#endif - -#endif /* _PROVIDERNAMES_H */ diff --git a/usr/src/cmd/wbem/provider/c/include/realizesdiskdrive_descriptors.h b/usr/src/cmd/wbem/provider/c/include/realizesdiskdrive_descriptors.h deleted file mode 100644 index 4ba229d1a5..0000000000 --- a/usr/src/cmd/wbem/provider/c/include/realizesdiskdrive_descriptors.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _REALIZESDISKDRIVE_DESCRIPTORS_H -#define _REALIZESDISKDRIVE_DESCRIPTORS_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <sys/types.h> -#include <cimapi.h> -#include <cimprovider.h> -#include "libdiskmgt.h" - -CCIMInstance *realizesdiskdrive_descriptor_toCCIMInstance( - char *hostName, CCIMObjectPath * antOp, - dm_descriptor_t dp, char *providerName, - int *errp); - - -#ifdef __cplusplus -} -#endif - -#endif /* _REALIZESDISKDRIVE_DESCRIPTORS_H */ diff --git a/usr/src/cmd/wbem/provider/c/include/realizesextent_descriptors.h b/usr/src/cmd/wbem/provider/c/include/realizesextent_descriptors.h deleted file mode 100644 index 0c561c0912..0000000000 --- a/usr/src/cmd/wbem/provider/c/include/realizesextent_descriptors.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _REALIZESEXTENT_DESCRIPTORS_H -#define _REALIZESEXTENT_DESCRIPTORS_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <sys/types.h> -#include <cimapi.h> -#include <cimprovider.h> -#include "libdiskmgt.h" - -CCIMInstance *realizesextent_descriptor_toCCIMInstance( - char *hostName, dm_descriptor_t dp, - char *providerName, int *errp); - - -#ifdef __cplusplus -} -#endif - -#endif /* _REALIZESEXTENT_DESCRIPTORS_H */ diff --git a/usr/src/cmd/wbem/provider/c/include/util.h b/usr/src/cmd/wbem/provider/c/include/util.h deleted file mode 100644 index 4cef82bd00..0000000000 --- a/usr/src/cmd/wbem/provider/c/include/util.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002-2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _UTIL_H -#define _UTIL_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdio.h> -#include <netdb.h> -#include <cimapi.h> -#include <cimomhandle.h> -#include <cimprovider.h> -#include <cimauthcheck.h> -#include <cimlogsvc.h> - -#include "providerNames.h" -#include "messageStrings.h" - -#define MAXFAILSTRINGLEN 256 - -void util_handleError(char *, CIMErrorReason, char *, CCIMException *, - int *); -void *util_getKeyValue(CCIMPropertyList *, CIMType, char *, int *); -void util_doReferenceProperty(cimchar *, CCIMObjectPath *, CIMBool, - CCIMInstance *, int *); -void util_doProperty(cimchar *, CIMType, cimchar *, CIMBool, - CCIMInstance *, int *); -FILE *util_openFile(char *, char *); -int util_closeFile(FILE *, char *); -void util_removeFile(char *); -char *util_routineFailureMessage(char *); -char *util_routineStartDaemonMessage(char *); - -char hostName[MAXHOSTNAMELEN]; - -#define DISK_DOMAIN "libWBEMdisk" -#define DISK_PROVIDER "libWBEMdisk" - -#ifdef __cplusplus -} -#endif - -#endif /* _UTIL_H */ diff --git a/usr/src/cmd/wbem/provider/c/mof/CIM2.7.mof b/usr/src/cmd/wbem/provider/c/mof/CIM2.7.mof deleted file mode 100644 index bfba2520a3..0000000000 --- a/usr/src/cmd/wbem/provider/c/mof/CIM2.7.mof +++ /dev/null @@ -1,232 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 - */ -/* - * ident "%Z%%M% %I% %E% SMI" - * Title CIM version 2.7 NFS dependencies. - * Description CIM version 2.7 Solaris Network File System model dependencies. - * Date 02/18/2003 - * Version 2.7 - * Copyright 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma namespace("root/cimv2") -#pragma Locale ("en_US") -#pragma namespace("__create") - -// ================================================================== -// ManagedElement -// ================================================================== -[Abstract, Version ("2.7.0"), Description ( - "ManagedElement is an abstract class that provides a common " - "superclass (or top of the inheritance tree) for the " - "non-association classes in the CIM Schema.") ] -class CIM_ManagedElement { - - [MaxLen (64), Description ( - "The Caption property is a short textual description (one-" - "line string) of the object.") ] - string Caption; - - [Description ( - "The Description property provides a textual description of " - "the object.") ] - string Description; - - [Description ( - " A user-friendly name for the object. This property allows " - "each instance to define a user-friendly name IN ADDITION TO its " - "key properties/identity data, and description information. \n" - " Note that ManagedSystemElement's Name property is also defined " - "as a user-friendly name. But, it is often subclassed to be a " - "Key. It is not reasonable that the same property can convey " - "both identity and a user friendly name, without inconsistencies. " - "Where Name exists and is not a Key (such as for instances of " - "LogicalDevice), the same information MAY be present in both " - "the Name and ElementName properties.") ] - string ElementName; -}; - -// ================================================================== -// SettingData -// =================================================================== -[Abstract, Experimental, Version ("2.7.0"), Description ( - " The SettingData class represents configuration-related and " - "operational parameters for one or more ManagedElement(s). A " - "ManagedElement may have multiple SettingData objects associated " - "with it. The current operational values for an Element's " - "parameters are reflected by properties in the Element itself or " - "by properties in its associations. These properties do not have " - "to be the same values present in the SettingData object. For " - "example, a modem may have a SettingData baud rate of 56Kb/sec " - "but be operating at 19.2Kb/sec. \n" - " Note that the CIM_SettingData class is very similar to " - "CIM_Setting, yet both classes are present in the model. This is " - "because many implementations have successfully used CIM_Setting. " - "However, issues have arisen that could not be resolved without " - "defining a new class. Therefore, until a new major release " - "occurs, both classes will exist in the model. Refer to the Core " - "White Paper for additional information.") ] -class CIM_SettingData : CIM_ManagedElement { - - [Key, Description ( - "InstanceID opaquely identifies a unique instance of " - "SettingData. The InstanceID must be unique within a " - "namespace. In order to ensure uniqueness, the value of " - "InstanceID SHOULD be constructed in the following manner: \n" - "<Vendor ID><ID> \n" - " <Vendor ID> MUST include a copyrighted, trademarked " - "or otherwise unique name that is owned by the business entity " - "or a registered ID that is assigned to the business entity " - "that is defining the InstanceID. (This is similar to the " - "<Schema Name>_<Class Name> structure of Schema class names.) " - "The purpose of <Vendor ID> is to ensure that <ID> is truly " - "unique across multiple vendor implementations. If such a " - "name is not used, the defining entity MUST assure that the " - "<ID> portion of the Instance ID is unique when compared with " - "other instance providers. For DMTF defined instances, the " - "<Vendor ID> is 'CIM'. \n" - " <ID> MUST include a vendor specified unique " - "identifier.") ] - string InstanceID; - - [Required, Description ( - "The user friendly name for this instance of SettingData. " - "In addition, the user friendly name can be used as a " - "index property for a search of query. (Note: Name " - "does not have to be unique within a namespace.)") ] - string ElementName; -}; - -// =================================================================== -// Share -// =================================================================== -[Abstract, Experimental, Version ("2.7.0"), Description ( - "A Share is representative of an object presented for use " - "(or shared) across systems. Instances of CIM_Share are " - "associated with the shared object on the 'server'-side via " - "the CIM_SharedElement association. Shares are mounted on the " - "'client'-side (usually into another namespace) via the CIM_Import" - "Share association. CIM_Share is Abstract to force subclassing to " - "define the semantics of sharing." ) ] -class CIM_Share : CIM_LogicalElement { - - [Key, MaxLen (256), - Propagated ("CIM_System.CreationClassName"), - Description ("The scoping System's CreationClassName. ") ] - string SystemCreationClassName; - - [Key, Propagated ("CIM_System.Name"), - Description ("The scoping System's Name.") ] - string SystemName; - - [Key, MaxLen (256), Description ( - "CreationClassName indicates the name of the class or the " - "subclass used in the creation of an instance.") ] - string CreationClassName; - - [Override("Name"), Key, Description ( - "The Name property, inherited from LogicalElement, " - "defines the shared name by which the shared object is " - "exported.") ] - string Name; -}; - - -// =================================================================== -// FileShare -// =================================================================== -[Abstract, Experimental, Version ("2.7.0"), Description ( - "A FileShare is representative of a file or directory presented " - "for use (or shared) across systems. Instances of FileShare are " - "associated with the shared object on the 'server'-side via " - "the CIM_SharedElement association. Shares are mounted on the " - "'client'-side (usually into another namespace) via the CIM_Import" - "Share association. FileShare is Abstract to force subclassing to " - "define the semantics of sharing." ) ] -class CIM_FileShare : CIM_Share { - - [Description ("Indicates whether a directory or file is presented " - "for use (or shared) across systems. A value of true " - "represents a directory. A value of false represents a file") ] - boolean SharingDirectory; -}; - -// =================================================================== -// NFSShare -// =================================================================== -[Experimental, Version ("2.7.0"), Description ( - "An NFSShare represents a Directory associated " - "via CIM_SharedElement that is made accessible to " - "other systems. On the client-side, the NFSShare is " - "associated with its mount point via " - "CIM_ImportedShare.") ] -class CIM_NFSShare : CIM_FileShare { - - [Override("Name"), Description ( - "The Name property, inherited from Share, defines the " - "shared name by which the shared object is exported. " - "For NFS, this will typically be the pathname of the " - "exported directory, using forward slashes '/' to " - "precede directory names in the path.") ] - string Name; -}; - -// =================================================================== -// SharedElement -// =================================================================== -[Association, Experimental, Version ("2.7.0"), Description ( - "SharedElement associates the Share to a LogicalElement" - "that is being exported.") ] -class CIM_SharedElement: CIM_LogicalIdentity { - - [Override("SystemElement"), Key, Max (1), - Description ("The Directory that is Shared.") ] - CIM_LogicalElement REF SystemElement; - - [Override("SameElement"), Key, Description ( - "The Shared view of the Directory.") ] - CIM_Share ref SameElement; -}; - -// ================================================================== -// HostedShare -// ================================================================== -[Association, Experimental, Version ("2.7.0"), Description ( - "CIM_HostedShare is an association between a Share and " - "the System on which the functionality resides. The " - "cardinality of this association is 1-to-many. A System " - "may host many Shares. Shares are weak with respect to " - "their hosting System. Heuristic: A Share is hosted on " - "the System where the LogicalElement that Exports the " - "Share is located, (via LogicalIdentity.)") ] -class CIM_HostedShare:CIM_Dependency { - - [Override ("Antecedent"), Max (1), Min (1), - Description ("The hosting System.") ] - CIM_System REF Antecedent; - - [Override ("Dependent"), Weak, - Description ("The Share hosted on the System.") ] - CIM_Share REF Dependent; -}; - diff --git a/usr/src/cmd/wbem/provider/c/mof/Makefile b/usr/src/cmd/wbem/provider/c/mof/Makefile deleted file mode 100644 index c4e33e7644..0000000000 --- a/usr/src/cmd/wbem/provider/c/mof/Makefile +++ /dev/null @@ -1,54 +0,0 @@ -# -# 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 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -REG = Solaris_DMGT1.0.mof Solaris_NFS1.0.mof CIM2.7.mof - -DIRMODE= 755 -FILEMODE= 644 - -VARSADM= $(ROOT)/var/sadm -VARSADMWBEM= $(ROOT)/var/sadm/wbem -VARSADMWBEMLOGR= $(ROOT)/var/sadm/wbem/logr -VARSADMWBEMLOGRPREREG= $(ROOT)/var/sadm/wbem/logr/preReg - -REGDIRS= $(VARSADM) \ - $(VARSADMWBEM) \ - $(VARSADMWBEMLOGR) \ - $(VARSADMWBEMLOGRPREREG) - -$(REGDIRS): - $(INS.dir) - -ROOTMOFREG= $(REG:%=$(ROOTMOF)/%) - -.KEEP_STATE: - -all: - -install: $(REGDIRS) $(ROOTMOFREG) - -include $(SRC)/cmd/Makefile.targ diff --git a/usr/src/cmd/wbem/provider/c/mof/Solaris_DMGT1.0.mof b/usr/src/cmd/wbem/provider/c/mof/Solaris_DMGT1.0.mof deleted file mode 100644 index 84c6dbb0c9..0000000000 --- a/usr/src/cmd/wbem/provider/c/mof/Solaris_DMGT1.0.mof +++ /dev/null @@ -1,789 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 - */ -/* - * ident "%Z%%M% %I% %E% SMI" - * - * Title Solaris Device Management MOF specification - * Description This model incorporates Disks, Disks Partitions and other - * device management classes. - * Copyright 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma namespace("root/cimv2") -#pragma Locale ("en_US") -#pragma namespace("__modify") - -//============================================================================= -// Title: Solaris_DiskDrive -// Version: 1.3.0 -// Date: 2/12/02 -// Description: Solaris_DiskDrive MOF Class definition -//============================================================================= - - [Provider ("jni:libWBEMdisk.so"), - Version("1.3.0"), - Description( - "Provides information about the logical characteristics" - "of a disk drive attached to a Solaris system.")] -class Solaris_DiskDrive : CIM_DiskDrive -{ - [Deprecated { - ""}, - MaxLen (256), - Description ( - "A string describing the type of disk. The use of" - "this is deprecated. This is a media specific attribute. ")] - string DiskType; - - [Deprecated { - "Solaris_Disk.PhysicalLabels"}, - MaxLen (256), - Description ( - "A string containing a user defined label for the disk." - "This attribute has been deprecated. It is a media attribute and" - "is covered by the label property inherited on the media object.")] - string DiskLabel; - - [Deprecated { - ""}, - Description ( - "The number of sectors per cylinder.This attribute has" - "been deprecated. It is a media attribute and is not valid" - "because this information cannot be reliably determined." )] - uint32 SectorsPerCylinder; - - [Deprecated { - ""}, - Description ( - "The number of heads per cylinder. This attribute has been" - "deprecated. See SectorsPerCylinder for details." )] - uint32 HeadsPerCylinder; - - [Deprecated { - ""}, - Description ( - "The number of sectors per track. This attribute has been" - "deprecated. See SectorsPerCylinder for details.")] - uint32 SectorsPerTrack; - - [Deprecated { - ""}, - Description ( - "The size of a cylinder in bytes. This attribute has been" - "deprecated. See SectorsPerCylinder for details.")] - uint32 BytesPerCylinder; - - [Deprecated { - ""}, - Description ( - "The number of cylinders for this disk. This attribute" - "has been deprecated. See SectorsPerCylinder for details.")] - uint32 PhysicalCylinders; - - [Deprecated { - ""}, - Description ( - "The number of cylinders available for partitions. This" - "attribute has been deprecated. See SectorsPerCylinder for details.")] - uint32 DataCylinders; - - [Deprecated { - ""}, - Description ( - "The number of reserved cylinders. This attribute has been" - "deprecated. See SectorsPerCylinder for details.")] - uint32 AlternateCylinders; - - [Deprecated { - ""}, - Description ( - "The number of actual cylinders. This attribute has" - "been deprecated. See SectorsPerCylinder for details.")] - uint32 ActualCylinders; - - [Deprecated { - ""}, - Description ( - "Does this disk require fdisk partitions?" - "Solaris i386 machines require a disk to" - "contain fdisk partitions. This attribute has been deprecated.")] - boolean FdiskRequired; - - [Deprecated { - ""}, - Description ( - "Does this disk contain fdisk partitions. This attribute" - "has been deprecated. This is now modeled using the" - "Solaris_DiskPartBasedOnFDisk association.")] - boolean FdiskPresent; - - [Deprecated { - "Solaris_Disk.labelDisk()" - }, - Description ( - "Label the disk with the given string." - "The string should contain a short label for the" - "disk of up to 8 characters. This method has been deprecated." - "This behavior is now modeled using the labelDisk method on" - "Solaris_Disk.")] - boolean LabelDisk([IN] String label); - - [Deprecated { - "Solaris_Disk.createFDiskPartitions" - }, - Description ( - "Create one Solaris fdisk partition that" - "uses the whole disk. This method has been deprecated. This has" - "been replaced with the Solaris_Disk.createFDiskPartitions method.")] - boolean CreateDefaultFdiskPartition(); - - [Deprecated { - "Solaris_Disk.createFDiskPartitions" - }, - Description ( - "Create fdisk partitions on this disk. This method" - "has been deprecated. It has been replaced with the" - "Solaris_Disk.createFDiskPartitions method.")] - boolean CreateFdiskPartitions([IN] uint32 DiskParameters[]); - - [Deprecated { - ""}, - Description ( - "Retrieve the current fdisk partitions for this disk." - "This method has been deprecated. It is now modeled using the " - "Solaris_DiskPartition object with the fDisk subtype" )] - boolean GetFdiskPartitions([OUT, IN(False)] uint32 FDiskPartitions[]); -}; - -//============================================================================= -// Title: Solaris_DiskPartition -// Version: 1.3.0 -// Date: 2/12/02 -// Description: Solaris_DiskPartition MOF Class definition -//============================================================================= - - [Provider ("jni:libWBEMdisk.so"), - Version("1.3.0"), - Description("Provides information about the logical partitions" - "on a disk drive attached to a Solaris system.")] -class Solaris_DiskPartition : CIM_DiskPartition -{ - - [Description ("The type of Solaris partition."), - ValueMap{"0", "1", "2", "3", "4"}, - Values {"Unknown", "Other", "Solaris", "FDisk", "EFI"}] - uint16 SolarisPartitionType; - - [Description ("The size in bytes of this partition"), - Units("Bytes")] - uint64 PartitionSize; - - [Description ("The Starting cylinder for this partition")] - uint32 StartCylinder; - - [Description ("The ending cylinder for this partition")] - uint32 EndCylinder; - - [Description ("The number of cylinders for this partition")] - uint32 TotalCylinders; - - [Deprecated { - ""}, - MaxLen (256), - Description ("A string containing the deviceID of the scoping disk." - "This is now modeled on the media object and is obtained by the Name" - "attribute on that object. ")] - string DiskID; - - [Deprecated { - ""}, - Description ("The FLAG for this partition. The Flag describes" - "how the partition is to be mounted." - "0x00 Mountable Read Write" - "0x01 Not Mountable" - "0x10 Mountable Read Only. This attribute has been deprecated." - " A partition is not mounted. A Filesystem is.")] - uint8 Flag; - - [Deprecated { - ""}, - Description ("The TAG for this partition. The Tag describes" - "the type of partition" - "Unassigned 0x00" - "Boot 0x01" - "Root 0x02" - "Swap 0x03" - "Usr 0x04" - "Backup 0x05" - "Stand 0x06" - "Var 0x07" - "Home 0x08" - "Altsctr 0x09" - "Cache 0x0a This attribute has been deprecated. A" - "Filesystem on a partition determines its use case.")] - uint8 Tag; - - [Deprecated { - ""}, - Description ("Is there an existing file system on this partition." - "This attribute has been deprecated. This information is obtained" - "by traversing the Solaris_LocalFSResidesOnExtent association.")] - boolean ValidFileSystem; - - [Deprecated { - "" }, - Description ("Create file system on this partition using the default" - "parameters. Returns TRUE if successful. This method has been" - "deprecated. The behavior for this method is done with the " - "creation of a Solaris_FileSystem object.")] - boolean CreateFileSystem(); - - [Deprecated { - "Solaris_Disk.createPartitions()"}, - Description ("Create partition on this disk. Partitions are created" - "based on the instance of Solaris_DiskPartition that" - "are associated with this Solaris_DiskDrive instance. This " - "method has been deprecated. It is replaced by the" - "Solaris_Disk.createPartitions() method.")] - boolean CreatePartitions([IN] uint32 DiskParameters[]); - -}; - -//============================================================================= -// Title: Solaris_MediaPresent -// Version: 1.3.0 -// Date: 2/12/02 -// Description: Solaris_MediaPresent MOF Class definition -//============================================================================= - [Provider ("jni:libWBEMdisk.so"), - Version("1.3.0"), - Description ("Solaris_MediaPresent an association that represents" - "The relationship between a media access device and" - "its media if present.")] -class Solaris_MediaPresent : CIM_MediaPresent -{ -}; - -#pragma namespace("__create") -//============================================================================= -// Title: Solaris_LogicalDisk -// Version: 1.3.0 -// Date: 2/12/02 -// Description: Solaris_LogicalDisk MOF Class definition -//============================================================================= - - [Provider ("jni:libWBEMdisk.so"), - Version("1.3.0"), - Description("Provides information about the logical characteristics" - "of a disk.")] - -class Solaris_LogicalDisk : CIM_StorageVolume -{ -}; - - -//============================================================================= -// Title: Solaris_PhysicalMedia -// Version: 1.3.0 -// Date: 2/12/02 -// Description: Solaris_PhysicalMedia MOF Class definition -//============================================================================= - - [Version("1.3.0"), - Abstract, - Description( - "The PhysicalMedia class represents any type of documentation" - "or storage medium, such as tapes, CDROMs, etc. This class" - "is typically used to locate and manage Removable Media" - "(versus Media sealed with the MediaAccessDevice, as a single" - "Package, as is the case with hard disks). However, 'sealed'" - "Media can also be modeled using this class, where the Media" - "would then be associated with the PhysicalPackage using the" - "PackagedComponent relationship.")] -class Solaris_PhysicalMedia : CIM_PhysicalMedia -{ -}; - -//============================================================================= -// Title: Solaris_Disk -// Version: 1.3.0 -// Date: 2/12/02 -// Description: Solaris_Disk MOF Class definition -//============================================================================= - - [Provider ("jni:libWBEMdisk.so"), - Version("1.3.0"), - Description("Provides information about the physical characteristics" - "of a disk.")] -class Solaris_Disk : Solaris_PhysicalMedia -{ - - [Description ("Create partitions on this disk.")] - boolean createPartitions([IN] uint32 diskParameters[]); - - [Description ("Create fdisk partitions on this disk.")] - boolean createFDiskPartitions([IN] uint32 diskParameters[]); - - [Description ("Change the label on this disk.")] - boolean labelDisk([IN] string newLabel); - - [Description ("Returns the geometry information with regard to this" - "disk.")] - boolean getDiskGeometry([IN] string diskName, [OUT, IN(False)] uint32 geometry[]); -}; - -//============================================================================= -// Title: Solaris_PhysicalPackage -// Version: 1.3.0 -// Date: 2/12/02 -// Description: Solaris_PhysicalPackage MOF Class definition -//============================================================================= - - [Version("1.3.0"), - Description ( - "This class represents the package that realizes the Solaris" - "logical devices.This class does not have a provider,rather it relies on" - "the user to provide instances of this class. Physical package" - "characteristics are not generally available via Solaris, so the" - "user will have to manually input the instances of these.")] -class Solaris_PhysicalPackage : CIM_PhysicalPackage -{ -}; - -//============================================================================= -// Title: Solaris_RealizesExtent -// Version: 1.3.0 -// Date: 02/12/02 -// Description: Solaris_RealizesExtent MOF Class definition -//============================================================================= - - [Association, - Version("1.3.0"), - Provider ("jni:libWBEMdisk.so"), - Description("A logical disk is realized by a physical disk. This" - "association models this relationship, specifically the relationship" - "between the Solaris_Disk and the Solaris_LogicalDisk.")] -class Solaris_RealizesExtent : CIM_RealizesExtent -{ - [Override ("Antecedent"), Key, - Description( - "The physical disk which realizes the logical disk")] - Solaris_Disk REF Antecedent; - - [Override ("Dependent"), Key, - Description( - "The logical representation of the physical disk")] - Solaris_LogicalDisk REF Dependent; -}; - -//============================================================================= -// Title: Solaris_RealizesDiskPartition -// Version: 1.3.0 -// Date: 2/12/02 -// Description: Solaris_RealizesDiskPartition MOF Class definition -//============================================================================= - - [Association, - Version("1.3.0"), - Provider ("jni:libWBEMdisk.so"), - Description("Disk partitions are directly realized on physical media." - "This is used to model the creation of partitions on a raw SCSI or" - "IDE drive, Solaris_PhysicalDisk")] -class Solaris_RealizesDiskPartition: CIM_RealizesDiskPartition -{ - [Override ("Antecedent"), Key, - Description ( - "The physical media on which the partition is realized."), - Max (1)] - Solaris_Disk REF Antecedent; - - [Override ("Dependent"), Key, - Description ( - "The disk partition that is located on the media.")] - Solaris_DiskPartition REF Dependent; -}; - -//============================================================================= -// Title: Solaris_RealizesDiskDrive -// Version: 1.3.0 -// Date: 2/12/02 -// Description: Solaris_RealizesDiskDrive MOF Class definition -//============================================================================= - - [Association, - Version("1.3.0"), - Provider ("jni:libWBEMdisk.so"), - Description("Disk drives are realized by physical packages." - "This is used to model the realization of a Solaris_DiskDrive by" - "Solaris_PhysicalPackage. If the user has not input instances" - "of Solaris_PhysicalPackage no values will be returned on enumeration." - "Additionally, no create, modify or delete operations are allowed.")] -class Solaris_RealizesDiskDrive: CIM_Realizes -{ - [Override ("Antecedent"), Key, - Description ( - "The physical package that implements the logical device.")] - Solaris_PhysicalPackage REF Antecedent; - - [Override ("Dependent"), Key, - Description ( - "The logical device .") ] - Solaris_DiskDrive REF Dependent; -}; - -//============================================================================= -// Title: Solaris_DiskPartitionBasedOnDisk -// Version: 1.3.0 -// Date: 2/12/02 -// Description: Solaris_DiskPartitionBasedOnDisk MOF Class definition -//============================================================================= - - [Association, - Version("1.3.0"), - Provider ("jni:libWBEMdisk.so"), - Description("A disk partition in Solaris can be based on either" - "a disk or an fdisk. This association models the relationship of" - "Solaris disk partition with its underlying disk(not fDisk)")] -class Solaris_DiskPartitionBasedOnDisk: CIM_DiskPartitionBasedOnVolume -{ - [Override ("Antecedent"), Key, - Description ( - "The lower level StorageExtent.") ] - Solaris_LogicalDisk REF Antecedent; - - [Override ("Dependent"), Key, - Description ( - "The higher level StorageExtent.") ] - Solaris_DiskPartition REF Dependent; -}; - - -//============================================================================= -// Title: Solaris_DiskPartitionBasedOnFDisk -// Version: 1.3.0 -// Date: 2/12/02 -// Description: Solaris_DiskPartitionBasedOnFDisk MOF Class definition -//============================================================================= - - [Association, - Version("1.3.0"), - Provider ("jni:libWBEMdisk.so"), - Description("A disk partition in Solaris can be based on either" - "a disk or an fdisk. This association models the relationship of" - "Solaris disk partition with its underlying fdisk")] -class Solaris_DiskPartitionBasedOnFDisk: CIM_BasedOn -{ - [Override ("Antecedent"), Key, - Description ( - "The lower level StorageExtent. The Fdisk partition")] - Solaris_DiskPartition REF Antecedent; - - [Override ("Dependent"), Key, - Description ( - "The higher level StorageExtent. The Solaris disk partition")] - Solaris_DiskPartition REF Dependent; -}; - -//============================================================================= -// Title: Solaris_SCSIController -// Version: 1.3.0 -// Date: 2/12/02 -// Description: Solaris_SCSIController MOF Class definition -//============================================================================= - - [Provider ("jni:libWBEMdisk.so"), - Version("1.3.0"), - Description( - "Provides data with regard to the capabilities and management" - "of a SCSI controller under Solaris.")] -class Solaris_SCSIController : CIM_SCSIController -{ -}; - -//============================================================================= -// Title: Solaris_IDEController -// Version: 1.3.0 -// Date: 2/12/02 -// Description: Solaris_IDEController MOF Class definition -//============================================================================= - - [Provider ("jni:libWBEMdisk.so"), - Version("1.3.0"), - Description( - "Provides data with regard to the capabilities and management" - "of a SCSI controller under Solaris.")] -class Solaris_IDEController : CIM_IDEController -{ -}; - -//============================================================================= -// Title: Solaris_MPXIOController -// Version: 1.3.0 -// Date: 2/12/02 -// Description: Solaris_MPXIOController MOF Class definition -//============================================================================= - - [Provider ("jni:libWBEMdisk.so"), - Version("1.3.0"), - Description( - "Provides data with regard to the capabilities and management" - "of a MPXIO controller under Solaris.")] -class Solaris_MPXIOController : CIM_Controller -{ -}; - -//============================================================================= -// Title: Solaris_USBSCSIController -// Version: 1.3.0 -// Date: 2/12/02 -// Description: Solaris_USBSCSIController MOF Class definition -//============================================================================= - - [Provider ("jni:libWBEMdisk.so"), - Version("1.3.0"), - Description( - "Provides data with regard to the capabilities and management" - "of a USB SCSI controller under Solaris.")] -class Solaris_USBSCSIController : Solaris_SCSIController -{ -}; - -//============================================================================= -// Title: Solaris_GenericController -// Version: 1.3.0 -// Date: 2/12/02 -// Description: Solaris_GenericController MOF Class definition -//============================================================================= - - [Provider ("jni:libWBEMdisk.so"), - Version("1.3.0"), - Description( - "Provides data with regard to the capabilities and management" - "of 'unknown' controllers under Solaris.")] -class Solaris_GenericController : CIM_Controller -{ -}; - -//============================================================================= -// Title: Solaris_SCSIInterface -// Version: 1.3.0 -// Date: 2/12/02 -// Description: Solaris_SCSIInterface MOF Class definition -//============================================================================= - - [Association, - Provider ("jni:libWBEMdisk.so"), - Version("1.3.0"), - Description( - "The ControlledBy relationship indicating which devices" - "are accessed through a SCSIController, along with the characteristics" - "of this access.")] -class Solaris_SCSIInterface : CIM_SCSIInterface -{ -}; - -//============================================================================= -// Title: Solaris_MPXIOInterface -// Version: 1.3.0 -// Date: 2/12/02 -// Description: Solaris_MPXIOInterface MOF Class definition -//============================================================================= - - [Association, - Provider ("jni:libWBEMdisk.so"), - Version("1.3.0"), - Description( - "MPXIOInterface is a ControlledBy relationship indicating" - "which devices are accessed through the MPXIOController and the" - "the characteristics of this access.")] -class Solaris_MPXIOInterface : CIM_ControlledBy -{ -}; - -//============================================================================= -// Title: Solaris_IDEInterface -// Version: 1.3.0 -// Date: 2/12/02 -// Description: Solaris_IDEInterface MOF Class definition -//============================================================================= - - [Association, - Provider ("jni:libWBEMdisk.so"), - Version("1.3.0"), - Description( - "IDEInterface is a ControlledBy relationship indicating" - "which devices are accessed through the IDEController and the" - "the characteristics of this access.")] -class Solaris_IDEInterface : CIM_ControlledBy -{ -}; - -//============================================================================= -// Title: Solaris_ExtraCapacityGroup -// Version: 1.3.0 -// Date: 2/12/02 -// Description: Solaris_ExtraCapacityGroup MOF Class definition -//============================================================================= - - [Version("1.3.0"), - Abstract, - Description( - "A class that indicates that the aggregated elements have more" - "capacity or capability than is needed.")] - -class Solaris_ExtraCapacityGroup : CIM_ExtraCapacityGroup -{ -}; - -//============================================================================= -// Title: Solaris_MPXIOGroup -// Version: 1.3.0 -// Date: 2/12/02 -// Description: Solaris_MPXIOGroup MOF Class definition -//============================================================================= - - [Provider ("jni:libWBEMdisk.so"), - Version("1.3.0"), - Description( - "A class that indicates that the aggregated elements have more" - "capacity or capability than is needed. Specifically, this" - "class addresses the controllers that make up the MPXIO " - "controller functionality.")] - -class Solaris_MPXIOGroup : Solaris_ExtraCapacityGroup -{ -}; - -//============================================================================= -// Title: Solaris_ControllerLogicalIdentity -// Version: 1.3.0 -// Date: 2/12/02 -// Description: Solaris_ControllerLogicalIdentity MOF Class definition -//============================================================================= - - [Association, - Abstract, - Version("1.3.0"), - Description( - "This association represents the different aspects of the " - "the same controller.")] -class Solaris_ControllerLogicalIdentity : CIM_LogicalIdentity -{ -}; - -//============================================================================= -// Title: Solaris_MPXIOCtrlrLogicalIdentity -// Version: 1.3.0 -// Date: 2/12/02 -// Description: Solaris_MPXIOCtrlrLogicalIdentity MOF Class definition -//============================================================================= - - [Association, - Provider ("jni:libWBEMdisk.so"), - Version("1.3.0"), - Description( - "This association represents the different aspects of the " - "the same MPXIO controller. Specifically, the ExtraCapacityGroup" - "view of the MPXIO Controller.")] -class Solaris_MPXIOCtrlrLogicalIdentity : Solaris_ControllerLogicalIdentity -{ - [Override ("SystemElement"), Key, - Description( - "Represents the mpxio aspect of the controller.")] - Solaris_MPXIOController REF SystemElement; - - [Override ("SameElement"), Key, - Description( - "Represents the other logical aspect of the mpxio controller.")] - Solaris_MPXIOGroup REF SameElement; -}; - - - -//============================================================================= -// Title: Solaris_ControllerComponent -// Version: 1.3.0 -// Date: 2/12/02 -// Description: Solaris_ControllerComponent MOF Class definition -//============================================================================= - - [Association, Aggregation, - Abstract, - Version("1.3.0"), - Description( - "A redundancy group aggregates managed system elements, and" - "indicates that these elements provide redundancy.")] -class Solaris_ControllerComponent : CIM_RedundancyComponent -{ -}; - - -//============================================================================= -// Title: Solaris_MPXIOComponent -// Version: 1.3.0 -// Date: 2/12/02 -// Description: Solaris_MPXIOComponent MOF Class definition -//============================================================================= - - [Association, Aggregation, - Provider ("jni:libWBEMdisk.so"), - Version("1.3.0"), - Description( - "A redundancy group aggregates managed system elements, and" - "indicates that these elements provide redundancy. Specifically" - "this class represents the physical controllers that are" - "a part of the scsi_vhci controller group.")] -class Solaris_MPXIOComponent : Solaris_ControllerComponent -{ - [Override ("GroupComponent"), Aggregate, Key, - Description ( - "This grouping is an extra capacity group.")] - Solaris_MPXIOGroup REF GroupComponent; - - [Override ("PartComponent"), Key, - Description ( - "Parts can only be a controller type.")] - CIM_Controller REF PartComponent; -}; - - -//============================================================================= -// Title: Solaris_StorageLibrary -// Version: 0.0.9 -// Date: 2/12/02 -// Description: Solaris_StorageLibrary MOF Class definition -//============================================================================= - - [Version("0.0.9"), - Experimental, - Description ( - "A StorageLibrary is a collection of ManagedSystemElements " - "that operate together to provide cartridge library " - "capabilities. This object serves as an aggregation point to " - "group the following elements: MediaTransferDevices, a Label" - "Reader, a library Door, MediaAccessDevices, and other " - "Library components.") ] - -class Solaris_StorageLibrary : CIM_StorageLibrary -{ -}; diff --git a/usr/src/cmd/wbem/provider/c/mof/Solaris_NFS1.0.mof b/usr/src/cmd/wbem/provider/c/mof/Solaris_NFS1.0.mof deleted file mode 100644 index 39f3bf6111..0000000000 --- a/usr/src/cmd/wbem/provider/c/mof/Solaris_NFS1.0.mof +++ /dev/null @@ -1,1229 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 - */ -/* - * ident "%Z%%M% %I% %E% SMI" - * Title Solaris Network File System (NFS) MOF specification 1.3 - * Description Solaris Network File System model. - * Date 03/21/2003 - * Version 1.3 - * Copyright 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma namespace("root/cimv2") -#pragma Locale ("en_US") - -// =================================================================== -// Objects -// =================================================================== - -#pragma namespace("__create") - -[Provider("jni:libWBEMnfs.so"), - Version("1.3.0"), - Description ( - "A class that represents a local NFS shared object on the " - "server side that is made accessible to other systems.") -] -class Solaris_NFSShare : CIM_NFSShare -{ - [Description("If set to true: maximal access is given to all " - "clients. Valid for NFS version 2 only. Corresponds " - "to the 'aclok' share_nfs option (Solaris 9)."), - ModelCorrespondence{"Solaris_NFSMount.Version"}] - boolean AllowAccessControl = false; - - [Description("Sets the the effective user ID of unknown users. By " - "default, unknown users are given the effective user " - "ID UID_NOBODY. UID_NOBODY is usually set to 60001 but " - "because an administrator can change this we don't set " - "it to this by default. Corresponds to the " - "'anon=' share_nfs option (Solaris 9)."), - Required, - Units("Bytes")] - Uint32 EffectiveUID; - - [Description("If set to true: causes the server file system to " - "silently ignore any attempt to enable the setuid or " - "setgid mode bits. Corresponds to the 'nosuid' " - "share_nfs option (Solaris 9).")] - boolean IgnoreSetId = false; - - [Description("Enables NFS server logging for the specified file " - "system. The optional tag determines the location of " - "the related log files. The tag is defined in " - "etc/nfs/nfslog.conf. The default value is the global " - "tag. The log file tag is only applicable when logging is " - "turned on. Corresponds to the 'log=' share_nfs option " - "(Solaris 9)."), - MappingStrings{"SOLARIS9.SUN|/etc/nfs/nfslog.conf"}] - String LogFileTag; - - [Description("If set to true: the share is to be persistent across " - "reboots.")] - boolean Persistent = false; - - [Description( - "A value of true prevents clients from mounting subdirectories " - "of shared directories. Corresponds to the 'nosub' share_nfs " - "option (Solaris 9).")] - boolean PreventSubDirMount = false; - - [Description("If set to true: the public file handle is moved from " - "root (/) to the exported directory. Corresponds to " - "the 'public' share_nfs option (Solaris 9).")] - boolean Public = false; - - [Description("This attribute is only used upon creation of a share. " - "Security information should be retrieved from " - "Solaris_NFSShareSecurity and Solaris_NFSShareSecurityModes." - "This attribute stores the security options for a share. " - "Each element of the array is a string starting with " - "sec=<mode> and including all options, such as access lists, " - "pertaining to that security mode.")] - String SecurityOptions[]; - - [Description("A string of share options for the shared file system as found" - "in /etc/dfs/sharetab.")] - String ShareOptions; - - [Description("An attribute that is only used at the time of creation of " - "a Solaris_NFSShare instance. If it is set to true, the " - "the NFS server daemons (nfsd and mountd) will be started " - "with the default settings, if and only if, nfsd and mountd " - "aren't already running on the host. The daemons will NOT " - "be stopped and restarted. As a side effect of starting the " - "NFS server daemons the share being created will be placed " - "as an entry in /etc/dfs/dfstab since the starting of the " - "daemon relies on entries here."), - MappingStrings{"SOLARIS9.SUN|/etc/init.d/nfs.server start"}] - boolean StartDaemons = false; -}; - -[Provider( - "jni:libWBEMnfs.so"), - Version("1.3.0"), - Description ( - "A class used to represent the NFS share security mode and " - "associated options for a Solaris_NFSShare object.") -] -class Solaris_NFSShareSecurity : CIM_Setting -{ - - [Description("Sets the maximum life time (in seconds) of the " - "RPC request's credential, that the NFS server " - "will allow. Valid for NFS sec mode of diffie " - "helman (dh) only. Corresponds to the 'window=' " - "share_nfs option (Solaris 9)." - "If the security mode is not Diffie Helman, this " - "property will not be set."), - ModelCorrespondence{"Solaris_NFSShareSecurity.Mode"}, - Units("seconds")] - uint32 MaxLife = 30000; - - [Key, - Description ( - "Security mode used. Can be either sys, dh, krb5, krb5i, " - "krb5p. Unknown and other default to the default security " - "mode of AUTH_SYS (sys). Corresponds to the 'sec=' share_nfs " - "option (Solaris 9)."), - Required, - ValueMap {"Unknown", "Other", "sys", "dh", "krb5", "krb5i", "krb5p"}] - String Mode; - - [Description ( - "If true: Access will be read-only for all clients in this " - "security mode. else: access will be read-write. Corresponds " - "to the 'ro' share_nfs option (Solaris 9).")] - boolean ReadOnly; - - [Description ( - "The list of clients whose access will be read-only. " - "Corresponds to the 'ro=' share_nfs option (Solaris 9).")] - string ReadOnlyList[]; - - [Description ( - "The list of clients whose access will be read-write. " - "Corresponds to the 'rw=' share_nfs option (Solaris 9).")] - string ReadWriteList[]; - - [Description ( - "The list of hosts with root access. Only root users from the " - "hosts specified will have root access. Corresponds to the " - "'root=' share_nfs option (Solaris 9).")] - string RootServers[]; - - [Override("SettingId"), - Key, - Description("The path name of the share."), - Required] - String SettingId; -}; - -#pragma namespace("__modify") - -[Provider( - "jni:libWBEMnfs.so"), - Version("1.3.0"), - Description ( - "The options used to mount a Solaris NFS file system.")] -class Solaris_NFS : CIM_NFS -{ - [Deprecated { - "This is not replaced with anything. Global doesn't apply to NFS file " - "system mounts."}, - Description("If set to true: the filesystem is mounted 'globally' on all " - "nodes of a cluster. " - "If set to false (default): the filesystem is not mounted on " - "all nodes of a cluster. " - "Ignored for non-clustered systems.")] - boolean Global = false; - - [Deprecated { - "Solaris_NFSMount.GroupId"}, - Description("If set to true: use BSD style group id semantics. " - "If set to false (default): use System V style group " - "id semantics.")] - boolean GrpId = false; - -// [Override("Name"), -// Description("The Name property is populated with the following string: " -// "resource:=<resource> devid:=<devid> " -// "Upon creation of an instance of Solaris_NFS, Name must be " -// "populated with just the file system resource " -// "(ex: /dev/dsk/c0t0d0s6 or pogo:/export) since the devid/file " -// "system id is not yet known.")] -// string Name; - - [Deprecated { - "Solaris_Mount.NoMnttabEntry"}, - Description("If set to true: the mount entry is not added to /etc/mnttab. " - " If set to false (default): the mount is recorded in " - "/etc/mnttab.")] - boolean NoMnttabEntry = false; - - [Deprecated { - "Solaris_Mount.NoSuid"}, - Description("If set to true: don't allow allow setuid execution. " - "If set to false (default): allow setuid execution.")] - boolean NoSuid = false; - - [Deprecated { - "Solaris_Mount.Overlay"}, - Description("If set to true: the file system is mounted over an existing " - "mounted filesystem. " - "If set to false (default): the filesystem is not mounted over " - "an existing mounted filesystem.")] - boolean Overlay = false; - - [Deprecated { - "Solaris_NFSMount.Posix"}, - Description("If set to true: use POSIX.1 semantics for filesystem. " - "If set to false (default): do not use POSIX.1 semantics.")] - boolean Posix = false; - - [Deprecated { - "Solaris_NFSMount.Protocol"}, - Description("A string specifying the transport protocol used for the " - "NFS mount. It is the value of the network_id field from " - "/etc/netconfig.")] - String Proto; - - [Deprecated { - "Solaris_NFSMount.Public"}, - Description("If set to true: use the public file handle. " - "If set to false (default): do not use the public " - "file handle.")] - boolean Public = false; - - [Deprecated { - "Solaris_NFSMount.EnableQuotaChecking"}, - Description("If set to true: enable quota checking. " - "If set to false (default): disable quota checking.")] - boolean Quota = false; - - [Deprecated { - "The same effect can be achieved by setting Solaris_Mount.ReadOnly " - "to false which resets the mount option to read-write. Then remount " - "the filesystem."}, - Description("If set to true: remount a read-only file system with " - "read-write options. " - "If set to false (default): the filsystem is mounted with " - "the specified mount options.")] - boolean Remount = false; - - [Deprecated { - "Solaris_NFSMount.SecurityMode"}, - Description("A string describing the security mode for NFS transactions. " - "Available modes is listed in /etc/nfssec.conf.")] - String SecurityMode; - - [Deprecated { - "Calculate from CIM_FileSystem.FileSystemSize and " - "CIM_FileSystem.AvailableSpace. " - "UsedSpace = CIM_FileSystem.FileSystemSize - " - "CIM_FileSystem.AvailableSpace. " - "Note: CIM_FileSystem.AvailableSpace now contains " - "the correct value with respect to the space " - "reserved only for superuser."}, - Description("Indicates the total amount of used space on the " - "File System in bytes. Note that this is not the " - "FileSystemSize minus AvailableSpace due to the space " - "reserved only for superuser."), - Units("Bytes")] - uint64 UsedSpace; - - [Deprecated { - "Solaris_NFSMount.Version"}, - Description ("Version number of NFS protocol to use."), - ValueMap {"2", "3", "4", "highest"}] - String Version = "highest"; - - // Methods - [Deprecated { - "Solaris_NFSMount.getNetCfgList"}, - Description("Method to obtain the list of network IDs from " - "the /etc/netconfig file.")] - sint32 getNetCfgList([OUT, IN(false)]string ids[]); - - [Deprecated { - "Solaris_NFSMount.getNfsSecList"}, - Description("Method to obtain the list of nfs security modes from " - "the /etc/nfssec.conf file.")] - sint32 getNfsSecList([OUT, IN(false)]string secmodes[]); - - [Deprecated { - "Solaris_NFSMount.getDefaultNfsSecMode"}, - Description("Method to obtain the the default nfs security mode from " - "the /etc/nfssec.conf file.")] - sint32 getDefaultNfsSecMode([OUT, IN(false)]string secmode); -}; - -#pragma namespace("__create") - -[Provider( - "jni:libWBEMnfs.so"), - Version("1.3.0"), - Description ( - "This class represents a share that is to be persistent across reboots. " - "There is a possiblity depending on the persistance mechanism " - "(ex: /etc/dfs/dfstab) that there are multiple shares that are to be " - "persistent which have the same path. If this occurs, a Key Not Unique " - "type of error will be set when calling intrinsic methods getInstance, " - "deleteInstance, addInstance and editInstance and no instance will be " - "returned.")] -class Solaris_PersistentShare : CIM_SystemSetting -{ - - [Description( - "String representing the share command entry in /etc/dfs/dfstab.")] - String Command; - - [Override ("SettingID"), - Description("The path of the persistent share.")] - string SettingID; - - //Methods - [Description("Method to be used to clear up conflicts in the " - "/etc/dfs/dfstab file. Conflicts are defined as any entries that have " - "the same path to be shared. All entries with the same path as passed " - "in with the <path> parameter will be deleted. The method returns 1 " - "if it succeded, 0 if a failure occurred.")] - sint32 deleteAllWithDuplicatePath([IN]String path); -}; - -[Experimental, - Version("1.3.0"), - Description("The Solaris_MountSetting object contains attributes that " - "are commonly used to configure a file system mount on a " - "Solaris system. Attributes which have the potential of " - "operating at a different value than what was configured " - "will also be on the Solaris_Mount object.")] -class Solaris_MountSetting : CIM_SettingData { - - [Description ("The underlying file system type the mount is to be " - "configured for."), - ValueMap {"Unknown", "Other", "ufs", "nfs", "hsfs", "cachefs", "pcfs", - "procfs", "tmpfs", "VxFS", "SAMQFS", "devfs", "udfs", "sockfs", - "autofs", "specfs", "fifofs"}, - ModelCorrespondence {"CIM_FileSystem.FileSystemType"}, - MappingStrings {"SOLARIS9.SUN|mount -F <FStype>"}] - string FsType; - - [Description ("A string of file system mount options specified when " - "mounting the file system. This property is also present on " - "the Solaris_Mount class. The Solaris_Mount.MountOptions " - "property represents the actual operational value of the " - "mount options string as reported in /etc/mnttab. " - "Therefore, the properties may have different values."), - MappingStrings {"SOLARIS9.SUN|mount -o <mount options, comma delimited>"}] - string MountOptions; - - [Description("If set to true: the mount entry is added to /etc/mnttab." - "If set to false (default): the mount is not recorded in " - "/etc/mnttab."), - MappingStrings {"SOLARIS9.SUN|mount -m"}] - boolean NoMnttabEntry = false; - - [Description("If set to true: don't allow allow setuid execution. " - "If set to false (default): allow setuid execution."), - MappingStrings {"SOLARIS9.SUN|mount -o suid | nosuid"}] - boolean NoSuid = false; - - [Description("If set to true: the filesystem is mounted over an " - "existing mounted filesystem. If set to false (default): " - " the filesystem is not mounted over an existing mounted " - "filesystem."), - MappingStrings {"SOLARIS9.SUN|mount -O"}] - boolean Overlay = false; - - [Description("If set to true: the filesystem is mounted as a read only " - "filesystem. If set to false (default): the " - "filesystem is mounted as a read/write " - "filesystem."), - MappingStrings {"SOLARIS9.SUN|mount -o rw | ro"}] - boolean ReadOnly = false; - - [Description("If set to true, the file system will have a corresponding " - "device to mount/mount point entry in /etc/vfstab. This " - "property is also present on the Solaris_Mount class. The " - "Solaris_Mount.VfstabEntry property represents the actual " - "operational value of whether or not the mount has and entry " - "in /etc/vfstab. Therefore, the properties may have " - "different values."), - MappingStrings {"SOLARIS9.SUN|vfstab"}] - - boolean VfstabEntry; - -}; - -[Experimental, - Version("1.3.0"), - Description ("The Solaris_NFSMountSetting object contains attributes " - "that are commonly used to configure an NFS mount " - "on a Solaris system. Attributes which have the " - "potential of operating at a different value than what " - "was configured will also be on the Solaris_NFSMount object.") ] -class Solaris_NFSMountSetting : Solaris_MountSetting -{ - - [Description ( - "If set to true, allow data and attribute caching. If set to " - "false, suppress data and attribute caching. Corresponds to " - "the 'noac' mount_nfs option (Solaris 9).") ] - boolean AttributeCaching = true; - - [Description ( - "Maximum number of seconds that cached attributes are held " - "after directory update. Corresponds to the 'acdirmax=' " - "mount_nfs option (Solaris 9)."), - Units("Seconds") ] - uint16 AttributeCachingForDirectoriesMax = 60; - - [Description ( - "Minimum number of seconds that cached attributes are held " - "after directory update. Corresponds to the 'acdirmin=' " - "mount_nfs option (Solaris 9)."), - Units("Seconds") ] - uint16 AttributeCachingForDirectoriesMin = 30; - - [Description ( - "Maximum number of seconds that cached attributes are held " - "after file modification. Corresponds to the 'acregmax=' " - "mount_nfs option (Solaris 9)."), - Units("Seconds") ] - uint16 AttributeCachingForRegularFilesMax = 60; - - [Description ( - "Minimum number of seconds that cached attributes are held " - "after file modification. Corresponds to the 'acregmin=' " - "mount_nfs option (Solaris 9)."), - Units("Seconds") ] - uint16 AttributeCachingForRegularFilesMin = 3; - - [Description("If set to true: enable quota checking. If set to " - "false (default): disable quota checking. " - "Corresponds to the 'quota/noquota' mount_nfs " - "options (Solaris 9).")] - boolean EnableQuotaChecking = false; - - [Description ( - "The list of resources to be used for failover. Each " - "resource must be of the form host:/pathname, NFS URL or a " - "list of hosts, if the exported directory name is the same.")] - string FailoverList[]; - - [Description("If true, data is transferred directly between " - "client and server, with no buffering on the client. " - "If false: Data is buffered on the client. " - "The default is false. Corresponds to the " - "'forcedirectio/noforcedirectio' mount_nfs options " - "(Solaris 9).")] - boolean ForceDirectIO = false; - - [Description("If set to true: use BSD style group id semantics. " - "If set to false (default): use System V style group " - "id semantics. Corresponds to the 'grpid' mount_nfs " - "option (Solaris 9).")] - boolean GroupId = false; - - [Description ( - "If set to true, once the FileSystem is mounted, NFS requests " - "are retried until the hosting System responds. " - "If set to false, once the FileSystem is mounted, an error " - "is returned if the hosting System does not respond. " - "Corresponds to the 'hard/soft' mount_nfs options (Solaris 9).")] - boolean HardMount = true; - - [Description ( - "If set to true, keyboard interrupts are permitted to kill a " - "process that is hung while waiting for a response on a hard- " - "mounted file system. If set to false, keyboard interrupts " - "are ignored. Corresponds to the 'intr/nointr' mount_nfs " - "options (Solaris 9).") ] - boolean Interrupt = true; - - [Description ("Maximum number of NFS retransmissions allowed. " - "Corresponds to the 'retrans=' mount_nfs option (Solaris 9).") ] - uint16 MaxRetransmissionAttempts = 5; - - [Description ("Maximum number of mount failure retries allowed. The " - "default for the mount command is 10000. The default for the " - "automounter is 0. " - "Corresponds to the 'retry=' mount_nfs option (Solaris 9). " - "This value is only valid upon creation of an instance of " - "instance of Solaris_NFSMount. This is actually a mount _process_ " - "option and not a mount option.") ] - uint16 MountFailureRetries; - - [Description("If true, do not perform the normal close-to-open " - "consistency. The client will not perform the flush " - "on close and the request for validation, allowing " - "the possiblity of differences among copies of the " - "same file as stored on multiple clients. This can " - "be used where it can be guaranteed that accesses to " - "a specified file system will be made from only one " - "client and only that client. The default is false. " - "Corresponds to the 'nocto' mount_nfs option (Solaris 9).")] - boolean NoCloseToOpenConsistency = false; - - [Description("If set to true: use POSIX.1 semantics for filesystem. " - "If set to false (default): do not use POSIX.1 " - "semantics. Corresponds to the 'posix' mount_nfs " - "option (Solaris 9).")] - boolean Posix = false; - - [Description("A string specifying the transport protocol used for the " - "NFS mount. It is the value of the network_id field from " - "/etc/netconfig. Corresponds to the 'proto=' " - "mount_nfs option (Solaris 9)."), - MappingStrings{"SOLARIS9.SUN|/etc/netconfig"} ] - String Protocol; - - [Description("If set to true: use the public file handle. " - "If set to false (default): do not use the public " - "file handle. Corresponds to the 'public' mount_nfs " - "option (Solaris 9).")] - boolean Public = false; - - [Description ("Read buffer size in bytes. The default is 32768 for " - "version 3 and 8192 for version 2. Corresponds to the " - "'rsize=' mount_nfs option (Solaris 9)."), - Units("Bytes") ] - uint64 ReadBufferSize; - - [Description ("NFS timeout in tenths of a second. The default is 11 " - "tenths of a second for connectionless transports and 600 " - "tenths of a second for connection oriented transports. " - "Corresponds to the 'timeo=' mount_nfs option (Solaris 9)."), - Units ("Tenths of Seconds") ] - uint32 RetransmissionTimeout; - - [Description ( - "If set to true, if the first mount attempt fails, retries are " - "performed in the foreground. If set to false, retries are " - "performed in the background. Corresponds to the 'bg/fg' " - "mount_nfs options (Solaris 9). " - "This value is only valid upon creation of an instance of " - "instance of Solaris_NFSMount. This is actually a mount _process_ " - "option and not a mount option.") ] - boolean RetryInForeground = true; - - [Description("A string describing the security mode for NFS transactions. " - "Available modes is listed in /etc/nfssec.conf. " - "Corresponds to the 'sec=' mount_nfs option (Solaris 9)."), - MappingStrings{"SOLARIS9.SUN|/etc/nfssec.conf"} ] - String SecurityMode; - - [Description ( - "The NFS Server IP port number. Default is NFS_PORT which is defined " - "in /usr/include/nfs/nfs.h. Corresponds to the 'port=' mount_nfs " - "option (Solaris 9).") ] - uint32 ServerCommunicationPort; - - [Description("The name of the NFS server.")] - String ServerName; - - [Description("The path of the NFS resource on the server.")] - String ServerPath; - - [Description ( - "Version number of NFS protocol to use. Corresponds to the " - "'vers=' mount_nfs option (Solaris 9)."), - ValueMap {"2", "3", "4", "highest"} ] - String Version = "highest"; - - [Description ("Write buffer size in bytes. The default is 32768 for " - "version 3 and 8192 for version 2. Corresponds to the " - "'wsize=' mount_nfs option (Solaris 9)."), - Units("Bytes") ] - uint64 WriteBufferSize; - - - [Description( - "Allows the creation and manipulation of extended attributes. " - "Corresponds to the 'xattr/noxattr' mount_nfs options (Solaris 9). ")] - boolean Xattr = true; -}; - - [Experimental, - Version("1.3.0"), - Description("The Solaris_ShareSetting object contains attributes that " - "are commonly used to configure the sharing of a resource " - "on a Solaris system.")] -class Solaris_ShareSetting : CIM_SettingData { -}; - -[Experimental, - Version("1.3.0"), - Description ( - "A class that contains attributes for a local NFS shared object " - "on the server side that is made accessible to other systems. " - "Attributes which have the potential of operating at a different " - "value than what was configured will also be on the Solaris_Mount " - "object.") -] -class Solaris_NFSShareSetting : Solaris_ShareSetting -{ - - [Description("If set to true: maximal access is given to all " - "clients. Valid for NFS version 2 only. Corresponds " - "to the 'aclok' share_nfs option (Solaris 9)."), - ModelCorrespondence{"Solaris_NFSMount.Version"}] - boolean AllowAccessControl; - - [Description("Sets the the effective user ID of unknown users. By " - "default, unknown users are given the effective user " - "ID UID_NOBODY. UID_NOBODY is usually set to 60001 but " - "because an administrator can change this we don't set " - "it to this by default. Corresponds to the " - "'anon=' share_nfs option (Solaris 9)."), - Required, - Units("Bytes")] - Uint32 EffectiveUID; - - [Description("If set to true: causes the server file system to " - "silently ignore any attempt to enable the setuid or " - "setgid mode bits. Corresponds to the 'nosuid' " - "share_nfs option (Solaris 9).")] - boolean IgnoreSetId; - - [Description("Enables NFS server logging for the specified file " - "system. The optional tag determines the location of " - "the related log files. The tag is defined in " - "etc/nfs/nfslog.conf. The default value is the global " - "tag. Corresponds to the 'log=' share_nfs option (Solaris 9)."), - MappingStrings{"SOLARIS9.SUN|/etc/nfs/nfslog.conf"}] - String LogFileTag = "global"; - - [Description("If set to true: the public file handle is moved from " - "root (/) to the exported directory. Corresponds to " - "the 'public' share_nfs option (Solaris 9).")] - boolean Public; - - [Description ( - "A value of true prevents clients from mounting subdirectories " - "of shared directories. Corresponds to the 'nosub' share_nfs " - "option (Solaris 9).")] - boolean PreventSubDirMount; - - [Description("An attribute that is only used at the time of creation of " - "a NFS Share instance. If it is set to true, the " - "the NFS server daemons (nfsd and mountd) will be started " - "with the default settings, if and only if, nfsd and mountd " - "aren't already running on the host. The daemons will NOT " - "be stopped and restarted. As a side effect of starting the " - "NFS server daemons the share being created will be placed " - "as an entry in /etc/dfs/dfstab since the starting of the " - "daemon relies on entries here."), - MappingStrings{"SOLARIS9.SUN|/etc/init.d/nfs.server start"}] - boolean StartDaemons; -}; - - - [Provider("jni:libWBEMnfs.so"), - Version("1.3.0"), - Description("A logical element that contains the information necessary " - "to represent and manage the functionality provided by " - "shares in Solaris.")] - -class Solaris_ShareService : CIM_Service { - - //Methods - [Description("Method which shares all resources listed in the file " - "specified with the file parameter. The specified file " - "should contain a list of share command lines. " - "If no file is specified /etc/dfs/dfstab is used. " - "Resources may be shared by specific file system types by " - "specifying the file system type (or types in a comma " - "delimited list) as input parameter, fstype. The method " - "returns 1 if it succeded, 0 if a failure occurred. " - "Corresponds to /usr/sbin/shareall (Solaris 9)")] - sint32 shareall([IN]String fstype, [IN]String file); - - [Description("Method which unshares all currently shared resources. " - "If a fstype (or fstypes in a comma delimited list) is not " - "specified in the fstype parameter, all distributed file " - "system type resources will be unshared. The method " - "returns 1 if it succeded, 0 if a failure occurred. " - "Corresponds to /usr/sbin/unshareall (Solaris 9)")] - sint32 unshareall([IN]String fstype); -}; - - - - [Provider("jni:libWBEMnfs.so"), - Version("1.3.0"), - Description("A logical element that contains the information necessary " - "to represent and manage the functionality provided by " - "file system mounts in Solaris.")] - -class Solaris_MountService : CIM_Service { - - //Methods - [Description("Method which mounts file systems listed in the file system " - "table as specified with the fstable parameter." - "The specified file system table (file) must be in the vfstab " - "format. If no file system table is specified (an empty " - "string is passed in) /etc/vfstab is used. Only the file " - "systems having the mount at boot field set to yes in the " - "table will be mounted. " - "The fstype parameter can be used to specify the file " - "system type of the file systems to be mounted. The " - "onlyLocalFileSystems and onlyRemoteFileSystems parameters " - "are mutually exclusive. If onlyLocalFileSystems is true, " - "the mountall action will be limited to local file systems. " - "If onlyRemoteFileSystems is true, the mountall action will " - "be limited to remote file system types. The method " - "returns 1 if it succeded, 0 if a failure occurred. " - "Corresponds to /usr/sbin/mountall (Solaris 9)")] - sint32 mountall([IN]String fstype, [IN]Boolean onlyLocalFileSystems, - [IN]Boolean onlyRemoteFileSystems, [IN]String fstable); - - [Description("Method used to unmount all file systems except root, /usr, " - "/var, /var/adm, /var/run, /proc, and /dev/fd. There is no " - "guarantee that this function will unmount busy file " - "systems. " - "The fstype parameter can be used to specify the fstype of " - "the file systems to be unmounted. The host parameter " - "can be used to unmount all file systems listed in " - "/etc/mnttab that are remote-mounted from the host specified." - " If onlyLocalFileSystems is true, limit the unmounting to " - "local file systems. If onlyRemoteFileSystems is true, the " - "mounting will be limited to remote file system types. " - "If killProcesses is true, a SIGKILL signal is sent to each " - "process using the file and this spawns kills for those" - "processes. If unmountInParallel is true, the umount " - "operation will be performed in parallel. " - "The onlyLocalFileSystems and onlyRemoteFileSystems " - "parameters are mutually exclusive and cannot be used when " - "a host is defined. The fstype and host parameters are also " - "mutually exclusive. The method returns 1 if it succeded, 0 " - "if a failure occurred. Corresponds to /usr/sbin/umountall " - "(Solaris 9)")] - sint32 unmountall([IN]String fstype, - [IN]String host, - [IN]Boolean onlyLocalFileSystems, - [IN]Boolean onlyRemoteFileSystems, - [IN]Boolean killProcesses, - [IN]Boolean umountInParallel); -}; - -// =================================================================== -// Associations -// =================================================================== -#pragma namespace("__modify") - -[Association, - Provider( - "jni:libWBEMnfs.so"), - Version("1.3.0"), - Description ( - "An association between a remote directory that can be mounted " - "and the NFS mounted file system.") ] -class Solaris_NFSMount : Solaris_Mount -{ - [Description ( - "If set to true, allow data and attribute caching. If set to " - "false, suppress data and attribute caching. Corresponds to " - "the 'noac' mount_nfs option (Solaris 9).") ] - boolean AttributeCaching = true; - - [Description ( - "Maximum number of seconds that cached attributes are held " - "after directory update. Corresponds to the 'acdirmax=' " - "mount_nfs option (Solaris 9)."), - Units("Seconds") ] - uint16 AttributeCachingForDirectoriesMax = 60; - - [Description ( - "Minimum number of seconds that cached attributes are held " - "after directory update. Corresponds to the 'acdirmin=' " - "mount_nfs option (Solaris 9)."), - Units("Seconds") ] - uint16 AttributeCachingForDirectoriesMin = 30; - - [Description ( - "Maximum number of seconds that cached attributes are held " - "after file modification. Corresponds to the 'acregmax=' " - "mount_nfs option (Solaris 9)."), - Units("Seconds") ] - uint16 AttributeCachingForRegularFilesMax = 60; - - [Description ( - "Minimum number of seconds that cached attributes are held " - "after file modification. Corresponds to the 'acregmin=' " - "mount_nfs option (Solaris 9)."), - Units("Seconds") ] - uint16 AttributeCachingForRegularFilesMin = 3; - - [Override ("Dependent"), - Description ("The file system mounted via NFS. " - "It is also referred to as the resource to mount.") ] - Solaris_NFS REF Dependent; - - [Description("If set to true: enable quota checking. If set to " - "false (default): disable quota checking. " - "Corresponds to the 'quota/noquota' mount_nfs " - "options (Solaris 9).")] - boolean EnableQuotaChecking = false; - - [Description("If true, data is transferred directly between " - "client and server, with no buffering on the client. " - "If false: Data is buffered on the client. " - "The default is false. Corresponds to the " - "'forcedirectio/noforcedirectio' mount_nfs options " - "(Solaris 9).")] - boolean ForceDirectIO = false; - - [Description ( - "The list of resources to be used for failover. Each " - "resource must be of the form host:/pathname, NFS URL or a " - "list of hosts, if the exported directory name is the same.")] - string FailoverList[]; - - [Description("If set to true: use BSD style group id semantics. " - "If set to false (default): use System V style group " - "id semantics. Corresponds to the 'grpid' mount_nfs " - "option (Solaris 9).")] - boolean GroupId = false; - - [Description ( - "If set to true, once the FileSystem is mounted, NFS requests " - "are retried until the hosting System responds. " - "If set to false, once the FileSystem is mounted, an error " - "is returned if the hosting System does not respond. " - "Corresponds to the 'hard/soft' mount_nfs options (Solaris 9).")] - boolean HardMount = true; - - [Description ( - "If set to true, keyboard interrupts are permitted to kill a " - "process that is hung while waiting for a response on a hard- " - "mounted file system. If set to false, keyboard interrupts " - "are ignored. Corresponds to the 'intr/nointr' mount_nfs " - "options (Solaris 9).")] - boolean Interrupt = true; - - [Description ("Maximum number of NFS retransmissions allowed. " - "Corresponds to the 'retrans=' mount_nfs option (Solaris 9).") ] - uint16 MaxRetransmissionAttempts = 5; - - [Description ("Maximum number of mount failure retries allowed. The " - "default for the mount command is 10000. The default for the " - "automounter is 0. " - "Corresponds to the 'retry=' mount_nfs option (Solaris 9). " - "This value is only valid upon creation of an instance of " - "instance of Solaris_NFSMount. This is actually a mount _process_ " - "option and not a mount option.") ] - uint16 MountFailureRetries; - - [Description("If true, do not perform the normal close-to-open " - "consistency. The client will not perform the flush " - "on close and the request for validation, allowing " - "the possiblity of differences among copies of the " - "same file as stored on multiple clients. This can " - "be used where it can be guaranteed that accesses to " - "a specified file system will be made from only one " - "client and only that client. The default is false. " - "Corresponds to the 'nocto' mount_nfs option (Solaris 9).")] - boolean NoCloseToOpenConsistency = false; - - [Description("If set to true: use POSIX.1 semantics for filesystem. " - "If set to false (default): do not use POSIX.1 " - "semantics. Corresponds to the 'posix' mount_nfs " - "option (Solaris 9).")] - boolean Posix = false; - - [Description("A string specifying the transport protocol used for the " - "NFS mount. It is the value of the network_id field from " - "/etc/netconfig. Corresponds to the 'proto=' " - "mount_nfs option (Solaris 9)."), - MappingStrings{"SOLARIS9.SUN|/etc/netconfig"}] - String Protocol; - - [Description("If set to true: use the public file handle. " - "If set to false (default): do not use the public " - "file handle. Corresponds to the 'public' mount_nfs " - "option (Solaris 9).")] - boolean Public = false; - - [Description ("Read buffer size in bytes. The default is 32768 for " - "version 3 and 8192 for version 2. Corresponds to the " - "'rsize=' mount_nfs option (Solaris 9)."), - Units("Bytes") ] - uint64 ReadBufferSize; - - [Deprecated { - "Solaris_NFSMount.FailoverList"}, - Description ( - "Array of replicated resources to be used for failover. Each " - "resource must be of the form host:/pathname, NFS URL or a " - "list of hosts, if the exported directory name is the same.") ] - string ReplicatedResources[]; - - [Description ("NFS timeout in tenths of a second. The default is 11 " - "tenths of a second for connectionless transports and 600 " - "tenths of a second for connection oriented transports. " - "Corresponds to the 'timeo=' mount_nfs option (Solaris 9)."), - Units ("Tenths of Seconds")] - uint32 RetransmissionTimeout; - - [Description ( - "If set to true, if the first mount attempt fails, retries are " - "performed in the foreground. If set to false, retries are " - "performed in the background. Corresponds to the 'bg/fg' " - "mount_nfs options (Solaris 9). " - "This value is only valid upon creation of an instance of " - "instance of Solaris_NFSMount. This is actually a mount _process_ " - "option and not a mount option.")] - boolean RetryInForeground = true; - - [Description("A string describing the security mode for NFS transactions. " - "Available modes are listed in /etc/nfssec.conf. " - "Corresponds to the 'sec=' mount_nfs option (Solaris 9)."), - MappingStrings{"SOLARIS9.SUN|/etc/nfssec.conf"}] - String SecurityMode; - - [Description ( - "The NFS Server IP port number. Default is NFS_PORT which is defined " - "defined in /usr/include/nfs/nfs.h. Corresponds to the " - "'port=' mount_nfs option (Solaris 9).") ] - uint32 ServerCommunicationPort; - - [Description("The name of the NFS server.")] - String ServerName; - - [Description("The path of the NFS resource on the server.")] - String ServerPath; - - [Description ( - "Version number of NFS protocol to use. Corresponds to the " - "'vers=' mount_nfs option (Solaris 9)."), - ValueMap {"2", "3", "4", "highest"} ] - String Version = "highest"; - - - [Description ("Write buffer size in bytes. The default is 32768 for " - "version 3 and 8192 for version 2. Corresponds to the " - "'wsize=' mount_nfs option (Solaris 9)."), - Units("Bytes") ] - uint64 WriteBufferSize; - - [Description( - "Allows the creation and manipulation of extended attributes. " - "Corresponds to the 'xattr/noxattr' mount_nfs options (Solaris 9). ")] - boolean Xattr = true; - - // Methods - [Description("Method to obtain the list of network IDs from " - "the /etc/netconfig file. Returns 1 if method completed " - "successfully, 0 if an error occurred. Corresponds to the " - "data stored in /etc/netconfig (Solaris 9).")] - sint32 getNetCfgList([OUT, IN(false)]string ids[]); - - [Description("Method to obtain the list of nfs security modes from " - "the /etc/nfssec.conf file. Returns 1 if method completed " - "successfully, 0 if an error occurred. Corresponds to the " - "data stored in /etc/nfssec.conf (Solaris 9).")] - sint32 getNfsSecList([OUT, IN(false)]string secmodes[]); - - [Description("Method to obtain the the default nfs security mode from " - "the /etc/nfssec.conf file. Returns 1 if method completed " - "successfully, 0 if an error occurred. Corresponds to the " - "data stored in /etc/nfssec.conf (Solaris9).")] - sint32 getDefaultNfsSecMode([OUT, IN(false)]string secmode); -}; - -#pragma namespace("__create") - -[Association, - Provider( - "jni:libWBEMnfs.so"), - Version("1.3.0"), - Description ( - "This association represents the relationship between an NFS " - "share and its security modes.") -] -class Solaris_NFSShareSecurityModes : CIM_ElementSetting -{ - [Override ("Element"), - Description ("The share the mode is for.")] - Solaris_NFSShare REF Element; - - [Override("Setting"), Description ( - "The Setting that can be applied") ] - Solaris_NFSShareSecurity REF Setting; - -}; - -[Association, - Version("1.3.0"), - Description ("Class represents the relationship between an NFS " - "Share object and its default setting. The default " - "setting of AUTH_SYS for the security mode will be " - "set in the provider.") -] -class Solaris_NFSShareDefSecurityMode : CIM_DefaultSetting -{ - [Override ("Element"), - Description ("The share the mode is for.")] - Solaris_NFSShare REF Element; - - [Override("Setting"), - Description ("The Setting that can be applied to ") ] - Solaris_NFSShareSecurity REF Setting; - -}; - - - -[Association, - Provider( - "jni:libWBEMnfs.so"), - Version("1.3.0"), - Description ("Class that represents the association between the " - "share and its host.") -] -class Solaris_HostedShare : CIM_HostedShare -{ - [Override ("Antecedent"), - Description ("The host of the NFS shared file system.")] - Solaris_ComputerSystem REF Antecedent; - - [Override ("Dependent"), - Description ("The NFS shared directory.")] - Solaris_NFSShare REF Dependent; -}; - -[Association, - Aggregation, - Version("1.3.0"), - Description( - "An association that represents the aggregation of all of " - "the Solaris_PersistentShare objects and ties them to a " - "Solaris_SystemConfiguration object.")] -class Solaris_PersistentShareConfiguration : CIM_SystemSettingContext -{ - -}; - -[Association, - Provider( - "jni:libWBEMnfs.so"), - Version("1.3.0"), - Description( - "This class ties an individual Solaris_PersistentShare to its " - "owning system.")] -class Solaris_PersistentShareForSystem : CIM_SettingForSystem -{ - - [Override ("Antecedent"), - Description ("The Solaris Hosting System.")] - Solaris_ComputerSystem REF Antecedent; - - [Override ("Dependent"), - Description ("The dfstab entry for the system.")] - Solaris_PersistentShare REF Dependent; -}; - - -[Association, - Provider( - "jni:libWBEMnfs.so"), - Version("1.3.0"), - Description( - "This class ties an individual Solaris_PersistentShare to a " - "Solaris_NFSShare.")] -class Solaris_NFSShareEntry : CIM_ElementSetting -{ - [Override ("Setting"), - Description ("The persistent share setting")] - Solaris_PersistentShare REF Setting; - -}; - -[Association, - Version("1.3.0"), - Description ("associates the Share to a LogicalElement that is " - "being exported.") ] -class Solaris_SharedElement : CIM_SharedElement -{ -}; - -#pragma namespace("__modify") - -[Association, - Provider("java:com.sun.wbem.solarisprovider.fsmgr.share.Solaris_NFSExport"), - Deprecated { - "Solaris_SharedFileSystem"}, - Description ("Solaris_NFSExport inherited from CIM_Export")] -class Solaris_NFSExport : CIM_Export -{ - - [Description ( - "If set to true: give maximum access to NFS v2 clients. " - "If set to false (default): give minimum access to NFS v2 " - "clients.") ] - boolean AclOk = false; - - [Description ( - "The effective UID of unknown users. The default value is " - "UID_NOBODY (60001).") ] - sint32 AnonUid; - - [Description ("Share description.") ] - string Description; - - [Description ( - "Index file to use when accessing a Web-NFS directory.") ] - string IndexFile; - - [Description ( - "If set to true: prevents clients from mounting " - "subdirectories of the exported directory. " - "If set to false (default): allows clients to mount " - "subdirectories.") ] - boolean NoSub = false; - - [Description ( - "If set to true: don't allow allow setuid execution. " - "If set to false (default): allow setuid execution.") ] - boolean NoSuid = false; - - [Description ( - "If set to true: use exported directory as the location of " - "the public file handle for Web-NFS. " - "If set to false (default): exported directory is not the " - "location of the public file handle.") ] - boolean Public = false; - - [Description ( - "If set to true: grant read-only access to all clients. " - "If set to false (default):do not grant read-only access " - "to all clients.") ] - boolean ReadOnly = false; - - [Description ( - "If set to true (default): grant read-write access to all " - "clients. " - "If set to false: do not grant read-write access to all " - "clients.") ] - boolean ReadWrite = true; - - [Description ("Array of clients granted read-only access.") ] - string ROAccessList[]; - - [Description ( - "Array of hosts from which root users can gain " - "root access.") ] - string RootAccessList[]; - - [Description ("Array of clients granted read-write access.") ] - string RWAccessList[]; - - [Description ( - "If set to true: the filesystem is shared at boot. " - "If set to false (default): the resource is not shared at " - "boot.") ] - boolean ShareAtBootEntry = false; - - [Description ( - "Array of security modes to be used to NFS transactions. " - "Available modes is listed in /etc/nfssec.conf.") ] - string SecurityModes[]; - - [Description ("Share options.") ] - string ShareOptions; - - [Description ( - "Maximum lifetime of a request allowed by the NFS server " - "(in seconds) when using Diffie-Hellman or Kerberos security. " - "Default value is 30000 seconds (8.3 hours).") ] - uint32 Window = 30000; - - - //Methods - [Description("Method to delete a dfstab entry.")] - sint32 deleteDfstabEntry([IN]string pathName); - -}; - -#pragma namespace("__create") - -[Association, - Version("1.3.0"), - Provider( - "jni:libWBEMnfs.so"), - Description ("Class that represents the association between the local " - "filesystem and the Solaris_NFSShare on the server.") -] -class Solaris_SharedFileSystem : Solaris_SharedElement -{ - [Override("SystemElement"), Key, MAX(1), - Description ("The Directory that is Shared.") ] - CIM_LogicalElement REF SystemElement; - - [Override("SameElement"), Key, Description ( - "The Shared view of the Directory.") ] - CIM_Share REF SameElement; - -}; diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/Makefile b/usr/src/cmd/wbem/provider/c/wbem_disk/Makefile deleted file mode 100644 index 69b139f082..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/Makefile +++ /dev/null @@ -1,72 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 2002-2003 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -SUBDIR1 = common \ - diskdrive \ - diskpartition \ - disk \ - logicaldisk \ - controller \ - assoc \ - mpxio - -SUBDIR2 = lib - -SUBDIRS = $(SUBDIR1) $(SUBDIR2) - -POFILE = wbem_disk.po -POFILES = $(SUBDIRS:%=%/_%.po) - -all:= TARGET = all -clean:= TARGET = clean -clobber:= TARGET = clobber -install:= TARGET = install -lint:= TARGET = lint -check:= TARGET = check -_msg:= TARGET = catalog - -.KEEP_STATE: - -all clean install lint check: $(SUBDIR1) .WAIT $(SUBDIR2) - -clobber: $(SUBDIRS) - $(RM) $(POFILE) - -FRC: - -${SUBDIRS}: FRC - cd $@; pwd; $(MAKE) $(TARGET) - -$(POFILE): $(POFILES) - $(BUILDPO.pofiles) - -_msg: $(SUBDIRS) .WAIT $(MSGDOMAINPOFILE) - -include $(SRC)/Makefile.msg.targ diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Makefile b/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Makefile deleted file mode 100644 index 4782d73605..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Makefile +++ /dev/null @@ -1,82 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -OBJECTS = Solaris_DiskPartitionBasedOnDisk.o \ - Sol_DiskPartitionBasedOnFDisk.o \ - Solaris_MediaPresent.o \ - Solaris_RealizesExtent.o \ - Solaris_RealizesDiskDrive.o \ - Solaris_SCSIInterface.o \ - Solaris_IDEInterface.o \ - Solaris_MPXIOInterface.o \ - Sol_MPXIOCtrlrLogicalIdentity.o \ - Solaris_MPXIOComponent.o - -LINT_OBJS = $(OBJECTS:%.o=%.ln) - -GENERAL = $(ROOTWBEMINC) \ - $(SRC)/lib/libdiskmgt/common \ - $(SRC)/cmd/wbem/provider/c/include - -CPPFLAGS += -I. $(GENERAL:%=-I%) -D_REENTRANT -Dpic -D_TS_ERRNO - -CFLAGS += $(XREGSFLAG) $(C_PICFLAGS) - -LINTFLAGS += -um -LINTLIBS = $(LDLIBS.cmd) - -POFILE = _assoc.po -MSGFILES = $(OBJECTS:%.o=%.i) - -CLOBBERFILES += $(POFILE) - -.KEEP_STATE: - -all: $(OBJECTS) - -install: all - -lint: $(LINT_OBJS) - $(LINT.c) $(LINTFLAGS) $(LINT_OBJS) $(LINTLIBS) - -clean: - $(RM) $(OBJECTS) $(LINT_OBJS) $(MSGFILES) - -check: - $(CSTYLE) -p -P $(OBJECTS:%.o=%.c) *.h - $(HDRCHK) *.h - -catalog: $(POFILE) - -$(POFILE): $(MSGFILES) - $(BUILDPO.msgfiles) - -include $(SRC)/cmd/Makefile.targ -include $(SRC)/Makefile.msg.targ diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Sol_DiskPartitionBasedOnFDisk.c b/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Sol_DiskPartitionBasedOnFDisk.c deleted file mode 100644 index 38e63a541d..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Sol_DiskPartitionBasedOnFDisk.c +++ /dev/null @@ -1,1007 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <unistd.h> -#include <netdb.h> -#include <errno.h> - -#include "util.h" -#include "cimKeys.h" -#include "providerNames.h" -#include "messageStrings.h" -#include "partbasedon_descriptors.h" -#include "partition_descriptors.h" -#include "logicaldisk_descriptors.h" -#include "Sol_DiskPartitionBasedOnFDisk.h" - -#define DISKPART_GETINSTANCE "DISKPART_BASEDONFDISK,GET_INSTANCE" -#define DISKPART_ENUMINSTANCES "DISKPART_BASEDONFDISK,ENUM_INSTANCES" -#define DISKPART_ENUMINSTANCENAMES \ - "DISKPART_BASEDONFDISK,ENUM_INSTANCENAMES" -#define DISKPART_CREATEINSTANCE "DISKPART_BASEDONFDISK,CREATE_INSTANCE" -#define DISKPART_DELETEINSTANCE "DISKPART_BASEDONFDISK,DELETE_INSTANCE" -#define DISKPART_SETINSTANCE "DISKPART_BASEDONFDISK,SET_INSTANCE" -#define DISKPART_SETPROPERTY "DISKPART_BASEDONFDISK,SET_PROPERTY" -#define DISKPART_GETPROPERTY "DISKPART_BASEDONFDISK,GET_PROPERTY" -#define DISKPART_INVOKEMETHOD "DISKPART_BASEDONFDISK,INVOKE_METHOD" -#define DISKPART_EXECQUERY "DISKPART_BASEDONFDISK,EXEC_QUERY" -#define DISKPART_ASSOCIATORS "DISKPART_BASEDONFDISK,ASSOCIATORS" -#define DISKPART_ASSOCIATORNAMES "DISKPART_BASEDONFDISK,ASSOCIATOR_NAMES" -#define DISKPART_REFERENCES "DISKPART_BASEDONFDISK,REFERENCES" -#define DISKPART_REFERENCENAMES "DISKPART_BASEDONFDISK,REFERENCE_NAMES" - -static CCIMInstanceList *createDiskPartBasedOnFRefList( -CCIMObjectPath *pObjectName, CCIMObjectPathList *objList, int *error); - -/* - * Solaris_DiskPartitionBasedOnFDisk provider - * - * It is important to note that all memory allocated by these functions - * and passed to the CIMOM, is freed by the door process prior to - * sending a copy of the data to the CIMOM. - */ - -/* - * Name: cp_getInstance_Solaris_DiskPartitionBasedOnFDisk - * - * Description: Returns an instance which matches the passed in object path - * if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMInstance* -cp_getInstance_Solaris_DiskPartitionBasedOnFDisk(CCIMObjectPath* pOP) -{ - CCIMInstance* inst = NULL; - CCIMPropertyList* pCurPropList; - dm_descriptor_t f_descriptor; - dm_descriptor_t s_descriptor; - CCIMObjectPath *antOp = NULL; - CCIMObjectPath *depOp = NULL; - char *name; - int error; - - - if (pOP == NULL || - (pCurPropList = pOP->mKeyProperties) == NULL) { - util_handleError(DISKPART_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstance *)NULL); - } - - antOp = (CCIMObjectPath *)util_getKeyValue(pCurPropList, reference, - ANTECEDENT, &error); - - if (error == 0) { - depOp = (CCIMObjectPath *)util_getKeyValue(pCurPropList, reference, - DEPENDENT, &error); - } - if (error != 0) { - util_handleError(DISKPART_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstance *)NULL); - } - - /* - * Now, get the name of the antecedent from the object path. - */ - - if (((pCurPropList = antOp->mKeyProperties) == NULL) || - ((pCurPropList = depOp->mKeyProperties) == NULL)) { - util_handleError(DISKPART_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstance *)NULL); - } - - pCurPropList = antOp->mKeyProperties; - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - if (error != 0) { - util_handleError(DISKPART_GETINSTANCE, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstance *)NULL); - } - - f_descriptor = dm_get_descriptor_by_name(DM_PARTITION, name, - &error); - /* - * Not found. Return a null instance. - */ - - if (error == ENODEV) { - return ((CCIMInstance *)NULL); - } - if (error != 0) { - util_handleError(DISKPART_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstance *)NULL); - } - /* - * Now, get the name of the dependent from the object path. - */ - - pCurPropList = depOp->mKeyProperties; - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - if (error != 0) { - util_handleError(DISKPART_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - dm_free_descriptor(f_descriptor); - } - - s_descriptor = dm_get_descriptor_by_name(DM_SLICE, name, &error); - /* - * Not found. Return a null instance. - */ - if (error == ENODEV) { - dm_free_descriptor(f_descriptor); - return ((CCIMInstance *)NULL); - } - if (error != 0) { - util_handleError(DISKPART_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - dm_free_descriptor(f_descriptor); - return ((CCIMInstance *)NULL); - } - - /* Turn these descriptors in to a disk part based on instance */ - - inst = partbasedon_descriptor_toCCIMInstance( - hostName, f_descriptor, s_descriptor, - DISKPART_BASEDONFDISK, &error); - dm_free_descriptor(s_descriptor); - dm_free_descriptor(f_descriptor); - - if (error != 0) { - util_handleError(DISKPART_GETINSTANCE, CIM_ERR_FAILED, - PARTBASEDON_DESC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstance *)NULL); - } - - return (inst); -} - -/* - * Name: cp_enumInstances_Solaris_DiskPartitionBasedOnFDisk - * - * Description: Returns a linked list of instances of - * Solaris_DiskPartitionBasedOnFDisk if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMInstanceList * if instances are found. - * Otherwise, NULL is returned. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_enumInstances_Solaris_DiskPartitionBasedOnFDisk(CCIMObjectPath* pOP) -{ - CCIMInstanceList* instList = NULL; - CCIMInstance* inst; - CCIMException* ex; - dm_descriptor_t *fdisk_descriptorp = NULL; - dm_descriptor_t *part_descriptorp = NULL; - int error = 0; - int filter[2]; - int i = 0; - int j = 0; - - filter[0] = DM_MT_FIXED; - filter[1] = DM_FILTER_END; - - fdisk_descriptorp = dm_get_descriptors(DM_PARTITION, filter, &error); - - if (fdisk_descriptorp == NULL|| - fdisk_descriptorp[0] == NULL) { - return ((CCIMInstanceList *)NULL); - } - if (error != 0) { - util_handleError(DISKPART_ENUMINSTANCES, CIM_ERR_FAILED, - DM_GET_DESCRIPTORS, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* - * For each one of the fdisks found, get the associated partitions. - */ - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(DISKPART_ENUMINSTANCES, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - dm_free_descriptors(fdisk_descriptorp); - return ((CCIMInstanceList *)NULL); - } - - for (i = 0; fdisk_descriptorp[i] != NULL; i ++) { - part_descriptorp = dm_get_associated_descriptors( - fdisk_descriptorp[i], DM_SLICE, &error); - - /* If no partitions associated with this fdisk, continue */ - - if (part_descriptorp == NULL) { - continue; - } - - if (error != 0) { - util_handleError(DISKPART_ENUMINSTANCES, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, &error); - dm_free_descriptors(fdisk_descriptorp); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - - for (j = 0; part_descriptorp[j] != NULL; j ++) { - inst = partbasedon_descriptor_toCCIMInstance(hostName, - fdisk_descriptorp[i], part_descriptorp[j], - DISKPART_BASEDONFDISK, &error); - if (error != 0) { - util_handleError(DISKPART_ENUMINSTANCES, CIM_ERR_FAILED, - PARTBASEDON_DESC_TO_INSTANCE_FAILURE, NULL, &error); - dm_free_descriptors(fdisk_descriptorp); - dm_free_descriptors(part_descriptorp); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(DISKPART_ENUMINSTANCES, CIM_ERR_FAILED, - PARTBASEDON_DESC_TO_INSTANCE_FAILURE, ex, &error); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - } - - dm_free_descriptors(part_descriptorp); - } - - - dm_free_descriptors(fdisk_descriptorp); - - /* - * Since the instance list has to be created prior to the for loop, - * it may be empty. The CIMOM requires that I return a NULL list if - * there are no instances, so I must check for this. - */ - if (instList->mDataObject == NULL) { - cim_freeInstanceList(instList); - instList = NULL; - } - return (instList); -} - -/* - * Name: cp_enumInstanceNames_Solaris_DiskPartitionBasedOnFDisk - * - * Description: Returns a linked list of CCIMObjectPath * - * of Solaris_DiskPartitionBasedOnFDisk if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMObjectPathList * if objects are found. - * Otherwise, NULL is returned. - */ - -/* ARGSUSED */ -CCIMObjectPathList* -cp_enumInstanceNames_Solaris_DiskPartitionBasedOnFDisk(CCIMObjectPath * pOP) { - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pOP == NULL) { - util_handleError(DISKPART_ENUMINSTANCENAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - /* - * Call in to enumInstances and then convert the instance list in - * to an object list. - */ - - instList = - cp_enumInstances_Solaris_DiskPartitionBasedOnFDisk(pOP); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Creating an instance of a Solaris_DiskPartitionBasedOnFDisk is not supported. - */ - -/* ARGSUSED */ -CCIMObjectPath* -cp_createInstance_Solaris_DiskPartitionBasedOnFDisk( -CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - int error; - - util_handleError(DISKPART_CREATEINSTANCE, - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &error); - return ((CCIMObjectPath *)NULL); -} - - -/* - * Deleting an instance of a Solaris_DiskPartitionBasedOnFDisk is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_DiskPartitionBasedOnFDisk(CCIMObjectPath* pInst) -{ - int error; - - util_handleError(DISKPART_DELETEINSTANCE, - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &error); - return (cim_false); -} - -/* - * Name: cp_getProperty_Solaris_DiskPartitionBasedOnFDisk - * - * Description: Returns the property requested, if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMProperty * if found. - */ - -/* ARGSUSED */ -CCIMProperty * -cp_getProperty_Solaris_DiskPartitionBasedOnFDisk(CCIMObjectPath *pOP, - char *pPropName) -{ - - CCIMProperty *prop = NULL; - CCIMInstance *inst = NULL; - int error = 0; - - if (pOP == NULL) { - util_handleError(DISKPART_GETPROPERTY, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMProperty *)NULL); - } - - inst = cp_getInstance_Solaris_DiskPartitionBasedOnFDisk(pOP); - if (inst == NULL) { - return ((CCIMProperty *)NULL); - } - - prop = cim_getProperty(inst, pPropName); - cim_freeInstance(inst); - return (prop); -} - -/* - * Setting an instance of a Solaris_DiskPartitionBasedOnFDisk is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_DiskPartitionBasedOnFDisk(CCIMObjectPath* pOP, -CCIMInstance* pInst) -{ - int error; - - util_handleError(DISKPART_SETINSTANCE, - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &error); - return (cim_false); -} - - -/* - * Setting a property on a Solaris_DiskPartitionBasedOnFDisk is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_DiskPartitionBasedOnFDisk( -CCIMObjectPath* pOP, CCIMProperty* pProp) -{ - int error; - - util_handleError(DISKPART_SETPROPERTY, - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &error); - return (cim_false); -} - -/* - * No Methods for Solaris_DiskPartitionBasedOnFDisk. - */ - -/* ARGSUSED */ -CCIMProperty* -cp_invokeMethod_Solaris_DiskPartitionBasedOnFDisk( -CCIMObjectPath* op, cimchar* methodName, - CCIMPropertyList* inParams, CCIMPropertyList* outParams) -{ - CCIMProperty *retVal = (CCIMProperty *)NULL; - return (retVal); -} - -/* - * Name: cp_execQuery_Solaris_DiskPartitionBasedOnFDisk - * - * Description: - * Returns an instance list which matches the query if any are found. - * - * Parameters: - * CCIMObjectPath *op - An CCIMObjectPath * which contains the - * information on the class for which to find the instances. - * - * selectList - Not used - * nonJoinExp - Not used - * - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ -/* - * Currently, there is no WQL parser for the C providers. As a result, - * what is returned to the CIMOM is a list of instances with - * a NULL value at the beginning of the list. This NULL value indicates - * to the CIMOM that it must do the filtering for the client. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_execQuery_Solaris_DiskPartitionBasedOnFDisk( -CCIMObjectPath *op, cimchar *selectList, cimchar *nonJoinExp, - cimchar *queryExp, int queryType) -{ - CCIMInstanceList *instList = NULL; - CCIMInstanceList *result; - CCIMInstance *emptyInst; - CCIMException *ex; - int error; - - if (op == NULL) { - util_handleError(DISKPART_EXECQUERY, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = cp_enumInstances_Solaris_DiskPartitionBasedOnFDisk(op); - - if (instList == NULL) { - return ((CCIMInstanceList *)NULL); - } - /* - * Create a null instance and add it to the beginning - * of the list to indicate to the CIMOM that no filtering - * was done. - */ - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError(DISKPART_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, &error); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_createInstanceList(); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(DISKPART_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_addInstance(result, emptyInst); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(DISKPART_EXECQUERY, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - /* - * Since copying the original list to the new list will - * leave no way to free the original list, manually - * concatenate the original list to the new one. - */ - - result->mNext = instList; - return (result); -} - -/* - * Name: cp_associators_Solaris_DiskPartitionBasedOnFDisk - * - * Description: - * Returns instances of objects associated with the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pResultClass - If specified, only return instances that - * are of this class type. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * cimchar *pResultRole - If specified, only return instances that - * are playing this role in the association. - * - * - * Returns: - * CCIMInstanceList * if associated objects are found. This list - * may be empty. NULL is returned on error. - */ - -/* ARGSUSED */ -CCIMInstanceList * -cp_associators_Solaris_DiskPartitionBasedOnFDisk(CCIMObjectPath *pAssocName, -CCIMObjectPath *pObjectName, cimchar *pResultClass, cimchar *pRole, - cimchar *pResultRole) -{ - CCIMPropertyList *pCurPropList; - CCIMInstanceList *instList = NULL; - dm_descriptor_t *assoc_descriptors; - dm_descriptor_t obj_desc; - char *name; - int error = 0; - int isAntecedent = 0; - - /* - * In this association, both sides are Solaris_DiskPartitions. I - * must use the c api to find the appropriate type calling this, - * either fdisk, or Solaris. - */ - if (pObjectName == NULL || - ((pCurPropList = pObjectName->mKeyProperties) == NULL)) { - util_handleError(DISKPART_ASSOCIATORS, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - if (error != 0) { - util_handleError(DISKPART_ASSOCIATORS, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - obj_desc = dm_get_descriptor_by_name(DM_PARTITION, name, - &error); - - if (error == ENODEV) { - obj_desc = dm_get_descriptor_by_name(DM_SLICE, name, - &error); - /* - * No matching device found. - */ - if (error == ENODEV) { - return ((CCIMInstanceList *)NULL); - } else if (error != 0) { - util_handleError(DISKPART_ASSOCIATORS, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - } else if (error != 0) { - util_handleError(DISKPART_ASSOCIATORS, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } else { - isAntecedent = 1; - } - - if (pRole != NULL) { - if (strcasecmp(pRole, ANTECEDENT) == 0) { - if (isAntecedent != 1) { - util_handleError(DISKPART_ASSOCIATORS, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - } else if (strcasecmp(pRole, DEPENDENT) == 0) { - if (isAntecedent == 1) { - util_handleError(DISKPART_ASSOCIATORS, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - } - } - - if (isAntecedent) { - /* Get associated descriptors. */ - - assoc_descriptors = dm_get_associated_descriptors(obj_desc, - DM_SLICE, &error); - - } else { - assoc_descriptors = dm_get_associated_descriptors(obj_desc, - DM_PARTITION, &error); - } - dm_free_descriptor(obj_desc); - - if (assoc_descriptors == NULL) { - return ((CCIMInstanceList *)NULL); - } - - if (assoc_descriptors[0] == NULL) { - dm_free_descriptors(assoc_descriptors); - return ((CCIMInstanceList *)NULL); - } - - if (error != 0) { - util_handleError(DISKPART_ASSOCIATORS, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - if (isAntecedent) { - instList = partition_descriptors_toCCIMInstanceList(DISK_PARTITION, - NULL, assoc_descriptors, &error); - } else { - instList = partition_descriptors_toCCIMInstanceList(DISK_PARTITION, - assoc_descriptors, NULL, &error); - } - dm_free_descriptors(assoc_descriptors); - - if (error != 0) { - util_handleError(DISKPART_ASSOCIATORS, CIM_ERR_FAILED, - PART_DESC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - return (instList); -} - -/* - * Name: cp_associatorNames_Solaris_DiskPartitionBasedOnFDisk - * - * Description: - * Returns a list of objects associated with the passed in - * object if there are any via the object CCIMObjectPath. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pResultClass - If specified, only return instances that - * are of this class type. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * cimchar *pResultRole - If specified, only return instances that - * are playing this role in the association. - * - * - * Returns: - * CCIMObjectPathList * if associated objects are found. - * Otherwise, NULL is returned. - */ - -/* ARGSUSED */ -CCIMObjectPathList * -cp_associatorNames_Solaris_DiskPartitionBasedOnFDisk(CCIMObjectPath *pAssocName, -CCIMObjectPath *pObjectName, cimchar *pResultClass, cimchar *pRole, - cimchar *pResultRole) -{ - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pObjectName == NULL) { - util_handleError(DISKPART_ASSOCIATORNAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - instList = - cp_associators_Solaris_DiskPartitionBasedOnFDisk( - pAssocName, pObjectName, pResultClass, pRole, pResultRole); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Name: cp_references_Solaris_DiskPartitionBasedOnFDisk - * - * Description: - * Returns instances of objects that have references to the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * Returns: - * CCIMInstanceList * if associated objects are found. - * Otherwise, NULL is returned. - */ - -/* ARGSUSED */ -CCIMInstanceList * -cp_references_Solaris_DiskPartitionBasedOnFDisk(CCIMObjectPath *pAssocName, -CCIMObjectPath *pObjectName, char *pRole) -{ - - CCIMInstanceList *instList = NULL; - CCIMObjectPathList *objList; - int error = 0; - - - if (pObjectName == NULL) { - util_handleError(DISKPART_REFERENCES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - /* - * Get the list of those objects that are referred to by - * the calling object. - */ - - objList = - cp_associatorNames_Solaris_DiskPartitionBasedOnFDisk( - pAssocName, pObjectName, NULL, NULL, NULL); - - if (objList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - instList = createDiskPartBasedOnFRefList(pObjectName, objList, &error); - cim_freeObjectPathList(objList); - return (instList); -} - -/* - * Name: cp_referenceNames_Solaris_DiskPartitionBasedOnFDisk - * - * Description: - * Returns a instances of objects that have references to the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * - * Returns: - * CCIMObjectPathList * if associated objects are found. - * Otherwise, NULL is returned. - * - */ - -/* ARGSUSED */ -CCIMObjectPathList * -cp_referenceNames_Solaris_DiskPartitionBasedOnFDisk(CCIMObjectPath *pAssocName, -CCIMObjectPath *pObjectName, cimchar *pRole) -{ - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pObjectName == NULL) { - util_handleError(DISKPART_REFERENCENAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - instList = - cp_references_Solaris_DiskPartitionBasedOnFDisk( - pAssocName, pObjectName, pRole); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - return (objList); -} - -/* - * Create the association class with the passed in attributes. - */ - -static -CCIMInstanceList * -createDiskPartBasedOnFRefList(CCIMObjectPath *pObjectName, - CCIMObjectPathList *objList, int *error) -{ - - CCIMObjectPathList *tmpList; - CCIMInstanceList *instList = NULL; - CCIMInstance *inst; - CCIMObjectPath *obj1; - CCIMObjectPath *obj2; - CCIMException *ex; - CCIMPropertyList *pCurPropList = NULL; - dm_descriptor_t obj_desc; - char *name; - int isAntecedent = 0; - - *error = 0; - - if (objList == NULL) { - return (instList); - } - /* - * Determine if it is the antecedent or dependent calling this - */ - if ((pCurPropList = pObjectName->mKeyProperties) == NULL) { - util_handleError(DISKPART_BASEDONFDISK, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, error); - return ((CCIMInstanceList *)NULL); - } - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - error); - if (*error != 0) { - util_handleError(DISKPART_BASEDONFDISK, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, error); - return ((CCIMInstanceList *)NULL); - } - obj_desc = dm_get_descriptor_by_name(DM_PARTITION, name, error); - if (*error == ENODEV) { - obj_desc = dm_get_descriptor_by_name(DM_SLICE, name, error); - if (*error == ENODEV) { - return (instList); - } else if (*error != 0) { - util_handleError(DISKPART_BASEDONFDISK, CIM_ERR_FAILED, - NULL, NULL, error); - return ((CCIMInstanceList *)NULL); - } - } else if (*error != 0) { - util_handleError(DISKPART_BASEDONFDISK, CIM_ERR_FAILED, - NULL, NULL, error); - return ((CCIMInstanceList *)NULL); - } else { - isAntecedent = 1; - } - - dm_free_descriptor(obj_desc); - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(DISKPART_BASEDONFDISK, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, error); - return ((CCIMInstanceList *)NULL); - } - - tmpList = objList; - while (tmpList != NULL) { - obj1 = tmpList->mDataObject; - obj2 = cim_copyObjectPath(pObjectName); - if (obj2 == NULL) { - ex = cim_getLastError(); - util_handleError(DISKPART_BASEDONFDISK, CIM_ERR_FAILED, - COPY_OBJPATH_FAILURE, ex, error); - return ((CCIMInstanceList *)NULL); - } - - inst = cim_createInstance(DISKPART_BASEDONDISK); - if (inst == NULL) { - ex = cim_getLastError(); - util_handleError(DISKPART_BASEDONDISK, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, error); - cim_freeObjectPath(obj2); - return ((CCIMInstanceList *)NULL); - } - - if (isAntecedent) { - util_doReferenceProperty(ANTECEDENT, obj2, cim_true, inst, - error); - cim_freeObjectPath(obj2); - util_doReferenceProperty(DEPENDENT, obj1, cim_true, inst, - error); - if (*error != 0) { - ex = cim_getLastError(); - util_handleError(DISKPART_BASEDONDISK, CIM_ERR_FAILED, - CREATE_REFPROP_FAILURE, ex, error); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - - } else { - util_doReferenceProperty(DEPENDENT, obj2, cim_true, inst, - error); - util_doReferenceProperty(ANTECEDENT, obj1, cim_true, inst, - error); - cim_freeObjectPath(obj2); - if (*error != 0) { - ex = cim_getLastError(); - util_handleError(DISKPART_BASEDONDISK, CIM_ERR_FAILED, - CREATE_REFPROP_FAILURE, ex, error); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - } - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(DISKPART_BASEDONDISK, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, error); - return ((CCIMInstanceList *)NULL); - } - - tmpList = tmpList->mNext; - } - return (instList); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Sol_DiskPartitionBasedOnFDisk.h b/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Sol_DiskPartitionBasedOnFDisk.h deleted file mode 100644 index 6db87050fb..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Sol_DiskPartitionBasedOnFDisk.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOL_DISKPARTITIONBASEDONFDISK_H_ -#define _SOL_DISKPARTITIONBASEDONFDISK_H_ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> -#include <cimprovider.h> -#include <cimomhandle.h> -#include <cimlogsvc.h> -#include <cp_required.h> - -#include "libdiskmgt.h" - -#ifdef __cplusplus -} -#endif - -#endif /* _SOL_DISKPARTITIONBASEDONFDISK_H_ */ diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Sol_MPXIOCtrlrLogicalIdentity.c b/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Sol_MPXIOCtrlrLogicalIdentity.c deleted file mode 100644 index fb36bda18e..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Sol_MPXIOCtrlrLogicalIdentity.c +++ /dev/null @@ -1,1044 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <unistd.h> -#include <netdb.h> -#include <errno.h> - -#include "util.h" -#include "cimKeys.h" -#include "providerNames.h" -#include "messageStrings.h" -#include "ctrl_descriptors.h" -#include "mpxiogroup_descriptors.h" -#include "Sol_MPXIOCtrlrLogicalIdentity.h" - - -#define LOGID_GETINSTANCE "MPXIO_LOGICALIDENTITY,GET_INSTANCE" -#define LOGID_ENUMINSTANCES "MPXIO_LOGICALIDENTITY,ENUM_INSTANCES" -#define LOGID_ENUMINSTANCENAMES \ - "MPXIO_LOGICALIDENTITY,ENUM_INSTANCENAMES" -#define LOGID_CREATEINSTANCE "MPXIO_LOGICALIDENTITY,CREATE_INSTANCE" -#define LOGID_DELETEINSTANCE "MPXIO_LOGICALIDENTITY,DELETE_INSTANCE" -#define LOGID_SETINSTANCE "MPXIO_LOGICALIDENTITY,SET_INSTANCE" -#define LOGID_SETPROPERTY "MPXIO_LOGICALIDENTITY,SET_PROPERTY" -#define LOGID_GETPROPERTY "MPXIO_LOGICALIDENTITY,GET_PROPERTY" -#define LOGID_INVOKEMETHOD "MPXIO_LOGICALIDENTITY,INVOKE_METHOD" -#define LOGID_EXECQUERY "MPXIO_LOGICALIDENTITY,EXEC_QUERY" -#define LOGID_ASSOCIATORS "MPXIO_LOGICALIDENTITY,ASSOCIATORS" -#define LOGID_ASSOCIATORNAMES "MPXIO_LOGICALIDENTITY,ASSOCIATOR_NAMES" -#define LOGID_REFERENCES "MPXIO_LOGICALIDENTITY,REFERENCES" -#define LOGID_REFERENCENAMES "MPXIO_LOGICALIDENTITY,REFERENCE_NAMES" - -static -CCIMInstanceList * -mpxioLogIdentAssocToInstList(CCIMObjectPath *pObjectName, - cimchar *pObjectNameRole, CCIMObjectPathList *objList, - cimchar *objRole, int *error); - -static -CCIMInstance * -mpxioLogIdentAssocToInst(CCIMObjectPath *obj1, cimchar *obj1Role, - CCIMObjectPath *obj2, cimchar *obj2Role, int *error); - -/* - * Solaris_MPXIOCtrlrLogicalIdentity provider - * - * It is important to note that all memory allocated by these functions - * and passed to the CIMOM, is freed by the door process prior to - * sending a copy of the data to the CIMOM. - */ - -/* - * Name: cp_getInstance_Solaris_MPXIOCtrlrLogicalIdentity - * - * Description: Returns an instance which matches the passed in object path - * if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ - -CCIMInstance* -cp_getInstance_Solaris_MPXIOCtrlrLogicalIdentity(CCIMObjectPath* pOP) -{ - CCIMInstance *inst = NULL; - CCIMPropertyList *pCurPropList; - CCIMObjectPath *antOp = NULL; - CCIMObjectPath *depOp = NULL; - dm_descriptor_t c_descriptor; - char *name; - int error; - - if (pOP == NULL || - ((pCurPropList = pOP->mKeyProperties) == NULL)) { - util_handleError(LOGID_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - - antOp = (CCIMObjectPath *)util_getKeyValue(pCurPropList, reference, - SYSTEM_ELEMENT, &error); - - if (error == 0) { - depOp = (CCIMObjectPath *)util_getKeyValue(pCurPropList, reference, - SAME_ELEMENT, &error); - } - - if (error != 0) { - util_handleError(LOGID_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - - /* - * Now, get the name of the antecedent from the object path. - */ - - if ((pCurPropList = antOp->mKeyProperties) == NULL) { - util_handleError(LOGID_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - - if (error != 0) { - util_handleError(LOGID_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - - /* - * The only reason it is needed to get the descriptor for these - * two devices is to verify that they still exist and are valid. - * If they are not found, then getting the instance for this - * association as passed in by the client is not possible. - */ - c_descriptor = dm_get_descriptor_by_name(DM_CONTROLLER, name, - &error); - /* - * Not found. Return a null instance. - */ - - if (error == ENODEV) { - return ((CCIMInstance *)NULL); - } - - if (error != 0) { - util_handleError(LOGID_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstance*)NULL); - } - - dm_free_descriptor(c_descriptor); - - /* - * At this point I have verified I have the controller device that - * are part of this association. Use the object paths I got - * earlier to create the mpxiologicalident instance. - */ - inst = mpxioLogIdentAssocToInst(antOp, SYSTEM_ELEMENT, depOp, - SAME_ELEMENT, &error); - - if (error != 0) { - util_handleError(LOGID_GETINSTANCE, CIM_ERR_FAILED, - MPXIOINT_ASSOC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstance *)NULL); - } - - return (inst); -} - -/* - * Name: cp_enumInstances_Solaris_MPXIOCtrlrLogicalIdentity - * - * Description: Returns a linked list of instances of - * Solaris_MPXIOCtrlrLogicalIdentity if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMInstanceList * if istances are found. - * Otherwise, NULL is returned. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_enumInstances_Solaris_MPXIOCtrlrLogicalIdentity(CCIMObjectPath* pOP) -{ - CCIMInstanceList *instList = NULL; - CCIMObjectPathList *cObjList = NULL; - CCIMObjectPathList *tmpObjList; - CCIMObjectPath *objPath; - CCIMException *ex; - int error = 0; - - /* - * Get the list of MPXIO Controllers. Then generate the list - * of mpxio groups from these controllers. - */ - - objPath = cim_createEmptyObjectPath(MPXIO_CONTROLLER); - if (objPath == NULL) { - ex = cim_getLastError(); - util_handleError(LOGID_ENUMINSTANCES, CIM_ERR_FAILED, - CREATE_OBJECT_PATH, ex, &error); - return ((CCIMInstanceList *)NULL); - } - cObjList = cimom_enumerateInstanceNames(objPath, cim_false); - cim_freeObjectPath(objPath); - - /* - * NULL is error. - */ - if (cObjList == NULL) { - ex = cim_getLastError(); - util_handleError(LOGID_ENUMINSTANCES, CIM_ERR_FAILED, - ENUM_INSTANCENAMES_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - - if (cObjList->mDataObject == NULL) { - return ((CCIMInstanceList *)NULL); - } - - /* - * Loop through all of these controller objects and get the associated - * disks. - */ - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(LOGID_ENUMINSTANCES, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - - /* - * For each of the object paths found above, generate the group - * object path that is associated with it. If, there is an MPXIO - * controller, there will automatically be an MPXIOGroup object - * because of the nature of this controllers identity. - */ - - for (tmpObjList = cObjList; tmpObjList != NULL; - tmpObjList = tmpObjList->mNext) { - - CCIMObjectPath *cOp; - CCIMInstance *tmpInst; - CCIMInstance *tmpInst1; - CCIMPropertyList *pCurPropList; - CCIMObjectPath *dObjPath; - dm_descriptor_t c_descriptor; - char *name = NULL; - - cOp = tmpObjList->mDataObject; - if ((pCurPropList = cOp->mKeyProperties) == NULL) { - util_handleError(LOGID_ENUMINSTANCES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - - name = (cimchar *)util_getKeyValue(pCurPropList, string, - DEVICEID, &error); - if (error != 0) { - util_handleError(LOGID_ENUMINSTANCES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - c_descriptor = dm_get_descriptor_by_name(DM_CONTROLLER, name, - &error); - if (error == ENODEV) { - continue; - } - if (error != 0) { - util_handleError(LOGID_ENUMINSTANCES, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - tmpInst = mpxiogroup_descriptor_toCCIMInstance( - c_descriptor, MPXIO_GROUP, &error); - dm_free_descriptor(c_descriptor); - - if (error != 0) { - util_handleError(LOGID_ENUMINSTANCES, CIM_ERR_FAILED, - MPXIOGRP_DESC_TO_INSTANCE_FAILURE, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - - dObjPath = cim_createObjectPath(tmpInst); - cim_freeInstance(tmpInst); - - if (dObjPath == NULL) { - util_handleError(LOGID_ENUMINSTANCES, CIM_ERR_FAILED, - CREATE_OBJECT_PATH_FAILURE, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - - tmpInst1 = mpxioLogIdentAssocToInst( - cOp, SYSTEM_ELEMENT, dObjPath, SAME_ELEMENT, &error); - cim_freeObjectPath(dObjPath); - - if (error != 0) { - util_handleError(LOGID_ENUMINSTANCES, CIM_ERR_FAILED, - DRIVE_DESC_TO_INSTANCE_FAILURE, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - - instList = cim_addInstance(instList, tmpInst1); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(LOGID_ENUMINSTANCES, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - } /* end for */ - - cim_freeObjectPathList(cObjList); - - /* - * It is possible I will have an empty instance list at - * this point. So, I must check and NULL this out if - * there are no entries. - */ - - if (instList->mDataObject == NULL) { - cim_freeInstanceList(instList); - instList = NULL; - } - return (instList); -} - -/* - * Name: cp_enumInstanceNames_Solaris_MPXIOCtrlrLogicalIdentity - * - * Description: Returns a linked list of CCIMObjectPath * - * of Solaris_MPXIOCtrlrLogicalIdentity if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMObjectPathList * if objects are found. NULL otherwise. - */ - -CCIMObjectPathList* -cp_enumInstanceNames_Solaris_MPXIOCtrlrLogicalIdentity(CCIMObjectPath * pOP) { - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pOP == NULL) { - util_handleError(LOGID_ENUMINSTANCENAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - /* - * Call in to enumInstances and then convert the instance list in - * to an object list. - */ - - instList = cp_enumInstances_Solaris_MPXIOCtrlrLogicalIdentity(pOP); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Creating an instance of a Solaris_MPXIOCtrlrLogicalIdentity is not supported. - */ - -/* ARGSUSED */ -CCIMObjectPath* -cp_createInstance_Solaris_MPXIOCtrlrLogicalIdentity(CCIMObjectPath* pOP, - CCIMInstance* pInst) -{ - int error; - - util_handleError(LOGID_CREATEINSTANCE, CIM_ERR_NOT_SUPPORTED, - NULL, NULL, &error); - return ((CCIMObjectPath *)NULL); -} - - -/* - * Deleting an instance of a Solaris_MPXIOCtrlrLogicalIdentity is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_MPXIOCtrlrLogicalIdentity(CCIMObjectPath* pInst) -{ - int error; - - util_handleError(LOGID_DELETEINSTANCE, CIM_ERR_NOT_SUPPORTED, - NULL, NULL, &error); - return (cim_false); -} - -/* - * Name: cp_getProperty_Solaris_MPXIOCtrlrLogicalIdentity - * - * Description: Returns the property requested, if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMProperty * if found. - */ - -/* ARGSUSED */ -CCIMProperty * -cp_getProperty_Solaris_MPXIOCtrlrLogicalIdentity(CCIMObjectPath *pOP, - char *pPropName) -{ - - CCIMProperty *prop = NULL; - CCIMInstance *inst = NULL; - int error = 0; - - if (pOP == NULL) { - util_handleError(LOGID_GETPROPERTY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMProperty *)NULL); - } - - inst = cp_getInstance_Solaris_MPXIOCtrlrLogicalIdentity(pOP); - if (inst == NULL) { - return ((CCIMProperty *)NULL); - } - - prop = cim_getProperty(inst, pPropName); - cim_freeInstance(inst); - return (prop); -} - -/* - * Setting an instance of a Solaris_MPXIOCtrlrLogicalIdentity is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_MPXIOCtrlrLogicalIdentity(CCIMObjectPath* pOP, - CCIMInstance* pInst) -{ - int error; - - util_handleError(LOGID_SETINSTANCE, CIM_ERR_NOT_SUPPORTED, - NULL, NULL, &error); - return (cim_false); -} - -/* - * Setting a property on a Solaris_MPXIOCtrlrLogicalIdentity is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_MPXIOCtrlrLogicalIdentity(CCIMObjectPath* pOP, - CCIMProperty* pProp) -{ - int error; - - util_handleError(LOGID_SETPROPERTY, CIM_ERR_NOT_SUPPORTED, - NULL, NULL, &error); - return (cim_false); -} - -/* - * No Methods for Solaris_MPXIOCtrlrLogicalIdentity. - */ - -/* ARGSUSED */ -CCIMProperty* -cp_invokeMethod_Solaris_MPXIOCtrlrLogicalIdentity( - CCIMObjectPath* op, cimchar* methodName, - CCIMPropertyList* inParams, CCIMPropertyList* outParams) -{ - CCIMProperty *retVal = (CCIMProperty *)NULL; - return (retVal); -} - -/* - * Name: cp_execQuery_Solaris_MPXIOCtrlrLogicalIdentity - * - * Description: - * Returns an instance list which matches the query if any are found. - * - * Parameters: - * CCIMObjectPath *op - An CCIMObjectPath * which contains the - * information on the class for which to find the instances. - * - * selectList - Not used - * nonJoinExp - Not used - * - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ -/* - * Currently, there is no WQL parser for the C providers. As a result, - * what is returned to the CIMOM is a list of instances with - * a NULL value at the beginning of the list. This NULL value indicates - * to the CIMOM that it must do the filtering for the client. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_execQuery_Solaris_MPXIOCtrlrLogicalIdentity(CCIMObjectPath *op, - cimchar *selectList, cimchar *nonJoinExp, cimchar *queryExp, int queryType) -{ - CCIMInstanceList *instList = NULL; - CCIMInstanceList *result; - CCIMInstance *emptyInst; - CCIMException *ex; - int error; - - if (op == NULL) { - util_handleError(LOGID_EXECQUERY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = cp_enumInstances_Solaris_MPXIOCtrlrLogicalIdentity(op); - - if (instList == NULL) { - return ((CCIMInstanceList *)NULL); - } - /* - * Create a null instance and add it to the beginning - * of the list to indicate to the CIMOM that no filtering - * was done. - */ - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError(LOGID_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, &error); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_createInstanceList(); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(LOGID_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_addInstance(result, emptyInst); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(LOGID_EXECQUERY, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - /* - * Since copying the original list to the new list will - * leave no way to free the original list, manually - * concatenate the original list to the new one. - */ - - result->mNext = instList; - return (result); -} - -/* - * Name: cp_associators_Solaris_MPXIOCtrlrLogicalIdentity - * - * Description: - * Returns a instances of objects associated with the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pResultClass - If specified, only return instances that - * are of this class type. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * cimchar *pResultRole - If specified, only return instances that - * are playing this role in the association. - * - * - * Returns: - * CCIMInstanceList * if associated objects are found. NULL otherwise. - */ - -/* ARGSUSED */ -CCIMInstanceList * -cp_associators_Solaris_MPXIOCtrlrLogicalIdentity(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, cimchar *pResultClass, cimchar *pRole, - cimchar *pResultRole) -{ - CCIMPropertyList *pCurPropList; - CCIMInstance *inst; - CCIMInstanceList *instList = NULL; - CCIMException *ex; - dm_descriptor_t obj_desc; - char *name; - int error = 0; - int isSystem = 0; - - - if (pObjectName == NULL || - ((pCurPropList = pObjectName->mKeyProperties) == NULL)) { - util_handleError(LOGID_ASSOCIATORS, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - if (strcasecmp(pObjectName->mName, MPXIO_CONTROLLER) == 0) { - isSystem = 1; - } - - if (pRole != NULL) { - if (strcasecmp(pRole, SYSTEM_ELEMENT) == 0) { - if (isSystem != 1) { - util_handleError(LOGID_ASSOCIATORS, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - } else if (strcasecmp(pRole, SAME_ELEMENT) == 0) { - if (isSystem == 1) { - util_handleError(LOGID_ASSOCIATORS, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - } - } - - if (isSystem) { - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - } else { - name = (cimchar *)util_getKeyValue(pCurPropList, string, "Name", - &error); - } - - if (error != 0) { - util_handleError(LOGID_ASSOCIATORS, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* - * In this case, it does not matter which object called it for - * getting the descriptor. This is an association which represents - * another identity of the controller, so the only device we - * really have is the controller. - */ - obj_desc = dm_get_descriptor_by_name(DM_CONTROLLER, name, &error); - - if (error == ENODEV) { - return ((CCIMInstanceList *)NULL); - } - if (error != 0) { - util_handleError(LOGID_ASSOCIATORS, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - if (isSystem == 1) { - /* - * Generate associated mpxio group. - */ - - inst = mpxiogroup_descriptor_toCCIMInstance(obj_desc, - MPXIO_GROUP, &error); - dm_free_descriptor(obj_desc); - - if (error != 0) { - util_handleError(LOGID_ASSOCIATORS, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - } else { - /* - * This is the mpxio group calling this function. Return the - * controllers that are associated with this group. - */ - inst = ctrl_descriptor_toCCIMInstance(hostName, - obj_desc, MPXIO_CONTROLLER, &error); - dm_free_descriptor(obj_desc); - - if (error != 0) { - util_handleError(LOGID_ASSOCIATORS, CIM_ERR_FAILED, - MPXIOCTRL_DESC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - } - - /* - * Now generate the instance list for return. This is a strange - * association since it is always only possible to have one - * associated object no matter what is the calling object. - */ - - instList = cim_createInstanceList(); - if (instList == NULL) { - cim_getLastError(); - util_handleError(LOGID_ASSOCIATORS, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, NULL, &error); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(LOGID_ASSOCIATORS, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - return (instList); -} - -/* - * Name: cp_associatorNames_Solaris_MPXIOCtrlrLogicalIdentity - * - * Description: - * Returns a list of objects associated with the passed in - * object if there are any via the object CCIMObjectPath. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pResultClass - If specified, only return instances that - * are of this class type. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * cimchar *pResultRole - If specified, only return instances that - * are playing this role in the association. - * - * - * Returns: - * CCIMObjectPathList * if associated objects are found. Otherwise NULL. - */ - -/* ARGSUSED */ -CCIMObjectPathList * -cp_associatorNames_Solaris_MPXIOCtrlrLogicalIdentity(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, cimchar *pResultClass, cimchar *pRole, - cimchar *pResultRole) -{ - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pObjectName == NULL) { - util_handleError(LOGID_ASSOCIATORNAMES, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - instList = - cp_associators_Solaris_MPXIOCtrlrLogicalIdentity( - pAssocName, pObjectName, pResultClass, pRole, pResultRole); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - return (objList); -} - -/* - * Name: cp_references_Solaris_MPXIOCtrlrLogicalIdentity - * - * Description: - * Returns a instances of objects that have references to the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * Returns: - * CCIMObjectPathList * if associated objects are found. Otherwise NULL. - */ - -/* ARGSUSED */ -CCIMInstanceList * -cp_references_Solaris_MPXIOCtrlrLogicalIdentity(CCIMObjectPath *pAssocName, -CCIMObjectPath *pObjectName, char *pRole) -{ - - CCIMInstanceList *instList = NULL; - CCIMObjectPathList *objList; - int error; - - if (pObjectName == NULL) { - util_handleError(LOGID_REFERENCES, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* - * Get the list of those objects that are referred to by - * the calling object. - */ - - objList = - cp_associatorNames_Solaris_MPXIOCtrlrLogicalIdentity( - pAssocName, pObjectName, NULL, NULL, NULL); - - if (objList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - /* - * Now generate the list of instances to return. - */ - - if ((strcasecmp(pObjectName->mName, MPXIO_CONTROLLER)) == 0) { - instList = mpxioLogIdentAssocToInstList(pObjectName, - SYSTEM_ELEMENT, objList, SAME_ELEMENT, &error); - } else { - instList = mpxioLogIdentAssocToInstList(pObjectName, - SYSTEM_ELEMENT, objList, SAME_ELEMENT, &error); - } - - cim_freeObjectPathList(objList); - return (instList); -} - -/* - * Name: cp_referenceNames_Solaris_MPXIOCtrlrLogicalIdentity - * - * Description: - * Returns a instances of objects that have references to the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * - * Returns: - * CCIMObjectPathList * if associated objects are found. Otherwise NULL. - * - */ - -/* ARGSUSED */ -CCIMObjectPathList * -cp_referenceNames_Solaris_MPXIOCtrlrLogicalIdentity(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, cimchar *pRole) -{ - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pObjectName == NULL) { - util_handleError(LOGID_REFERENCENAMES, CIM_ERR_INVALID_PARAMETER, - NULL, CIM_ERR_FAILED, &error); - return ((CCIMObjectPathList *)NULL); - } - instList = - cp_references_Solaris_MPXIOCtrlrLogicalIdentity(pAssocName, - pObjectName, pRole); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Create the association class with the passed in attributes. - */ -static -CCIMInstanceList * -mpxioLogIdentAssocToInstList(CCIMObjectPath *pObjectName, - cimchar *pObjectNameRole, CCIMObjectPathList *objList, cimchar *objRole, - int *error) -{ - - CCIMObjectPathList *tmpList; - CCIMInstanceList *instList = NULL; - CCIMInstance *inst; - CCIMObjectPath *obj1; - CCIMObjectPath *obj2; - CCIMException *ex; - - *error = 0; - - /* - * If no objects associated with this one, return NULL. - */ - if (objList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_LOGICALIDENTITY, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, error); - return ((CCIMInstanceList *)NULL); - } - tmpList = objList; - while (tmpList != NULL) { - obj1 = tmpList->mDataObject; - obj2 = cim_copyObjectPath(pObjectName); - if (obj2 == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_LOGICALIDENTITY, CIM_ERR_FAILED, - COPY_OBJPATH_FAILURE, ex, error); - return ((CCIMInstanceList *)NULL); - } - - inst = mpxioLogIdentAssocToInst(obj1, objRole, obj2, - pObjectNameRole, error); - cim_freeObjectPath(obj2); - if (*error != 0) { - util_handleError(MPXIO_LOGICALIDENTITY, CIM_ERR_FAILED, - MPXIOINT_ASSOC_TO_INSTANCE_FAILURE, NULL, error); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_LOGICALIDENTITY, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, NULL, error); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - tmpList = tmpList->mNext; - } - return (instList); -} - -static -CCIMInstance * -mpxioLogIdentAssocToInst(CCIMObjectPath *obj1, cimchar *obj1Role, - CCIMObjectPath *obj2, cimchar *obj2Role, int *error) -{ - - CCIMInstance *inst = NULL; - CCIMException *ex; - - *error = 0; - inst = cim_createInstance(MPXIO_LOGICALIDENTITY); - if (inst == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_LOGICALIDENTITY, CIM_ERR_FAILED, - MPXIOINT_ASSOC_TO_INSTANCE_FAILURE, ex, error); - return ((CCIMInstance *)NULL); - } - - util_doReferenceProperty(obj2Role, obj2, cim_true, inst, - error); - if (*error != 0) { - ex = cim_getLastError(); - util_handleError(MPXIO_LOGICALIDENTITY, CIM_ERR_FAILED, - CREATE_REFPROP_FAILURE, ex, error); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - util_doReferenceProperty(obj1Role, obj1, cim_true, inst, error); - if (*error != 0) { - ex = cim_getLastError(); - util_handleError(MPXIO_LOGICALIDENTITY, CIM_ERR_FAILED, - CREATE_REFPROP_FAILURE, ex, error); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - return (inst); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Sol_MPXIOCtrlrLogicalIdentity.h b/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Sol_MPXIOCtrlrLogicalIdentity.h deleted file mode 100644 index 5b93282b72..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Sol_MPXIOCtrlrLogicalIdentity.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOL_MPXIOCTRLRLOGICALIDENTITY_H_ -#define _SOL_MPXIOCTRLRLOGICALIDENTITY_H_ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> -#include <cimprovider.h> -#include <cimomhandle.h> -#include <cimlogsvc.h> -#include <cp_required.h> -#include <cim_objectpath.h> - -#include "libdiskmgt.h" - -#ifdef __cplusplus -} -#endif - -#endif /* _SOL_MPXIOCTRLRLOGICALIDENTITY_H_ */ diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_DiskPartitionBasedOnDisk.c b/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_DiskPartitionBasedOnDisk.c deleted file mode 100644 index bcbff28353..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_DiskPartitionBasedOnDisk.c +++ /dev/null @@ -1,1044 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <unistd.h> -#include <netdb.h> -#include <errno.h> - -#include "util.h" -#include "cimKeys.h" -#include "providerNames.h" -#include "messageStrings.h" -#include "partbasedon_descriptors.h" -#include "partition_descriptors.h" -#include "logicaldisk_descriptors.h" -#include "Solaris_DiskPartitionBasedOnDisk.h" - -#define DISKPART_GETINSTANCE "DISKPART_BASEDONDISK,GET_INSTANCE" -#define DISKPART_ENUMINSTANCES "DISKPART_BASEDONDISK,ENUM_INSTANCES" -#define DISKPART_ENUMINSTANCENAMES \ - "DISKPART_BASEDONDISK,ENUM_INSTANCENAMES" -#define DISKPART_CREATEINSTANCE "DISKPART_BASEDONDISK,CREATE_INSTANCE" -#define DISKPART_DELETEINSTANCE "DISKPART_BASEDONDISK,DELETE_INSTANCE" -#define DISKPART_SETINSTANCE "DISKPART_BASEDONDISK,SET_INSTANCE" -#define DISKPART_SETPROPERTY "DISKPART_BASEDONDISK,SET_PROPERTY" -#define DISKPART_GETPROPERTY "DISKPART_BASEDONDISK,GET_PROPERTY" -#define DISKPART_INVOKEMETHOD "DISKPART_BASEDONDISK,INVOKE_METHOD" -#define DISKPART_EXECQUERY "DISKPART_BASEDONDISK,EXEC_QUERY" -#define DISKPART_ASSOCIATORS "DISKPART_BASEDONDISK,ASSOCIATORS" -#define DISKPART_ASSOCIATORNAMES "DISKPART_BASEDONDISK,ASSOCIATOR_NAMES" -#define DISKPART_REFERENCES "DISKPART_BASEDONDISK,REFERENCES" -#define DISKPART_REFERENCENAMES "DISKPART_BASEDONDISK,REFERENCE_NAMES" - -static CCIMInstanceList *createDiskPartBasedOnRefList( - CCIMObjectPath *pObjectName, cimchar *pObjectNameRole, - CCIMObjectPathList *objList, cimchar *objRole, int *error); - -/* - * Solaris_DiskPartitionBasedOnDisk provider - * - * It is important to note that all memory allocated by these functions - * and passed to the CIMOM, is freed by the door process prior to - * sending a copy of the data to the CIMOM. - */ - -/* - * Name: cp_getInstance_Solaris_DiskPartitionBasedOnDisk - * - * Description: Returns an instance which matches the passed in object path - * if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ - -CCIMInstance* -cp_getInstance_Solaris_DiskPartitionBasedOnDisk(CCIMObjectPath* pOP) -{ - CCIMInstance *inst = NULL; - CCIMPropertyList *pCurPropList; - dm_descriptor_t d_descriptor; - dm_descriptor_t p_descriptor; - CCIMObjectPath *antOp = NULL; - CCIMObjectPath *depOp = NULL; - char *name; - int error; - - - if (pOP == NULL) { - util_handleError(DISKPART_GETINSTANCE, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstance *)NULL); - } - - if ((pCurPropList = pOP->mKeyProperties) == NULL) { - util_handleError(DISKPART_GETINSTANCE, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstance*)NULL); - } - - antOp = (CCIMObjectPath *)util_getKeyValue( - pCurPropList, reference, ANTECEDENT, &error); - - if (error == 0) { - depOp = (CCIMObjectPath *)util_getKeyValue( - pCurPropList, reference, DEPENDENT, &error); - } - - if (error != 0) { - util_handleError(DISKPART_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstance *)NULL); - } - - /* - * Now, get the name of the antecedent from the object path. - */ - - if ((pCurPropList = antOp->mKeyProperties) == NULL || - ((pCurPropList = depOp->mKeyProperties) == NULL)) { - util_handleError(DISKPART_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstance *)NULL); - } - - pCurPropList = antOp->mKeyProperties; - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - - if (error != 0) { - util_handleError(DISKPART_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstance *)NULL); - } - d_descriptor = dm_get_descriptor_by_name(DM_MEDIA, name, &error); - /* - * Not found. Return a null instance. - */ - - if (error == ENODEV || d_descriptor == NULL) { - return ((CCIMInstance *)NULL); - } - - if (error != 0) { - util_handleError(DISKPART_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstance*)NULL); - } - - /* - * Now, get the name of the dependent from the object path. - */ - - pCurPropList = depOp->mKeyProperties; - name = (cimchar *)util_getKeyValue(pCurPropList, string, - DEVICEID, & error); - - if (error != 0) { - util_handleError(DISKPART_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstance *)NULL); - } - p_descriptor = dm_get_descriptor_by_name(DM_SLICE, name, - &error); - - /* - * Not found. Return a null instance. - */ - - if (error == ENODEV || p_descriptor == NULL) { - return ((CCIMInstance *)NULL); - } - - if (error != 0) { - util_handleError(DISKPART_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstance*)NULL); - } - - /* Turn these descriptors in to a disk part based on instance */ - - inst = partbasedon_descriptor_toCCIMInstance( - hostName, d_descriptor, p_descriptor, DISKPART_BASEDONDISK, &error); - dm_free_descriptor(d_descriptor); - dm_free_descriptor(p_descriptor); - - if (error != 0) { - util_handleError(DISKPART_GETINSTANCE, CIM_ERR_FAILED, - PARTBASEDON_DESC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstance*)NULL); - } - - return (inst); -} - -/* - * Name: cp_enumInstances_Solaris_DiskPartitionBasedOnDisk - * - * Description: Returns a linked list of instances of - * Solaris_DiskPartitionBasedOnDisk if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMInstanceList * if instances are found. Otherwise, - * NULL is returned. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_enumInstances_Solaris_DiskPartitionBasedOnDisk(CCIMObjectPath* pOP) -{ - CCIMInstanceList* instList = NULL; - CCIMInstance* inst; - CCIMException* ex; - dm_descriptor_t *disk_descriptorp = NULL; - dm_descriptor_t *part_descriptorp = NULL; - int error = 0; - int filter[2]; - int i = 0; - int j = 0; - - filter[0] = DM_MT_FIXED; - filter[1] = DM_FILTER_END; - - disk_descriptorp = dm_get_descriptors(DM_MEDIA, filter, &error); - - if (disk_descriptorp == NULL || - disk_descriptorp[0] == NULL) { - return ((CCIMInstanceList *)NULL); - } - if (error != 0) { - util_handleError(DISKPART_ENUMINSTANCES, CIM_ERR_FAILED, - DM_GET_DESCRIPTORS, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* - * For each one of the disks found, get the associated partitions. - */ - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(DISKPART_ENUMINSTANCES, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, - &error); - dm_free_descriptors(disk_descriptorp); - return ((CCIMInstanceList *)NULL); - } - - for (i = 0; disk_descriptorp[i] != NULL; i ++) { - part_descriptorp = dm_get_associated_descriptors( - disk_descriptorp[i], DM_SLICE, &error); - - /* If no partitions associated with this disk, continue */ - - if (part_descriptorp == NULL) { - continue; - } - - if (error != 0) { - util_handleError(DISKPART_ENUMINSTANCES, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, &error); - dm_free_descriptors(disk_descriptorp); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - - for (j = 0; part_descriptorp[j] != NULL; j ++) { - inst = partbasedon_descriptor_toCCIMInstance(hostName, - disk_descriptorp[i], part_descriptorp[j], - DISKPART_BASEDONDISK, &error); - if (error != 0) { - util_handleError(DISKPART_ENUMINSTANCES, CIM_ERR_FAILED, - PARTBASEDON_DESC_TO_INSTANCE_FAILURE, NULL, &error); - dm_free_descriptors(disk_descriptorp); - dm_free_descriptors(part_descriptorp); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(DISKPART_ENUMINSTANCES, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - dm_free_descriptors(disk_descriptorp); - dm_free_descriptors(part_descriptorp); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - } - - dm_free_descriptors(part_descriptorp); - } - - dm_free_descriptors(disk_descriptorp); - return (instList); -} - -/* - * Name: cp_enumInstanceNames_Solaris_DiskPartitionBasedOnDisk - * - * Description: Returns a linked list of CCIMObjectPath * - * of Solaris_DiskPartitionBasedOnDisk if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMObjectPathList * if objects are found. - * Otherwise NULL is returned. - */ - -CCIMObjectPathList* -cp_enumInstanceNames_Solaris_DiskPartitionBasedOnDisk(CCIMObjectPath * pOP) { - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pOP == NULL) { - util_handleError(DISKPART_ENUMINSTANCENAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - } - /* - * Call in to enumInstances and then convert the instance list in - * to an object list. - */ - - instList = cp_enumInstances_Solaris_DiskPartitionBasedOnDisk(pOP); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Creating an instance of a Solaris_DiskPartitionBasedOnDisk is not supported. - */ - -/* ARGSUSED */ -CCIMObjectPath* -cp_createInstance_Solaris_DiskPartitionBasedOnDisk( - CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - int error; - - util_handleError(DISKPART_CREATEINSTANCE, - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &error); - return ((CCIMObjectPath *)NULL); -} - -/* - * Deleting an instance of a Solaris_DiskPartitionBasedOnDisk is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_DiskPartitionBasedOnDisk(CCIMObjectPath* pInst) -{ - int error; - - util_handleError(DISKPART_DELETEINSTANCE, - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &error); - return (cim_false); -} - -/* - * Name: cp_getProperty_Solaris_DiskPartitionBasedOnDisk - * - * Description: Returns the property requested, if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMProperty * if found. - */ - -/* ARGSUSED */ -CCIMProperty * -cp_getProperty_Solaris_DiskPartitionBasedOnDisk(CCIMObjectPath *pOP, - char *pPropName) -{ - - CCIMProperty *prop = NULL; - CCIMInstance *inst = NULL; - int error = 0; - - if (pOP == NULL) { - util_handleError(DISKPART_GETPROPERTY, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMProperty *)NULL); - } - - inst = cp_getInstance_Solaris_DiskPartitionBasedOnDisk(pOP); - if (inst == NULL) { - return ((CCIMProperty *)NULL); - } - - prop = cim_getProperty(inst, pPropName); - cim_freeInstance(inst); - return (prop); -} - -/* - * Setting an instance of a Solaris_DiskPartitionBasedOnDisk is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_DiskPartitionBasedOnDisk( - CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - int error; - - util_handleError(DISKPART_SETINSTANCE, - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &error); - return (cim_false); -} - - - -/* - * Setting a property on a Solaris_DiskPartitionBasedOnDisk is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_DiskPartitionBasedOnDisk( - CCIMObjectPath* pOP, CCIMProperty* pProp) -{ - int error; - - util_handleError(DISKPART_SETPROPERTY, - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &error); - return (cim_false); -} - -/* - * No Methods for Solaris_DiskPartitionBasedOnDisk. - */ - -/* ARGSUSED */ -CCIMProperty* -cp_invokeMethod_Solaris_DiskPartitionBasedOnDisk( - CCIMObjectPath* op, cimchar* methodName, - CCIMPropertyList* inParams, CCIMPropertyList* outParams) -{ - CCIMProperty *retVal = (CCIMProperty *)NULL; - return (retVal); -} - -/* - * Name: cp_execQuery_Solaris_DiskPartitionBasedOnDisk - * - * Description: - * Returns an instance list which matches the query if any are found. - * - * Parameters: - * CCIMObjectPath *op - An CCIMObjectPath * which contains the - * information on the class for which to find the instances. - * - * selectList - Not used - * nonJoinExp - Not used - * - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ -/* - * Currently, there is no WQL parser for the C providers. As a result, - * what is returned to the CIMOM is a list of instances with - * a NULL value at the beginning of the list. This NULL value indicates - * to the CIMOM that it must do the filtering for the client. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_execQuery_Solaris_DiskPartitionBasedOnDisk( - CCIMObjectPath *op, cimchar *selectList, cimchar *nonJoinExp, - cimchar *queryExp, int queryType) -{ - CCIMInstanceList *instList = NULL; - CCIMInstanceList *result; - CCIMInstance *emptyInst; - CCIMException *ex; - int error; - - if (op == NULL) { - util_handleError(DISKPART_EXECQUERY, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = cp_enumInstances_Solaris_DiskPartitionBasedOnDisk(op); - - if (instList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - /* - * Create a null instance and add it to the beginning - * of the list to indicate to the CIMOM that no filtering - * was done. - */ - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError(DISKPART_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, &error); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_createInstanceList(); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(DISKPART_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_addInstance(result, emptyInst); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(DISKPART_EXECQUERY, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - /* - * Since copying the original list to the new list will - * leave no way to free the original list, manually - * concatenate the original list to the new one. - */ - - result->mNext = instList; - return (result); -} - -/* - * Name: cp_associators_Solaris_DiskPartitionBasedOnDisk - * - * Description: - * Returns instances of objects associated with the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pResultClass - If specified, only return instances that - * are of this class type. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * cimchar *pResultRole - If specified, only return instances that - * are playing this role in the association. - * - * - * Returns: - * CCIMInstanceList * if associated objects are found. - * Otherwise NULL is returned. - */ - -/* ARGSUSED */ -CCIMInstanceList * -cp_associators_Solaris_DiskPartitionBasedOnDisk(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, cimchar *pResultClass, cimchar *pRole, - cimchar *pResultRole) -{ - CCIMPropertyList *pCurPropList; - CCIMInstanceList *instList = NULL; - CCIMInstance *inst; - CCIMException *ex; - dm_descriptor_t *assoc_descriptors; - dm_descriptor_t obj_desc; - char *name; - int error = 0; - int isAntecedent = 0; - int i; - - - if (pObjectName == NULL || pObjectName->mName == NULL) { - util_handleError(DISKPART_ASSOCIATORS, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - if (strcasecmp(pObjectName->mName, LOGICAL_DISK) == 0) { - isAntecedent = 1; - } - - if (pRole != NULL) { - if (strcasecmp(pRole, ANTECEDENT) == 0) { - if (isAntecedent != 1) { - util_handleError(DISKPART_ASSOCIATORS, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - } - } - - if ((pCurPropList = pObjectName->mKeyProperties) == NULL) { - util_handleError(DISKPART_ASSOCIATORS, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* - * Both logical disk and disk partition have deviceid as the - * key. - */ - - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - - if (error != 0) { - util_handleError(DISKPART_ASSOCIATORS, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - if (isAntecedent) { - obj_desc = dm_get_descriptor_by_name(DM_MEDIA, name, &error); - } else { - obj_desc = dm_get_descriptor_by_name(DM_SLICE, name, &error); - } - - /* No device found. */ - - if (error == ENODEV || obj_desc == NULL) { - return ((CCIMInstanceList *)NULL); - } - - if (error != 0) { - util_handleError(DISKPART_ASSOCIATORS, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - if (isAntecedent == 1) { - /* - * Logical disk calling this method, return instances of the - * partitions associated with this disk. - */ - - /* Get associated descriptors. */ - - assoc_descriptors = dm_get_associated_descriptors(obj_desc, - DM_SLICE, &error); - dm_free_descriptor(obj_desc); - - if (assoc_descriptors == NULL) { - return ((CCIMInstanceList *)NULL); - } - - if (assoc_descriptors[0] == NULL) { - dm_free_descriptors(assoc_descriptors); - return ((CCIMInstanceList *)NULL); - } - - if (error != 0) { - util_handleError(DISKPART_ASSOCIATORS, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(DISKPART_ASSOCIATORS, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, &error); - dm_free_descriptors(assoc_descriptors); - return ((CCIMInstanceList *)NULL); - } - - /* Traverse the list and create instances of associated objects. */ - - for (i = 0; assoc_descriptors[i] != NULL; i ++) { - inst = partition_descriptor_toCCIMInstance(hostName, - assoc_descriptors[i], DISK_PARTITION, &error); - - if (error != 0) { - util_handleError(DISKPART_ASSOCIATORS, CIM_ERR_FAILED, - PART_DESC_TO_INSTANCE_FAILURE, NULL, &error); - dm_free_descriptors(assoc_descriptors); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(DISKPART_ASSOCIATORS, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - cim_freeInstance(inst); - dm_free_descriptors(assoc_descriptors); - return ((CCIMInstanceList *)NULL); - } - } /* End for */ - } else { - /* - * This is the partition calling this function. Return the - * logical disk that this belongs to. - */ - assoc_descriptors = dm_get_associated_descriptors(obj_desc, - DM_MEDIA, &error); - dm_free_descriptor(obj_desc); - - if (assoc_descriptors == NULL) { - return ((CCIMInstanceList *)NULL); - } - - if (assoc_descriptors[0] == NULL) { - dm_free_descriptors(assoc_descriptors); - return ((CCIMInstanceList *)NULL); - } - - if (error != 0) { - util_handleError(DISKPART_ASSOCIATORS, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(DISKPART_ASSOCIATORS, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - for (i = 0; assoc_descriptors[i] != NULL; i ++) { - inst = logicaldisk_descriptor_toCCIMInstance(hostName, - assoc_descriptors[i], LOGICAL_DISK, &error); - - if (error != 0) { - util_handleError(DISKPART_ASSOCIATORS, CIM_ERR_FAILED, - LOGICALDISK_DESC_TO_INSTANCE_FAILURE, - NULL, &error); - dm_free_descriptors(assoc_descriptors); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(DISKPART_ASSOCIATORS, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - dm_free_descriptors(assoc_descriptors); - return ((CCIMInstanceList *)NULL); - } - } /* End for */ - } - dm_free_descriptors(assoc_descriptors); - return (instList); -} - -/* - * Name: cp_associatorNames_Solaris_DiskPartitionBasedOnDisk - * - * Description: - * Returns a list of objects associated with the passed in - * object if there are any via the object CCIMObjectPath. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pResultClass - If specified, only return instances that - * are of this class type. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * cimchar *pResultRole - If specified, only return instances that - * are playing this role in the association. - * - * - * Returns: - * CCIMObjectPathList * if associated objects are found. - * Otherwise, NULL is returned. - */ - -/* ARGSUSED */ -CCIMObjectPathList * -cp_associatorNames_Solaris_DiskPartitionBasedOnDisk(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, cimchar *pResultClass, cimchar *pRole, - cimchar *pResultRole) -{ - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pObjectName == NULL) { - util_handleError(DISKPART_ASSOCIATORNAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - instList = - cp_associators_Solaris_DiskPartitionBasedOnDisk( - pAssocName, pObjectName, pResultClass, pRole, pResultRole); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Name: cp_references_Solaris_DiskPartitionBasedOnDisk - * - * Description: - * Returns instances of objects that have references to the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * Returns: - * CCIMInstanceList * if associated objects are found. - * Otherwise, NULL is returned. - */ - -/* ARGSUSED */ -CCIMInstanceList * -cp_references_Solaris_DiskPartitionBasedOnDisk(CCIMObjectPath *pAssocName, -CCIMObjectPath *pObjectName, char *pRole) -{ - - CCIMInstanceList *instList = NULL; - CCIMObjectPathList *objList; - int error; - - - if (pObjectName == NULL) { - util_handleError(DISKPART_REFERENCES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - /* - * Get the list of those objects that are referred to by - * the calling object. - */ - - objList = - cp_associatorNames_Solaris_DiskPartitionBasedOnDisk( - pAssocName, pObjectName, NULL, NULL, NULL); - - if (objList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - /* - * Now generate the list of instances to return. - */ - - if (strcasecmp(pObjectName->mName, LOGICAL_DISK) == 0) { - instList = createDiskPartBasedOnRefList(pObjectName, - ANTECEDENT, objList, DEPENDENT, &error); - } else { - instList = createDiskPartBasedOnRefList(pObjectName, - DEPENDENT, objList, ANTECEDENT, &error); - } - - cim_freeObjectPathList(objList); - return (instList); -} - -/* - * Name: cp_referenceNames_Solaris_DiskPartitionBasedOnDisk - * - * Description: - * Returns a instances of objects that have references to the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * - * Returns: - * CCIMInstanceList * if associated objects are found. - * Otherwise, NULL is returned. - * - */ - -/* ARGSUSED */ -CCIMObjectPathList * -cp_referenceNames_Solaris_DiskPartitionBasedOnDisk(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, cimchar *pRole) -{ - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pObjectName == NULL) { - util_handleError(DISKPART_REFERENCENAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - instList = - cp_references_Solaris_DiskPartitionBasedOnDisk( - pAssocName, pObjectName, pRole); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Create the association class with the passed in attributes. - */ -static -CCIMInstanceList * -createDiskPartBasedOnRefList(CCIMObjectPath *pObjectName, - cimchar *pObjectNameRole, - CCIMObjectPathList *objList, cimchar *objRole, int *error) -{ - - CCIMObjectPathList *tmpList; - CCIMInstanceList *instList = NULL; - CCIMInstance *inst; - CCIMObjectPath *obj1; - CCIMObjectPath *obj2; - CCIMException *ex; - - *error = 0; - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(DISKPART_BASEDONDISK, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, error); - return ((CCIMInstanceList *)NULL); - } - - /* - * If no objects associated with this one, return an empty list. - */ - if (objList == NULL) { - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)instList); - } - - tmpList = objList; - while (tmpList != NULL) { - obj1 = tmpList->mDataObject; - obj2 = cim_copyObjectPath(pObjectName); - if (obj2 == NULL) { - ex = cim_getLastError(); - util_handleError(DISKPART_BASEDONDISK, CIM_ERR_FAILED, - COPY_OBJPATH_FAILURE, ex, error); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - inst = cim_createInstance(DISKPART_BASEDONDISK); - if (inst == NULL) { - ex = cim_getLastError(); - util_handleError(DISKPART_BASEDONDISK, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, error); - cim_freeObjectPath(obj2); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - util_doReferenceProperty(pObjectNameRole, obj2, cim_true, inst, - error); - util_doReferenceProperty(objRole, obj1, cim_true, inst, error); - cim_freeObjectPath(obj2); - - if (*error != 0) { - ex = cim_getLastError(); - util_handleError(DISKPART_BASEDONDISK, CIM_ERR_FAILED, - CREATE_REFPROP_FAILURE, ex, error); - cim_freeInstance(inst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(DISKPART_BASEDONDISK, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, error); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - - tmpList = tmpList->mNext; - } - return (instList); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_DiskPartitionBasedOnDisk.h b/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_DiskPartitionBasedOnDisk.h deleted file mode 100644 index f5bfe44bd7..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_DiskPartitionBasedOnDisk.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOLARIS_DISKPARTITIONBASEDONDISK_H_ -#define _SOLARIS_DISKPARTITIONBASEDONDISK_H_ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> -#include <cimprovider.h> -#include <cimomhandle.h> -#include <cimlogsvc.h> -#include <cp_required.h> - -#include "libdiskmgt.h" - -#ifdef __cplusplus -} -#endif - -#endif /* _SOLARIS_DISKPARTITIONBASEDONDISK_H_ */ diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_IDEInterface.c b/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_IDEInterface.c deleted file mode 100644 index 3821b6c41e..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_IDEInterface.c +++ /dev/null @@ -1,1183 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <unistd.h> -#include <errno.h> - -#include "util.h" -#include "cimKeys.h" -#include "providerNames.h" -#include "messageStrings.h" -#include "drive_descriptors.h" -#include "ctrl_descriptors.h" -#include "Solaris_IDEInterface.h" - -#define IDE_GETINSTANCE "IDE_INTERFACE,GET_INSTANCE" -#define IDE_ENUMINSTANCES "IDE_INTERFACE,ENUM_INSTANCES" -#define IDE_ENUMINSTANCENAMES "IDE_INTERFACE,ENUM_INSTANCENAMES" -#define IDE_CREATEINSTANCE "IDE_INTERFACE,CREATE_INSTANCE" -#define IDE_DELETEINSTANCE "IDE_INTERFACE,DELETE_INSTANCE" -#define IDE_SETINSTANCE "IDE_INTERFACE,SET_INSTANCE" -#define IDE_GETPROPERTY "IDE_INTERFACE,GET_PROPERTY" -#define IDE_SETPROPERTY "IDE_INTERFACE,SET_PROPERTY" -#define IDE_INVOKEMETHOD "IDE_INTERFACE,INVOKE_METHOD" -#define IDE_EXECQUERY "IDE_INTERFACE,EXEC_QUERY" -#define IDE_ASSOCIATORS "IDE_INTERFACE,ASSOCIATORS" -#define IDE_ASSOCIATORNAMES "IDE_INTERFACE,ASSOCIATOR_NAMES" -#define IDE_REFERENCES "IDE_INTERFACE,REFERENCES" -#define IDE_REFERENCENAMES "IDE_INTERFACE,REFERENCE_NAMES" - - -static -CCIMInstanceList * -ideIntAssocToInstList(CCIMObjectPath *pObjectName, cimchar *pObjectNameRole, - CCIMObjectPathList *objList, cimchar *objRole, int *error); - -static -CCIMInstance * -ideIntAssocToInst(CCIMObjectPath *obj1, cimchar *obj1Role, - CCIMObjectPath *obj2, cimchar *obj2Role, int *error); - -/* - * Solaris_IDEInterface provider - * - * It is important to note that all memory allocated by these functions - * and passed to the CIMOM, is freed by the door process prior to - * sending a copy of the data to the CIMOM. - */ - -/* - * Name: cp_getInstance_Solaris_IDEInterface - * - * Description: Returns an instance which matches the passed in object path - * if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMInstance* -cp_getInstance_Solaris_IDEInterface(CCIMObjectPath* pOP) -{ - CCIMInstance* inst = NULL; - CCIMPropertyList* pCurPropList; - dm_descriptor_t d_descriptor; - dm_descriptor_t c_descriptor; - CCIMObjectPath *antOp = NULL; - CCIMObjectPath *depOp = NULL; - int error; - char *name; - - if (pOP == NULL) { - util_handleError(IDE_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - - if ((pCurPropList = pOP->mKeyProperties) == NULL) { - util_handleError(IDE_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - - antOp = (CCIMObjectPath *)util_getKeyValue(pCurPropList, reference, - ANTECEDENT, &error); - - if (error == 0) { - depOp = (CCIMObjectPath *)util_getKeyValue(pCurPropList, reference, - DEPENDENT, &error); - } - - if (error != 0) { - util_handleError(IDE_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstance *)NULL); - } - - /* - * Now, get the name of the antecedent from the object path. - */ - - if ((pCurPropList = antOp->mKeyProperties) == NULL) { - util_handleError(IDE_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - - if (error != 0) { - util_handleError(IDE_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - } - - /* - * The only reason it is needed to get the descriptor for these - * two devices is to verify that they still exist and are valid. - * If they are not found, then getting the instance for this - * association as passed in by the client is not possible. - */ - c_descriptor = dm_get_descriptor_by_name(DM_CONTROLLER, name, - &error); - /* - * Not found. Return a null instance. - */ - - if (c_descriptor == NULL || error == ENODEV) { - return ((CCIMInstance *)NULL); - } - - if (error != 0) { - util_handleError(IDE_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstance*)NULL); - } - dm_free_descriptor(c_descriptor); - - /* - * Now, get the name of the dependent from the object path. - */ - - if ((pCurPropList = depOp->mKeyProperties) == NULL) { - util_handleError(IDE_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - - if (error != 0) { - util_handleError(IDE_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstance *)NULL); - } - - d_descriptor = dm_get_descriptor_by_name(DM_DRIVE, name, - &error); - /* - * Not found. Return a null instance. - */ - - if (d_descriptor == NULL || error == ENODEV) { - d_descriptor = dm_get_descriptor_by_name(DM_ALIAS, name, - &error); - if (d_descriptor == NULL || error == ENODEV) { - util_handleError(IDE_GETINSTANCE, CIM_ERR_NOT_FOUND, - NULL, NULL, &error); - return ((CCIMInstance *)NULL); - } - } - - if (error != 0) { - util_handleError(IDE_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstance *)NULL); - } - - dm_free_descriptor(d_descriptor); - - /* - * At this point I have verified I have the two devices that - * are part of this association. Use the object paths I got - * earlier to create the ideinterface instance. - */ - inst = ideIntAssocToInst(antOp, ANTECEDENT, depOp, DEPENDENT, &error); - - if (error != 0) { - util_handleError(IDE_GETINSTANCE, CIM_ERR_FAILED, - IDEINT_ASSOC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstance *)NULL); - } - - return (inst); -} - -/* - * Name: cp_enumInstances_Solaris_IDEInterface - * - * Description: Returns a linked list of instances of - * Solaris_IDEInterface if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMInstanceList * if istances are found. If no instances, - * NULL is returned. On error, NULL is returned. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_enumInstances_Solaris_IDEInterface(CCIMObjectPath* pOP) -{ - CCIMInstanceList *instList = NULL; - CCIMObjectPathList *cObjList = NULL; - CCIMObjectPathList *tmpObjList; - CCIMObjectPath *objPath; - CCIMInstance *inst; - CCIMException *ex; - dm_descriptor_t *d_descriptorp = NULL; - int error = 0; - - /* - * Get the list of IDE Controllers. Then get the associated drives - * via the device api. - */ - - objPath = cim_createEmptyObjectPath(IDE_CONTROLLER); - if (objPath == NULL) { - ex = cim_getLastError(); - util_handleError(IDE_ENUMINSTANCES, CIM_ERR_FAILED, - CREATE_OBJECT_PATH, ex, &error); - return ((CCIMInstanceList *)NULL); - } - - cObjList = cimom_enumerateInstanceNames(objPath, cim_false); - cim_freeObjectPath(objPath); - - /* - * NULL means error. - */ - if (cObjList == NULL) { - ex = cim_getLastError(); - util_handleError(IDE_ENUMINSTANCES, CIM_ERR_FAILED, - ENUM_INSTANCENAMES_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - - if (cObjList->mDataObject == NULL) { - return ((CCIMInstanceList *)NULL); - } - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(IDE_ENUMINSTANCES, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - /* - * Loop through all of these controller objects and get the associated - * disks. - */ - - for (tmpObjList = cObjList; - tmpObjList != NULL && tmpObjList->mDataObject != NULL; - tmpObjList = tmpObjList->mNext) { - - char *name = NULL; - CCIMObjectPath *cOp; - CCIMInstanceList *tmpList = NULL; - CCIMInstanceList *tmpList1; - CCIMPropertyList *pCurPropList; - CCIMObjectPathList *dObjList; - CCIMInstanceList *tL; - dm_descriptor_t c_descriptor = NULL; - error = 0; - - cOp = tmpObjList->mDataObject; - if ((pCurPropList = cOp->mKeyProperties) == NULL) { - util_handleError(IDE_ENUMINSTANCES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - cim_freeObjectPathList(cObjList); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - - if (error != 0) { - util_handleError(IDE_ENUMINSTANCES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - cim_freeObjectPathList(cObjList); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - c_descriptor = dm_get_descriptor_by_name(DM_CONTROLLER, name, - &error); - if (c_descriptor == NULL || error == ENODEV) { - continue; - } - if (error != 0) { - util_handleError(IDE_ENUMINSTANCES, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, - &error); - cim_freeObjectPathList(cObjList); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - d_descriptorp = dm_get_associated_descriptors(c_descriptor, - DM_DRIVE, &error); - dm_free_descriptor(c_descriptor); - - /* - * If there are no drives associated with this controller, - * continue on to the next controller. - */ - - if (d_descriptorp == NULL) { - continue; - } - - if (d_descriptorp[0] == NULL) { - dm_free_descriptors(d_descriptorp); - continue; - } - - if (error == ENODEV) { - continue; - } - - if (error != 0) { - util_handleError(IDE_ENUMINSTANCES, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - - tmpList = drive_descriptors_toCCIMObjPathInstList( - DISK_DRIVE, d_descriptorp, &error); - dm_free_descriptors(d_descriptorp); - d_descriptorp = NULL; - - if (error != 0) { - util_handleError(IDE_ENUMINSTANCES, CIM_ERR_FAILED, - DRIVE_DESC_TO_INSTANCE_FAILURE, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - - /* - * It is possible that the controller does not have a drive - * associated with it. If this is true, the list will be - * NULL. - */ - - if (tmpList == NULL) { - continue; - } - - dObjList = cim_createObjectPathList(tmpList); - cim_freeInstanceList(tmpList); - - if (dObjList == NULL) { - util_handleError(IDE_ENUMINSTANCES, CIM_ERR_FAILED, - DRIVE_DESC_TO_INSTANCE_FAILURE, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - tmpList1 = ideIntAssocToInstList( - cOp, ANTECEDENT, dObjList, DEPENDENT, &error); - cim_freeObjectPathList(dObjList); - - if (error != 0) { - util_handleError(IDE_ENUMINSTANCES, CIM_ERR_FAILED, - IDECTRL_DESC_TO_INSTANCE_FAILURE, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - - tL = tmpList1; - do { - inst = cim_copyInstance(tL->mDataObject); - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - util_handleError(IDE_ENUMINSTANCES, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, NULL, &error); - cim_freeObjectPathList(cObjList); - cim_freeObjectPathList(tmpList1); - return ((CCIMInstanceList *)NULL); - } - tL = tL->mNext; - } while (tL && tL->mDataObject != NULL); - - cim_freeInstanceList(tmpList1); - } /* end for */ - - cim_freeObjectPathList(cObjList); - /* - * It is possible I will have an empty instance list at - * this point. So, I must check and NULL this out if - * there are no entries. - */ - if (instList->mDataObject == NULL) { - cim_freeInstanceList(instList); - instList = NULL; - } - return (instList); -} - -/* - * Name: cp_enumInstanceNames_Solaris_IDEInterface - * - * Description: Returns a linked list of CCIMObjectPath * - * of Solaris_IDEInterface if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMObjectPathList * if objects are found. If no objects, - * an empty list is returned. On error, NULL is returned. - */ - -CCIMObjectPathList* -cp_enumInstanceNames_Solaris_IDEInterface(CCIMObjectPath * pOP) { - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pOP == NULL) { - util_handleError(IDE_ENUMINSTANCENAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - /* - * Call in to enumInstances and then convert the instance list in - * to an object list. - */ - - instList = cp_enumInstances_Solaris_IDEInterface(pOP); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Creating an instance of a Solaris_IDEInterface is not supported. - */ - -/* ARGSUSED */ -CCIMObjectPath* -cp_createInstance_Solaris_IDEInterface(CCIMObjectPath* pOP, - CCIMInstance* pInst) -{ - int error; - - util_handleError(IDE_CREATEINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return ((CCIMObjectPath *)NULL); -} - -/* - * Deleting an instance of a Solaris_IDEInterface is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_IDEInterface(CCIMObjectPath* pInst) -{ - int error; - - util_handleError( - IDE_DELETEINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, NULL, &error); - return (cim_false); -} -/* - * Name: cp_getProperty_Solaris_IIDEInterface - * - * Description: Returns the property requested, if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMProperty * if found. - */ - -/* ARGSUSED */ -CCIMProperty * -cp_getProperty_Solaris_IDEInterface(CCIMObjectPath *pOP, - char *pPropName) -{ - - CCIMProperty *prop = NULL; - CCIMInstance *inst = NULL; - int error = 0; - - if (pOP == NULL) { - util_handleError(IDE_GETPROPERTY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMProperty *)NULL); - } - - inst = cp_getInstance_Solaris_IDEInterface(pOP); - if (inst == NULL) { - return ((CCIMProperty *)NULL); - } - - prop = cim_getProperty(inst, pPropName); - cim_freeInstance(inst); - return (prop); -} - -/* - * Setting an instance of a Solaris_IDEInterface is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_IDEInterface(CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - int error; - - util_handleError( - IDE_SETINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, NULL, &error); - return (cim_false); -} - - -/* - * Setting a property on a Solaris_IDEInterface is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_IDEInterface(CCIMObjectPath* pOP, CCIMProperty* pProp) -{ - int error; - - util_handleError( - IDE_SETPROPERTY, CIM_ERR_NOT_SUPPORTED, NULL, NULL, &error); - return (cim_false); -} - -/* - * No Methods for Solaris_IDEInterface. - */ - -/* ARGSUSED */ -CCIMProperty* -cp_invokeMethod_Solaris_IDEInterface( - CCIMObjectPath* op, cimchar* methodName, - CCIMPropertyList* inParams, CCIMPropertyList* outParams) -{ - CCIMProperty *retVal = (CCIMProperty *)NULL; - return (retVal); -} - -/* - * Name: cp_execQuery_Solaris_IDEInterface - * - * Description: - * Returns an instance list which matches the query if any are found. - * - * Parameters: - * CCIMObjectPath *op - An CCIMObjectPath * which contains the - * information on the class for which to find the instances. - * - * selectList - Not used - * nonJoinExp - Not used - * - * Returns: - * CCIMInstanceList * if matched instance is found. Otherwise, NULL. - */ -/* - * Currently, there is no WQL parser for the C providers. As a result, - * what is returned to the CIMOM is a list of instances with - * a NULL value at the beginning of the list. This NULL value indicates - * to the CIMOM that it must do the filtering for the client. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_execQuery_Solaris_IDEInterface(CCIMObjectPath *op, - cimchar *selectList, cimchar *nonJoinExp, cimchar *queryExp, int queryType) -{ - CCIMInstanceList *instList = NULL; - CCIMInstanceList *result; - CCIMInstance *emptyInst; - CCIMException *ex; - int error; - - if (op == NULL) { - util_handleError(IDE_EXECQUERY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = cimom_enumerateInstances(op, cim_false, cim_false, cim_false, - cim_false, cim_false, NULL, 0); - - /* - * NULL means error. - */ - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(IDE_EXECQUERY, CIM_ERR_FAILED, - ENUM_INSTANCES_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - - if (instList->mDataObject == NULL) { - return ((CCIMInstanceList *)NULL); - } - /* - * Create a null instance and add it to the beginning - * of the list to indicate to the CIMOM that no filtering - * was done. - */ - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError(IDE_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - - result = cim_createInstanceList(); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(IDE_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_addInstance(result, emptyInst); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(IDE_EXECQUERY, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - /* - * Since copying the original list to the new list will - * leave no way to free the original list, manually - * concatenate the original list to the new one. - */ - - result->mNext = instList; - return (result); -} - -/* - * Name: cp_associators_Solaris_IDEInterface - * - * Description: - * Returns instances of objects associated with the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pResultClass - If specified, only return instances that - * are of this class type. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * cimchar *pResultRole - If specified, only return instances that - * are playing this role in the association. - * - * - * Returns: - * CCIMInstanceList * if associated objects are found. Thist list - * may be empty. NULL is returned on error. - */ - -/* ARGSUSED */ -CCIMInstanceList * -cp_associators_Solaris_IDEInterface(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, cimchar *pResultClass, cimchar *pRole, - cimchar *pResultRole) -{ - CCIMPropertyList *pCurPropList; - CCIMInstanceList *instList = NULL; - dm_descriptor_t *assoc_descriptors = NULL; - dm_descriptor_t *tmpList = NULL; - dm_descriptor_t obj_desc = NULL; - char *name; - int error = 0; - int isAntecedent = 0; - int isAlias = 0; - - if ((pObjectName == NULL || - (pCurPropList = pObjectName->mKeyProperties) == NULL)) { - util_handleError(IDE_ASSOCIATORS, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - if (strcasecmp(pObjectName->mName, IDE_CONTROLLER) == 0) { - isAntecedent = 1; - } - - if (pRole != NULL) { - if (strcasecmp(pRole, ANTECEDENT) == 0) { - if (isAntecedent != 1) { - util_handleError(IDE_ASSOCIATORS, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - } else if (strcasecmp(pRole, DEPENDENT) == 0) { - if (isAntecedent == 1) { - util_handleError(IDE_ASSOCIATORS, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - } - } - - /* - * Both ide controller and disk drive have deviceid as the - * key. - */ - - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - if (error != 0) { - util_handleError(IDE_ASSOCIATORS, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - if (isAntecedent) { - obj_desc = dm_get_descriptor_by_name(DM_CONTROLLER, name, - &error); - } else { - obj_desc = dm_get_descriptor_by_name(DM_DRIVE, name, - &error); - if (obj_desc == NULL || error == ENODEV) { - isAlias = 1; - obj_desc = dm_get_descriptor_by_name(DM_ALIAS, name, &error); - } - } - - if (obj_desc == NULL) { - return ((CCIMInstanceList *)NULL); - } - - if (error != 0) { - util_handleError(IDE_ASSOCIATORS, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - if (isAlias) { - tmpList = dm_get_associated_descriptors(obj_desc, DM_DRIVE, - &error); - if (tmpList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - if (tmpList[0] == NULL) { - dm_free_descriptors(tmpList); - return ((CCIMInstanceList *)NULL); - } - } - - - if (isAntecedent) { - /* - * Get associated descriptors. - */ - - assoc_descriptors = dm_get_associated_descriptors(obj_desc, - DM_DRIVE, &error); - dm_free_descriptor(obj_desc); - - if (assoc_descriptors == NULL) { - return (instList); - } - - if (assoc_descriptors[0] == NULL) { - dm_free_descriptors(assoc_descriptors); - return (instList); - } - - if (error != 0) { - util_handleError(IDE_ASSOCIATORS, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* - * Generate the inst list of the associated disk drives. - */ - - instList = drive_descriptors_toCCIMObjPathInstList(DISK_DRIVE, - assoc_descriptors, &error); - dm_free_descriptors(assoc_descriptors); - - if (error != 0) { - util_handleError(IDE_ASSOCIATORS, CIM_ERR_FAILED, - DRIVE_DESC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - } else { - /* - * This is the disk drive calling this function. Return the - * controllers that are associated with this disk. - */ - - if (tmpList == NULL && obj_desc == NULL) { - return ((CCIMInstanceList *)NULL); - } - - if (tmpList != NULL) { - assoc_descriptors = dm_get_associated_descriptors(tmpList[0], - DM_CONTROLLER, &error); - dm_free_descriptors(tmpList); - } else { - assoc_descriptors = dm_get_associated_descriptors(obj_desc, - DM_CONTROLLER, &error); - dm_free_descriptor(obj_desc); - } - - if (assoc_descriptors == NULL) { - return ((CCIMInstanceList *)NULL); - } - - if (assoc_descriptors[0] == NULL) { - dm_free_descriptors(assoc_descriptors); - return ((CCIMInstanceList *)NULL); - } - - if (error != 0) { - util_handleError(IDE_ASSOCIATORS, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = ctrl_descriptors_toCCIMInstanceList(IDE_CONTROLLER, - assoc_descriptors, &error, 2, "ata", "pcata"); - dm_free_descriptors(assoc_descriptors); - - if (error != 0) { - util_handleError(IDE_ASSOCIATORS, CIM_ERR_FAILED, - IDECTRL_DESC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - } - - return (instList); -} - -/* - * Name: cp_associatorNames_Solaris_IDEInterface - * - * Description: - * Returns a list of objects associated with the passed in - * object if there are any via the object CCIMObjectPath. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pResultClass - If specified, only return instances that - * are of this class type. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * cimchar *pResultRole - If specified, only return instances that - * are playing this role in the association. - * - * - * Returns: - * CCIMObjectPathList * if associated objects are found. Thist list - * may be empty. NULL is returned on error. - */ -/* ARGSUSED */ -CCIMObjectPathList * -cp_associatorNames_Solaris_IDEInterface(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, cimchar *pResultClass, cimchar *pRole, - cimchar *pResultRole) -{ - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pObjectName == NULL) { - util_handleError(IDE_ASSOCIATORNAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - instList = - cp_associators_Solaris_IDEInterface( - pAssocName, pObjectName, pResultClass, pRole, pResultRole); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Name: cp_references_Solaris_IDEInterface - * - * Description: - * Returns instances of objects that have references to the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * Returns: - * CCIMInstanceList * if associated objects are found. Thist list - * may be empty. NULL is returned on error. - */ - -/* ARGSUSED */ -CCIMInstanceList * -cp_references_Solaris_IDEInterface(CCIMObjectPath *pAssocName, -CCIMObjectPath *pObjectName, char *pRole) -{ - - CCIMInstanceList *instList = NULL; - CCIMObjectPathList *objList; - int error; - - if (pObjectName == NULL) { - util_handleError(IDE_REFERENCES, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* - * Get the list of those objects that are referred to by - * the calling object. - */ - - objList = - cp_associatorNames_Solaris_IDEInterface( - pAssocName, pObjectName, NULL, NULL, NULL); - - if (objList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - /* - * Now generate the list of instances to return. - */ - - if ((strcasecmp(pObjectName->mName, IDE_CONTROLLER)) == 0) { - instList = ideIntAssocToInstList(pObjectName, - ANTECEDENT, objList, DEPENDENT, &error); - } else { - instList = ideIntAssocToInstList(pObjectName, - DEPENDENT, objList, ANTECEDENT, &error); - } - - cim_freeObjectPathList(objList); - return (instList); -} - -/* - * Name: cp_referenceNames_Solaris_IDEInterface - * - * Description: - * Returns a instances of objects that have references to the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * - * Returns: - * CCIMInstanceList * if associated objects are found. Thist list - * may be empty. NULL is returned on error. - * - */ -/* ARGSUSED */ -CCIMObjectPathList * -cp_referenceNames_Solaris_IDEInterface(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, cimchar *pRole) -{ - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pObjectName == NULL) { - util_handleError(IDE_REFERENCENAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - instList = - cp_references_Solaris_IDEInterface(pAssocName, pObjectName, pRole); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Create the association class with the passed in attributes. - */ -static -CCIMInstanceList * -ideIntAssocToInstList(CCIMObjectPath *pObjectName, cimchar *pObjectNameRole, - CCIMObjectPathList *objList, cimchar *objRole, int *error) -{ - - CCIMObjectPathList *tmpList; - CCIMInstanceList *instList = NULL; - CCIMInstance *inst; - CCIMObjectPath *obj1; - CCIMObjectPath *obj2; - CCIMException *ex; - - *error = 0; - - if (objList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(IDE_INTERFACE, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, error); - return ((CCIMInstanceList *)NULL); - } - - tmpList = objList; - while (tmpList != NULL) { - obj1 = tmpList->mDataObject; - obj2 = cim_copyObjectPath(pObjectName); - if (obj2 == NULL) { - ex = cim_getLastError(); - util_handleError(IDE_INTERFACE, CIM_ERR_FAILED, - COPY_OBJPATH_FAILURE, ex, error); - return ((CCIMInstanceList *)NULL); - } - - inst = ideIntAssocToInst(obj1, objRole, obj2, pObjectNameRole, - error); - cim_freeObjectPath(obj2); - - if (*error != 0) { - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(IDE_INTERFACE, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, error); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - tmpList = tmpList->mNext; - } - return (instList); -} - -/* - * Create an instance of the class with the passed in attributes. - */ -static -CCIMInstance * -ideIntAssocToInst(CCIMObjectPath *obj1, cimchar *obj1Role, - CCIMObjectPath *obj2, cimchar *obj2Role, int *error) -{ - - CCIMInstance *inst = NULL; - CCIMException *ex; - - *error = 0; - - inst = cim_createInstance(IDE_INTERFACE); - if (inst == NULL) { - ex = cim_getLastError(); - util_handleError(IDE_INTERFACE, CIM_ERR_FAILED, - IDEINT_ASSOC_TO_INSTANCE_FAILURE, ex, error); - return ((CCIMInstance *)NULL); - } - - util_doReferenceProperty(obj2Role, obj2, cim_true, inst, error); - util_doReferenceProperty(obj1Role, obj1, cim_true, inst, error); - if (*error != 0) { - ex = cim_getLastError(); - util_handleError(IDE_INTERFACE, CIM_ERR_FAILED, - CREATE_REFPROP_FAILURE, ex, error); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - return (inst); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_IDEInterface.h b/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_IDEInterface.h deleted file mode 100644 index f4283020b3..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_IDEInterface.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOLARIS_IDEINTERFACE_H_ -#define _SOLARIS_IDEINTERFACE_H_ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> -#include <cimprovider.h> -#include <cimomhandle.h> -#include <cimlogsvc.h> -#include <cp_required.h> -#include <cim_objectpath.h> - -#include "libdiskmgt.h" - -#ifdef __cplusplus -} -#endif - -#endif /* _SOLARIS_IDEINTERFACE_H_ */ diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_MPXIOComponent.c b/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_MPXIOComponent.c deleted file mode 100644 index 7f048b8b01..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_MPXIOComponent.c +++ /dev/null @@ -1,1095 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <unistd.h> -#include <netdb.h> -#include <errno.h> - -#include "util.h" -#include "cimKeys.h" -#include "providerNames.h" -#include "messageStrings.h" -#include "ctrl_descriptors.h" -#include "Solaris_MPXIOComponent.h" - -#define MPXIO_GETINSTANCE "MPXIO_COMPONENT,GET_INSTANCE" -#define MPXIO_ENUMINSTANCES "MPXIO_COMPONENT,ENUM_INSTANCES" -#define MPXIO_ENUMINSTANCENAMES "MPXIO_COMPONENT,ENUM_INSTANCENAMES" -#define MPXIO_CREATEINSTANCE "MPXIO_COMPONENT,CREATE_INSTANCE" -#define MPXIO_DELETEINSTANCE "MPXIO_COMPONENT,DELETE_INSTANCE" -#define MPXIO_SETINSTANCE "MPXIO_COMPONENT,SET_INSTANCE" -#define MPXIO_GETPROPERTY "MPXIO_COMPONENT,GET_PROPERTY" -#define MPXIO_SETPROPERTY "MPXIO_COMPONENT,SET_PROPERTY" -#define MPXIO_INVOKEMETHOD "MPXIO_COMPONENT,INVOKE_METHOD" -#define MPXIO_EXECQUERY "MPXIO_COMPONENT,EXEC_QUERY" -#define MPXIO_ASSOCIATORS "MPXIO_COMPONENT,ASSOCIATORS" -#define MPXIO_ASSOCIATORNAMES "MPXIO_COMPONENT,ASSOCIATOR_NAMES" -#define MPXIO_REFERENCES "MPXIO_COMPONENT,REFERENCES" -#define MPXIO_REFERENCENAMES "MPXIO_COMPONENT,REFERENCE_NAMES" - -static -CCIMInstanceList * -mpxioCompToInstList(CCIMObjectPath *pObjectName, cimchar *pObjectNameRole, - CCIMObjectPathList *objList, cimchar *objRole, int *error); - -static -CCIMInstance * -mpxioCompToInst(CCIMObjectPath *obj1, cimchar *obj1Role, - CCIMObjectPath *obj2, cimchar *obj2Role, int *error); - -/* - * Solaris_MPXIOComponent provider - * - * It is important to note that all memory allocated by these functions - * and passed to the CIMOM, is freed by the door process prior to - * sending a copy of the data to the CIMOM. - */ - -/* - * Name: cp_getInstance_Solaris_MPXIOComponent - * - * Description: Returns an instance which matches the passed in object path - * if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMInstance* -cp_getInstance_Solaris_MPXIOComponent(CCIMObjectPath* pOP) -{ - CCIMInstance *inst = NULL; - CCIMPropertyList *pCurPropList; - CCIMObjectPath *antOp = NULL; - CCIMObjectPath *depOp = NULL; - dm_descriptor_t m_descriptor; - dm_descriptor_t c_descriptor; - char *name; - int error; - - if (pOP == NULL || - (pCurPropList = pOP->mKeyProperties) == NULL) { - util_handleError(MPXIO_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance*)NULL); - } - - antOp = (CCIMObjectPath *)util_getKeyValue(pCurPropList, reference, - GROUP, &error); - - if (error == 0) { - depOp = (CCIMObjectPath *)util_getKeyValue(pCurPropList, reference, - PART, &error); - } - - if (error != 0) { - util_handleError(MPXIO_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance*)NULL); - } - - /* - * Now, get the name of the antecedent from the object path. - */ - - if ((pCurPropList = antOp->mKeyProperties) == NULL || - (pCurPropList = depOp->mKeyProperties) == NULL) { - util_handleError(MPXIO_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - - pCurPropList = antOp->mKeyProperties; - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - if (error != 0 || name == NULL) { - util_handleError(MPXIO_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - - /* - * The only reason it is needed to get the descriptor for these - * two devices is to verify that they still exist and are valid. - * If they are not found, then getting the instance for this - * association as passed in by the client is not possible. - */ - m_descriptor = dm_get_descriptor_by_name(DM_CONTROLLER, name, - &error); - /* - * Not found. Return a null instance. - */ - if (error == ENODEV || m_descriptor == NULL) { - return ((CCIMInstance *)NULL); - } - if (error != 0) { - util_handleError(MPXIO_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstance*)NULL); - } - dm_free_descriptor(m_descriptor); - /* - * Now, get the name of the dependent from the object path. - */ - pCurPropList = depOp->mKeyProperties; - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - if (error != 0 || name == NULL) { - util_handleError(MPXIO_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - c_descriptor = dm_get_descriptor_by_name(DM_PATH, name, - &error); - /* - * Not found. Return a null instance. - */ - if (error == ENODEV || c_descriptor == NULL) { - return ((CCIMInstance *)NULL); - } - if (error != 0) { - util_handleError(MPXIO_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstance*)NULL); - } - dm_free_descriptor(c_descriptor); - - /* - * At this point I have verified I have the two devices that - * are part of this association. Use the object paths I got - * earlier to create the mpxiointerface instance. - */ - inst = mpxioCompToInst(antOp, ANTECEDENT, depOp, DEPENDENT, &error); - - if (error != 0) { - util_handleError(MPXIO_GETINSTANCE, CIM_ERR_FAILED, - MPXIOINT_ASSOC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstance *)NULL); - } - return (inst); -} - -/* - * Name: cp_enumInstances_Solaris_MPXIOComponent - * - * Description: Returns a linked list of instances of - * Solaris_MPXIOComponent if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMInstanceList * if istances are found. - * Otherwise, NULL is returned. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_enumInstances_Solaris_MPXIOComponent(CCIMObjectPath* pOP) -{ - CCIMInstanceList *instList = NULL; - CCIMObjectPathList *cObjList; - CCIMObjectPathList *tmpObjList; - CCIMObjectPath *objPath; - CCIMInstance *inst; - CCIMException *ex; - int error = 0; - - /* - * Get the list of MPXIO Controllers. Then get the associated paths - * via the device api. - */ - - objPath = cim_createEmptyObjectPath(MPXIO_CONTROLLER); - if (objPath == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_ENUMINSTANCES, CIM_ERR_FAILED, - CREATE_OBJECT_PATH, ex, &error); - return ((CCIMInstanceList *)NULL); - } - - cObjList = cimom_enumerateInstanceNames(objPath, cim_false); - cim_freeObjectPath(objPath); - - /* - * NULL means error, empty list does not. - */ - if (cObjList == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_ENUMINSTANCES, CIM_ERR_FAILED, - ENUM_INSTANCENAMES_FAILURE, ex, - &error); - return ((CCIMInstanceList *)NULL); - } - - if (cObjList->mDataObject == NULL) { - return ((CCIMInstanceList *)NULL); - } - - /* - * Loop through all of these controller objects and get the associated - * paths. - */ - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_ENUMINSTANCES, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - - for (tmpObjList = cObjList; tmpObjList != NULL; - tmpObjList = tmpObjList->mNext) { - - char *name = NULL; - CCIMObjectPath *cOp; - CCIMInstanceList *tmpList; - CCIMInstanceList *tmpList1; - CCIMPropertyList *pCurPropList; - CCIMObjectPathList *dObjList; - CCIMInstanceList *tL; - dm_descriptor_t m_descriptor; - dm_descriptor_t *c_descriptorp = NULL; - - cOp = tmpObjList->mDataObject; - if ((pCurPropList = cOp->mKeyProperties) == NULL) { - util_handleError(MPXIO_ENUMINSTANCES, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - if (error != 0 || name == NULL) { - util_handleError(MPXIO_ENUMINSTANCES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - - m_descriptor = dm_get_descriptor_by_name(DM_CONTROLLER, name, - &error); - if (error == ENODEV || m_descriptor == NULL) { - continue; - } - if (error != 0) { - util_handleError(MPXIO_ENUMINSTANCES, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - - c_descriptorp = dm_get_associated_descriptors(m_descriptor, - DM_PATH, &error); - dm_free_descriptor(m_descriptor); - /* - * If there are no paths associated with this mpxio controller, - * continue on to the next controller. - */ - - if (c_descriptorp == NULL) { - continue; - } - - if (c_descriptorp[0] == NULL) { - dm_free_descriptors(c_descriptorp); - continue; - } - - if (error != 0) { - util_handleError(MPXIO_ENUMINSTANCES, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - - tmpList = ctrl_descriptors_toCCIMInstanceList( - SCSI_CONTROLLER, c_descriptorp, &error, 5, "scsi"); - dm_free_descriptors(c_descriptorp); - - if (error != 0) { - util_handleError(MPXIO_ENUMINSTANCES, CIM_ERR_FAILED, - DRIVE_DESC_TO_INSTANCE_FAILURE, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - - dObjList = cim_createObjectPathList(tmpList); - cim_freeInstanceList(tmpList); - - if (dObjList == NULL) { - util_handleError(MPXIO_ENUMINSTANCES, CIM_ERR_FAILED, - DRIVE_DESC_TO_INSTANCE_FAILURE, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - tmpList1 = mpxioCompToInstList( - cOp, ANTECEDENT, dObjList, DEPENDENT, &error); - cim_freeObjectPathList(dObjList); - - if (error != 0) { - util_handleError(MPXIO_ENUMINSTANCES, CIM_ERR_FAILED, - DRIVE_DESC_TO_INSTANCE_FAILURE, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - - tL = tmpList1; - do { - inst = cim_copyInstance(tL->mDataObject); - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_ENUMINSTANCES, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - cim_freeObjectPathList(cObjList); - cim_freeInstance(inst); - cim_freeObjectPathList(tmpList1); - return ((CCIMInstanceList *)NULL); - } - tL = tL->mNext; - } while (tL); - - cim_freeObjectPathList(tmpList1); - } /* end for */ - - - cim_freeObjectPathList(cObjList); - - /* - * It is possible I will have an empty instance list at - * this point. So, I must check and NULL this out if - * there are no entries. - */ - if (instList->mDataObject == NULL) { - cim_freeInstanceList(instList); - instList = NULL; - } - return (instList); -} - -/* - * Name: cp_enumInstanceNames_Solaris_MPXIOComponent - * - * Description: Returns a linked list of CCIMObjectPath * - * of Solaris_MPXIOComponent if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMObjectPathList * if objects are found. - * Otherwise, NULL is returned. - */ - -CCIMObjectPathList* -cp_enumInstanceNames_Solaris_MPXIOComponent(CCIMObjectPath * pOP) { - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pOP == NULL) { - util_handleError(MPXIO_ENUMINSTANCENAMES, - CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - /* - * Call in to enumInstances and then convert the instance list in - * to an object list. - */ - - instList = cp_enumInstances_Solaris_MPXIOComponent(pOP); - - if (instList->mDataObject != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Creating an instance of a Solaris_MPXIOComponent is not supported. - */ - -/* ARGSUSED */ -CCIMObjectPath* -cp_createInstance_Solaris_MPXIOComponent(CCIMObjectPath* pOP, - CCIMInstance* pInst) -{ - int error; - - util_handleError(MPXIO_COMPONENT, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return ((CCIMObjectPath *)NULL); -} - -/* - * Deleting an instance of a Solaris_MPXIOComponent is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_MPXIOComponent(CCIMObjectPath* pInst) -{ - int error; - - util_handleError(MPXIO_COMPONENT, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - -/* - * Name: cp_getProperty_Solaris_MPXIOComponent - * - * Description: Returns the property requested, if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMProperty * if found. - */ - -/* ARGSUSED */ -CCIMProperty * -cp_getProperty_Solaris_MPXIOComponent(CCIMObjectPath *pOP, - char *pPropName) -{ - - CCIMProperty *prop = NULL; - CCIMInstance *inst = NULL; - int error = 0; - - - if (pOP == NULL) { - util_handleError(MPXIO_GETPROPERTY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMProperty *)NULL); - } - - inst = cp_getInstance_Solaris_MPXIOComponent(pOP); - if (inst == NULL) { - return ((CCIMProperty *)NULL); - } - - prop = cim_getProperty(inst, pPropName); - cim_freeInstance(inst); - return (prop); -} - -/* - * Setting an instance of a Solaris_MPXIOComponent is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_MPXIOComponent(CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - int error; - - util_handleError(MPXIO_COMPONENT, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - -/* - * Setting a property on a Solaris_MPXIOComponent is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_MPXIOComponent(CCIMObjectPath* pOP, CCIMProperty* pProp) -{ - int error; - - util_handleError(MPXIO_COMPONENT, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - -/* - * No Methods for Solaris_MPXIOComponent. - */ - -/* ARGSUSED */ -CCIMProperty* -cp_invokeMethod_Solaris_MPXIOComponent( - CCIMObjectPath* op, cimchar* methodName, - CCIMPropertyList* inParams, CCIMPropertyList* outParams) -{ - CCIMProperty *retVal = (CCIMProperty *)NULL; - return (retVal); -} - -/* - * Name: cp_execQuery_Solaris_MPXIOComponent - * - * Description: - * Returns an instance list which matches the query if any are found. - * - * Parameters: - * CCIMObjectPath *op - An CCIMObjectPath * which contains the - * information on the class for which to find the instances. - * - * selectList - Not used - * nonJoinExp - Not used - * - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ -/* - * Currently, there is no WQL parser for the C providers. As a result, - * what is returned to the CIMOM is a list of instances with - * a NULL value at the beginning of the list. This NULL value indicates - * to the CIMOM that it must do the filtering for the client. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_execQuery_Solaris_MPXIOComponent(CCIMObjectPath *op, - cimchar *selectList, cimchar *nonJoinExp, cimchar *queryExp, int queryType) -{ - CCIMInstanceList *instList = NULL; - CCIMInstanceList *result; - CCIMInstance *emptyInst; - CCIMException *ex; - int error; - - if (op == NULL) { - util_handleError(MPXIO_EXECQUERY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = cp_enumInstances_Solaris_MPXIOComponent(op); - - if (instList == NULL) { - return ((CCIMInstanceList *)NULL); - } - /* - * Create a null instance and add it to the beginning - * of the list to indicate to the CIMOM that no filtering - * was done. - */ - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - - result = cim_createInstanceList(); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_addInstance(result, emptyInst); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_EXECQUERY, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - /* - * Since copying the original list to the new list will - * leave no way to free the original list, manually - * concatenate the original list to the new one. - */ - - result->mNext = instList; - return (result); -} - -/* - * Name: cp_associators_Solaris_MPXIOComponent - * - * Description: - * Returns instances of objects associated with the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pResultClass - If specified, only return instances that - * are of this class type. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * cimchar *pResultRole - If specified, only return instances that - * are playing this role in the association. - * - * - * Returns: - * CCIMInstanceList * if associated objects are found. - * Otherwise, NULL is returned. - */ - -/* ARGSUSED */ -CCIMInstanceList * -cp_associators_Solaris_MPXIOComponent(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, cimchar *pResultClass, cimchar *pRole, - cimchar *pResultRole) -{ - CCIMPropertyList *pCurPropList; - CCIMInstanceList *instList = NULL; - CCIMException *ex; - dm_descriptor_t *assoc_descriptors; - dm_descriptor_t obj_desc; - char *name; - int error = 0; - int isGroup = 0; - - if (pObjectName == NULL || - ((pCurPropList = pObjectName->mKeyProperties) == NULL)) { - util_handleError(MPXIO_ASSOCIATORS, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - if (strcasecmp(pObjectName->mName, MPXIO_CONTROLLER) == 0) { - isGroup = 1; - } - - if (pRole != NULL) { - if (strcasecmp(pRole, GROUP) == 0) { - if (isGroup != 1) { - util_handleError(MPXIO_ASSOCIATORS, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - } - } - - /* - * Both mpxio controller and the paths have deviceid as the - * key. - */ - - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - if (error != 0) { - util_handleError(MPXIO_ASSOCIATORS, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - if (isGroup == 1) { - obj_desc = dm_get_descriptor_by_name(DM_CONTROLLER, name, - &error); - } else { - obj_desc = dm_get_descriptor_by_name(DM_PATH, name, - &error); - } - if (error == ENODEV || obj_desc == NULL) { - return ((CCIMInstanceList *)NULL); - } - if (error != 0) { - util_handleError(MPXIO_ASSOCIATORS, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - if (isGroup) { - /* - * Get associated descriptors. - */ - assoc_descriptors = dm_get_associated_descriptors(obj_desc, - DM_PATH, &error); - dm_free_descriptor(obj_desc); - - if (assoc_descriptors == NULL) { - return ((CCIMInstanceList *)NULL); - } - - if (assoc_descriptors[0] == NULL) { - dm_free_descriptors(assoc_descriptors); - return ((CCIMInstanceList *)NULL); - } - - if (error != 0) { - util_handleError(MPXIO_ASSOCIATORS, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - /* - * Generate the inst list of the associated paths. - */ - instList = ctrl_descriptors_toCCIMInstanceList(SCSI_CONTROLLER, - assoc_descriptors, &error, 1, "scsi"); - dm_free_descriptors(assoc_descriptors); - - if (error != 0) { - ex = cim_getLastError(); - util_handleError(MPXIO_ASSOCIATORS, CIM_ERR_FAILED, - SCSICTRL_DESC_TO_INSTANCE_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - } else { - /* - * This is the underlying ctrl calling this function. Return - * the controllers that are associated with this disk. - */ - - assoc_descriptors = dm_get_associated_descriptors(obj_desc, - DM_CONTROLLER, &error); - dm_free_descriptor(obj_desc); - - if (assoc_descriptors == NULL) { - return ((CCIMInstanceList *)NULL); - } - - if (assoc_descriptors[0] == NULL) { - dm_free_descriptors(assoc_descriptors); - return ((CCIMInstanceList *)NULL); - } - - if (error != 0) { - util_handleError(MPXIO_ASSOCIATORS, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - instList = ctrl_descriptors_toCCIMInstanceList(MPXIO_CONTROLLER, - assoc_descriptors, &error, 1, "scsi_vhci"); - dm_free_descriptors(assoc_descriptors); - - if (error != 0) { - util_handleError(MPXIO_ASSOCIATORS, CIM_ERR_FAILED, - MPXIOCTRL_DESC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - } - return (instList); -} - -/* - * Name: cp_associatorNames_Solaris_MPXIOComponent - * - * Description: - * Returns a list of objects associated with the passed in - * object if there are any via the object CCIMObjectPath. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pResultClass - If specified, only return instances that - * are of this class type. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * cimchar *pResultRole - If specified, only return instances that - * are playing this role in the association. - * - * - * Returns: - * CCIMObjectPathList * if associated objects are found. - * Otherwise, NULL is returned. - */ - -/* ARGSUSED */ -CCIMObjectPathList * -cp_associatorNames_Solaris_MPXIOComponent(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, cimchar *pResultClass, cimchar *pRole, - cimchar *pResultRole) -{ - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pObjectName == NULL) { - util_handleError(MPXIO_ASSOCIATORNAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - instList = - cp_associators_Solaris_MPXIOComponent( - pAssocName, pObjectName, pResultClass, pRole, pResultRole); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - return (objList); -} - -/* - * Name: cp_references_Solaris_MPXIOComponent - * - * Description: - * Returns instances of objects that have references to the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * Returns: - * CCIMInstanceList * if associated objects are found. Thist list - * may be empty. NULL is returned on error. - */ - -/* ARGSUSED */ -CCIMInstanceList * -cp_references_Solaris_MPXIOComponent(CCIMObjectPath *pAssocName, -CCIMObjectPath *pObjectName, char *pRole) -{ - - CCIMInstanceList *instList = NULL; - CCIMObjectPathList *objList; - int error; - - if (pObjectName == NULL) { - util_handleError(MPXIO_REFERENCES, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* - * Get the list of those objects that are referred to by - * the calling object. - */ - - objList = - cp_associatorNames_Solaris_MPXIOComponent( - pAssocName, pObjectName, NULL, NULL, NULL); - - if (objList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - /* - * Now generate the list of instances to return. - */ - - if ((strcasecmp(pObjectName->mName, MPXIO_CONTROLLER)) == 0) { - instList = mpxioCompToInstList(pObjectName, - ANTECEDENT, objList, DEPENDENT, &error); - } else { - instList = mpxioCompToInstList(pObjectName, - DEPENDENT, objList, ANTECEDENT, &error); - } - - cim_freeObjectPathList(objList); - return (instList); -} - -/* - * Name: cp_referenceNames_Solaris_MPXIOComponent - * - * Description: - * Returns a instances of objects that have references to the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * - * Returns: - * CCIMObjectPathList * if associated objects are found. Otherwise, NULL. - * - */ - -/* ARGSUSED */ -CCIMObjectPathList * -cp_referenceNames_Solaris_MPXIOComponent(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, cimchar *pRole) -{ - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pObjectName == NULL) { - util_handleError(MPXIO_REFERENCENAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - instList = - cp_references_Solaris_MPXIOComponent(pAssocName, - pObjectName, pRole); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - return (objList); -} - -/* - * Create the association class with the passed in attributes. - */ -static -CCIMInstanceList * -mpxioCompToInstList(CCIMObjectPath *pObjectName, cimchar *pObjectNameRole, - CCIMObjectPathList *objList, cimchar *objRole, int *error) -{ - - CCIMObjectPathList *tmpList; - CCIMInstanceList *instList = NULL; - CCIMInstance *inst; - CCIMObjectPath *obj1; - CCIMObjectPath *obj2; - CCIMException *ex; - - *error = 0; - - /* - * If no objects associated with this one, return NULL. - */ - if (objList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_COMPONENT, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, error); - return ((CCIMInstanceList *)NULL); - } - - tmpList = objList; - while (tmpList != NULL) { - obj1 = tmpList->mDataObject; - obj2 = cim_copyObjectPath(pObjectName); - if (obj2 == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_COMPONENT, CIM_ERR_FAILED, - COPY_OBJPATH_FAILURE, ex, error); - return ((CCIMInstanceList *)NULL); - } - - inst = mpxioCompToInst(obj1, objRole, obj2, pObjectNameRole, - error); - cim_freeObjectPath(obj2); - if (*error != 0) { - util_handleError(MPXIO_COMPONENT, CIM_ERR_FAILED, - MPXIOINT_ASSOC_TO_INSTANCE_FAILURE, NULL, error); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_COMPONENT, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, error); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - tmpList = tmpList->mNext; - } - return (instList); -} - -/* - * Create an instance of an mpxio group object. - */ -static -CCIMInstance * -mpxioCompToInst(CCIMObjectPath *obj1, cimchar *obj1Role, - CCIMObjectPath *obj2, cimchar *obj2Role, int *error) -{ - - CCIMInstance *inst = NULL; - CCIMException *ex; - - *error = 0; - inst = cim_createInstance(MPXIO_COMPONENT); - if (inst == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_COMPONENT, CIM_ERR_FAILED, - MPXIOINT_ASSOC_TO_INSTANCE_FAILURE, ex, error); - return ((CCIMInstance *)NULL); - } - - util_doReferenceProperty(obj2Role, obj2, cim_true, inst, error); - util_doReferenceProperty(obj1Role, obj1, cim_true, inst, error); - if (*error != 0) { - ex = cim_getLastError(); - util_handleError(MPXIO_COMPONENT, CIM_ERR_FAILED, - CREATE_REFPROP_FAILURE, ex, error); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - return (inst); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_MPXIOComponent.h b/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_MPXIOComponent.h deleted file mode 100644 index 8d2c987da7..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_MPXIOComponent.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOLARIS_MPXIOCOMPONENT_H_ -#define _SOLARIS_MPXIOCOMPONENT_H_ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> -#include <cimprovider.h> -#include <cimomhandle.h> -#include <cimlogsvc.h> -#include <cp_required.h> -#include <cim_objectpath.h> - -#include "libdiskmgt.h" - -#ifdef __cplusplus -} -#endif - -#endif /* _SOLARIS_MPXIOCOMPONENT_H_ */ diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_MPXIOInterface.c b/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_MPXIOInterface.c deleted file mode 100644 index 8de5481676..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_MPXIOInterface.c +++ /dev/null @@ -1,1101 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <unistd.h> -#include <netdb.h> -#include <errno.h> - -#include "util.h" -#include "cimKeys.h" -#include "providerNames.h" -#include "messageStrings.h" -#include "drive_descriptors.h" -#include "ctrl_descriptors.h" -#include "Solaris_MPXIOInterface.h" - - -#define MPXIO_GETINSTANCE "MPXIO_INTERFACE,GET_INSTANCE" -#define MPXIO_ENUMINSTANCES "MPXIO_INTERFACE,ENUM_INSTANCES" -#define MPXIO_ENUMINSTANCENAMES "MPXIO_INTERFACE,ENUM_INSTANCENAMES" -#define MPXIO_CREATEINSTANCE "MPXIO_INTERFACE,CREATE_INSTANCE" -#define MPXIO_DELETEINSTANCE "MPXIO_INTERFACE,DELETE_INSTANCE" -#define MPXIO_SETINSTANCE "MPXIO_INTERFACE,SET_INSTANCE" -#define MPXIO_GETPROPERTY "MPXIO_INTERFACE,GET_PROPERTY" -#define MPXIO_SETPROPERTY "MPXIO_INTERFACE,SET_PROPERTY" -#define MPXIO_INVOKEMETHOD "MPXIO_INTERFACE,INVOKE_METHOD" -#define MPXIO_EXECQUERY "MPXIO_INTERFACE,EXEC_QUERY" -#define MPXIO_ASSOCIATORS "MPXIO_INTERFACE,ASSOCIATORS" -#define MPXIO_ASSOCIATORNAMES "MPXIO_INTERFACE,ASSOCIATOR_NAMES" -#define MPXIO_REFERENCES "MPXIO_INTERFACE,REFERENCES" -#define MPXIO_REFERENCENAMES "MPXIO_INTERFACE,REFERENCE_NAMES" - -static -CCIMInstanceList * -mpxioIntAssocToInstList(CCIMObjectPath *pObjectName, cimchar *pObjectNameRole, - CCIMObjectPathList *objList, cimchar *objRole, int *error); - -static -CCIMInstance * -mpxioIntAssocToInst(CCIMObjectPath *obj1, cimchar *obj1Role, - CCIMObjectPath *obj2, cimchar *obj2Role, int *error); - -/* - * Solaris_MPXIOInterface provider - * - * It is important to note that all memory allocated by these functions - * and passed to the CIMOM, is freed by the door process prior to - * sending a copy of the data to the CIMOM. - */ - -/* - * Name: cp_getInstance_Solaris_MPXIOInterface - * - * Description: Returns an instance which matches the passed in object path - * if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ - -CCIMInstance* -cp_getInstance_Solaris_MPXIOInterface(CCIMObjectPath* pOP) -{ - CCIMInstance* inst = NULL; - CCIMPropertyList* pCurPropList; - CCIMObjectPath *antOp = NULL; - CCIMObjectPath *depOp = NULL; - dm_descriptor_t d_descriptor; - dm_descriptor_t c_descriptor; - char *name; - int error; - - if (pOP == NULL || - ((pCurPropList = pOP->mKeyProperties) == NULL)) { - util_handleError(MPXIO_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstance *)NULL); - } - - antOp = (CCIMObjectPath *)util_getKeyValue( - pCurPropList, reference, ANTECEDENT, &error); - - if (error == 0) { - depOp = (CCIMObjectPath *)util_getKeyValue( - pCurPropList, reference, DEPENDENT, &error); - } - - if (error != 0) { - util_handleError(MPXIO_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - /* - * Now, get the name of the antecedent from the object path. - */ - - if (((pCurPropList = antOp->mKeyProperties) == NULL) || - ((pCurPropList = depOp->mKeyProperties) == NULL)) { - util_handleError(MPXIO_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - - pCurPropList = antOp->mKeyProperties; - name = (cimchar *)util_getKeyValue(pCurPropList, string, - DEVICEID, &error); - if (error != 0) { - util_handleError(MPXIO_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - /* - * The only reason it is needed to get the descriptor for these - * two devices is to verify that they still exist and are valid. - * If they are not found, then getting the instance for this - * association as passed in by the client is not possible. - */ - c_descriptor = dm_get_descriptor_by_name(DM_CONTROLLER, name, - &error); - /* - * Not found. Return a null instance. - */ - if (error == ENODEV || c_descriptor == NULL) { - return ((CCIMInstance *)NULL); - } - if (error != 0) { - util_handleError(MPXIO_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstance *)NULL); - } - dm_free_descriptor(c_descriptor); - - pCurPropList = depOp->mKeyProperties; - name = (cimchar *)util_getKeyValue(pCurPropList, string, - DEVICEID, &error); - if (error != 0) { - util_handleError(MPXIO_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstance *)NULL); - } - - d_descriptor = dm_get_descriptor_by_name(DM_DRIVE, name, &error); - - /* - * Not found. Return a null instance. - */ - - if (error == ENODEV || d_descriptor == NULL) { - return ((CCIMInstance *)NULL); - } - - if (error != 0) { - util_handleError(MPXIO_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstance*)NULL); - } - dm_free_descriptor(d_descriptor); - - /* - * At this point I have verified I have the two devices that - * are part of this association. Use the object paths I got - * earlier to create the mpxiointerface instance. - */ - inst = mpxioIntAssocToInst(antOp, ANTECEDENT, depOp, DEPENDENT, &error); - - if (error != 0) { - util_handleError(MPXIO_GETINSTANCE, CIM_ERR_FAILED, - MPXIOINT_ASSOC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstance *)NULL); - } - return (inst); -} - -/* - * Name: cp_enumInstances_Solaris_MPXIOInterface - * - * Description: Returns a linked list of instances of - * Solaris_MPXIOInterface if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMInstanceList * if istances are found. NULL otherwise. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_enumInstances_Solaris_MPXIOInterface(CCIMObjectPath* pOP) -{ - CCIMInstanceList *instList = NULL; - CCIMObjectPathList *cObjList; - CCIMObjectPathList *tmpObjList; - CCIMObjectPath *objPath; - CCIMInstance *inst; - CCIMException *ex; - dm_descriptor_t *d_descriptorp = NULL; - int error = 0; - - - objPath = cim_createEmptyObjectPath(MPXIO_CONTROLLER); - if (objPath == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_ENUMINSTANCES, CIM_ERR_FAILED, - CREATE_OBJECT_PATH, ex, &error); - return ((CCIMInstanceList *)NULL); - } - - cObjList = cimom_enumerateInstanceNames(objPath, cim_false); - cim_freeObjectPath(objPath); - - /* - * NULL is an error. Empty list is not. - */ - if (cObjList == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_ENUMINSTANCES, CIM_ERR_FAILED, - ENUM_INSTANCENAMES_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - - if (cObjList->mDataObject == NULL) { - return ((CCIMInstanceList *)NULL); - } - /* - * Loop through all of these controller objects and get the associated - * disks. - */ - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_ENUMINSTANCES, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - - for (tmpObjList = cObjList; tmpObjList != NULL && - tmpObjList->mDataObject != NULL; - tmpObjList = tmpObjList->mNext) { - - CCIMObjectPath *cOp; - CCIMInstanceList *tmpList; - CCIMInstanceList *tmpList1 = NULL; - CCIMPropertyList *pCurPropList; - CCIMObjectPathList *dObjList; - CCIMInstanceList *tL; - dm_descriptor_t c_descriptor; - char *name = NULL; - - cOp = tmpObjList->mDataObject; - if ((pCurPropList = cOp->mKeyProperties) == NULL) { - util_handleError(MPXIO_ENUMINSTANCES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - - name = (cimchar *)util_getKeyValue(pCurPropList, string, - DEVICEID, &error); - if (error != 0 || name == NULL) { - util_handleError(MPXIO_ENUMINSTANCES, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - - c_descriptor = dm_get_descriptor_by_name(DM_CONTROLLER, name, - &error); - if (error == ENODEV || c_descriptor == NULL) { - continue; - } - if (error != 0) { - util_handleError(MPXIO_ENUMINSTANCES, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - - d_descriptorp = dm_get_associated_descriptors(c_descriptor, - DM_DRIVE, &error); - dm_free_descriptor(c_descriptor); - /* - * If there are no drives associated with this controller, - * continue on to the next controller. - */ - if (d_descriptorp == NULL || - d_descriptorp[0] == NULL) { - continue; - } - if (error != 0) { - util_handleError(MPXIO_ENUMINSTANCES, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - - tmpList = drive_descriptors_toCCIMObjPathInstList( - DISK_DRIVE, d_descriptorp, &error); - dm_free_descriptors(d_descriptorp); - - if (error != 0) { - util_handleError(MPXIO_ENUMINSTANCES, CIM_ERR_FAILED, - DRIVE_DESC_TO_INSTANCE_FAILURE, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - - if (tmpList == NULL) { - continue; - } - - dObjList = cim_createObjectPathList(tmpList); - cim_freeInstanceList(tmpList); - - if (dObjList == NULL) { - util_handleError(MPXIO_ENUMINSTANCES, CIM_ERR_FAILED, - DRIVE_DESC_TO_INSTANCE_FAILURE, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - tmpList1 = mpxioIntAssocToInstList( - cOp, ANTECEDENT, dObjList, DEPENDENT, &error); - cim_freeObjectPathList(dObjList); - - if (error != 0) { - util_handleError(MPXIO_ENUMINSTANCES, CIM_ERR_FAILED, - DRIVE_DESC_TO_INSTANCE_FAILURE, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - /* - * Assign a pointer to the tmplist. Traverse the list with - * this pointer so as not to disturb the original value of - * the instance list. This is needed for freeing the list - * later. - */ - tL = tmpList1; - do { - inst = cim_copyInstance(tL->mDataObject); - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - /* - * In this case we do not free the indivual instance - * added to the instance list. On error, the original - * instance list is freed. - */ - util_handleError(MPXIO_ENUMINSTANCENAMES, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, NULL, &error); - cim_freeInstance(inst); - cim_freeObjectPathList(cObjList); - cim_freeInstanceList(tmpList1); - return ((CCIMInstanceList *)NULL); - } - tL = tL->mNext; - } while (tL); - - cim_freeInstanceList(tmpList1); - } /* end for */ - - cim_freeObjectPathList(cObjList); - - /* - * It is possible I will have an empty instance list at - * this point. So, I must check and NULL this out if - * there are no entries. - */ - if (instList->mDataObject == NULL) { - cim_freeInstanceList(instList); - instList = NULL; - } - return (instList); -} - -/* - * Name: cp_enumInstanceNames_Solaris_MPXIOInterface - * - * Description: Returns a linked list of CCIMObjectPath * - * of Solaris_MPXIOInterface if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMObjectPathList * if objects are found. NULL otherwise. - */ - -CCIMObjectPathList* -cp_enumInstanceNames_Solaris_MPXIOInterface(CCIMObjectPath * pOP) { - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - - if (pOP == NULL) { - util_handleError(MPXIO_ENUMINSTANCENAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - /* - * Call in to enumInstances and then convert the instance list in - * to an object list. - */ - - instList = cp_enumInstances_Solaris_MPXIOInterface(pOP); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Creating an instance of a Solaris_MPXIOInterface is not supported. - */ - -/* ARGSUSED */ -CCIMObjectPath* -cp_createInstance_Solaris_MPXIOInterface(CCIMObjectPath* pOP, - CCIMInstance* pInst) -{ - int error; - - util_handleError(MPXIO_CREATEINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return ((CCIMObjectPath *)NULL); -} - - -/* - * Deleting an instance of a Solaris_MPXIOInterface is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_MPXIOInterface(CCIMObjectPath* pInst) -{ - int error; - - util_handleError(MPXIO_DELETEINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - -/* - * Name: cp_getProperty_Solaris_MPXIOInterface - * - * Description: Returns the property requested, if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMProperty * if found. - */ - -/* ARGSUSED */ -CCIMProperty * -cp_getProperty_Solaris_MPXIOInterface(CCIMObjectPath *pOP, - char *pPropName) -{ - - CCIMProperty *prop = NULL; - CCIMInstance *inst = NULL; - int error = 0; - - if (pOP == NULL) { - util_handleError(MPXIO_GETPROPERTY, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMProperty *)NULL); - } - - inst = cp_getInstance_Solaris_MPXIOInterface(pOP); - if (inst == NULL) { - return ((CCIMProperty *)NULL); - } - prop = cim_getProperty(inst, pPropName); - cim_freeInstance(inst); - return (prop); -} - -/* - * Setting an instance of a Solaris_MPXIOInterface is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_MPXIOInterface(CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - int error; - - util_handleError(MPXIO_SETINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - -/* - * Setting a property on a Solaris_MPXIOInterface is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_MPXIOInterface(CCIMObjectPath* pOP, CCIMProperty* pProp) -{ - int error; - - util_handleError(MPXIO_SETPROPERTY, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - -/* - * No Methods for Solaris_MPXIOInterface. - */ - -/* ARGSUSED */ -CCIMProperty* -cp_invokeMethod_Solaris_MPXIOInterface( - CCIMObjectPath* op, cimchar* methodName, - CCIMPropertyList* inParams, CCIMPropertyList* outParams) -{ - - CCIMProperty *retVal = (CCIMProperty *)NULL; - return (retVal); -} - -/* - * Name: cp_execQuery_Solaris_MPXIOInterface - * - * Description: - * Returns an instance list which matches the query if any are found. - * - * Parameters: - * CCIMObjectPath *op - An CCIMObjectPath * which contains the - * information on the class for which to find the instances. - * - * selectList - Not used - * nonJoinExp - Not used - * - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ -/* - * Currently, there is no WQL parser for the C providers. As a result, - * what is returned to the CIMOM is a list of instances with - * a NULL value at the beginning of the list. This NULL value indicates - * to the CIMOM that it must do the filtering for the client. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_execQuery_Solaris_MPXIOInterface(CCIMObjectPath *op, - cimchar *selectList, cimchar *nonJoinExp, cimchar *queryExp, int queryType) -{ - CCIMInstanceList *instList = NULL; - CCIMInstanceList *result; - CCIMInstance *emptyInst; - CCIMException *ex; - int error; - - if (op == NULL) { - util_handleError(MPXIO_EXECQUERY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = cp_enumInstances_Solaris_MPXIOInterface(op); - - if (instList == NULL) { - return ((CCIMInstanceList *)NULL); - } - /* - * Create a null instance and add it to the beginning - * of the list to indicate to the CIMOM that no filtering - * was done. - */ - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - - result = cim_createInstanceList(); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_addInstance(result, emptyInst); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_EXECQUERY, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - /* - * Since copying the original list to the new list will - * leave no way to free the original list, manually - * concatenate the original list to the new one. - */ - - result->mNext = instList; - return (result); -} - -/* - * Name: cp_associators_Solaris_MPXIOInterface - * - * Description: - * Returns a instances of objects associated with the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pResultClass - If specified, only return instances that - * are of this class type. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * cimchar *pResultRole - If specified, only return instances that - * are playing this role in the association. - * - * - * Returns: - * CCIMInstanceList * if associated objects are found. NULL otherwise. - */ - -/* ARGSUSED */ -CCIMInstanceList * -cp_associators_Solaris_MPXIOInterface(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, cimchar *pResultClass, cimchar *pRole, - cimchar *pResultRole) -{ - CCIMPropertyList *pCurPropList; - CCIMInstanceList *instList = NULL; - dm_descriptor_t *assoc_descriptors; - dm_descriptor_t obj_desc; - char *name; - int error = 0; - int isAntecedent = 0; - - if (pObjectName == NULL || - pObjectName->mName == NULL || - ((pCurPropList = pObjectName->mKeyProperties) == NULL)) { - util_handleError(MPXIO_ASSOCIATORS, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - if (strcasecmp(pObjectName->mName, MPXIO_CONTROLLER) == 0) { - isAntecedent = 1; - } - - if (pRole != NULL) { - if (strcasecmp(pRole, ANTECEDENT) == 0) { - if (isAntecedent != 1) { - util_handleError(MPXIO_ASSOCIATORS, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - } else if (strcasecmp(pRole, DEPENDENT) == 0) { - if (isAntecedent == 1) { - util_handleError(MPXIO_ASSOCIATORS, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - } - } - - /* - * Both mpxio controller and disk drive have deviceid as the - * key. - */ - - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - if (error != 0) { - util_handleError(MPXIO_ASSOCIATORS, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - if (isAntecedent) { - obj_desc = dm_get_descriptor_by_name(DM_CONTROLLER, name, - &error); - } else { - obj_desc = dm_get_descriptor_by_name(DM_DRIVE, name, - &error); - } - /* - * No device found. - */ - if (error == ENODEV || obj_desc == NULL) { - return ((CCIMInstanceList *)NULL); - } - if (error != 0) { - util_handleError(MPXIO_ASSOCIATORS, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - if (isAntecedent) { - /* - * Controller calling this method, return instances of the - * disk drives associatied with this controller. - */ - - assoc_descriptors = dm_get_associated_descriptors(obj_desc, - DM_DRIVE, &error); - dm_free_descriptor(obj_desc); - - if (assoc_descriptors == NULL || - assoc_descriptors[0] == NULL) { - return ((CCIMInstanceList *)NULL); - } - - if (error != 0) { - util_handleError(MPXIO_ASSOCIATORS, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - /* - * Generate the inst list of the associated disk drives. - */ - - instList = drive_descriptors_toCCIMObjPathInstList(DISK_DRIVE, - assoc_descriptors, &error); - dm_free_descriptors(assoc_descriptors); - - if (error != 0) { - util_handleError(MPXIO_ASSOCIATORS, CIM_ERR_FAILED, - DRIVE_DESC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - } else { - /* - * This is the disk drive calling this function. Return the - * controllers that are associated with this disk. - */ - assoc_descriptors = dm_get_associated_descriptors(obj_desc, - DM_CONTROLLER, &error); - dm_free_descriptor(obj_desc); - - if (assoc_descriptors == NULL || - assoc_descriptors[0] == NULL) { - return ((CCIMInstanceList *)NULL); - } - - if (error != 0) { - util_handleError(MPXIO_ASSOCIATORS, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = ctrl_descriptors_toCCIMInstanceList(MPXIO_CONTROLLER, - assoc_descriptors, &error, 1, "scsi_vhci"); - dm_free_descriptors(assoc_descriptors); - - if (error != 0) { - util_handleError(MPXIO_ASSOCIATORS, CIM_ERR_FAILED, - MPXIOCTRL_DESC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - } - - return (instList); -} - -/* - * Name: cp_associatorNames_Solaris_MPXIOInterface - * - * Description: - * Returns a list of objects associated with the passed in - * object if there are any via the object CCIMObjectPath. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pResultClass - If specified, only return instances that - * are of this class type. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * cimchar *pResultRole - If specified, only return instances that - * are playing this role in the association. - * - * - * Returns: - * CCIMObjectPathList * if associated objects are found. Otherwise, NULL. - */ -/* ARGSUSED */ -CCIMObjectPathList * -cp_associatorNames_Solaris_MPXIOInterface(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, cimchar *pResultClass, cimchar *pRole, - cimchar *pResultRole) -{ - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pObjectName == NULL) { - util_handleError(MPXIO_ASSOCIATORNAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - instList = - cp_associators_Solaris_MPXIOInterface( - pAssocName, pObjectName, pResultClass, pRole, pResultRole); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - return (objList); -} - -/* - * Name: cp_references_Solaris_MPXIOInterface - * - * Description: - * Returns a instances of objects that have references to the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * Returns: - * CCIMInstanceList * if associated objects are found. NULL otherwise. - */ - -/* ARGSUSED */ -CCIMInstanceList * -cp_references_Solaris_MPXIOInterface(CCIMObjectPath *pAssocName, -CCIMObjectPath *pObjectName, char *pRole) -{ - - CCIMInstanceList *instList = NULL; - CCIMObjectPathList *objList; - int error; - - if (pObjectName == NULL) { - util_handleError(MPXIO_REFERENCES, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - /* - * Get the list of those objects that are referred to by - * the calling object. - */ - - objList = - cp_associatorNames_Solaris_MPXIOInterface( - pAssocName, pObjectName, NULL, NULL, NULL); - - if (objList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - /* - * Now generate the list of instances to return. - */ - - if ((strcasecmp(pObjectName->mName, MPXIO_CONTROLLER)) == 0) { - instList = mpxioIntAssocToInstList(pObjectName, - ANTECEDENT, objList, DEPENDENT, &error); - } else { - instList = mpxioIntAssocToInstList(pObjectName, - DEPENDENT, objList, ANTECEDENT, &error); - } - - cim_freeObjectPathList(objList); - return (instList); -} - -/* - * Name: cp_referenceNames_Solaris_MPXIOInterface - * - * Description: - * Returns a instances of objects that have references to the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * - * Returns: - * CCIMObjectPathList * if associated objects are found. NULL otherwise. - * - */ -/* ARGSUSED */ -CCIMObjectPathList * -cp_referenceNames_Solaris_MPXIOInterface(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, cimchar *pRole) -{ - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pObjectName == NULL) { - util_handleError(MPXIO_REFERENCENAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - instList = - cp_references_Solaris_MPXIOInterface(pAssocName, - pObjectName, pRole); - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Create the association class with the passed in attributes. - */ -static -CCIMInstanceList * -mpxioIntAssocToInstList(CCIMObjectPath *pObjectName, cimchar *pObjectNameRole, - CCIMObjectPathList *objList, cimchar *objRole, int *error) -{ - - CCIMObjectPathList *tmpList; - CCIMInstanceList *instList = NULL; - CCIMInstance *inst; - CCIMObjectPath *obj1; - CCIMObjectPath *obj2; - CCIMException *ex; - - *error = 0; - - /* - * If no objects associated with this one, return NULL. - */ - if (objList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_INTERFACE, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, error); - return ((CCIMInstanceList *)NULL); - } - - tmpList = objList; - while (tmpList != NULL) { - obj1 = tmpList->mDataObject; - obj2 = cim_copyObjectPath(pObjectName); - if (obj2 == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_INTERFACE, CIM_ERR_FAILED, - COPY_OBJPATH_FAILURE, ex, error); - return ((CCIMInstanceList *)NULL); - } - - inst = mpxioIntAssocToInst(obj1, objRole, obj2, pObjectNameRole, - error); - cim_freeObjectPath(obj2); - if (*error != 0) { - util_handleError(MPXIO_INTERFACE, CIM_ERR_FAILED, - MPXIOINT_ASSOC_TO_INSTANCE_FAILURE, NULL, error); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_INTERFACE, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, error); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - tmpList = tmpList->mNext; - } - return (instList); -} - -static -CCIMInstance * -mpxioIntAssocToInst(CCIMObjectPath *obj1, cimchar *obj1Role, - CCIMObjectPath *obj2, cimchar *obj2Role, int *error) -{ - - CCIMInstance *inst = NULL; - CCIMException *ex; - - *error = 0; - - inst = cim_createInstance(MPXIO_INTERFACE); - if (inst == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_INTERFACE, CIM_ERR_FAILED, - MPXIOINT_ASSOC_TO_INSTANCE_FAILURE, ex, error); - return ((CCIMInstance *)NULL); - } - - util_doReferenceProperty(obj2Role, obj2, cim_true, inst, error); - if (*error != 0) { - ex = cim_getLastError(); - util_handleError(MPXIO_INTERFACE, CIM_ERR_FAILED, - CREATE_REFPROP_FAILURE, ex, error); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - util_doReferenceProperty(obj1Role, obj1, cim_true, inst, - error); - if (*error != 0) { - ex = cim_getLastError(); - util_handleError(MPXIO_INTERFACE, CIM_ERR_FAILED, - CREATE_REFPROP_FAILURE, ex, error); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - return (inst); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_MPXIOInterface.h b/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_MPXIOInterface.h deleted file mode 100644 index e13b7a5387..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_MPXIOInterface.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOLARIS_MPXIOINTERFACE_H_ -#define _SOLARIS_MPXIOINTERFACE_H_ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> -#include <cimprovider.h> -#include <cimomhandle.h> -#include <cimlogsvc.h> -#include <cp_required.h> -#include <cim_objectpath.h> - -#include "libdiskmgt.h" - -#ifdef __cplusplus -} -#endif - -#endif /* _SOLARIS_MPXIOINTERFACE_H_ */ diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_MediaPresent.c b/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_MediaPresent.c deleted file mode 100644 index 125e289b9e..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_MediaPresent.c +++ /dev/null @@ -1,1065 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <unistd.h> -#include <netdb.h> -#include <errno.h> - -#include "util.h" -#include "cimKeys.h" -#include "providerNames.h" -#include "messageStrings.h" -#include "mediapresent_descriptors.h" -#include "drive_descriptors.h" -#include "logicaldisk_descriptors.h" -#include "Solaris_MediaPresent.h" - -#define MEDIA_GETINSTANCE "MEDIA_PRESENT,GET_INSTANCE" -#define MEDIA_ENUMINSTANCES "MEDIA_PRESENT,ENUM_INSTANCES" -#define MEDIA_ENUMINSTANCENAMES "MEDIA_PRESENT,ENUM_INSTANCENAMES" -#define MEDIA_CREATEINSTANCE "MEDIA_PRESENT,CREATE_INSTANCE" -#define MEDIA_DELETEINSTANCE "MEDIA_PRESENT,DELETE_INSTANCE" -#define MEDIA_SETINSTANCE "MEDIA_PRESENT,SET_INSTANCE" -#define MEDIA_GETPROPERTY "MEDIA_PRESENT,GET_PROPERTY" -#define MEDIA_SETPROPERTY "MEDIA_PRESENT,SET_PROPERTY" -#define MEDIA_INVOKEMETHOD "MEDIA_PRESENT,INVOKE_METHOD" -#define MEDIA_EXECQUERY "MEDIA_PRESENT,EXEC_QUERY" -#define MEDIA_ASSOCIATORS "MEDIA_PRESENT,ASSOCIATORS" -#define MEDIA_ASSOCIATORNAMES "MEDIA_PRESENT,ASSOCIATOR_NAMES" -#define MEDIA_REFERENCES "MEDIA_PRESENT,REFERENCES" -#define MEDIA_REFERENCENAMES "MEDIA_PRESENT,REFERENCE_NAMES" - - -static CCIMInstanceList *createMediaPresRefList( - CCIMObjectPath *pObjectName, cimchar *pObjectNameRole, - CCIMObjectPathList *objList, cimchar *objRole, int *error); - -static CCIMInstance *createMediaPresRefInst( - CCIMObjectPath *pObjectName, cimchar *pObjectNameRole, - CCIMObjectPath *objName, cimchar *objRole, int *error); -/* - * Solaris_MediaPresent provider - * - * It is important to note that all memory allocated by these functions - * and passed to the CIMOM, is freed by the door process prior to - * sending a copy of the data to the CIMOM. - */ - -/* - * Name: cp_getInstance_Solaris_MediaPresent - * - * Description: Returns an instance which matches the passed in object path - * if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ - -CCIMInstance* -cp_getInstance_Solaris_MediaPresent(CCIMObjectPath* pOP) -{ - CCIMInstance* inst = NULL; - CCIMPropertyList* pCurPropList; - CCIMObjectPath *antOp = NULL; - CCIMObjectPath *depOp = NULL; - dm_descriptor_t dd_descriptor; - dm_descriptor_t ld_descriptor; - char *name; - int error; - - if (pOP == NULL || - (pCurPropList = pOP->mKeyProperties) == NULL) { - util_handleError(MEDIA_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - - antOp = (CCIMObjectPath *)util_getKeyValue(pCurPropList, reference, - ANTECEDENT, &error); - - if (error == 0) { - depOp = (CCIMObjectPath *)util_getKeyValue(pCurPropList, reference, - DEPENDENT, &error); - } - /* - * Make sure we have both keys. If not, this is an error. - */ - - if (error != 0) { - util_handleError(MEDIA_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance*)NULL); - } - - /* - * Now, get the name of the antecedent from the object path. - */ - - if ((pCurPropList = antOp->mKeyProperties) == NULL || - (pCurPropList = depOp->mKeyProperties) == NULL) { - util_handleError(MEDIA_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - - /* - * both of the objects have the deviceid as the key value. - */ - pCurPropList = antOp->mKeyProperties; - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - if (error != 0) { - util_handleError(MEDIA_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - dd_descriptor = dm_get_descriptor_by_name(DM_DRIVE, name, &error); - /* - * Not found. Return a null instance. - */ - if (error == ENODEV || dd_descriptor) { - return ((CCIMInstance *)NULL); - } - - if (error != 0) { - util_handleError(MEDIA_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstance*)NULL); - } - - /* - * Only need the descriptor to verify the device still exists. - */ - dm_free_descriptor(dd_descriptor); - - /* - * Now, get the name of the dependent from the object path. - */ - - pCurPropList = depOp->mKeyProperties; - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - if (error != 0) { - util_handleError(MEDIA_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstance *)NULL); - } - - ld_descriptor = dm_get_descriptor_by_name(DM_MEDIA, name, &error); - /* - * Not found. Return a null instance. - */ - - if (error == ENODEV || ld_descriptor == NULL) { - return ((CCIMInstance *)NULL); - } - - if (error != 0) { - util_handleError(MEDIA_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstance *)NULL); - } - dm_free_descriptor(ld_descriptor); - - /* Turn these descriptors in to a media present instance */ - inst = createMediaPresRefInst(antOp, ANTECEDENT, depOp, DEPENDENT, - &error); - if (error != 0) { - util_handleError(MEDIA_GETINSTANCE, CIM_ERR_FAILED, - MEDIAPRES_ASSOC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstance *)NULL); - } - return (inst); -} - -/* - * Name: cp_enumInstances_Solaris_MediaPresent - * - * Description: Returns a linked list of instances of associated objects - * if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMInstanceList * if istances are found. Otherwise NULL, - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_enumInstances_Solaris_MediaPresent(CCIMObjectPath* pOP) -{ - CCIMInstanceList *instList = NULL; - CCIMInstance *inst; - CCIMException* ex; - dm_descriptor_t *dd_descriptorp = NULL; - dm_descriptor_t *ld_descriptorp = NULL; - int error = 0; - int filter[2]; - int i = 0; - int j = 0; - - filter[0] = DM_DT_FIXED; - filter[1] = DM_FILTER_END; - - if (pOP == NULL) { - util_handleError(MEDIA_ENUMINSTANCES, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - dd_descriptorp = dm_get_descriptors(DM_DRIVE, filter, &error); - if (dd_descriptorp == NULL) { - return ((CCIMInstanceList *)NULL); - } - - if (dd_descriptorp[0] == NULL) { - dm_free_descriptors(dd_descriptorp); - return ((CCIMInstanceList *)NULL); - } - - if (error != 0) { - util_handleError(MEDIA_ENUMINSTANCES, CIM_ERR_FAILED, - DM_GET_DESCRIPTORS, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* - * For each one of the drives found, get the associated media, if - * any. - */ - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(MEDIA_ENUMINSTANCES, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - dm_free_descriptors(dd_descriptorp); - return ((CCIMInstanceList *)NULL); - } - - for (i = 0; dd_descriptorp[i] != NULL; i ++) { - ld_descriptorp = dm_get_associated_descriptors( - dd_descriptorp[i], DM_MEDIA, &error); - - /* If no media associated with this disk, continue */ - - if (ld_descriptorp == NULL) { - continue; - } - - if (error != 0) { - util_handleError(MEDIA_ENUMINSTANCES, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, &error); - dm_free_descriptors(dd_descriptorp); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - for (j = 0; ld_descriptorp[j] != NULL; j ++) { - inst = mediapresent_descriptor_toCCIMInstance(hostName, - dd_descriptorp[i], ld_descriptorp[j], - MEDIA_PRESENT, &error); - if (error != 0) { - util_handleError(MEDIA_ENUMINSTANCES, CIM_ERR_FAILED, - MEDIAPRES_DESC_TO_INSTANCE_FAILURE, NULL, &error); - dm_free_descriptors(dd_descriptorp); - dm_free_descriptors(ld_descriptorp); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(MEDIA_ENUMINSTANCES, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, NULL); - dm_free_descriptors(dd_descriptorp); - dm_free_descriptors(ld_descriptorp); - return ((CCIMInstanceList *)NULL); - } - } - - dm_free_descriptors(ld_descriptorp); - } - dm_free_descriptors(dd_descriptorp); - - if (instList->mDataObject == NULL) { - cim_freeInstanceList(instList); - instList = NULL; - } - - return (instList); -} - -/* - * Name: cp_enumInstanceNames_Solaris_MediaPresent - * - * Description: Returns a linked list of CCIMObjectPath * - * of Solaris_MediaPresent if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMObjectPathList * if objects are found. Otherwise NULL. - */ - -CCIMObjectPathList* -cp_enumInstanceNames_Solaris_MediaPresent(CCIMObjectPath * pOP) { - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pOP == NULL) { - util_handleError(MEDIA_ENUMINSTANCENAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - /* - * Call in to enumInstances and then convert the instance list in - * to an object list. - */ - - instList = cp_enumInstances_Solaris_MediaPresent(pOP); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - return (objList); -} - -/* - * Creating an instance of a Solaris_MediaPresent is not supported. - */ - -/* ARGSUSED */ -CCIMObjectPath* -cp_createInstance_Solaris_MediaPresent( - CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - int error; - - util_handleError(MEDIA_CREATEINSTANCE, CIM_ERR_NOT_SUPPORTED, - NULL, NULL, &error); - return ((CCIMObjectPath *)NULL); -} - -/* - * Deleting an instance of a Solaris_MediaPresent is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_MediaPresent(CCIMObjectPath* pInst) -{ - int error; - - util_handleError(MEDIA_DELETEINSTANCE, CIM_ERR_NOT_SUPPORTED, - NULL, NULL, &error); - return (cim_false); -} - -/* - * Name: cp_getProperty_Solaris_MediaPresent - * - * Description: Returns the property requested, if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMProperty * if found. - */ - -/* ARGSUSED */ -CCIMProperty * -cp_getProperty_Solaris_MediaPresent(CCIMObjectPath *pOP, - char *pPropName) -{ - - CCIMProperty *prop = NULL; - CCIMInstance *inst = NULL; - int error = 0; - - if (pOP == NULL) { - util_handleError(MEDIA_GETPROPERTY, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMProperty *)NULL); - } - - inst = cp_getInstance_Solaris_MediaPresent(pOP); - if (inst == NULL) { - return ((CCIMProperty *)NULL); - } - - prop = cim_getProperty(inst, pPropName); - cim_freeInstance(inst); - return (prop); -} - -/* - * Setting an instance of a Solaris_MediaPresent is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_MediaPresent(CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - int error; - - util_handleError(MEDIA_SETINSTANCE, CIM_ERR_NOT_SUPPORTED, - NULL, NULL, &error); - return (cim_false); -} - -/* - * Setting a property on a Solaris_MediaPresent is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_MediaPresent(CCIMObjectPath* pOP, CCIMProperty* pProp) -{ - int error; - - util_handleError(MEDIA_SETPROPERTY, CIM_ERR_NOT_SUPPORTED, - NULL, NULL, &error); - return (cim_false); -} - -/* - * No Methods for Solaris_MediaPresent. - */ - -/* ARGSUSED */ -CCIMProperty* -cp_invokeMethod_Solaris_MediaPresent(CCIMObjectPath* op, cimchar* methodName, - CCIMPropertyList* inParams, CCIMPropertyList* outParams) -{ - CCIMProperty *retVal = (CCIMProperty *)NULL; - return (retVal); -} - -/* - * Name: cp_execQuery_Solaris_MediaPresent - * - * Description: - * Returns an instance list which matches the query if any are found. - * - * Parameters: - * CCIMObjectPath *op - An CCIMObjectPath * which contains the - * information on the class for which to find the instances. - * - * selectList - Not used - * nonJoinExp - Not used - * - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ -/* - * Currently, there is no WQL parser for the C providers. As a result, - * what is returned to the CIMOM is a list of instances with - * a NULL value at the beginning of the list. This NULL value indicates - * to the CIMOM that it must do the filtering for the client. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_execQuery_Solaris_MediaPresent(CCIMObjectPath *op, cimchar *selectList, - cimchar *nonJoinExp, cimchar *queryExp, int queryType) -{ - CCIMInstanceList *instList = NULL; - CCIMInstanceList *result; - CCIMInstance *emptyInst; - CCIMException *ex; - int error; - - if (op == NULL) { - util_handleError(MEDIA_EXECQUERY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = cp_enumInstances_Solaris_MediaPresent(op); - - if (instList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - /* - * Create a null instance and add it to the beginning - * of the list to indicate to the CIMOM that no filtering - * was done. - */ - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError(MEDIA_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - - result = cim_createInstanceList(); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(MEDIA_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_addInstance(result, emptyInst); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(MEDIA_EXECQUERY, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - /* - * Since copying the original list to the new list will - * leave no way to free the original list, manually - * concatenate the original list to the new one. - */ - - result->mNext = instList; - return (result); -} - -/* - * Name: cp_associators_Solaris_MediaPresent - * - * Description: - * Returns a instances of objects associated with the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pResultClass - If specified, only return instances that - * are of this class type. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * cimchar *pResultRole - If specified, only return instances that - * are playing this role in the association. - * - * - * Returns: - * CCIMInstanceList * if associated objects are found. - * NULL is returned on error and for an empty list. - */ -/* ARGSUSED */ -CCIMInstanceList * -cp_associators_Solaris_MediaPresent(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, cimchar *pResultClass, cimchar *pRole, - cimchar *pResultRole) -{ - CCIMPropertyList *pCurPropList; - CCIMInstanceList *instList = NULL; - CCIMInstance *inst; - CCIMException *ex; - dm_descriptor_t *assoc_descriptors; - dm_descriptor_t obj_desc; - char *name; - int error = 0; - int isAntecedent = 0; - int i; - - - if (pObjectName == NULL || pObjectName->mName == NULL || - pObjectName->mKeyProperties == NULL) { - util_handleError(MEDIA_ASSOCIATORS, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - if (strcasecmp(pObjectName->mName, DISK_DRIVE) == 0) { - isAntecedent = 1; - } - - if (pRole != NULL) { - if (strcasecmp(pRole, ANTECEDENT) == 0) { - if (isAntecedent != 1) { - util_handleError(MEDIA_ASSOCIATORS, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - } else if (strcasecmp(pRole, DEPENDENT) == 0) { - if (isAntecedent == 1) { - util_handleError(MEDIA_ASSOCIATORS, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - } - } - - /* - * Both logical disk and disk drive have deviceid as the - * key. - */ - - pCurPropList = pObjectName->mKeyProperties; - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - if (error != 0) { - util_handleError(MEDIA_ASSOCIATORS, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - if (isAntecedent) { - obj_desc = dm_get_descriptor_by_name(DM_DRIVE, name, &error); - } else { - obj_desc = dm_get_descriptor_by_name(DM_MEDIA, name, &error); - } - if (error == ENODEV || obj_desc == NULL) { - return ((CCIMInstanceList *)NULL); - } - if (error != 0) { - util_handleError(MEDIA_ASSOCIATORS, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - if (isAntecedent) { - - /* Get associated descriptors. */ - - assoc_descriptors = dm_get_associated_descriptors(obj_desc, - DM_MEDIA, &error); - dm_free_descriptor(obj_desc); - - if (assoc_descriptors == NULL) { - return ((CCIMInstanceList *)NULL); - } - - if (assoc_descriptors[0] == NULL) { - dm_free_descriptors(assoc_descriptors); - return ((CCIMInstanceList *)NULL); - } - - if (error != 0) { - util_handleError(MEDIA_ASSOCIATORS, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(MEDIA_ASSOCIATORS, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - dm_free_descriptors(assoc_descriptors); - return ((CCIMInstanceList *)NULL); - } - /* Traverse the list and create instances of associated objects. */ - - for (i = 0; assoc_descriptors[i] != NULL; i ++) { - inst = logicaldisk_descriptor_toCCIMInstance(hostName, - assoc_descriptors[i], LOGICAL_DISK, &error); - - if (error != 0) { - ex = cim_getLastError(); - util_handleError(MEDIA_ASSOCIATORS, CIM_ERR_FAILED, - LOGICALDISK_DESC_TO_INSTANCE_FAILURE, ex, &error); - dm_free_descriptors(assoc_descriptors); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(MEDIA_ASSOCIATORS, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - dm_free_descriptors(assoc_descriptors); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - } /* End for */ - } else { - /* - * This is the logical disk calling this function. Return the - * logical disk that this belongs to. - */ - - assoc_descriptors = dm_get_associated_descriptors(obj_desc, - DM_DRIVE, &error); - dm_free_descriptor(obj_desc); - - if (assoc_descriptors == NULL) { - return ((CCIMInstanceList *)NULL); - } - - if (assoc_descriptors[0] == NULL) { - dm_free_descriptors(assoc_descriptors); - return ((CCIMInstanceList *)NULL); - } - - if (error != 0) { - util_handleError(MEDIA_ASSOCIATORS, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(MEDIA_ASSOCIATORS, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - dm_free_descriptors(assoc_descriptors); - return ((CCIMInstanceList *)NULL); - } - for (i = 0; assoc_descriptors[i] != NULL; i ++) { - inst = drive_descriptor_toCCIMInstance(hostName, - assoc_descriptors[i], DISK_DRIVE, &error); - - if (error != 0) { - ex = cim_getLastError(); - util_handleError(MEDIA_ASSOCIATORS, CIM_ERR_FAILED, - DRIVE_DESC_TO_INSTANCE_FAILURE, ex, &error); - dm_free_descriptors(assoc_descriptors); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(MEDIA_ASSOCIATORS, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - dm_free_descriptors(assoc_descriptors); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - } /* End for */ - } - dm_free_descriptors(assoc_descriptors); - return (instList); -} - -/* - * Name: cp_associatorNames_Solaris_MediaPresent - * - * Description: - * Returns a list of objects associated with the passed in - * object if there are any via the object CCIMObjectPath. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pResultClass - If specified, only return instances that - * are of this class type. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * cimchar *pResultRole - If specified, only return instances that - * are playing this role in the association. - * - * - * Returns: - * CCIMObjectPathList * if associated objects are found. NULL otherwise. - */ - -/* ARGSUSED */ -CCIMObjectPathList * -cp_associatorNames_Solaris_MediaPresent(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, cimchar *pResultClass, cimchar *pRole, - cimchar *pResultRole) -{ - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pObjectName == NULL) { - util_handleError(MEDIA_ASSOCIATORNAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - instList = - cp_associators_Solaris_MediaPresent( - pAssocName, pObjectName, pResultClass, pRole, pResultRole); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Name: cp_references_Solaris_MediaPresent - * - * Description: - * Returns a instances of objects that have references to the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * Returns: - * CCIMObjectPathList * if associated objects are found. NULL otherwise. - */ - -/* ARGSUSED */ -CCIMInstanceList * -cp_references_Solaris_MediaPresent(CCIMObjectPath *pAssocName, -CCIMObjectPath *pObjectName, char *pRole) -{ - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pObjectName == NULL) { - util_handleError(MEDIA_REFERENCES, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - /* - * Get the list of those objects that are referred to by - * the calling object. - */ - - objList = - cp_associatorNames_Solaris_MediaPresent( - pAssocName, pObjectName, NULL, NULL, NULL); - /* - * Now generate the list of instances to return. - */ - - if (strcasecmp(pObjectName->mName, DISK_DRIVE) == 0) { - instList = createMediaPresRefList(pObjectName, - ANTECEDENT, objList, DEPENDENT, &error); - } else { - instList = createMediaPresRefList(pObjectName, - DEPENDENT, objList, ANTECEDENT, &error); - } - - cim_freeObjectPathList(objList); - return (instList); -} - -/* - * Name: cp_referenceNames_Solaris_MediaPresent - * - * Description: - * Returns a instances of objects that have references to the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * - * Returns: - * CCIMInstanceList * if associated objects are found. Thist list - * may be empty. NULL is returned on error. - * - */ -/* ARGSUSED */ -CCIMObjectPathList * -cp_referenceNames_Solaris_MediaPresent(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, cimchar *pRole) -{ - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pObjectName == NULL) { - util_handleError(MEDIA_REFERENCENAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - instList = - cp_references_Solaris_MediaPresent(pAssocName, pObjectName, pRole); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Create the association class with the passed in attributes. - */ -static -CCIMInstanceList * -createMediaPresRefList(CCIMObjectPath *pObjectName, cimchar *pObjectNameRole, - CCIMObjectPathList *objList, cimchar *objRole, int *error) -{ - - CCIMObjectPathList *tmpList; - CCIMInstanceList *instList = NULL; - CCIMInstance *inst; - CCIMObjectPath *obj1; - CCIMObjectPath *obj2; - CCIMException *ex; - - *error = 0; - - - /* - * If no objects associated with this one, return NULL. - */ - if (objList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(MEDIA_PRESENT, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, error); - return ((CCIMInstanceList *)NULL); - } - - tmpList = objList; - while (tmpList != NULL) { - obj1 = tmpList->mDataObject; - obj2 = cim_copyObjectPath(pObjectName); - if (obj2 == NULL) { - ex = cim_getLastError(); - util_handleError(MEDIA_PRESENT, CIM_ERR_FAILED, - COPY_OBJPATH_FAILURE, ex, error); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - inst = createMediaPresRefInst(obj2, pObjectNameRole, obj1, - objRole, error); - cim_freeObjectPath(obj2); - - if (*error != 0) { - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(MEDIA_PRESENT, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, NULL); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - - tmpList = tmpList->mNext; - } - return (instList); -} -static -CCIMInstance * -createMediaPresRefInst(CCIMObjectPath *obj2, - cimchar *pObjectNameRole, CCIMObjectPath *obj1, cimchar *objRole, - int *error) -{ - - CCIMInstance *inst = NULL; - CCIMException *ex; - - *error = 0; - - inst = cim_createInstance(MEDIA_PRESENT); - if (inst == NULL) { - ex = cim_getLastError(); - util_handleError(MEDIA_PRESENT, CIM_ERR_FAILED, NULL, NULL, error); - return ((CCIMInstance *)NULL); - } - util_doReferenceProperty(pObjectNameRole, obj2, cim_true, inst, error); - if (*error != 0) { - ex = cim_getLastError(); - util_handleError(MEDIA_PRESENT, CIM_ERR_FAILED, - CREATE_REFPROP_FAILURE, ex, error); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - util_doReferenceProperty(objRole, obj1, cim_true, inst, error); - if (*error != 0) { - ex = cim_getLastError(); - util_handleError(MEDIA_PRESENT, CIM_ERR_FAILED, - CREATE_REFPROP_FAILURE, ex, error); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - util_doProperty("FixedMedia", boolean, "1", cim_false, inst, error); - if (*error != 0) { - ex = cim_getLastError(); - util_handleError(MEDIA_PRESENT, CIM_ERR_FAILED, - CREATE_REFPROP_FAILURE, ex, error); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - return (inst); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_MediaPresent.h b/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_MediaPresent.h deleted file mode 100644 index f5bfe44bd7..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_MediaPresent.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOLARIS_DISKPARTITIONBASEDONDISK_H_ -#define _SOLARIS_DISKPARTITIONBASEDONDISK_H_ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> -#include <cimprovider.h> -#include <cimomhandle.h> -#include <cimlogsvc.h> -#include <cp_required.h> - -#include "libdiskmgt.h" - -#ifdef __cplusplus -} -#endif - -#endif /* _SOLARIS_DISKPARTITIONBASEDONDISK_H_ */ diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_RealizesDiskDrive.c b/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_RealizesDiskDrive.c deleted file mode 100644 index 0de1f8a2e9..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_RealizesDiskDrive.c +++ /dev/null @@ -1,1038 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <unistd.h> -#include <netdb.h> -#include <errno.h> - -#include "util.h" -#include "cimKeys.h" -#include "providerNames.h" -#include "messageStrings.h" -#include "disk_descriptors.h" -#include "realizesdiskdrive_descriptors.h" -#include "Solaris_RealizesDiskDrive.h" - -#define REALIZES_GETINSTANCE "REALIZES_DISKDRIVE,GET_INSTANCE" -#define REALIZES_ENUMINSTANCES "REALIZES_DISKDRIVE,ENUM_INSTANCES" -#define REALIZES_ENUMINSTANCENAMES \ - "REALIZES_BASEDONDISK,ENUM_INSTANCENAMES" -#define REALIZES_CREATEINSTANCE "REALIZES_DISKDRIVE,CREATE_INSTANCE" -#define REALIZES_DELETEINSTANCE "REALIZES_DISKDRIVE,DELETE_INSTANCE" -#define REALIZES_SETINSTANCE "REALIZES_DISKDRIVE,SET_INSTANCE" -#define REALIZES_SETPROPERTY "REALIZES_DISKDRIVE,SET_PROPERTY" -#define REALIZES_GETPROPERTY "REALIZES_DISKDRIVE,GET_PROPERTY" -#define REALIZES_INVOKEMETHOD "REALIZES_DISKDRIVE,INVOKE_METHOD" -#define REALIZES_EXECQUERY "REALIZES_DISKDRIVE,EXEC_QUERY" -#define REALIZES_ASSOCIATORS "REALIZES_DISKDRIVE,ASSOCIATORS" -#define REALIZES_ASSOCIATORNAMES "REALIZES_DISKDRIVE,ASSOCIATOR_NAMES" -#define REALIZES_REFERENCES "REALIZES_DISKDRIVE,REFERENCES" -#define REALIZES_REFERENCENAMES "REALIZES_DISKDRIVE,REFERENCE_NAMES" - - -static -CCIMInstanceList * -createRealizesDiskDriveList(CCIMObjectPath *pObjectName, - cimchar *pObjectNameRole, CCIMObjectPathList *objList, - cimchar *objRole, int *error); -/* - * Solaris_RealizesDiskDrive provider - * - * It is important to note that all memory allocated by these functions - * and passed to the CIMOM, is freed by the door process prior to - * sending a copy of the data to the CIMOM. - */ - -/* - * Name: cp_getInstance_Solaris_RealizesDiskDrive - * - * Description: Returns an instance of Solaris_RealizesDiskDrive if one - * is found that matches the object path passed in . - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: CCIMInstance * if match is found, or NULL if not. - * - */ - -/* ARGSUSED */ -CCIMInstance* -cp_getInstance_Solaris_RealizesDiskDrive(CCIMObjectPath* pOP) -{ - - CCIMInstance *inst = NULL; - CCIMPropertyList *pCurPropList; - CCIMObjectPath *antOp = NULL; - CCIMObjectPath *depOp = NULL; - dm_descriptor_t d_descriptor; - char *name; - int error; - - if (pOP == NULL || - (pCurPropList = pOP->mKeyProperties) == NULL) { - util_handleError(REALIZES_GETINSTANCE, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstance *)NULL); - } - - antOp = (CCIMObjectPath *)util_getKeyValue(pCurPropList, reference, - ANTECEDENT, &error); - - if (error == 0) { - depOp = (CCIMObjectPath *)util_getKeyValue(pCurPropList, reference, - DEPENDENT, &error); - } - - if (error != 0) { - util_handleError(REALIZES_GETINSTANCE, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstance *)NULL); - } - - /* - * In this provider, the antecedent has no provider, therefore - * we check the validity of this request based on a match - * from the device api to the dependent name. The dependent in - * this case is a disk drive. - */ - - if ((pCurPropList = depOp->mKeyProperties) == NULL) { - util_handleError(REALIZES_GETINSTANCE, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstance *)NULL); - } - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - if (error != 0) { - util_handleError(REALIZES_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstance *)NULL); - } - - d_descriptor = dm_get_descriptor_by_name(DM_DRIVE, name, - &error); - /* - * Not found. Return a null instance. - */ - - if (error == ENODEV || d_descriptor == NULL) { - return ((CCIMInstance *)NULL); - } - - if (error != 0) { - util_handleError(REALIZES_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstance *)NULL); - } - - /* - * Turn this in to a realizes diskdrive instance. - */ - - inst = realizesdiskdrive_descriptor_toCCIMInstance( - hostName, antOp, d_descriptor, REALIZES_DISKDRIVE, &error); - dm_free_descriptor(d_descriptor); - - if (error != 0) { - util_handleError(REALIZES_GETINSTANCE, CIM_ERR_FAILED, - REALIZESDD_DESC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstance *)NULL); - } - return (inst); -} - -/* - * Name: cp_enumInstances_Solaris_RealizesDiskDrive - * - * Description: Returns a linked list of instances of this association. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMInstanceList * if istances are found. NULL otherwise. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_enumInstances_Solaris_RealizesDiskDrive(CCIMObjectPath* pOP) -{ - CCIMInstanceList *instList = NULL; - CCIMObjectPathList *objList; - CCIMObjectPathList *tmpObjList; - CCIMPropertyList *pCurPropList; - CCIMObjectPath *objPath; - CCIMInstance *inst; - CCIMException *ex; - dm_descriptor_t d_descriptor; - int error = 0; - int filter[2]; - - filter[0] = DM_MT_FIXED; - filter[1] = DM_FILTER_END; - - /* - * First see if there are any physical package instances on this - * system. If none found, then we cannot enumerate instances of - * this association. We will return an empty list. - */ - - inst = cim_createInstance(PHYSICAL_PACKAGE); - if (inst == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_ENUMINSTANCES, CIM_ERR_FAILED, - CREATE_INSTANCE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - - objPath = cim_createObjectPath(inst); - cim_freeInstance(inst); - - if (objPath == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_ENUMINSTANCES, CIM_ERR_FAILED, - CREATE_OBJECT_PATH_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - objList = cimom_enumerateInstanceNames(objPath, cim_false); - cim_freeObjectPath(objPath); - - /* - * NULL means error. Empty list does not. - */ - if (objList == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_ENUMINSTANCES, CIM_ERR_FAILED, - ENUM_INSTANCENAMES_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - if (objList->mDataObject == NULL) { - return ((CCIMInstanceList *)NULL); - } - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_ENUMINSTANCES, CIM_ERR_FAILED, - CREATE_INSTANCE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - - for (tmpObjList = objList; tmpObjList->mDataObject != NULL; - tmpObjList = tmpObjList->mNext) { - /* - * Make sure there is a device associated with the instance of - * the physical package. - */ - - char *name = NULL; - - if ((pCurPropList = - ((CCIMObjectPath *)tmpObjList->mDataObject)->mKeyProperties) - == NULL) { - util_handleError(REALIZES_ENUMINSTANCES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - name = (cimchar *)util_getKeyValue(pCurPropList, string, TAG, - &error); - if (error != 0 || name == NULL) { - util_handleError(REALIZES_ENUMINSTANCES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(objList); - return ((CCIMInstanceList *)NULL); - } - - d_descriptor = dm_get_descriptor_by_name(DM_DRIVE, name, &error); - if (error == ENODEV || d_descriptor == NULL) { - continue; - } - - if (error != 0) { - util_handleError(REALIZES_ENUMINSTANCES, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(objList); - return ((CCIMInstanceList *)NULL); - } - inst = realizesdiskdrive_descriptor_toCCIMInstance(hostName, - tmpObjList->mDataObject, d_descriptor, - REALIZES_DISKDRIVE, &error); - dm_free_descriptor(d_descriptor); - - if (error != 0) { - util_handleError(REALIZES_ENUMINSTANCES, CIM_ERR_FAILED, - REALIZESDD_DESC_TO_INSTANCE_FAILURE, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(objList); - return ((CCIMInstanceList *)NULL); - } - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - util_handleError(REALIZES_ENUMINSTANCES, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, NULL, &error); - cim_freeObjectPathList(objList); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - } - - cim_freeObjectPathList(objList); - if (instList->mDataObject == NULL) { - cim_freeInstanceList(instList); - instList = NULL; - } - return (instList); -} - -/* - * Name: cp_enumInstanceNames_Solaris_RealizesDiskDrive - * - * Description: Returns a linked list of CCIMObjectPath * - * of Solaris_RealizesDiskDrive objects if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMObjectPathList * if objects are found. NULL Otherwise. - */ - -/* ARGSUSED */ -CCIMObjectPathList* -cp_enumInstanceNames_Solaris_RealizesDiskDrive(CCIMObjectPath * pOP) { - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - - if (pOP == NULL) { - util_handleError(REALIZES_ENUMINSTANCENAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - /* - * Call in to enumInstances and then convert the instance list in - * to an object list. - */ - - instList = cp_enumInstances_Solaris_RealizesDiskDrive(pOP); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Creating an instance of a Solaris_RealizesDiskDrive is not supported. - */ - -/* ARGSUSED */ -CCIMObjectPath* -cp_createInstance_Solaris_RealizesDiskDrive( - CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - int error; - - util_handleError(REALIZES_CREATEINSTANCE, - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &error); - return ((CCIMObjectPath *)NULL); -} - - -/* - * Deleting an instance of a Solaris_RealizesDiskDrive is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_RealizesDiskDrive(CCIMObjectPath* pInst) -{ - int error; - - util_handleError(REALIZES_DELETEINSTANCE, - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &error); - return (cim_false); -} - -/* - * Name: cp_getProperty_Solaris_RealizesDiskDrive - * - * Description: Returns the property requested, if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMProperty * if found. - */ - -/* ARGSUSED */ -CCIMProperty * -cp_getProperty_Solaris_RealizesDiskDrive(CCIMObjectPath *pOP, - char *pPropName) -{ - - CCIMProperty *prop = NULL; - CCIMInstance *inst = NULL; - int error = 0; - - if (pOP == NULL) { - util_handleError(REALIZES_GETPROPERTY, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMProperty *)NULL); - } - - inst = cp_getInstance_Solaris_RealizesDiskDrive(pOP); - if (inst == NULL) { - return ((CCIMProperty *)NULL); - } - - prop = cim_getProperty(inst, pPropName); - cim_freeInstance(inst); - return (prop); -} -/* - * Setting an instance of a Solaris_RealizesDiskDrive is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_RealizesDiskDrive( - CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - int error; - - util_handleError(REALIZES_SETINSTANCE, - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &error); - return (cim_false); -} - - -/* - * Setting a property on a Solaris_RealizesDiskDrive is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_RealizesDiskDrive( - CCIMObjectPath* pOP, CCIMProperty* pProp) -{ - int error; - - util_handleError(REALIZES_SETPROPERTY, - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &error); - return (cim_false); -} - -/* - * No Methods for Solaris_RealizesDiskDrive. - */ - -/* ARGSUSED */ -CCIMProperty* -cp_invokeMethod_Solaris_RealizesDiskDrive( - CCIMObjectPath* op, cimchar* methodName, - CCIMPropertyList* inParams, CCIMPropertyList* outParams) -{ - CCIMProperty *retVal = (CCIMProperty *)NULL; - return (retVal); -} - -/* - * Name: cp_execQuery_Solaris_RealizesDiskDrive - * - * Description: - * Returns an instance list which matches the query if any are found. - * - * Parameters: - * CCIMObjectPath *op - An CCIMObjectPath * which contains the - * information on the class for which to find the instances. - * - * selectList - Not used - * nonJoinExp - Not used - * - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ -/* - * Currently, there is no WQL parser for the C providers. As a result, - * what is returned to the CIMOM is a list of instances with - * a NULL value at the beginning of the list. This NULL value indicates - * to the CIMOM that it must do the filtering for the client. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_execQuery_Solaris_RealizesDiskDrive( - CCIMObjectPath *op, cimchar *selectList, cimchar *nonJoinExp, - cimchar *queryExp, int queryType) -{ - CCIMInstanceList *instList = NULL; - CCIMInstanceList *result; - CCIMInstance *emptyInst; - CCIMException *ex; - int error; - - if (op == NULL) { - util_handleError(REALIZES_EXECQUERY, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = cp_enumInstances_Solaris_RealizesDiskDrive(op); - - if (instList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - /* - * Create a null instance and add it to the beginning - * of the list to indicate to the CIMOM that no filtering - * was done. - */ - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - - result = cim_createInstanceList(); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_addInstance(result, emptyInst); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_EXECQUERY, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - /* - * Since copying the original list to the new list will - * leave no way to free the original list, manually - * concatenate the original list to the new one. - */ - - result->mNext = instList; - return (result); -} - -/* - * Name: cp_associators_Solaris_RealizesDiskDrive - * - * Description: - * Returns a instances of objects associated with the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pResultClass - If specified, only return instances that - * are of this class type. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * cimchar *pResultRole - If specified, only return instances that - * are playing this role in the association. - * - * - * Returns: - * CCIMInstanceList * if associated objects are found. NULL Otherwise. - */ - -/* ARGSUSED */ -CCIMInstanceList * -cp_associators_Solaris_RealizesDiskDrive(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, cimchar *pResultClass, cimchar *pRole, - cimchar *pResultRole) -{ - CCIMPropertyList *pCurPropList; - CCIMInstanceList *instList = NULL; - CCIMInstance *inst = NULL; - CCIMException *ex; - dm_descriptor_t obj_desc; - char *name; - int error = 0; - int isAntecedent = 0; - - if (pObjectName == NULL || - pObjectName->mName == NULL || - pObjectName->mKeyProperties == NULL) { - util_handleError(REALIZES_ASSOCIATORS, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - if (strcasecmp(pObjectName->mName, PHYSICAL_PACKAGE) == 0) { - isAntecedent = 1; - } - - if (pRole != NULL) { - if (strcasecmp(pRole, ANTECEDENT) == 0) { - if (isAntecedent != 1) { - util_handleError(REALIZES_ASSOCIATORS, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - } - } - - pCurPropList = pObjectName->mKeyProperties; - /* - * Get the key. It will either be deviceid or tag. These are - * mutually exclusive. - */ - if (isAntecedent) { - name = (cimchar *)util_getKeyValue(pCurPropList, string, TAG, - &error); - } else { - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - } - - /* - * We went through the whole list and didn't find the necessary - * key value. - */ - - if (error != 0) { - util_handleError(REALIZES_ASSOCIATORS, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - obj_desc = dm_get_descriptor_by_name(DM_DRIVE, name, &error); - /* - * No device found. - */ - if (error == ENODEV || obj_desc == NULL) { - return ((CCIMInstanceList *)NULL); - - } - if (error != 0) { - util_handleError(REALIZES_ASSOCIATORS, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - if (isAntecedent == 1) { - /* - * Physical package calling this method, return instances of the - * disk drive associated with this physical package. - */ - - inst = disk_descriptor_toCCIMInstance(hostName, obj_desc, DISK, - &error); - dm_free_descriptor(obj_desc); - - if (error != 0) { - ex = cim_getLastError(); - util_handleError(REALIZES_ASSOCIATORS, CIM_ERR_FAILED, - DISK_DESC_TO_INSTANCE_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_ASSOCIATORS, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - instList = cim_addInstance(instList, inst); - - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_ASSOCIATORS, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - } else { - /* - * This is the disk calling this function. Return the physical - * package instances, if any, that are found on this system. - * Turn the object descriptor in to a CCIMObjectPath. Then, ask - * the CIMOM for any instances of this. - */ - - CCIMObjectPath *ob; - CCIMInstance *in = - cim_createInstance(PHYSICAL_PACKAGE); - - if (in == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_ASSOCIATORS, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - - util_doProperty( - DEVICEID, string, name, cim_true, inst, &error); - - ob = cim_createObjectPath(in); - cim_freeInstance(in); - - if (ob == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_ASSOCIATORS, CIM_ERR_FAILED, - CREATE_OBJECT_PATH_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - - inst = cimom_getInstance(ob, cim_false, cim_false, - cim_false, cim_false, NULL, 0); - cim_freeObjectPath(ob); - - /* - * NULL indicates error. Empty object does not. - */ - if (inst == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_ASSOCIATORS, CIM_ERR_FAILED, - GET_INSTANCE_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - - if (inst->mProperties == NULL) { - return ((CCIMInstanceList *)NULL); - } - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_ASSOCIATORS, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - instList = cim_addInstance(instList, inst); - - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_ASSOCIATORS, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - } - - return (instList); -} - -/* - * Name: cp_associatorNames_Solaris_RealizesDiskDrive - * - * Description: - * Returns a list of objects associated with the passed in - * object if there are any via the object CCIMObjectPath. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pResultClass - If specified, only return instances that - * are of this class type. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * cimchar *pResultRole - If specified, only return instances that - * are playing this role in the association. - * - * - * Returns: - * CCIMObjectPathList * if associated objects are found. NULL otherwise. - */ - -/* ARGSUSED */ -CCIMObjectPathList * -cp_associatorNames_Solaris_RealizesDiskDrive(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, cimchar *pResultClass, cimchar *pRole, - cimchar *pResultRole) -{ - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - - if (pObjectName == NULL) { - util_handleError(REALIZES_ASSOCIATORNAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - instList = - cp_associators_Solaris_RealizesDiskDrive( - pAssocName, pObjectName, pResultClass, pRole, pResultRole); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Name: cp_references_Solaris_RealizesDiskDrive - * - * Description: - * Returns a instances of objects that have references to the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * Returns: - * CCIMInstanceList * if associated objects are found. NULL otherwise. - */ - -/* ARGSUSED */ -CCIMInstanceList * -cp_references_Solaris_RealizesDiskDrive(CCIMObjectPath *pAssocName, -CCIMObjectPath *pObjectName, char *pRole) -{ - - CCIMInstanceList *instList = NULL; - CCIMObjectPathList *objList; - int error; - - if (pObjectName == NULL) { - util_handleError(REALIZES_REFERENCES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - /* - * Get the list of those objects that are referred to by - * the calling object. - */ - - objList = - cp_associatorNames_Solaris_RealizesDiskDrive( - pAssocName, pObjectName, NULL, NULL, NULL); - - if (objList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - /* - * Now generate the list of instances to return. - */ - - if ((strcasecmp(pObjectName->mName, PHYSICAL_PACKAGE)) == 0) { - instList = createRealizesDiskDriveList(pObjectName, ANTECEDENT, - objList, DEPENDENT, &error); - } else { - instList = createRealizesDiskDriveList(pObjectName, DEPENDENT, - objList, ANTECEDENT, &error); - } - - cim_freeObjectPathList(objList); - return (instList); -} - -/* - * Name: cp_referenceNames_Solaris_RealizesDiskDrive - * - * Description: - * Returns a instances of objects that have references to the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * - * Returns: - * CCIMInstanceList * if associated objects are found. NULL otherwise. - * - */ -/* ARGSUSED */ -CCIMObjectPathList * -cp_referenceNames_Solaris_RealizesDiskDrive(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, cimchar *pRole) -{ - - CCIMInstanceList *instList = NULL; - CCIMObjectPathList *objList = NULL; - int error; - - if (pObjectName == NULL) { - util_handleError(REALIZES_REFERENCENAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - instList = - cp_references_Solaris_RealizesDiskDrive(pAssocName, - pObjectName, pRole); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Create the association class with the passed in attributes. - */ -static -CCIMInstanceList * -createRealizesDiskDriveList(CCIMObjectPath *pObjectName, - cimchar *pObjectNameRole, CCIMObjectPathList *objList, - cimchar *objRole, int *error) -{ - - CCIMObjectPathList *tmpList; - CCIMInstanceList *instList = NULL; - CCIMInstance *inst; - CCIMObjectPath *obj1; - CCIMObjectPath *obj2; - CCIMException *ex; - - *error = 0; - - /* - * If no objects associated with this one, return NULL. - */ - if (objList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_DISKDRIVE, - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, error); - return ((CCIMInstanceList *)NULL); - } - - tmpList = objList; - while (tmpList != NULL) { - obj1 = tmpList->mDataObject; - obj2 = cim_copyObjectPath(pObjectName); - if (obj2 == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_DISKDRIVE, CIM_ERR_FAILED, - COPY_OBJPATH_FAILURE, ex, error); - return ((CCIMInstanceList *)NULL); - } - - inst = cim_createInstance(REALIZES_DISKDRIVE); - if (inst == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_DISKDRIVE, - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, error); - return ((CCIMInstanceList *)NULL); - } - - util_doReferenceProperty(pObjectNameRole, obj2, cim_true, - inst, error); - cim_freeObjectPath(obj2); - - if (*error != 0) { - ex = cim_getLastError(); - util_handleError(REALIZES_DISKDRIVE, - CIM_ERR_FAILED, ADD_PROPERTY_FAILURE, ex, error); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - - util_doReferenceProperty(objRole, obj1, cim_true, inst, error); - - if (*error != 0) { - ex = cim_getLastError(); - util_handleError(REALIZES_DISKDRIVE, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, error); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_DISKDRIVE, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, error); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - - tmpList = tmpList->mNext; - } - return (instList); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_RealizesDiskDrive.h b/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_RealizesDiskDrive.h deleted file mode 100644 index 0642d75dc0..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_RealizesDiskDrive.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOLARIS_REALIZESDISKDRIVE_H_ -#define _SOLARIS_REALIZESDISKDRIVE_H_ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> -#include <cimprovider.h> -#include <cimomhandle.h> -#include <cimlogsvc.h> -#include <cp_required.h> - -#include "libdiskmgt.h" - -#ifdef __cplusplus -} -#endif - -#endif /* _SOLARIS_REALIZESDISKDRIVE_H_ */ diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_RealizesExtent.c b/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_RealizesExtent.c deleted file mode 100644 index 74023034c9..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_RealizesExtent.c +++ /dev/null @@ -1,942 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <unistd.h> -#include <netdb.h> -#include <errno.h> - -#include "util.h" -#include "cimKeys.h" -#include "providerNames.h" -#include "messageStrings.h" -#include "disk_descriptors.h" -#include "logicaldisk_descriptors.h" -#include "realizesextent_descriptors.h" -#include "Solaris_RealizesExtent.h" - -#define REALIZES_GETINSTANCE "REALIZES_EXTENT,GET_INSTANCE" -#define REALIZES_ENUMINSTANCES "REALIZES_EXTENT,ENUM_INSTANCES" -#define REALIZES_ENUMINSTANCENAMES \ - "REALIZES_EXTENT,ENUM_INSTANCENAMES" -#define REALIZES_CREATEINSTANCE "REALIZES_EXTENT,CREATE_INSTANCE" -#define REALIZES_DELETEINSTANCE "REALIZES_EXTENT,DELETE_INSTANCE" -#define REALIZES_SETINSTANCE "REALIZES_EXTENT,SET_INSTANCE" -#define REALIZES_SETPROPERTY "REALIZES_EXTENT,SET_PROPERTY" -#define REALIZES_GETPROPERTY "REALIZES_EXTENT,GET_PROPERTY" -#define REALIZES_INVOKEMETHOD "REALIZES_EXTENT,INVOKE_METHOD" -#define REALIZES_EXECQUERY "REALIZES_EXTENT,EXEC_QUERY" -#define REALIZES_ASSOCIATORS "REALIZES_EXTENT,ASSOCIATORS" -#define REALIZES_ASSOCIATORNAMES "REALIZES_EXTENT,ASSOCIATOR_NAMES" -#define REALIZES_REFERENCES "REALIZES_EXTENT,REFERENCES" -#define REALIZES_REFERENCENAMES "REALIZES_EXTENT,REFERENCE_NAMES" - -static -CCIMInstanceList * -createRealizesExtentList(CCIMObjectPath *pObjectName, - cimchar *pObjectNameRole, - CCIMObjectPathList *objList, cimchar *objRole, int *error); -/* - * Solaris_RealizesExtent provider - * - * It is important to note that all memory allocated by these functions - * and passed to the CIMOM, is freed by the door process prior to - * sending a copy of the data to the CIMOM. - */ - -/* - * Name: cp_getInstance_Solaris_RealizesExtent - * - * Description: Returns an instance of Solaris_RealizesExtent if one - * is found that matches the object path passed in . - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: CCIMInstance * if match is found, or NULL if not. - * - */ - -CCIMInstance* -cp_getInstance_Solaris_RealizesExtent(CCIMObjectPath* pOP) -{ - - CCIMInstance *inst = NULL; - CCIMPropertyList *pCurPropList; - CCIMObjectPath *antOp = NULL; - CCIMObjectPath *depOp = NULL; - dm_descriptor_t d_descriptor; - char *name; - int error; - - - if (pOP == NULL || pOP->mKeyProperties == NULL) { - util_handleError(REALIZES_GETINSTANCE, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - } - - pCurPropList = pOP->mKeyProperties; - antOp = (CCIMObjectPath *)util_getKeyValue(pCurPropList, reference, - ANTECEDENT, &error); - - if (error == 0) { - depOp = (CCIMObjectPath *)util_getKeyValue(pCurPropList, reference, - DEPENDENT, &error); - } - - /* - * Make sure we have both keys. If not, this is an error. - */ - - if (error != 0) { - util_handleError(REALIZES_GETINSTANCE, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstance *)NULL); - } - - /* - * Now get the name of the antecedent from the object path. - */ - - if (antOp->mKeyProperties == NULL || - depOp->mKeyProperties == NULL) { - util_handleError(REALIZES_GETINSTANCE, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstance *)NULL); - } - - pCurPropList = antOp->mKeyProperties; - name = (cimchar *)util_getKeyValue(pCurPropList, string, TAG, &error); - - if (error != 0 || name == NULL) { - util_handleError(REALIZES_GETINSTANCE, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstance *)NULL); - } - - d_descriptor = dm_get_descriptor_by_name(DM_MEDIA, name, &error); - - /* - * Not found. Return a null instance. - */ - - if (error == ENODEV || d_descriptor == NULL) { - return ((CCIMInstance *)NULL); - } - - if (error != 0) { - util_handleError(REALIZES_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstance *)NULL); - } - - /* - * Turn this in to a realizes extent instance. - */ - - inst = realizesextent_descriptor_toCCIMInstance(hostName, d_descriptor, - REALIZES_EXTENT, &error); - dm_free_descriptor(d_descriptor); - - if (error != 0) { - util_handleError(REALIZES_GETINSTANCE, CIM_ERR_FAILED, - REALIZESEXT_DESC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstance *)NULL); - } - - return (inst); -} - -/* - * Name: cp_enumInstances_Solaris_RealizesExtent - * - * Description: Returns a linked list of instances of this association. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMInstanceList * if istances are found. NULL otherwise. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_enumInstances_Solaris_RealizesExtent(CCIMObjectPath* pOP) -{ - CCIMInstanceList* instList = NULL; - CCIMInstance* inst; - CCIMException* ex; - dm_descriptor_t *disk_descriptorp = NULL; - int error = 0; - int filter[2]; - int i = 0; - - filter[0] = DM_MT_FIXED; - filter[1] = DM_FILTER_END; - - - disk_descriptorp = dm_get_descriptors(DM_MEDIA, filter, &error); - if (disk_descriptorp == NULL || - disk_descriptorp[0] == NULL) { - return ((CCIMInstanceList *)NULL); - } - if (error != 0) { - util_handleError(REALIZES_ENUMINSTANCES, CIM_ERR_FAILED, - DM_GET_DESCRIPTORS, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* - * For each one of the disks found, generate the physical and - * logical views and create an association instance. - */ - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_ENUMINSTANCES, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - dm_free_descriptors(disk_descriptorp); - return ((CCIMInstanceList *)NULL); - } - - for (i = 0; disk_descriptorp[i] != NULL; i ++) { - inst = realizesextent_descriptor_toCCIMInstance(hostName, - disk_descriptorp[i], REALIZES_EXTENT, &error); - if (error != 0) { - util_handleError(REALIZES_ENUMINSTANCES, CIM_ERR_FAILED, - REALIZESEXT_DESC_TO_INSTANCE_FAILURE, NULL, &error); - cim_freeInstanceList(instList); - dm_free_descriptors(disk_descriptorp); - return ((CCIMInstanceList *)NULL); - } - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - util_handleError(REALIZES_ENUMINSTANCES, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, NULL, &error); - dm_free_descriptors(disk_descriptorp); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - } - - dm_free_descriptors(disk_descriptorp); - if (instList->mDataObject == NULL) { - cim_freeInstanceList(instList); - instList = NULL; - } - return (instList); -} - -/* - * Name: cp_enumInstanceNames_Solaris_RealizesExtent - * - * Description: Returns a linked list of CCIMObjectPath * - * of Solaris_RealizesExtent objects if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMObjectPathList * if objects are found. NULL otherwise. - */ - -/* ARGSUSED */ -CCIMObjectPathList* -cp_enumInstanceNames_Solaris_RealizesExtent(CCIMObjectPath * pOP) { - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pOP == NULL) { - util_handleError(REALIZES_ENUMINSTANCENAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - /* - * Call in to enumInstances and then convert the instance list in - * to an object list. - */ - - instList = cp_enumInstances_Solaris_RealizesExtent(pOP); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Creating an instance of a Solaris_RealizesExtent is not supported. - */ - -/* ARGSUSED */ -CCIMObjectPath* -cp_createInstance_Solaris_RealizesExtent( - CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - int error; - - util_handleError(REALIZES_CREATEINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return ((CCIMObjectPath *)NULL); -} - - -/* - * Deleting an instance of a Solaris_RealizesExtent is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_RealizesExtent(CCIMObjectPath* pInst) -{ - int error; - - util_handleError(REALIZES_DELETEINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - -/* - * Name: cp_getProperty_Solaris_RealizesExtent - * - * Description: Returns the property requested, if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMProperty * if found. - */ - -/* ARGSUSED */ -CCIMProperty * -cp_getProperty_Solaris_RealizesExtent(CCIMObjectPath *pOP, - char *pPropName) -{ - - CCIMProperty *prop = NULL; - CCIMInstance *inst = NULL; - int error = 0; - - if (pOP == NULL) { - util_handleError(REALIZES_GETPROPERTY, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMProperty *)NULL); - } - - inst = cp_getInstance_Solaris_RealizesExtent(pOP); - if (inst == NULL) { - return ((CCIMProperty *)NULL); - } - - prop = cim_getProperty(inst, pPropName); - cim_freeInstance(inst); - return (prop); -} - -/* - * Setting an instance of a Solaris_RealizesExtent is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_RealizesExtent( - CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - int error; - - util_handleError(REALIZES_SETINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - - -/* - * Setting a property on a Solaris_RealizesExtent is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_RealizesExtent( - CCIMObjectPath* pOP, CCIMProperty* pProp) -{ - int error; - - util_handleError(REALIZES_SETPROPERTY, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - -/* - * No Methods for Solaris_RealizesExtent. - */ - -/* ARGSUSED */ -CCIMProperty* -cp_invokeMethod_Solaris_RealizesExtent( - CCIMObjectPath* op, cimchar* methodName, - CCIMPropertyList* inParams, CCIMPropertyList* outParams) -{ - CCIMProperty *retVal = (CCIMProperty *)NULL; - return (retVal); -} - -/* - * Name: cp_execQuery_Solaris_RealizesExtent - * - * Description: - * Returns an instance list which matches the query if any are found. - * - * Parameters: - * CCIMObjectPath *op - An CCIMObjectPath * which contains the - * information on the class for which to find the instances. - * - * selectList - Not used - * nonJoinExp - Not used - * - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ -/* - * Currently, there is no WQL parser for the C providers. As a result, - * what is returned to the CIMOM is a list of instances with - * a NULL value at the beginning of the list. This NULL value indicates - * to the CIMOM that it must do the filtering for the client. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_execQuery_Solaris_RealizesExtent( - CCIMObjectPath *op, cimchar *selectList, cimchar *nonJoinExp, - cimchar *queryExp, int queryType) -{ - CCIMInstanceList *instList = NULL; - CCIMInstanceList *result; - CCIMInstance *emptyInst; - CCIMException *ex; - int error; - - if (op == NULL) { - util_handleError(REALIZES_EXECQUERY, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = cp_enumInstances_Solaris_RealizesExtent(op); - - if (instList == NULL) { - return ((CCIMInstanceList *)NULL); - } - /* - * Create a null instance and add it to the beginning - * of the list to indicate to the CIMOM that no filtering - * was done. - */ - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - - result = cim_createInstanceList(); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_addInstance(result, emptyInst); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_EXECQUERY, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - /* - * Since copying the original list to the new list will - * leave no way to free the original list, manually - * concatenate the original list to the new one. - */ - - result->mNext = instList; - return (result); -} - -/* - * Name: cp_associators_Solaris_RealizesExtent - * - * Description: - * Returns a instances of objects associated with the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pResultClass - If specified, only return instances that - * are of this class type. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * cimchar *pResultRole - If specified, only return instances that - * are playing this role in the association. - * - * - * Returns: - * CCIMInstanceList * if associated objects are found. NULL otherwise. - */ - -/* ARGSUSED */ -CCIMInstanceList * -cp_associators_Solaris_RealizesExtent(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, cimchar *pResultClass, cimchar *pRole, - cimchar *pResultRole) -{ - CCIMPropertyList *pCurPropList; - CCIMInstanceList *instList = NULL; - CCIMInstance *inst; - CCIMException *ex; - dm_descriptor_t obj_desc; - char *name; - int error = 0; - int isAntecedent = 0; - - - if (pObjectName == NULL || - pObjectName->mName == NULL || - pObjectName->mKeyProperties == NULL) { - util_handleError(REALIZES_ASSOCIATORS, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - } - - if (strcasecmp(pObjectName->mName, DISK) == 0) { - isAntecedent = 1; - } - - if (pRole != NULL) { - if (strcasecmp(pRole, ANTECEDENT) == 0) { - if (isAntecedent != 1) { - util_handleError(REALIZES_ASSOCIATORS, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - } - } - - pCurPropList = pObjectName->mKeyProperties; - - /* - * Get the key. It will either be deviceid or tag. These are - * mutually exclusive. - */ - - if (isAntecedent) { - name = (cimchar *)util_getKeyValue(pCurPropList, string, TAG, - &error); - } else { - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - } - - /* - * We went through the whole list and didn't find the necessary - * key value. - */ - - if (error != 0 || name == NULL) { - util_handleError(REALIZES_ASSOCIATORS, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - obj_desc = dm_get_descriptor_by_name(DM_MEDIA, name, &error); - /* - * No device found. - */ - if (error == ENODEV || obj_desc == NULL) { - return (instList); - } - - if (error != 0) { - util_handleError(REALIZES_ASSOCIATORS, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - if (isAntecedent == 1) { - /* - * Physical disk calling this method, return instances of the - * logical disk associated with this disk. - */ - - inst = logicaldisk_descriptor_toCCIMInstance(hostName, - obj_desc, LOGICAL_DISK, &error); - dm_free_descriptor(obj_desc); - - if (error != 0) { - util_handleError(REALIZES_ASSOCIATORS, CIM_ERR_FAILED, - LOGICALDISK_DESC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_ASSOCIATORS, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_ASSOCIATORS, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - } else { - /* - * This is the logical disk calling this function. Return the - * disk that this belongs to. - */ - - inst = disk_descriptor_toCCIMInstance(hostName, obj_desc, - DISK, &error); - dm_free_descriptor(obj_desc); - - if (error != 0) { - util_handleError(REALIZES_ASSOCIATORS, CIM_ERR_FAILED, - DISK_DESC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_ASSOCIATORS, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, &error); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_ASSOCIATORS, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - } - - return (instList); -} - -/* - * Name: cp_associatorNames_Solaris_RealizesExtent - * - * Description: - * Returns a list of objects associated with the passed in - * object if there are any via the object CCIMObjectPath. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pResultClass - If specified, only return instances that - * are of this class type. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * cimchar *pResultRole - If specified, only return instances that - * are playing this role in the association. - * - * - * Returns: - * CCIMObjectPathList * if associated objects are found. NULL otherwise. - */ - -/* ARGSUSED */ -CCIMObjectPathList * -cp_associatorNames_Solaris_RealizesExtent(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, cimchar *pResultClass, cimchar *pRole, - cimchar *pResultRole) -{ - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - - if (pObjectName == NULL) { - util_handleError(REALIZES_ASSOCIATORNAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - instList = - cp_associators_Solaris_RealizesExtent( - pAssocName, pObjectName, pResultClass, pRole, pResultRole); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Name: cp_references_Solaris_RealizesExtent - * - * Description: - * Returns a instances of objects that have references to the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * Returns: - * CCIMObjectPathList * if associated objects are found. NULL otherwise. - */ - -/* ARGSUSED */ -CCIMInstanceList * -cp_references_Solaris_RealizesExtent(CCIMObjectPath *pAssocName, -CCIMObjectPath *pObjectName, char *pRole) -{ - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - - if (pObjectName == NULL) { - util_handleError(REALIZES_REFERENCES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - /* - * Get the list of those objects that are referred to by - * the calling object. - */ - - objList = - cp_associatorNames_Solaris_RealizesExtent( - pAssocName, pObjectName, NULL, NULL, NULL); - - if (objList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - /* - * Now generate the list of instances to return. - */ - - if (strcasecmp(pObjectName->mName, DISK) == 0) { - instList = createRealizesExtentList(pObjectName, - ANTECEDENT, objList, DEPENDENT, &error); - } else { - instList = createRealizesExtentList(pObjectName, - DEPENDENT, objList, ANTECEDENT, &error); - } - - cim_freeObjectPathList(objList); - return (instList); -} - -/* - * Name: cp_referenceNames_Solaris_RealizesExtent - * - * Description: - * Returns a instances of objects that have references to the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * - * Returns: - * CCIMObjectPathList * if associated objects are found. NULL otherwise. - * - */ - -/* ARGSUSED */ -CCIMObjectPathList * -cp_referenceNames_Solaris_RealizesExtent(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, cimchar *pRole) -{ - - CCIMInstanceList *instList = NULL; - CCIMObjectPathList *objList = NULL; - int error; - - if (pObjectName == NULL) { - util_handleError(REALIZES_REFERENCENAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - instList = - cp_references_Solaris_RealizesExtent(pAssocName, - pObjectName, pRole); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Create the association class with the passed in attributes. - */ -static -CCIMInstanceList * -createRealizesExtentList(CCIMObjectPath *pObjectName, - cimchar *pObjectNameRole, - CCIMObjectPathList *objList, cimchar *objRole, int *error) -{ - - CCIMObjectPathList *tmpList; - CCIMInstanceList *instList = NULL; - CCIMInstance *inst; - CCIMObjectPath *obj1; - CCIMObjectPath *obj2; - CCIMException *ex; - - *error = 0; - - /* - * If no objects associated with this one, return NULL. - */ - if (objList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_EXTENT, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, error); - return ((CCIMInstanceList *)NULL); - } - - tmpList = objList; - while (tmpList != NULL) { - obj1 = tmpList->mDataObject; - obj2 = cim_copyObjectPath(pObjectName); - if (obj2 == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_EXTENT, CIM_ERR_FAILED, - COPY_OBJPATH_FAILURE, ex, error); - return ((CCIMInstanceList *)NULL); - } - - inst = cim_createInstance(REALIZES_EXTENT); - if (inst == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_EXTENT, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, error); - return ((CCIMInstanceList *)NULL); - } - - util_doReferenceProperty(pObjectNameRole, obj2, cim_true, inst, - error); - cim_freeObjectPath(obj2); - - if (*error != 0) { - ex = cim_getLastError(); - util_handleError(REALIZES_EXTENT, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, error); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - - util_doReferenceProperty(objRole, obj1, cim_true, inst, error); - - if (*error != 0) { - ex = cim_getLastError(); - util_handleError(REALIZES_EXTENT, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, error); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZES_EXTENT, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, error); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - - tmpList = tmpList->mNext; - } - return (instList); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_RealizesExtent.h b/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_RealizesExtent.h deleted file mode 100644 index f9a1b729bd..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_RealizesExtent.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOLARIS_REALIZESEXTENT_H_ -#define _SOLARIS_REALIZESEXTENT_H_ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> -#include <cimprovider.h> -#include <cimomhandle.h> -#include <cimlogsvc.h> -#include <cp_required.h> - -#include "libdiskmgt.h" - -#ifdef __cplusplus -} -#endif - -#endif /* _SOLARIS_REALIZESEXTENT_H_ */ diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_SCSIInterface.c b/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_SCSIInterface.c deleted file mode 100644 index 7673484a8c..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_SCSIInterface.c +++ /dev/null @@ -1,1152 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <unistd.h> -#include <netdb.h> -#include <errno.h> - -#include "util.h" -#include "cimKeys.h" -#include "providerNames.h" -#include "messageStrings.h" -#include "drive_descriptors.h" -#include "ctrl_descriptors.h" -#include "Solaris_SCSIInterface.h" - -#define SCSI_GETINSTANCE "SCSI_INTERFACE,GET_INSTANCE" -#define SCSI_ENUMINSTANCES "SCSI_INTERFACE,ENUM_INSTANCES" -#define SCSI_ENUMINSTANCENAMES "SCSI_INTERFACE,ENUM_INSTANCENAMES" -#define SCSI_CREATEINSTANCE "SCSI_INTERFACE,CREATE_INSTANCE" -#define SCSI_DELETEINSTANCE "SCSI_INTERFACE,DELETE_INSTANCE" -#define SCSI_SETINSTANCE "SCSI_INTERFACE,SET_INSTANCE" -#define SCSI_GETPROPERTY "SCSI_INTERFACE,GET_PROPERTY" -#define SCSI_SETPROPERTY "SCSI_INTERFACE,SET_PROPERTY" -#define SCSI_INVOKEMETHOD "SCSI_INTERFACE,INVOKE_METHOD" -#define SCSI_EXECQUERY "SCSI_INTERFACE,EXEC_QUERY" -#define SCSI_ASSOCIATORS "SCSI_INTERFACE,ASSOCIATORS" -#define SCSI_ASSOCIATORNAMES "SCSI_INTERFACE,ASSOCIATOR_NAMES" -#define SCSI_REFERENCES "SCSI_INTERFACE,REFERENCES" -#define SCSI_REFERENCENAMES "SCSI_INTERFACE,REFERENCE_NAMES" - -static -CCIMInstanceList * -scsiIntAssocToInstList(CCIMObjectPath *pObjectName, cimchar *pObjectNameRole, - CCIMObjectPathList *objList, cimchar *objRole, int *error); - -static -CCIMInstance * -scsiIntAssocToInst(CCIMObjectPath *obj1, cimchar *obj1Role, - CCIMObjectPath *obj2, cimchar *obj2Role, int *error); - -/* - * Solaris_SCSIInterface provider - * - * It is important to note that all memory allocated by these functions - * and passed to the CIMOM, is freed by the door process prior to - * sending a copy of the data to the CIMOM. - */ - -/* - * Name: cp_getInstance_Solaris_SCSIInterface - * - * Description: Returns an instance which matches the passed in object path - * if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ - -CCIMInstance* -cp_getInstance_Solaris_SCSIInterface(CCIMObjectPath* pOP) -{ - CCIMInstance* inst = NULL; - CCIMPropertyList* pCurPropList; - CCIMObjectPath *antOp = NULL; - CCIMObjectPath *depOp = NULL; - dm_descriptor_t d_descriptor; - dm_descriptor_t c_descriptor; - char *name; - int error; - - - if (pOP == NULL || - pOP->mKeyProperties == NULL) { - util_handleError(SCSI_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - - - pCurPropList = pOP->mKeyProperties; - antOp = (CCIMObjectPath *)util_getKeyValue(pCurPropList, reference, - ANTECEDENT, &error); - - if (error == 0) { - depOp = (CCIMObjectPath *)util_getKeyValue(pCurPropList, reference, - DEPENDENT, &error); - } - - if (error != 0) { - util_handleError(SCSI_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - - /* - * Now, get the name of the antecedent from the object path. - */ - - if ((antOp->mKeyProperties) == NULL || - (depOp->mKeyProperties) == NULL) { - util_handleError(SCSI_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstance *)NULL); - } - - pCurPropList = antOp->mKeyProperties; - name = (char *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - - if (error != 0) { - util_handleError(SCSI_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - - /* - * The only reason it is needed to get the descriptor for these - * two devices is to verify that they still exist and are valid. - * If they are not found, then getting the instance for this - * association as passed in by the client is not possible. - */ - c_descriptor = dm_get_descriptor_by_name(DM_CONTROLLER, name, - &error); - /* - * Not found. Return a null instance. - */ - - if (error == ENODEV || c_descriptor == NULL) { - return ((CCIMInstance *)NULL); - } - if (error != 0) { - util_handleError(SCSI_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstance*)NULL); - } - dm_free_descriptor(c_descriptor); - - /* - * Now, get the name of the dependent from the object path. - */ - - pCurPropList = depOp->mKeyProperties; - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - - if (error != 0) { - util_handleError(SCSI_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - d_descriptor = dm_get_descriptor_by_name(DM_DRIVE, name, &error); - - /* - * Not found. Return a null instance. - */ - - if (error == ENODEV || d_descriptor == NULL) { - return ((CCIMInstance *)NULL); - } - - if (error != 0) { - util_handleError(SCSI_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstance*)NULL); - } - - dm_free_descriptor(d_descriptor); - - /* - * At this point I have verified I have the two devices that - * are part of this association. Use the object paths I got - * earlier to create the scsiinterface instance. - */ - inst = scsiIntAssocToInst(antOp, ANTECEDENT, depOp, DEPENDENT, &error); - - if (error != 0) { - util_handleError(SCSI_GETINSTANCE, CIM_ERR_FAILED, - SCSIINT_ASSOC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstance *)NULL); - } - - return (inst); -} - -/* - * Name: cp_enumInstances_Solaris_SCSIInterface - * - * Description: Returns a linked list of instances of - * Solaris_SCSIInterface if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMInstanceList * if instances are found. NULL otherwise. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_enumInstances_Solaris_SCSIInterface(CCIMObjectPath* pOP) -{ - CCIMInstanceList *instList = NULL; - CCIMObjectPathList *cObjList; - CCIMObjectPathList *tmpObjList; - CCIMObjectPath *objPath; - CCIMInstance *inst; - CCIMException *ex; - dm_descriptor_t *d_descriptorp = NULL; - int error = 0; - - - /* - * Get the list of SCSI Controllers. Then get the associated drives - * via the device api. - */ - - objPath = cim_createEmptyObjectPath(SCSI_CONTROLLER); - if (objPath == NULL) { - ex = cim_getLastError(); - util_handleError(SCSI_ENUMINSTANCES, CIM_ERR_FAILED, - CREATE_OBJECT_PATH, ex, &error); - return ((CCIMInstanceList *)NULL); - } - - cObjList = cimom_enumerateInstanceNames(objPath, cim_false); - cim_freeObjectPath(objPath); - - if (cObjList == NULL) { - ex = cim_getLastError(); - util_handleError(SCSI_ENUMINSTANCES, CIM_ERR_FAILED, - ENUM_INSTANCENAMES_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - - /* - * If no controllers of this type, then no interfaces. - */ - - if (cObjList->mDataObject == NULL) { - return ((CCIMInstanceList *)NULL); - } - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(SCSI_ENUMINSTANCES, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - /* - * Loop through all of these controller objects and get the associated - * disks. - */ - - for (tmpObjList = cObjList; tmpObjList != NULL; - tmpObjList = tmpObjList->mNext) { - - char *name = NULL; - CCIMObjectPath *cOp; - CCIMInstanceList *tmpList; - CCIMInstanceList *tmpList1; - CCIMPropertyList *pCurPropList; - CCIMObjectPathList *dObjList; - CCIMInstanceList *tL; - dm_descriptor_t c_descriptor; - - cOp = tmpObjList->mDataObject; - if ((pCurPropList = cOp->mKeyProperties) == NULL) { - util_handleError(SCSI_ENUMINSTANCES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - cim_freeObjectPathList(cObjList); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - name = (cimchar *)util_getKeyValue(pCurPropList, string, - DEVICEID, &error); - if (error != 0 || name == NULL) { - util_handleError(SCSI_ENUMINSTANCES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - - c_descriptor = dm_get_descriptor_by_name(DM_CONTROLLER, name, - &error); - - if (error == ENODEV || c_descriptor == NULL) { - continue; - } - - if (error != 0) { - util_handleError(SCSI_ENUMINSTANCES, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - - d_descriptorp = dm_get_associated_descriptors(c_descriptor, - DM_DRIVE, &error); - dm_free_descriptor(c_descriptor); - /* - * If there are no drives associated with this controller, - * continue on to the next controller. - */ - - if (d_descriptorp == NULL) { - continue; - } - - if (d_descriptorp[0] == NULL) { - dm_free_descriptors(d_descriptorp); - continue; - } - - if (error != 0) { - util_handleError(SCSI_ENUMINSTANCES, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - - tmpList = drive_descriptors_toCCIMObjPathInstList( - DISK_DRIVE, d_descriptorp, &error); - dm_free_descriptors(d_descriptorp); - - if (error != 0) { - util_handleError(SCSI_ENUMINSTANCES, CIM_ERR_FAILED, - DRIVE_DESC_TO_INSTANCE_FAILURE, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - - if (tmpList == NULL) { - continue; - } - - dObjList = cim_createObjectPathList(tmpList); - cim_freeInstanceList(tmpList); - - if (dObjList == NULL) { - ex = cim_getLastError(); - util_handleError(SCSI_ENUMINSTANCES, CIM_ERR_FAILED, - CREATE_OBJECT_PATH_FAILURE, ex, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - - tmpList1 = scsiIntAssocToInstList( - cOp, ANTECEDENT, dObjList, DEPENDENT, &error); - cim_freeObjectPathList(dObjList); - - if (error != 0) { - util_handleError(SCSI_ENUMINSTANCES, CIM_ERR_FAILED, - DRIVE_DESC_TO_INSTANCE_FAILURE, NULL, &error); - cim_freeInstanceList(instList); - cim_freeObjectPathList(cObjList); - return ((CCIMInstanceList *)NULL); - } - - tL = tmpList1; - do { - inst = cim_copyInstance(tL->mDataObject); - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - util_handleError(SCSI_ENUMINSTANCES, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, NULL, &error); - cim_freeObjectPathList(cObjList); - cim_freeObjectPathList(tmpList1); - return ((CCIMInstanceList *)NULL); - } - tL = tL->mNext; - } while (tL); - - cim_freeInstanceList(tmpList1); - } /* end for */ - - /* - * It is possible I will have an empty instance list at - * this point. So, I must check and NULL this out if - * there are no entries. - */ - - cim_freeObjectPathList(cObjList); - - if (instList->mDataObject == NULL) { - cim_freeInstanceList(instList); - instList = NULL; - } - - return (instList); -} - -/* - * Name: cp_enumInstanceNames_Solaris_SCSIInterface - * - * Description: Returns a linked list of CCIMObjectPath * - * of Solaris_SCSIInterface if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMObjectPathList * if objects are found. NULL otherwise. - */ - -/* ARGSUSED */ -CCIMObjectPathList* -cp_enumInstanceNames_Solaris_SCSIInterface(CCIMObjectPath * pOP) { - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - - if (pOP == NULL) { - util_handleError(SCSI_ENUMINSTANCENAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - /* - * Call in to enumInstances and then convert the instance list in - * to an object list. - */ - - instList = cp_enumInstances_Solaris_SCSIInterface(pOP); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Creating an instance of a Solaris_SCSIInterface is not supported. - */ - -/* ARGSUSED */ -CCIMObjectPath* -cp_createInstance_Solaris_SCSIInterface(CCIMObjectPath* pOP, - CCIMInstance* pInst) -{ - int error; - - util_handleError(SCSI_CREATEINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return ((CCIMObjectPath *)NULL); -} - - -/* - * Deleting an instance of a Solaris_SCSIInterface is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_SCSIInterface(CCIMObjectPath* pInst) -{ - int error; - - util_handleError(SCSI_DELETEINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - -/* - * Name: cp_getProperty_Solaris_SCSIInterface - * - * Description: Returns the property requested, if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMProperty * if found. - */ - -/* ARGSUSED */ -CCIMProperty * -cp_getProperty_Solaris_SCSIInterface(CCIMObjectPath *pOP, - char *pPropName) -{ - - CCIMProperty *prop = NULL; - CCIMInstance *inst = NULL; - int error = 0; - - - if (pOP == NULL) { - util_handleError(SCSI_GETPROPERTY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMProperty *)NULL); - } - - inst = cp_getInstance_Solaris_SCSIInterface(pOP); - if (inst == NULL) { - return ((CCIMProperty *)NULL); - } - - prop = cim_getProperty(inst, pPropName); - cim_freeInstance(inst); - return (prop); -} - -/* - * Setting an instance of a Solaris_SCSIInterface is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_SCSIInterface(CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - int error; - - util_handleError(SCSI_SETINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - - -/* - * Setting a property on a Solaris_SCSIInterface is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_SCSIInterface(CCIMObjectPath* pOP, CCIMProperty* pProp) -{ - int error; - - util_handleError(SCSI_SETPROPERTY, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - -/* - * No Methods for Solaris_SCSIInterface. - */ - -/* ARGSUSED */ -CCIMProperty* -cp_invokeMethod_Solaris_SCSIInterface( - CCIMObjectPath* op, cimchar* methodName, - CCIMPropertyList* inParams, CCIMPropertyList* outParams) -{ - CCIMProperty *retVal = (CCIMProperty *)NULL; - return (retVal); -} - -/* - * Name: cp_execQuery_Solaris_SCSIInterface - * - * Description: - * Returns an instance list which matches the query if any are found. - * - * Parameters: - * CCIMObjectPath *op - An CCIMObjectPath * which contains the - * information on the class for which to find the instances. - * - * selectList - Not used - * nonJoinExp - Not used - * - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ -/* - * Currently, there is no WQL parser for the C providers. As a result, - * what is returned to the CIMOM is a list of instances with - * a NULL value at the beginning of the list. This NULL value indicates - * to the CIMOM that it must do the filtering for the client. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_execQuery_Solaris_SCSIInterface(CCIMObjectPath *op, - cimchar *selectList, cimchar *nonJoinExp, cimchar *queryExp, int queryType) -{ - CCIMInstanceList *instList = NULL; - CCIMInstanceList *result; - CCIMInstance *emptyInst; - CCIMException *ex; - int error; - - - if (op == NULL) { - util_handleError(SCSI_EXECQUERY, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = cp_enumInstances_Solaris_SCSIInterface(op); - - if (instList == NULL) { - return (instList); - } - - /* - * Create a null instance and add it to the beginning - * of the list to indicate to the CIMOM that no filtering - * was done. - */ - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError(SCSI_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - - result = cim_createInstanceList(); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(SCSI_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_addInstance(result, emptyInst); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(SCSI_EXECQUERY, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - /* - * Since copying the original list to the new list will - * leave no way to free the original list, manually - * concatenate the original list to the new one. - */ - - result->mNext = instList; - return (result); -} - -/* - * Name: cp_associators_Solaris_SCSIInterface - * - * Description: - * Returns a instances of objects associated with the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pResultClass - If specified, only return instances that - * are of this class type. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * cimchar *pResultRole - If specified, only return instances that - * are playing this role in the association. - * - * - * Returns: - * CCIMInstanceList * if associated objects are found. - * NULL is returned on error as well as for an empty list. - */ - -/* ARGSUSED */ -CCIMInstanceList * -cp_associators_Solaris_SCSIInterface(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, cimchar *pResultClass, cimchar *pRole, - cimchar *pResultRole) -{ - CCIMPropertyList *pCurPropList; - CCIMInstanceList *instList = NULL; - CCIMException *ex; - dm_descriptor_t *assoc_descriptors; - dm_descriptor_t obj_desc; - char *name; - int error = 0; - int isAntecedent = 0; - - - if (pObjectName == NULL || - pObjectName->mName == NULL || - pObjectName->mKeyProperties == NULL) { - util_handleError(SCSI_ASSOCIATORS, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - if (strcasecmp(pObjectName->mName, SCSI_CONTROLLER) == 0) { - isAntecedent = 1; - } - - if (pRole != NULL) { - if (strcasecmp(pRole, ANTECEDENT) == 0) { - if (isAntecedent != 1) { - util_handleError(SCSI_ASSOCIATORS, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - } else if (strcasecmp(pRole, DEPENDENT) == 0) { - if (isAntecedent == 1) { - util_handleError(SCSI_ASSOCIATORS, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - } - } - - /* - * Both scsi controller and disk drive have deviceid as the - * key. - */ - - pCurPropList = pObjectName->mKeyProperties; - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - - /* - * We went through the whole list and didn't find the necessary - * key value. - */ - if (error != 0 || name == NULL) { - util_handleError(SCSI_ASSOCIATORS, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - if (isAntecedent) { - obj_desc = dm_get_descriptor_by_name(DM_CONTROLLER, name, &error); - } else { - obj_desc = dm_get_descriptor_by_name(DM_DRIVE, name, &error); - } - - /* - * Device not found, return NULL list. - */ - if (error == ENODEV || obj_desc == NULL) { - return ((CCIMInstanceList *)NULL); - } - - if (error != 0) { - util_handleError(SCSI_ASSOCIATORS, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - if (isAntecedent) { - - /* - * Controller calling this method, return instances of the - * disk drives associated with this controller. - */ - - assoc_descriptors = dm_get_associated_descriptors(obj_desc, - DM_DRIVE, &error); - dm_free_descriptor(obj_desc); - - if (assoc_descriptors == NULL) { - return ((CCIMInstanceList *)NULL); - } - - if (assoc_descriptors[0] == NULL) { - dm_free_descriptors(assoc_descriptors); - return ((CCIMInstanceList *)NULL); - } - - if (error != 0) { - util_handleError(SCSI_ASSOCIATORS, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - /* - * Generate the inst list of the associated disk drives. - */ - - instList = drive_descriptors_toCCIMObjPathInstList(DISK_DRIVE, - assoc_descriptors, &error); - dm_free_descriptors(assoc_descriptors); - - if (error != 0) { - ex = cim_getLastError(); - util_handleError(SCSI_ASSOCIATORS, CIM_ERR_FAILED, - DRIVE_DESC_TO_INSTANCE_FAILURE, ex, &error); - return ((CCIMInstanceList *)NULL); - } - } else { - /* - * This is the disk drive calling this function. Return the - * controllers that are associated with this disk. - */ - - assoc_descriptors = dm_get_associated_descriptors(obj_desc, - DM_CONTROLLER, &error); - dm_free_descriptor(obj_desc); - - if (assoc_descriptors == NULL) { - return (instList); - } - - if (assoc_descriptors[0] == NULL) { - dm_free_descriptors(assoc_descriptors); - return (instList); - } - - if (error != 0) { - util_handleError(SCSI_ASSOCIATORS, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = ctrl_descriptors_toCCIMInstanceList(SCSI_CONTROLLER, - assoc_descriptors, &error, 1, "scsi"); - dm_free_descriptors(assoc_descriptors); - - if (error != 0) { - util_handleError(SCSI_ASSOCIATORS, CIM_ERR_FAILED, - SCSICTRL_DESC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - } - - return (instList); -} - -/* - * Name: cp_associatorNames_Solaris_SCSIInterface - * - * Description: - * Returns a list of objects associated with the passed in - * object if there are any via the object CCIMObjectPath. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pResultClass - If specified, only return instances that - * are of this class type. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * cimchar *pResultRole - If specified, only return instances that - * are playing this role in the association. - * - * - * Returns: - * CCIMObjectPathList * if associated objects are found. NULL otherwise. - */ - -/* ARGSUSED */ -CCIMObjectPathList * -cp_associatorNames_Solaris_SCSIInterface(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, cimchar *pResultClass, cimchar *pRole, - cimchar *pResultRole) -{ - - CCIMInstanceList *instList = NULL; - CCIMObjectPathList *objList = NULL; - int error; - - - if (pObjectName == NULL) { - util_handleError(SCSI_ASSOCIATORNAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - instList = - cp_associators_Solaris_SCSIInterface( - pAssocName, pObjectName, pResultClass, pRole, pResultRole); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Name: cp_references_Solaris_SCSIInterface - * - * Description: - * Returns a instances of objects that have references to the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * Returns: - * CCIMObjectPathList * if associated objects are found. This list - * may be empty. NULL is returned on error. If empty list, NULL - * is returned also. An error is set for CIMOM if an error occurs - * to notify CIMOM that the NULL means error. - */ - -/* ARGSUSED */ -CCIMInstanceList * -cp_references_Solaris_SCSIInterface(CCIMObjectPath *pAssocName, -CCIMObjectPath *pObjectName, char *pRole) -{ - - CCIMInstanceList *instList = NULL; - CCIMObjectPathList *objList = NULL; - int error; - - - if (pObjectName == NULL) { - util_handleError(SCSI_REFERENCES, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* - * Get the list of those objects that are referred to by - * the calling object. - */ - - objList = - cp_associatorNames_Solaris_SCSIInterface( - pAssocName, pObjectName, NULL, NULL, NULL); - - if (objList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - /* - * Now generate the list of instances to return. - */ - - if ((strcasecmp(pObjectName->mName, SCSI_CONTROLLER)) == 0) { - instList = scsiIntAssocToInstList(pObjectName, - ANTECEDENT, objList, DEPENDENT, &error); - } else { - instList = scsiIntAssocToInstList(pObjectName, - DEPENDENT, objList, ANTECEDENT, &error); - } - - cim_freeObjectPathList(objList); - return (instList); -} - -/* - * Name: cp_referenceNames_Solaris_SCSIInterface - * - * Description: - * Returns a instances of objects that have references to the passed in - * object if there are any. - * - * Parameters: - * - * CCIMObjectPath *pAssocName - The name of the association that - * the client wants information about. - * - * CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the - * information on the class for which to find the associated instances. - * - * cimchar *pRole - If specified, must be valid for the object path - * passed in requesting the associated instances. - * - * - * Returns: - * CCIMObjectPathList * if associated objects are found. This list - * may be empty. NULL is returned on error and for an empty list. - * An error is set for CIMOM to determine if NULL means error. - * - */ - -/* ARGSUSED */ -CCIMObjectPathList * -cp_referenceNames_Solaris_SCSIInterface(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, cimchar *pRole) -{ - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pObjectName == NULL) { - util_handleError(SCSI_REFERENCENAMES, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - instList = - cp_references_Solaris_SCSIInterface(pAssocName, pObjectName, pRole); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Create the association class with the passed in attributes. - */ -static -CCIMInstanceList * -scsiIntAssocToInstList(CCIMObjectPath *pObjectName, cimchar *pObjectNameRole, - CCIMObjectPathList *objList, cimchar *objRole, int *error) -{ - - CCIMObjectPathList *tmpList; - CCIMInstanceList *instList = NULL; - CCIMInstance *inst; - CCIMObjectPath *obj1; - CCIMObjectPath *obj2; - CCIMException *ex; - - *error = 0; - - if (objList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(SCSI_INTERFACE, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, error); - return ((CCIMInstanceList *)NULL); - } - tmpList = objList; - while (tmpList != NULL) { - obj1 = tmpList->mDataObject; - obj2 = cim_copyObjectPath(pObjectName); - if (obj2 == NULL) { - ex = cim_getLastError(); - util_handleError(SCSI_INTERFACE, CIM_ERR_FAILED, - COPY_OBJPATH_FAILURE, ex, error); - return ((CCIMInstanceList *)NULL); - } - - inst = scsiIntAssocToInst(obj1, objRole, obj2, pObjectNameRole, - error); - cim_freeObjectPath(obj2); - - if (*error != 0) { - util_handleError(SCSI_INTERFACE, CIM_ERR_FAILED, - SCSIINT_ASSOC_TO_INSTANCE_FAILURE, NULL, error); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(SCSI_INTERFACE, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, error); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - tmpList = tmpList->mNext; - } - return (instList); -} - -static -CCIMInstance * -scsiIntAssocToInst(CCIMObjectPath *obj1, cimchar *obj1Role, - CCIMObjectPath *obj2, cimchar *obj2Role, int *error) -{ - - CCIMInstance *inst = NULL; - CCIMException *ex; - - *error = 0; - - inst = cim_createInstance(SCSI_INTERFACE); - if (inst == NULL) { - ex = cim_getLastError(); - util_handleError(SCSI_INTERFACE, CIM_ERR_FAILED, - SCSIINT_ASSOC_TO_INSTANCE_FAILURE, ex, error); - return ((CCIMInstance *)NULL); - } - - util_doReferenceProperty(obj2Role, obj2, cim_true, inst, error); - if (*error != 0) { - ex = cim_getLastError(); - util_handleError(SCSI_INTERFACE, CIM_ERR_FAILED, - CREATE_REFPROP_FAILURE, ex, error); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - util_doReferenceProperty(obj1Role, obj1, cim_true, inst, error); - if (*error != 0) { - ex = cim_getLastError(); - util_handleError(SCSI_INTERFACE, CIM_ERR_FAILED, - CREATE_REFPROP_FAILURE, ex, error); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - return (inst); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_SCSIInterface.h b/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_SCSIInterface.h deleted file mode 100644 index 9e396c918d..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_SCSIInterface.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOLARIS_SCSIINTERFACE_H_ -#define _SOLARIS_SCSIINTERFACE_H_ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> -#include <cimprovider.h> -#include <cimomhandle.h> -#include <cimlogsvc.h> -#include <cp_required.h> -#include <cim_objectpath.h> - -#include "libdiskmgt.h" - -#ifdef __cplusplus -} -#endif - -#endif /* _SOLARIS_SCSIINTERFACE_H_ */ diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/common/Makefile b/usr/src/cmd/wbem/provider/c/wbem_disk/common/Makefile deleted file mode 100644 index 333e9318f1..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/common/Makefile +++ /dev/null @@ -1,86 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# -# This Makefile just 'makes' the common .o files -# used by diskdrive and diskpartition. It does -# not create a library or message file. - -include $(SRC)/cmd/wbem/Makefile.wbem - -OBJECTS = util.o \ - drive_descriptors.o \ - partition_descriptors.o \ - logicaldisk_descriptors.o \ - ctrl_descriptors.o \ - partbasedon_descriptors.o \ - disk_descriptors.o \ - mediapresent_descriptors.o \ - methods.o \ - mpxiogroup_descriptors.o \ - realizesextent_descriptors.o \ - realizesdiskdrive_descriptors.o - -LINT_OBJS = $(OBJECTS:%.o=%.ln) - -GENERAL = $(ROOTWBEMINC) \ - $(SRC)/lib/libdiskmgt/common \ - $(SRC)/cmd/wbem/provider/c/include - -CPPFLAGS += $(GENERAL:%=-I%) -D_REENTRANT -Dpic -D_TS_ERRNO - -CFLAGS += $(XREGSFLAG) $(C_PICFLAGS) - -LINTFLAGS += -um -LINTLIBS = $(LDLIBS.cmd) - -POFILE = _common.po -MSGFILES = $(OBJECTS:%.o=%.i) - -CLOBBERFILES += $(POFILE) - -.KEEP_STATE: - -all: $(OBJECTS) - -install: all - -lint: $(LINT_OBJS) - $(LINT.c) $(LINTFLAGS) $(LINT_OBJS) $(LINTLIBS) - -clean: - $(RM) $(OBJECTS) $(LINT_OBJS) $(MSGFILES) - -check: - $(CSTYLE) -p -P $(OBJECTS:%.o=%.c) - -catalog: $(POFILE) - -$(POFILE): $(MSGFILES) - $(BUILDPO.msgfiles) - -include $(SRC)/cmd/Makefile.targ -include $(SRC)/Makefile.msg.targ diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/common/ctrl_descriptors.c b/usr/src/cmd/wbem/provider/c/wbem_disk/common/ctrl_descriptors.c deleted file mode 100644 index a22798c865..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/common/ctrl_descriptors.c +++ /dev/null @@ -1,332 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <stdarg.h> -#include <unistd.h> -#include <strings.h> -#include <stdlib.h> -#include <errno.h> -#include <netdb.h> -#include <cimapi.h> -#include <libnvpair.h> -#include <md5.h> - -#include "libdiskmgt.h" -#include "providerNames.h" -#include "messageStrings.h" -#include "cimKeys.h" -#include "util.h" - -/* - * Convert a single descriptor in to a Solaris_XXXController instance - */ - -CCIMInstance * -ctrl_descriptor_toCCIMInstance(char *hostname, dm_descriptor_t desc, - char *provider, int *errp) -{ - - CCIMInstance *inst = NULL; - CCIMException *ex; - nvlist_t *nvlp; - nvpair_t *nvp; - char *str; - int error; - - *errp = 0; - - /* Create instance of controller */ - - if ((inst = cim_createInstance(provider)) == NULL) { - ex = cim_getLastError(); - util_handleError(CTRL_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, errp); - return ((CCIMInstance *)NULL); - } - - /* First, assign the deviceID */ - - str = dm_get_name(desc, &error); - - if (error != 0) { - util_handleError(CTRL_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_NAME_FAILURE, NULL, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - if (str == NULL) { - util_handleError(CTRL_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_NAME_FAILURE, NULL, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - util_doProperty(DEVICEID, string, str, cim_true, inst, errp); - dm_free_name(str); - - if (*errp == 0) { - util_doProperty(CREATION_CLASS, string, provider, cim_true, inst, - errp); - } - - if (*errp == 0) { - util_doProperty(SYS_CREATION_CLASS, string, COMPUTER_SYSTEM, - cim_true, inst, errp); - } - - if (*errp == 0) { - util_doProperty(SYSTEM, string, hostname, cim_true, inst, errp); - } - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(CTRL_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - /* Now get the controller attributes */ - nvlp = dm_get_attributes(desc, &error); - if (error != 0) { - util_handleError(CTRL_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_ATTR_FAILURE, NULL, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - /* No attributes, no more to process */ - if (nvlp == NULL) { - return (inst); - } - - for (nvp = nvlist_next_nvpair(nvlp, NULL); nvp != NULL; - nvp = nvlist_next_nvpair(nvlp, nvp)) { - - char *attrname; - char *str; - char *protocol; - char *avail; - char *status; - - attrname = nvpair_name(nvp); - if (attrname == NULL) { - continue; - } - - /* Loop through nvpair list and assign attrs to the CIMInstance. */ - - if (strcasecmp(attrname, DM_CTYPE) == 0) { - error = nvpair_value_string(nvp, &str); - if (error != 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(CTRL_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - - if (strcasecmp(str, "scsi") == 0) { - protocol = "11"; - } else if (strcasecmp(str, "usb") == 0) { - protocol = "16"; - } else if (strcasecmp(str, "ata") == 0) { - protocol = "42"; - } else if (strcasecmp(str, "fibre channel") == 0) { - protocol = "10"; - } else if (strcasecmp(str, "scsi_vhci") == 0) { - protocol = "1"; - } else { - protocol = "2"; - } - - util_doProperty("ProtocolSupported", string, protocol, - cim_false, inst, errp); - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(CTRL_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - nvlist_free(nvlp); - return ((CCIMInstance *)NULL); - } - } else if (strcasecmp(attrname, DM_PATH_STATE) == 0) { - error = nvpair_value_string(nvp, &str); - if (error != 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(CTRL_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - - if (strcasecmp(str, "online") == 0) { - avail = "3"; - status = "3"; - } else if (strcasecmp(str, "standby") == 0) { - avail = "11"; - status = "1"; - } else if (strcasecmp(str, "offline") == 0) { - avail = "8"; - status = "4"; - } else if (strcasecmp(str, "faulted") == 0) { - avail = "9"; - status = "4"; - } else { - avail = "2"; - status = "2"; - } - util_doProperty("Availability", string, avail, - cim_false, inst, errp); - util_doProperty("StatusInfo", string, status, - cim_false, inst, errp); - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(CTRL_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - nvlist_free(nvlp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - } - } /* End for */ - - nvlist_free(nvlp); - return (inst); -} - -/* Convert the descriptor list to a CIMInstance List */ - -CCIMInstanceList* -ctrl_descriptors_toCCIMInstanceList(char *providerName, dm_descriptor_t *dp, - int *errp, int number, ...) -{ - CCIMInstance *inst; - CCIMInstanceList *instList = NULL; - CCIMException *ex; - va_list args; - dm_descriptor_t desc; - nvlist_t *nvlp; - int i; - int k; - int error; - char *type; - char *arg_type; - - *errp = 0; - - /* If not descriptor list, return an empty instance list. */ - if (dp == NULL) { - return (instList); - } - - /* - * Create the instance list which will store the instances - * Only create this list when we know we have a valid - * instance to create - */ - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(CTRL_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, errp); - return ((CCIMInstanceList *)NULL); - } - - /* - * Loop through all of the controller types specified. - */ - - - for (k = 0; dp[k] != NULL; k ++) { - desc = dp[k]; - nvlp = dm_get_attributes(desc, &error); - if (error != 0) { - util_handleError(CTRL_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_ATTR_FAILURE, NULL, errp); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - error = nvlist_lookup_string(nvlp, "ctype", &type); - if (error != 0) { - util_handleError(CTRL_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - NVLIST_FAILURE, NULL, errp); - nvlist_free(nvlp); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - va_start(args, number); - for (i = 0; i < number; i ++) { - arg_type = va_arg(args, char *); - if (strcasecmp(arg_type, "scsi_vhci") == 0) { - error = nvlist_lookup_boolean(nvlp, "multiplex"); - if (error != 0) { - continue; - } - } else if (strcasecmp(type, arg_type) != 0) { - continue; - } - - inst = ctrl_descriptor_toCCIMInstance(hostName, desc, - providerName, &error); - if (error != 0) { - /* Error handling is done in the subfunction. */ - nvlist_free(nvlp); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - /* add the instance to the instance list */ - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(CTRL_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, errp); - cim_freeInstance(inst); - nvlist_free(nvlp); - return ((CCIMInstanceList *)NULL); - } - } - } - va_end(args); - nvlist_free(nvlp); - - /* - * If no matches were found, then we need to free the instance list - * and return NULL. - */ - if (instList->mDataObject == NULL) { - cim_freeInstanceList(instList); - instList = NULL; - } - return (instList); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/common/disk_descriptors.c b/usr/src/cmd/wbem/provider/c/wbem_disk/common/disk_descriptors.c deleted file mode 100644 index c59d9f9543..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/common/disk_descriptors.c +++ /dev/null @@ -1,438 +0,0 @@ -/* - * 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 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <unistd.h> -#include <strings.h> -#include <stdlib.h> -#include <errno.h> -#include <netdb.h> -#include <cimapi.h> -#include <libnvpair.h> -#include <md5.h> - -#include "libdiskmgt.h" -#include "providerNames.h" -#include "messageStrings.h" -#include "cimKeys.h" -#include "util.h" - -/* - * Convert a single descriptor in to a Solaris_Disk instance - */ - -/* ARGSUSED */ -CCIMInstance * -disk_descriptor_toCCIMInstance(char *hostname, dm_descriptor_t desc, - char *provider, int *errp) -{ - - nvlist_t *nvlp; - nvpair_t *nvp; - CCIMInstance *inst = NULL; - CCIMException *ex; - dm_descriptor_t *dlist; - dm_descriptor_t *alist; - char *str; - char *drive; - char *vid; - char *prodid; - char buf[100]; - uint32_t status; - int error = 0; - - *errp = 0; - - if ((inst = cim_createInstance(provider)) == NULL) { - ex = cim_getLastError(); - util_handleError(DISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, errp); - return ((CCIMInstance *)NULL); - } - - /* - * First, assign the common name from the alias value of the - * drive. - */ - dlist = dm_get_associated_descriptors(desc, DM_DRIVE, &error); - - if (error != 0) { - util_handleError(DISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - alist = dm_get_associated_descriptors(dlist[0], DM_ALIAS, &error); - - if (error != 0) { - util_handleError(DISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_NAME_FAILURE, NULL, errp); - cim_freeInstance(inst); - dm_free_descriptors(dlist); - return ((CCIMInstance *)NULL); - } - - drive = dm_get_name(alist[0], &error); - dm_free_descriptors(alist); - if (error != 0) { - util_handleError(DISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_NAME_FAILURE, NULL, errp); - cim_freeInstance(inst); - dm_free_descriptors(dlist); - return ((CCIMInstance *)NULL); - } - - util_doProperty("Name", string, drive, cim_false, inst, errp); - if (error != 0) { - util_handleError(DISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, NULL, errp); - cim_freeInstance(inst); - dm_free_name(drive); - dm_free_descriptors(dlist); - return ((CCIMInstance *)NULL); - } - /* - * From the drive, assign the manufacturer and model. - */ - - nvlp = dm_get_attributes(dlist[0], &error); - dm_free_descriptors(dlist); - if (error != 0) { - util_handleError(DISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_ATTR_FAILURE, NULL, errp); - cim_freeInstance(inst); - dm_free_name(drive); - return ((CCIMInstance *)NULL); - } - - error = nvlist_lookup_string(nvlp, "product_id", &prodid); - if (error == 0) { - util_doProperty("Model", string, prodid, cim_false, inst, errp); - } - if (*errp != 0) { - util_handleError(DISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, NULL, errp); - cim_freeInstance(inst); - dm_free_name(drive); - nvlist_free(nvlp); - return ((CCIMInstance *)NULL); - } - - error = nvlist_lookup_string(nvlp, "vendor_id", &vid); - if (error == 0) { - util_doProperty("Manufacturer", string, vid, cim_false, inst, errp); - } - - if (*errp != 0) { - util_handleError(DISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, NULL, errp); - cim_freeInstance(inst); - dm_free_name(drive); - nvlist_free(nvlp); - return ((CCIMInstance *)NULL); - } - - /* - * Now get the status from the drive. - */ - error = nvlist_lookup_uint32(nvlp, "status", &status); - if (error == 0) { - if (status == 0) { - util_doProperty("Status", string, "Lost Comm", cim_false, - inst, errp); - } else { - util_doProperty("Status", string, "OK", cim_false, inst, - errp); - } - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(DISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - nvlist_free(nvlp); - dm_free_name(drive); - return ((CCIMInstance *)NULL); - } - } - nvlist_free(nvlp); - - /* Now, assign the TAG value */ - - str = dm_get_name(desc, &error); - - if (error != 0) { - util_handleError(DISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_NAME_FAILURE, NULL, errp); - cim_freeInstance(inst); - dm_free_name(drive); - return ((CCIMInstance *)NULL); - } - - if (str != NULL) { - util_doProperty(TAG, string, str, cim_true, inst, errp); - dm_free_name(str); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(DISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - dm_free_name(drive); - return ((CCIMInstance *)NULL); - } - - } else { - - util_doProperty(TAG, string, drive, cim_true, inst, errp); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(DISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - dm_free_name(drive); - return ((CCIMInstance *)NULL); - } - } - dm_free_name(drive); - - /* add keys */ - - util_doProperty(CREATION_CLASS, string, DISK, cim_true, inst, errp); - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(DISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - /* Now fill in the other attributes */ - - nvlp = dm_get_attributes(desc, &error); - - /* - * If the underlying api cannot access the media, it will return - * an ENODEV. Set the status for this media appropriately and return - * the instance. - */ - if (error == ENODEV) { - util_doProperty("Status", string, "Lost Comm", cim_false, - inst, errp); - return (inst); - } - if (error != 0) { - util_handleError(DISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_ATTR_FAILURE, NULL, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - /* If there are no other attriubtes, we are done. */ - if (nvlp == NULL) { - return (inst); - } - - for (nvp = nvlist_next_nvpair(nvlp, NULL); nvp != NULL; - nvp = nvlist_next_nvpair(nvlp, nvp)) { - - char *attrname; - uint32_t ui32; - uint64_t ui64; - - attrname = nvpair_name(nvp); - if (attrname == NULL) { - continue; - } - - /* Loop through nvpair list and assign attrs to the CIMInstace. */ - - if (strcasecmp(attrname, DM_SIZE) == 0) { - uint32_t blocksize = 512; - - error = nvpair_value_uint64(nvp, &ui64); - if (error < 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(DISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - - (void) nvlist_lookup_uint32(nvlp, DM_BLOCKSIZE, &blocksize); - - error = snprintf(buf, sizeof (buf), "%llu", ui64 * blocksize); - if (error < 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(DISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - - util_doProperty("Capacity", uint64, buf, cim_false, inst, - errp); - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(DISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - nvlist_free(nvlp); - return ((CCIMInstance *)NULL); - } - } else if (strcasecmp(attrname, DM_MTYPE) == 0) { - char *mtype = "0"; - - error = nvpair_value_uint32(nvp, &ui32); - if (error < 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(DISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - - /* - * The values for MediaType are hardcoded as the enumeration - * values from the CIM_PhysicalMedia MOF definition. - */ - switch (ui32) { - case DM_MT_FIXED: mtype = "29"; - break; - case DM_MT_FLOPPY: mtype = "28"; - break; - case DM_MT_CDROM: mtype = "16"; - break; - case DM_MT_ZIP: mtype = "13"; - break; - case DM_MT_JAZ: mtype = "12"; - break; - case DM_MT_CDR: mtype = "19"; - break; - case DM_MT_CDRW: mtype = "33"; - break; - case DM_MT_DVDROM: mtype = "25"; - break; - case DM_MT_DVDR: mtype = "22"; - break; - case DM_MT_DVDRAM: mtype = "24"; - break; - case DM_MT_MO_ERASABLE: mtype = "43"; - break; - case DM_MT_MO_WRITEONCE: mtype = "44"; - break; - case DM_MT_AS_MO: mtype = "21"; - break; - } - - util_doProperty("MediaType", uint16, mtype, cim_false, inst, - errp); - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(DISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - nvlist_free(nvlp); - return ((CCIMInstance *)NULL); - } - - } else if (strcasecmp(attrname, DM_REMOVABLE) == 0) { - util_doProperty("Removable", boolean, "1", cim_false, inst, - errp); - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(DISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - nvlist_free(nvlp); - return ((CCIMInstance *)NULL); - } - } - } /* End for */ - - nvlist_free(nvlp); - return (inst); -} - -/* Convert the descriptor list to a CIMInstance List */ - -CCIMInstanceList* -disk_descriptors_toCCIMInstanceList(char *providerName, dm_descriptor_t *dp, - int *errp) -{ - CCIMInstance *inst; - CCIMInstanceList *instList = NULL; - CCIMException *ex; - dm_descriptor_t desc; - int i; - int error; - - *errp = 0; - - - /* If not descriptpr list, return an empty instance list. */ - if (dp == NULL) { - return ((CCIMInstanceList *)NULL); - } - - /* Create the instance list which will store the instances */ - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(DISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, errp); - return ((CCIMInstanceList *)NULL); - } - - for (i = 0; dp[i] != NULL; i ++) { - desc = dp[i]; - inst = disk_descriptor_toCCIMInstance(hostName, desc, - providerName, &error); - if (error != 0) { - /* Error handling is done in the subfunction. */ - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - if (inst == NULL) { - continue; - } - - /* add the instance to the instance list */ - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(DISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - } - return (instList); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/common/drive_descriptors.c b/usr/src/cmd/wbem/provider/c/wbem_disk/common/drive_descriptors.c deleted file mode 100644 index 9ac1db1197..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/common/drive_descriptors.c +++ /dev/null @@ -1,833 +0,0 @@ -/* - * 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 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - - -#include <stdio.h> -#include <unistd.h> -#include <strings.h> -#include <stdlib.h> -#include <errno.h> -#include <netdb.h> -#include <cimapi.h> -#include <libnvpair.h> -#include <md5.h> - -#include "libdiskmgt.h" -#include "providerNames.h" -#include "messageStrings.h" -#include "cimKeys.h" -#include "util.h" - -/* - * Convert a single descriptor in to a Solaris_DiskDrive instance - */ - -CCIMInstance * -drive_descriptor_toCCIMInstance(char *hostname, dm_descriptor_t desc, - char *provider, int *errp) -{ - - nvlist_t *nvlp; - nvpair_t *nvp; - CCIMInstance *inst = NULL; - CCIMException *ex; - dm_descriptor_t *dlist; - dm_descriptor_t *mlist; - char *str = NULL; - char *alias; - char buf[100]; - uint32_t nheads = 0; - uint32_t nsecs = 0; - uint64_t bytes_per_cylinder = 0; - uint32_t blocksize = 0; - int error = 0; - int fdisk = 0; - - *errp = 0; - - if (desc == NULL) { - return ((CCIMInstance *)NULL); - } - - /* Create instance of disk drive. */ - - if ((inst = cim_createInstance(provider)) == NULL) { - ex = cim_getLastError(); - util_handleError(DRIVE_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, errp); - return ((CCIMInstance *)NULL); - } - - /* - * Get the common name from the alias descriptor associated with - * this drive. This is used for the 'name' attribute as well as the - * deviceid if the standard deviceid is not found. - */ - dlist = dm_get_associated_descriptors(desc, DM_ALIAS, - &error); - if (error != 0) { - util_handleError(DRIVE_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - if (dlist[0] == NULL) { - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - - alias = dm_get_name(dlist[0], &error); - dm_free_descriptors(dlist); - - if (error != 0) { - util_handleError(DRIVE_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_NAME_FAILURE, NULL, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - util_doProperty("Name", string, alias, cim_false, inst, errp); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(DRIVE_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, ADD_PROPERTY_FAILURE, ex, errp); - dm_free_name(alias); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - /* Now, assign the deviceID */ - - str = dm_get_name(desc, &error); - - if (error != 0) { - util_handleError(DRIVE_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_NAME_FAILURE, NULL, errp); - cim_freeInstance(inst); - dm_free_name(alias); - return ((CCIMInstance *)NULL); - } - - if (str != NULL) { - util_doProperty(DEVICEID, string, str, cim_true, inst, errp); - dm_free_name(str); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(DRIVE_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - dm_free_name(alias); - return ((CCIMInstance *)NULL); - } - - } else { - - util_doProperty(DEVICEID, string, alias, cim_true, inst, errp); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(DRIVE_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - dm_free_name(alias); - return ((CCIMInstance *)NULL); - } - } - dm_free_name(alias); - - /* add keys */ - - util_doProperty(CREATION_CLASS, string, DISK_DRIVE, cim_true, - inst, errp); - - if (*errp == 0) { - util_doProperty(SYS_CREATION_CLASS, string, COMPUTER_SYSTEM, - cim_true, inst, errp); - } - - if (*errp == 0) { - util_doProperty(SYSTEM, string, hostname, cim_true, inst, errp); - } - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(DRIVE_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - nvlp = dm_get_attributes(desc, &error); - if (error != 0) { - util_handleError(DRIVE_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_ATTR_FAILURE, NULL, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - if (nvlp == NULL) { - return (inst); - } - - for (nvp = nvlist_next_nvpair(nvlp, NULL); nvp != NULL; - nvp = nvlist_next_nvpair(nvlp, nvp)) { - - char *attrname; - uint32_t ui32; - char *status; - - attrname = nvpair_name(nvp); - if (attrname == NULL) { - continue; - } - - /* - * loop through the nvpair list and assign attributes to the - * CIMInstace. - */ - - if (strcasecmp(attrname, DM_DRVTYPE) == 0) { - char *type = "Unknown"; - - error = nvpair_value_uint32(nvp, &ui32); - if (error != 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(DRIVE_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - - switch (ui32) { - case DM_DT_FIXED: - type = "Fixed"; - break; - case DM_DT_ZIP: - type = "Zip"; - break; - case DM_DT_JAZ: - type = "Jaz"; - break; - default: - if (nvlist_lookup_boolean(nvlp, DM_REMOVABLE) == 0) { - type = "Removable"; - } - break; - } - - util_doProperty("DiskType", string, type, cim_false, inst, - errp); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(DRIVE_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - } else if (strcasecmp(attrname, DM_STATUS) == 0) { - error = nvpair_value_uint32(nvp, &ui32); - if (error != 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(DRIVE_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - - if (ui32 == 0) { - error = snprintf(buf, sizeof (buf), "%u", 4); - status = "Error"; - } else { - error = snprintf(buf, sizeof (buf), "%u", 3); - status = "OK"; - } - - if (error < 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(DRIVE_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - - util_doProperty("StatusInfo", uint32, buf, cim_false, - inst, errp); - - if (*errp == 0) { - util_doProperty("Status", string, status, cim_false, - inst, errp); - } - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(DRIVE_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - nvlist_free(nvlp); - return ((CCIMInstance *)NULL); - } - } - } - - nvlist_free(nvlp); - - /* - * Now get the associated media, and get some of the other attributes. - */ - - mlist = dm_get_associated_descriptors(desc, DM_MEDIA, errp); - - if (mlist == NULL) { - return (inst); - } - - if (mlist[0] == NULL) { - dm_free_descriptors(mlist); - return (inst); - } - - if (*errp != 0) { - util_handleError(DRIVE_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - nvlp = dm_get_attributes(mlist[0], errp); - dm_free_descriptors(mlist); - - /* - * It is possible that we cannot read the media for this drive. - * So, do not error out, but return what we have so far for the - * drive instance. - */ - if (*errp == ENODEV || nvlp == NULL) { - *errp = 0; - return (inst); - } - - if (*errp != 0) { - util_handleError(DRIVE_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - for (nvp = nvlist_next_nvpair(nvlp, NULL); nvp != NULL; - nvp = nvlist_next_nvpair(nvlp, nvp)) { - - char *attrname; - uint32_t ui32; - - attrname = nvpair_name(nvp); - if (attrname == NULL) { - continue; - } - - if (strcasecmp(attrname, DM_BLOCKSIZE) == 0) { - error = nvpair_value_uint32(nvp, &ui32); - if (error < 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(DRIVE_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - - blocksize = ui32; - error = snprintf(buf, sizeof (buf), "%u", ui32); - if (error < 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(DRIVE_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - util_doProperty("DefaultBlockSize", uint64, buf, - cim_false, inst, errp); - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(DRIVE_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - nvlist_free(nvlp); - return ((CCIMInstance *)NULL); - } - - } else if (strcasecmp(DM_FDISK, attrname) == 0) { - fdisk = 1; - util_doProperty("FdiskPresent", boolean, "1", cim_false, - inst, errp); - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(DRIVE_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - nvlist_free(nvlp); - return ((CCIMInstance *)NULL); - } - } else if (strcasecmp(DM_LABEL, attrname) == 0) { - error = nvpair_value_string(nvp, &str); - if (error != 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(DRIVE_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - - util_doProperty("DiskLabel", string, str, cim_false, inst, - errp); - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(DRIVE_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - nvlist_free(nvlp); - return ((CCIMInstance *)NULL); - } - } else if (strcasecmp(DM_NHEADS, attrname) == 0) { - error = nvpair_value_uint32(nvp, &ui32); - if (error < 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(DRIVE_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - nheads = ui32; - } else if (strcasecmp(DM_NSECTORS, attrname) == 0) { - error = nvpair_value_uint32(nvp, &ui32); - if (error < 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(DRIVE_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - nsecs = ui32; - } else if (strcasecmp(DM_NPHYSCYLINDERS, attrname) == 0) { - error = nvpair_value_uint32(nvp, &ui32); - if (error < 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(DRIVE_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - error = snprintf(buf, sizeof (buf), "%u", ui32); - if (error < 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(DRIVE_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - util_doProperty("PhysicalCylinders", uint32, buf, cim_false, - inst, errp); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(DRIVE_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, ADD_PROPERTY_FAILURE, ex, errp); - nvlist_free(nvlp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - } else if (strcasecmp(DM_NCYLINDERS, attrname) == 0) { - error = nvpair_value_uint32(nvp, &ui32); - if (error < 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(DRIVE_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - error = snprintf(buf, sizeof (buf), "%u", ui32); - if (error < 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(DRIVE_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - util_doProperty("DataCylinders", uint32, buf, cim_false, - inst, errp); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(DRIVE_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, ADD_PROPERTY_FAILURE, ex, errp); - nvlist_free(nvlp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - } else if (strcasecmp(DM_NACTUALCYLINDERS, attrname) == 0) { - error = nvpair_value_uint32(nvp, &ui32); - if (error < 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(DRIVE_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - error = snprintf(buf, sizeof (buf), "%u", ui32); - if (error < 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(DRIVE_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - util_doProperty("ActualCylinders", uint32, buf, cim_false, - inst, errp); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(DRIVE_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, ADD_PROPERTY_FAILURE, ex, errp); - nvlist_free(nvlp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - } - - } /* end for */ - - nvlist_free(nvlp); - - /* - * Now fill in the geometry data - */ - - error = snprintf(buf, sizeof (buf), "%u", nheads); - - if (error < 0) { - cim_freeInstance(inst); - util_handleError(DRIVE_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - - util_doProperty("HeadsPerCylinder", uint32, buf, cim_false, inst, - errp); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(DRIVE_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - error = snprintf(buf, sizeof (buf), "%u", nsecs); - - if (error < 0) { - cim_freeInstance(inst); - util_handleError(DRIVE_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - - util_doProperty("SectorsPerTrack", uint32, buf, cim_false, inst, - errp); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(DRIVE_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - error = snprintf(buf, sizeof (buf), "%u", nsecs * nheads); - - if (error < 0) { - cim_freeInstance(inst); - util_handleError(DRIVE_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - - util_doProperty("SectorsPerCylinder", uint32, buf, cim_false, inst, - errp); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(DRIVE_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - bytes_per_cylinder = (nheads * nsecs) * blocksize; - error = snprintf(buf, sizeof (buf), "%llu", bytes_per_cylinder); - - if (error < 0) { - cim_freeInstance(inst); - util_handleError(DRIVE_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - - util_doProperty("BytesPerCylinder", uint32, buf, cim_false, - inst, errp); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(DRIVE_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - /* - * Now check to see if there is an fdisk or not. - */ - - if (fdisk != 1) { - util_doProperty("FdiskPresent", boolean, "0", cim_false, - inst, errp); - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(DRIVE_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - } - - return (inst); -} - -/* Convert the descriptor list to a CIMInstance List */ - -CCIMInstanceList* -drive_descriptors_toCCIMInstanceList(char *providerName, dm_descriptor_t *dp, - int *errp) -{ - CCIMInstance *inst; - CCIMInstanceList *instList = NULL; - CCIMException *ex; - dm_descriptor_t desc; - int i; - int error = 0; - - *errp = 0; - - - /* If not descriptor list, return an empty instance list. */ - if (dp == NULL) { - return ((CCIMInstanceList *)NULL); - } - - /* Create the instance list which will store the instances */ - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(DRIVE_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, errp); - return ((CCIMInstanceList *)NULL); - } - for (i = 0; dp[i] != NULL; i ++) { - desc = dp[i]; - inst = drive_descriptor_toCCIMInstance(hostName, desc, - providerName, &error); - if (error != 0) { - /* Error handling is done in the subfunction. */ - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - if (inst == NULL) { - continue; - } - - /* add the instance to the instance list */ - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(DRIVE_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - } - - return (instList); -} - -/* - * Convert the descriptor list to a CIMInstance List that will be used - * only for object paths and thus does not need to be fully populated. - * We do the filtering in this function to be sure that we are only - * returning drives that are modeled with this class in CIM. - */ -CCIMInstanceList* -drive_descriptors_toCCIMObjPathInstList(char *providerName, dm_descriptor_t *dp, - int *errp) -{ - CCIMInstanceList *instList = NULL; - int i; - int error = 0; - int have_instances = 0; - - *errp = 0; - - if (dp == NULL) { - return ((CCIMInstanceList *)NULL); - } - - /* Create the instance list which will store the instances */ - instList = cim_createInstanceList(); - if (instList == NULL) { - util_handleError(DRIVE_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, cim_getLastError(), errp); - return ((CCIMInstanceList *)NULL); - } - - for (i = 0; dp[i] != NULL; i ++) { - dm_descriptor_t desc; - nvlist_t *attrs; - uint32_t drvtype; - char *str; - CCIMInstance *inst; - - desc = dp[i]; - - attrs = dm_get_attributes(desc, &error); - if (error != 0 || attrs == NULL) { - continue; - } - - drvtype = DM_DT_UNKNOWN; - (void) nvlist_lookup_uint32(attrs, DM_DRVTYPE, &drvtype); - nvlist_free(attrs); - - switch (drvtype) { - case DM_DT_UNKNOWN: - break; - case DM_DT_FIXED: - break; - case DM_DT_ZIP: - break; - case DM_DT_JAZ: - break; - default: - /* - * This is not one of the drives that are modeled as a - * Solaris_DiskDrive, so we should skip over it. - */ - continue; - } - - str = dm_get_name(desc, &error); - if (error != 0) { - util_handleError(DRIVE_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_NAME_FAILURE, NULL, errp); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - if (str == NULL) { - dm_descriptor_t *aliases; - - aliases = dm_get_associated_descriptors(desc, DM_ALIAS, &error); - if (error != 0) { - util_handleError(DRIVE_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, errp); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - str = dm_get_name(aliases[0], &error); - dm_free_descriptors(aliases); - - if (error != 0) { - util_handleError(DRIVE_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_NAME_FAILURE, NULL, errp); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - } - - /* Create instance of disk drive. */ - if ((inst = cim_createInstance(providerName)) == NULL) { - util_handleError(DRIVE_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, cim_getLastError(), errp); - dm_free_name(str); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - /* add keys */ - util_doProperty(DEVICEID, string, str, cim_true, inst, errp); - dm_free_name(str); - - if (*errp == 0) { - util_doProperty(CREATION_CLASS, string, DISK_DRIVE, cim_true, - inst, errp); - } - - if (*errp == 0) { - util_doProperty(SYS_CREATION_CLASS, string, COMPUTER_SYSTEM, - cim_true, inst, errp); - } - - if (*errp == 0) { - util_doProperty(SYSTEM, string, hostName, cim_true, inst, errp); - } - - if (*errp != 0) { - util_handleError(DRIVE_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, cim_getLastError(), errp); - cim_freeInstance(inst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - /* add the instance to the instance list */ - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - util_handleError(DRIVE_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, cim_getLastError(), errp); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - - have_instances = 1; - } - - if (!have_instances) { - cim_freeInstanceList(instList); - instList = (CCIMInstanceList *)NULL; - } - - return (instList); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/common/logicaldisk_descriptors.c b/usr/src/cmd/wbem/provider/c/wbem_disk/common/logicaldisk_descriptors.c deleted file mode 100644 index ad80309dda..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/common/logicaldisk_descriptors.c +++ /dev/null @@ -1,404 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <unistd.h> -#include <strings.h> -#include <stdlib.h> -#include <errno.h> -#include <netdb.h> -#include <cimapi.h> -#include <libnvpair.h> -#include <md5.h> - -#include "libdiskmgt.h" -#include "providerNames.h" -#include "messageStrings.h" -#include "cimKeys.h" -#include "util.h" - -/* - * Convert a single descriptor in to a Solaris_LogicalDisk instance - */ - -CCIMInstance * -logicaldisk_descriptor_toCCIMInstance(char *hostname, dm_descriptor_t desc, - char *provider, int *errp) -{ - - nvlist_t *nvlp; - nvpair_t *nvp; - CCIMInstance *inst = NULL; - CCIMException *ex; - dm_descriptor_t *dlist; - dm_descriptor_t *alist; - char *str; - char *drive; - int error; - char buf[100]; - - *errp = 0; - - /* Create instance of disk. */ - - if ((inst = cim_createInstance(provider)) == NULL) { - ex = cim_getLastError(); - util_handleError(LOGICALDISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, errp); - return ((CCIMInstance *)NULL); - } - - /* - * Get the alias name to display as the common name as well as - * the deviceid if for some reason this media does not have - * a name. - */ - dlist = dm_get_associated_descriptors(desc, DM_DRIVE, &error); - - if (error != 0) { - util_handleError(LOGICALDISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - alist = dm_get_associated_descriptors(dlist[0], DM_ALIAS, &error); - dm_free_descriptors(dlist); - - if (error != 0) { - util_handleError(LOGICALDISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - drive = dm_get_name(alist[0], &error); - dm_free_descriptors(alist); - - if (error != 0) { - util_handleError(LOGICALDISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_NAME_FAILURE, NULL, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - util_doProperty("Name", string, drive, cim_true, inst, errp); - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(LOGICALDISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - dm_free_name(drive); - return ((CCIMInstance *)NULL); - } - - /* Now, assign the deviceID */ - str = dm_get_name(desc, &error); - - if (error != 0) { - util_handleError(LOGICALDISK_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_NAME_FAILURE, NULL, errp); - cim_freeInstance(inst); - dm_free_name(drive); - return ((CCIMInstance *)NULL); - } - - if (str != NULL) { - util_doProperty(DEVICEID, string, str, cim_true, inst, errp); - dm_free_name(str); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(LOGICALDISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - dm_free_name(drive); - return ((CCIMInstance *)NULL); - } - - } else { - - util_doProperty(DEVICEID, string, drive, cim_true, inst, errp); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(LOGICALDISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - dm_free_name(drive); - return ((CCIMInstance *)NULL); - } - } - dm_free_name(drive); - - - /* add keys */ - - util_doProperty(CREATION_CLASS, string, LOGICAL_DISK, cim_true, - inst, errp); - - if (*errp == 0) { - util_doProperty(SYS_CREATION_CLASS, string, COMPUTER_SYSTEM, - cim_true, inst, errp); - } - - if (*errp == 0) { - util_doProperty(SYSTEM, string, hostname, cim_true, inst, errp); - } - - if (!errp != 0) { - ex = cim_getLastError(); - util_handleError(LOGICALDISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - nvlp = dm_get_attributes(desc, &error); - if (error != 0) { - util_handleError(LOGICALDISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_ATTR_FAILURE, NULL, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - if (nvlp == NULL) { - return (inst); - } - - for (nvp = nvlist_next_nvpair(nvlp, NULL); nvp != NULL; - nvp = nvlist_next_nvpair(nvlp, nvp)) { - - char *attrname; - uint32_t ui32; - uint64_t ui64; - - attrname = nvpair_name(nvp); - - /* If the attrname for this nvp is null, try the next one. */ - - if (attrname == NULL) { - continue; - } - - /* Loop through nvpair list and assign attrs to the CIMInstace. */ - - if (strcasecmp(attrname, DM_BLOCKSIZE) == 0) { - error = nvpair_value_uint32(nvp, &ui32); - if (error != 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(LOGICALDISK_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - error = snprintf(buf, sizeof (buf), "%u", ui32); - if (error < 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(LOGICALDISK_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - - util_doProperty("BlockSize", uint64, buf, cim_false, inst, - errp); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(LOGICALDISK_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - nvlist_free(nvlp); - return ((CCIMInstance *)NULL); - } - } else if (strcasecmp(attrname, DM_SIZE) == 0) { - error = nvpair_value_uint64(nvp, &ui64); - if (error < 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(LOGICALDISK_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - error = snprintf(buf, sizeof (buf), "%llu", ui64); - if (error < 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(LOGICALDISK_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - - util_doProperty("NumberOfBlocks", uint64, buf, cim_false, - inst, errp); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(LOGICALDISK_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - nvlist_free(nvlp); - return ((CCIMInstance *)NULL); - } - } - } /* End for */ - nvlist_free(nvlp); - - /* - * Get the associated drive descriptor to get the status information. - * about this media. - */ - - dlist = dm_get_associated_descriptors(desc, DM_DRIVE, &error); - if (error != 0) { - util_handleError(LOGICALDISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_ASSOC_FAILURE, NULL, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - - nvlp = dm_get_attributes(dlist[0], &error); - dm_free_descriptors(dlist); - if (error != 0) { - util_handleError(LOGICALDISK_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_ATTR_FAILURE, NULL, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - if (nvlp == NULL) { - return (inst); - } - - for (nvp = nvlist_next_nvpair(nvlp, NULL); nvp != NULL; - nvp = nvlist_next_nvpair(nvlp, nvp)) { - - char *attrname; - uint32_t ui32; - char *status; - char *statusinfo; - - attrname = nvpair_name(nvp); - /* If the attrname for this nvp is null, try the next one. */ - - if (attrname == NULL) { - continue; - } - - if (strcasecmp(attrname, DM_STATUS) == 0) { - error = nvpair_value_uint32(nvp, &ui32); - if (error < 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(LOGICALDISK_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - if (ui32 == 0) { - status = "Error"; - statusinfo = "4"; - } else { - status = "OK"; - statusinfo = "3"; - } - util_doProperty("Status", string, status, cim_false, - inst, errp); - util_doProperty("StatusInfo", uint16, statusinfo, cim_false, - inst, errp); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(DISK_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - nvlist_free(nvlp); - return ((CCIMInstance *)NULL); - } - } /* End ifelse */ - } /* end for */ - nvlist_free(nvlp); - return (inst); -} - -/* Convert the descriptor list to a CIMInstance List */ - -CCIMInstanceList* -logicaldisk_descriptors_toCCIMInstanceList(char *providerName, - dm_descriptor_t *dp, int *errp) -{ - CCIMInstance *inst; - CCIMInstanceList *instList = NULL; - CCIMException *ex; - dm_descriptor_t desc; - int error; - int i; - - *errp = 0; - - - /* If not descriptpr list, return an empty instance list. */ - if (dp == NULL) { - return ((CCIMInstanceList *)NULL); - } - - /* Create the instance list which will store the instances */ - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(LOGICALDISK_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, CREATE_INSTANCE_LIST_FAILURE, ex, errp); - return ((CCIMInstanceList *)NULL); - } - for (i = 0; dp[i] != NULL; i ++) { - desc = dp[i]; - inst = logicaldisk_descriptor_toCCIMInstance(hostName, desc, - providerName, &error); - if (error != 0) { - /* Error handling is done in the subfunction. */ - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - if (inst == NULL) { - continue; - } - - /* add the instance to the instance list */ - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(LOGICALDISK_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, ADD_INSTANCE_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - } - return (instList); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/common/mediapresent_descriptors.c b/usr/src/cmd/wbem/provider/c/wbem_disk/common/mediapresent_descriptors.c deleted file mode 100644 index aa0a685465..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/common/mediapresent_descriptors.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <unistd.h> -#include <strings.h> -#include <stdlib.h> -#include <errno.h> -#include <netdb.h> -#include <cimapi.h> -#include <libnvpair.h> -#include <md5.h> - -#include "libdiskmgt.h" -#include "providerNames.h" -#include "messageStrings.h" -#include "cimKeys.h" -#include "util.h" -#include "logicaldisk_descriptors.h" -#include "drive_descriptors.h" - -/* - * Convert a the antecedent and dependent descriptors to a - * Solaris_MediaPresent association instance - */ - -CCIMInstance * -mediapresent_descriptor_toCCIMInstance(char *hostname, dm_descriptor_t ant, - dm_descriptor_t dep, char *provider, int *errp) -{ - CCIMInstance *inst = NULL; - CCIMInstance *ant_inst; - CCIMInstance *dep_inst; - CCIMObjectPath *ant_op; - CCIMObjectPath *dep_op; - CCIMException *ex; - - *errp = 0; - - /* Create instance of media present assoc. */ - - if ((inst = cim_createInstance(provider)) == NULL) { - ex = cim_getLastError(); - util_handleError(PARTBASEDON_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, errp); - return ((CCIMInstance *)NULL); - } - - /* - * Now get the object path for the REF pointers. - */ - - ant_inst = drive_descriptor_toCCIMInstance(hostname, ant, - DISK_DRIVE, errp); - - if (*errp != 0) { - util_handleError(MEDIAPRES_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, MEDIAPRES_DESC_TO_INSTANCE_FAILURE, NULL, - errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - dep_inst = logicaldisk_descriptor_toCCIMInstance(hostname, dep, - LOGICAL_DISK, errp); - - if (*errp != 0) { - util_handleError(MEDIAPRES_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, MEDIAPRES_DESC_TO_INSTANCE_FAILURE, - NULL, errp); - cim_freeInstance(inst); - cim_freeInstance(ant_inst); - return ((CCIMInstance *)NULL); - } - - /* - * Get the object paths that are represented by these instances. - * Add these properties to the association instance. - */ - - ant_op = cim_createObjectPath(ant_inst); - dep_op = cim_createObjectPath(dep_inst); - cim_freeInstance(ant_inst); - cim_freeInstance(dep_inst); - - if (ant_op == NULL || dep_op == NULL) { - ex = cim_getLastError(); - util_handleError(PARTBASEDON_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, CREATE_OBJECT_PATH_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - - util_doReferenceProperty(ANTECEDENT, ant_op, cim_true, inst, errp); - cim_freeObjectPath(ant_op); - - util_doReferenceProperty(DEPENDENT, dep_op, cim_true, inst, errp); - cim_freeObjectPath(dep_op); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(PARTBASEDON_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - util_doProperty("FixedMedia", boolean, "1", cim_false, inst, errp); - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(MEDIAPRES_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - return (inst); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/common/methods.c b/usr/src/cmd/wbem/provider/c/wbem_disk/common/methods.c deleted file mode 100644 index 72489a3dbe..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/common/methods.c +++ /dev/null @@ -1,1122 +0,0 @@ -/* - * 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 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/wait.h> -#include <errno.h> -#include <cimlogsvc.h> -#include <cimauthcheck.h> -#include <sys/param.h> -#include "libdiskmgt.h" -#include "messageStrings.h" -#include "providerNames.h" -#include "util.h" -#include "methods.h" - -static int add_fdisk_props(ulong_t *ret_array, int part_num, - dm_descriptor_t d); -static CIMBool build_fdisk_file(char *fdisk_file, - CCIMPropertyList *params); -static CIMBool build_fmt_file(char *fmt_file, - CCIMPropertyList *params); -static CIMBool execute_cmd(char *command_line, char *err_file); -static CIMBool check_rights(char *provider); -static void convert_flag(long flag, char *flag_buf, int len); -static CCIMProperty *create_result(char *status); -static CCIMProperty *create_result_out(char *status, - CCIMPropertyList *outParams); -static int disk_geometry(char *media_name, ulong_t *geometry); -static CIMBool get_devpath(CCIMObjectPath *op, char *devpath, int len); -static cimchar *get_prop_val(CCIMProperty *prop); -static dm_descriptor_t *get_partition_descs(CCIMObjectPath *op); -static void make_fdisk_path(char *devpath); - -#define DATALEN 256 -#define CMDLEN 2048 -#define NUM_GEOM_ELEMENTS 7 - -/* - * This method formats the disk drive identified by CIMObjectPath - * based on the values in inParams - */ - -CCIMProperty * -create_partitions(CCIMPropertyList *params, CCIMObjectPath *op) -{ - char devpath[MAXPATHLEN]; - char fmt_file[L_tmpnam]; - char command_line[CMDLEN]; - int len; - int error; - - if (!check_rights("Solaris_Disk") || op == NULL || params == NULL) { - return (create_result(PROPFALSE)); - } - - if (get_devpath(op, devpath, sizeof (devpath)) == cim_false) { - util_handleError(INVOKE_METHOD, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return (create_result(PROPFALSE)); - } - - /* Create a format data file to be used by the fmthard command. */ - if (build_fmt_file(fmt_file, params) == cim_false) { - /* last error is set in build_fmt_file function */ - util_removeFile(fmt_file); - return (create_result(PROPFALSE)); - } - - /* Create 'fmthard' command line */ - len = snprintf(command_line, sizeof (command_line), - "/usr/sbin/fmthard -s %s %s 2> /dev/null", fmt_file, devpath); - - if (len < 0 || (len + 1) > sizeof (command_line)) { - util_handleError(INVOKE_METHOD, CIM_ERR_FAILED, - CIM_ERR_FAILED, NULL, &error); - util_removeFile(fmt_file); - return (create_result(PROPFALSE)); - } - - /* Execute the command. */ - if (!execute_cmd(command_line, "/dev/null")) { - util_removeFile(fmt_file); - return (create_result(PROPFALSE)); - } - - util_removeFile(fmt_file); - return (create_result(PROPTRUE)); -} - -CCIMProperty * -create_filesystem(CCIMObjectPath *op) -{ - char devpath[MAXPATHLEN]; - char command_line[CMDLEN]; - int len; - int error; - - /* check to make sure caller has admin write rights */ - if (!check_rights("Solaris_DiskPartition")) { - return (create_result(PROPFALSE)); - } - - if (get_devpath(op, devpath, sizeof (devpath)) == cim_false) { - util_handleError(INVOKE_METHOD, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return (create_result(PROPFALSE)); - } - - /* Create 'newfs' command line */ - len = snprintf(command_line, sizeof (command_line), - "echo y | /usr/sbin/newfs %s 2>/dev/null", devpath); - - if (len < 0 || (len + 1) > sizeof (command_line)) { - util_handleError(INVOKE_METHOD, CIM_ERR_FAILED, - CIM_ERR_FAILED, NULL, &error); - return (create_result(PROPFALSE)); - } - - /* Execute the command. */ - if (!execute_cmd(command_line, "/dev/null")) { - return (create_result(PROPFALSE)); - } - - return (create_result(PROPTRUE)); -} - -/* - * Function: create_fdisk_partitions - * - * Parameters: params - CCIMPropertyList pointer that dereferences - * to a list of not less than 4 or more than 16 CCIMProperty - * values. Number of CCIMProperty values must be a multiple - * of 4. - * op - CCIMObjectPath pointer that points to the object path - * of the device to fdisk. - * - * Returns: Returns a CCIMProperty pointer. The CCIMProperty referenced - * by the pointer will contain an mValue of cim_true for - * success or cim_false on failure. - * - * Description: Executes the fdisk command on the device pointed to my 'op' - * with the parameters provided in 'params'. - * - * Notes: The calling program is responsible for releasing the memory - * used by the returned CCIMProperty. - */ -CCIMProperty * -create_fdisk_partitions(CCIMPropertyList *params, CCIMObjectPath *op) -{ - char devpath[MAXPATHLEN]; - char fdisk_file[L_tmpnam]; - char err_file[L_tmpnam]; - char command_line[CMDLEN]; - int len; - int error; - - if (!check_rights("Solaris_Disk") || - op == NULL || params == NULL) { - return (create_result(PROPFALSE)); - } - - if (get_devpath(op, devpath, sizeof (devpath)) == cim_false) { - util_handleError(INVOKE_METHOD, CIM_ERR_INVALID_PARAMETER, - CIM_ERR_FAILED, NULL, &error); - return (create_result(PROPFALSE)); - } - make_fdisk_path(devpath); - - /* Create a fdisk data file to be used by the fdisk command. */ - if (build_fdisk_file(fdisk_file, params) == cim_false) { - /* last error is set in build_fdisk_file function */ - util_removeFile(fdisk_file); - return (create_result(PROPFALSE)); - } - - (void) tmpnam(err_file); - - /* - * Build the fdisk command line. Some combinations of - * parameters can cause fdisk to output a message and wait - * for a y/n response, echo'ing an 'n' and piping it to - * fdisk solves this problem. - * - * Using the form of fdisk (-F) that takes partition information - * from a disk file so that multiple partitions can be created - * by one request. - */ - - len = snprintf(command_line, sizeof (command_line), - "echo n | /usr/sbin/fdisk -F %s %s 2> %s", - fdisk_file, devpath, err_file); - - if (len < 0 || (len + 1) > sizeof (command_line)) { - util_handleError(INVOKE_METHOD, CIM_ERR_FAILED, - NULL, NULL, &error); - util_removeFile(fdisk_file); - return (create_result(PROPFALSE)); - } - - /* Execute the command. */ - if (!execute_cmd(command_line, err_file)) { - util_removeFile(fdisk_file); - return (create_result(PROPFALSE)); - } - - util_removeFile(fdisk_file); - return (create_result(PROPTRUE)); -} - -/* - * Function: create_default_fdisk_partition - * - * Parameters: op - CCIMObjectPath pointer that points to the object path - * of the device to fdisk. - * - * Returns: Returns a CCIMProperty pointer. The CCIMProperty referenced - * by the pointer will contain an mValue of cim_true for - * success or cim_false on failure. - * - * Description: Executes the fdisk command on the device pointed to my 'op' - * with the -B parameter. - * - * Notes: The calling program is responsible for releasing the memory - * used by the returned CCIMProperty. - */ -CCIMProperty * -create_default_fdisk_partition(CCIMObjectPath *op) -{ - char devpath[MAXPATHLEN]; - char err_file[L_tmpnam]; - char command_line[CMDLEN]; - int len; - int error; - - /* This function is called from Solaris_DiskDrive, not Solaris_Disk. */ - if (!check_rights("Solaris_DiskDrive") || op == NULL) { - return (create_result(PROPFALSE)); - } - - if (get_devpath(op, devpath, sizeof (devpath)) == cim_false) { - util_handleError(INVOKE_METHOD, CIM_ERR_INVALID_PARAMETER, - CIM_ERR_FAILED, NULL, &error); - return (create_result(PROPFALSE)); - } - make_fdisk_path(devpath); - - (void) tmpnam(err_file); - - /* - * Build the fdisk command line. Some combinations of - * parameters can cause fdisk to output a message and wait - * for a y/n response, echo'ing an 'n' and piping it to - * fdisk solves this problem. - * - * Using the form of fdisk (-F) that takes partition information - * from a disk file so that multiple partitions can be created - * by one request. - */ - - len = snprintf(command_line, sizeof (command_line), - "echo n | /usr/sbin/fdisk -B %s 2> %s", - devpath, err_file); - - if (len < 0 || (len + 1) > sizeof (command_line)) { - util_handleError(INVOKE_METHOD, CIM_ERR_FAILED, - NULL, NULL, &error); - return (create_result(PROPFALSE)); - } - - /* Execute the command. */ - if (!execute_cmd(command_line, err_file)) { - return (create_result(PROPFALSE)); - } - - return (create_result(PROPTRUE)); -} - -/* - * Function: writeVolumeName - * - * Parameters: params - CCIMPropertyList pointer. Property list - * containing the new disk label name. - * op - CCIMObjectPath pointer. Object path containing - * the deviceId of the disk to label. - * - * Returns: Returns a CCIMProperty pointer. The CCIMProperty referenced - * by the pointer will contain an mValue of cim_true for - * success or cim_false on failure. - * - * Description: Executes the fmthard -n volume_name command on the device - * pointed to by 'op'. - */ -CCIMProperty * -label_disk(CCIMPropertyList *params, CCIMObjectPath *op) -{ - char devpath[MAXPATHLEN]; - char command_line[CMDLEN]; - int len; - cimchar *label; - int error; - - if (!check_rights("Solaris_Disk") || - op == NULL || params == NULL) { - return (create_result(PROPFALSE)); - } - - if (get_devpath(op, devpath, sizeof (devpath)) == cim_false) { - util_handleError(INVOKE_METHOD, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return (create_result(PROPFALSE)); - } - - /* Extract the label from the input parameters */ - if ((label = get_prop_val(params->mDataObject)) == NULL) { - return (create_result(PROPFALSE)); - } - if (strlen(label) > 8) { - util_handleError(INVOKE_METHOD, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return (create_result(PROPFALSE)); - } - - /* Build the command line to execute */ - - len = snprintf(command_line, sizeof (command_line), - "/usr/sbin/fmthard -n '%s' %s 2> /dev/null", label, devpath); - - if (len < 0 || (len + 1) > sizeof (command_line)) { - util_handleError(INVOKE_METHOD, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return (create_result(PROPFALSE)); - } - - /* Execute the command. */ - if (!execute_cmd(command_line, "/dev/null")) { - return (create_result(PROPFALSE)); - } - return (create_result(PROPTRUE)); -} - -CCIMProperty * -get_disk_geometry(CCIMPropertyList *out, CCIMObjectPath *op) -{ - CCIMProperty *prop = NULL; - CCIMPropertyList *prop_list = NULL; - ulong_t geometry[NUM_GEOM_ELEMENTS]; - char *array_str; - int error; - - /* - * Don't use get_devpath since we are going through the API. - * Parse the object path to get the media name to pass in. - */ - if (op != NULL) { - prop_list = op->mKeyProperties; - } - - for (; prop_list; prop_list = prop_list->mNext) { - - if (((prop = prop_list->mDataObject) != NULL && - prop->mName != NULL && - strcasecmp(prop->mName, "Tag")) == 0) { - break; - } - } - - if (prop == NULL || prop->mValue == NULL) { - return (create_result(PROPFALSE)); - } - - cim_logDebug("get_disk_geometry", "%s", prop->mValue); - error = disk_geometry(prop->mValue, geometry); - if (error != 0) { - /* We have to put something in the out params when we fail. */ - ulong_t dummy [] = {0}; - char *array_str; - CCIMProperty *p; - - cim_logDebug("get_disk_geometry", "disk_geometry failed"); - if ((array_str = cim_encodeUint32Array(dummy, 1)) == NULL) { - util_handleError(DISK_DRIVE, CIM_ERR_FAILED, CIM_ERR_FAILED, - NULL, &error); - } else if ((p = cim_createProperty("geometry", - sint32_array, array_str, NULL, cim_false)) == NULL) { - free(array_str); - } else if ((cim_addPropertyToPropertyList(out, p)) == NULL) { - cim_freeProperty(p); - } - - return (create_result(PROPFALSE)); - } - - array_str = cim_encodeUint32Array(geometry, NUM_GEOM_ELEMENTS); - if (array_str == NULL) { - util_handleError(DISK_DRIVE, CIM_ERR_FAILED, CIM_ERR_FAILED, NULL, - &error); - return (create_result(PROPFALSE)); - } - - if ((prop = cim_createProperty("geometry", sint32_array, - array_str, NULL, cim_false)) == NULL) { - free(array_str); - return (create_result(PROPFALSE)); - } - - if ((cim_addPropertyToPropertyList(out, prop)) == NULL) { - cim_freeProperty(prop); - return (create_result(PROPFALSE)); - } - - return (create_result(PROPTRUE)); -} - -/* - * Function: getFdisk - * - * Parameters: outParams - CCIMPropertyList pointer. The output from - * the fdisk command is placed in this list. - * op - CCIMObjectPath pointer. The object path contains - * deviceID of the device to fdisk. - * - * Returns: Returns a CCIMProperty pointer. The CCIMProperty referenced - * by the pointer will contain an mValue of cim_true for - * success or cim_false on failure. - * - * Notes: The calling program is responsible for releasing the memory - * used by the returned CCIMProperty and the CCIMPropertyList - * pointed to by outParams. I don't know why we return only - * four of the possible values from fdisk. That is the way - * the Java provider worked and this provider was written to - * mimic the Java provider. - */ -CCIMProperty * -getFdisk(CCIMPropertyList *outParams, CCIMObjectPath *op) -{ - dm_descriptor_t *da; - int i; - int cnt; - ulong_t *ret_array; - int error; - char *array_str; - CCIMProperty *prop; - - if (cim_checkRights(DISK_DRIVE, DISK_READ_RIGHT, (void *) NULL) == - cim_false || op == NULL) { - return (create_result_out(PROPFALSE, outParams)); - } - - if ((da = get_partition_descs(op)) == NULL) { - return (create_result_out(PROPFALSE, outParams)); - } - - /* Count the number of fdisk partitions. */ - for (cnt = 0; da[cnt]; cnt++); - - /* We return 4 values for each partition. */ - cnt = cnt * 4; - - ret_array = (ulong_t *)calloc(cnt, sizeof (ulong_t)); - if (ret_array == NULL) { - dm_free_descriptors(da); - util_handleError(DISK_DRIVE, CIM_ERR_FAILED, CIM_ERR_FAILED, NULL, - &error); - return (create_result_out(PROPFALSE, outParams)); - } - - for (i = 0; da[i]; i++) { - if (!add_fdisk_props(ret_array, i, da[i])) { - dm_free_descriptors(da); - free(ret_array); - return (create_result_out(PROPFALSE, outParams)); - } - } - - dm_free_descriptors(da); - - array_str = cim_encodeUint32Array(ret_array, cnt); - - free(ret_array); - - if (array_str == NULL) { - util_handleError(DISK_DRIVE, CIM_ERR_FAILED, CIM_ERR_FAILED, NULL, - &error); - return (create_result_out(PROPFALSE, outParams)); - } - - if ((prop = cim_createProperty("FDiskPartitions", sint32_array, - array_str, NULL, cim_false)) == NULL) { - free(array_str); - return (create_result_out(PROPFALSE, outParams)); - } - - if ((cim_addPropertyToPropertyList(outParams, prop)) == NULL) { - cim_freeProperty(prop); - return (create_result_out(PROPFALSE, outParams)); - } - - return (create_result_out(PROPTRUE, outParams)); -} - -static int -add_fdisk_props(ulong_t *ret_array, int part_num, dm_descriptor_t d) -{ - int error; - nvlist_t *attrs; - int i; - int result = 1; - int offset; - static char *attr_names[] = { - DM_PTYPE, DM_BOOTID, DM_RELSECT, DM_NSECTORS, NULL}; - - attrs = dm_get_attributes(d, &error); - if (error != 0) { - return (0); - } - - /* figure out where in the array to put the values */ - offset = part_num * 4; - - for (i = 0; attr_names[i]; i++) { - uint32_t val32; - - if (nvlist_lookup_uint32(attrs, attr_names[i], &val32) != 0) { - result = 0; - break; - } - - ret_array[offset++] = val32; - } - - nvlist_free(attrs); - return (result); -} - -/* - * inParams - CCIMPropertyList pointer that dereferences to a list of not less - * than 4 or more than 16 CCIMProperty values. Number of CCIMProperty values - * must be a multiple of 4. - * - * The fdisk file will contain at least one line and not more than four lines - * in the following format: - * id:act:0:0:0:0:0:0:rsect:numsect. - * Values for id, act, rsect and numsect are taken from inParams. - */ -static CIMBool -build_fdisk_file(char *fdisk_file, CCIMPropertyList *params) -{ - FILE *fp; - int i; - int error; - ulong_t *vals; - int cnt = 0; - - if (params == NULL) { - util_handleError(INVOKE_METHOD, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return (cim_false); - } - - vals = cim_decodeUint32Array(get_prop_val(params->mDataObject), &cnt); - - if (cnt == 0 || cnt > 16 || (cnt % 4) != 0) { - util_handleError(INVOKE_METHOD, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return (cim_false); - } - - (void) tmpnam(fdisk_file); - - /* Open the temporary file for writing */ - if ((fp = util_openFile(fdisk_file, "w")) == NULL) { - util_handleError(INVOKE_METHOD, CIM_ERR_FAILED, NULL, - NULL, &error); - return (cim_false); - } - - /* - * Build a fdisk_file using 4 input parameters at a time. - * Check for all possible NULL parameters, parameter lists - * greater than 16 or not a multiple of 4. - */ - for (i = 0; i < cnt; i += 4) { - char line_buf[DATALEN]; - - (void) snprintf(line_buf, sizeof (line_buf), - "%lu:%lu:0:0:0:0:0:0:%lu:%lu\n", - vals[i], vals[i + 1], vals[i + 2], vals[i + 3]); - - /* Write the line of parameters to the fdisk_file */ - if ((fputs(line_buf, fp)) == EOF) { - util_handleError(INVOKE_METHOD, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - (void) util_closeFile(fp, fdisk_file); - return (cim_false); - } - } - - if ((util_closeFile(fp, fdisk_file)) == 0) { - return (cim_false); - } - - /* Caller must delete the temporary file */ - return (cim_true); -} - -/* - * inParams - CCIMPropertyList pointer that dereferences to a list of not less - * than 5 CCIMProperty values. The number of CCIMProperty values must be a - * multiple of 5. - * - * The file will contain at least one line in the following format: - * part tag flag start_sect part_size - * Values for partition, tag, flag, starting sector and partition size are - * taken from inParams. - */ -static CIMBool -build_fmt_file(char *fmt_file, CCIMPropertyList *params) -{ - ulong_t *vals; - int cnt = 0; - FILE *fp; - int error; - int i; - - if (params == NULL) { - util_handleError(INVOKE_METHOD, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return (cim_false); - } - - vals = cim_decodeUint32Array(get_prop_val(params->mDataObject), &cnt); - - if (cnt == 0 || (cnt % 5) != 0) { - util_handleError(INVOKE_METHOD, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return (cim_false); - } - - (void) tmpnam(fmt_file); - - /* Open the temporary file for writing */ - if ((fp = util_openFile(fmt_file, "w")) == NULL) { - util_handleError(INVOKE_METHOD, CIM_ERR_FAILED, NULL, - NULL, &error); - return (cim_false); - } - - /* - * Build a data file for the fmthard command. - * Each line of the file consists of: - * - * part_num tag flag start_sector partition_size - * - * The fmthard command requires the starting sector fall on - * a cylinder boundry. - */ - for (i = 0; i < cnt; i += 5) { - char line_buf[DATALEN]; - char flag_buf[DATALEN]; - - convert_flag(vals[i + 2], flag_buf, sizeof (flag_buf)); - - (void) snprintf(line_buf, sizeof (line_buf), - "%lu %lu %s %lu %lu\n", - vals[i], vals[i + 1], flag_buf, vals[i + 3], vals[i + 4]); - - /* Write the line of parameters to the fdisk_file */ - if ((fputs(line_buf, fp)) == EOF) { - util_handleError(INVOKE_METHOD, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - (void) util_closeFile(fp, fmt_file); - return (cim_false); - } - } - - if ((util_closeFile(fp, fmt_file)) == 0) { - return (cim_false); - } - - /* Caller must delete the file */ - return (cim_true); -} - -/* - * check_rights - * - * Performs check for 'admin write' rights. Handles error - * checking and reporting. Returns cim_true on success and - * cim_false on failure. - */ -static CIMBool -check_rights(char *provider) -{ - - int error; - - if ((cim_checkRights(provider, DISK_WRITE_RIGHT, (void *) NULL)) - == cim_false) { - util_handleError(INVOKE_METHOD, CIM_ERR_ACCESS_DENIED, NULL, - NULL, &error); - return (cim_false); - } - return (cim_true); -} - -/* - * Converts decimal flag value to hex string. - * Valid flag values are hex 00, 01, 10, 11. - * Places result in new cimchar array and returns - * pointer to array on success and NULL on failure. - */ -static void -convert_flag(long flag, char *flag_buf, int len) -{ - switch (flag) { - case 1: - (void) strlcpy(flag_buf, "0x01", len); - break; - case 16: - (void) strlcpy(flag_buf, "0x10", len); - break; - case 17: - (void) strlcpy(flag_buf, "0x11", len); - break; - default: - (void) strlcpy(flag_buf, "0x00", len); - break; - } -} - -static CCIMProperty * -create_result(char *status) -{ - return (cim_createProperty("result", boolean, status, NULL, cim_false)); -} - -static CCIMProperty * -create_result_out(char *status, CCIMPropertyList *outParams) -{ - if (strcmp(status, PROPFALSE) == 0) { - /* We have to put something in the out params when we fail. */ - ulong_t dummy [] = {0}; - int error; - char *array_str; - CCIMProperty *p; - - if ((array_str = cim_encodeUint32Array(dummy, 1)) == NULL) { - util_handleError(DISK_DRIVE, CIM_ERR_FAILED, CIM_ERR_FAILED, - NULL, &error); - } else if ((p = cim_createProperty("FDiskPartitions", - sint32_array, array_str, NULL, cim_false)) == NULL) { - free(array_str); - } else if ((cim_addPropertyToPropertyList(outParams, p)) == NULL) { - cim_freeProperty(p); - } - } - - return (create_result(status)); -} - -/* - * Return: 1 if fails, 0 if ok. geometry array contains: - * 0. SectorsPerCylinder - * 1. HeadsPerCylinder - * 2. BytesPerCylinder - * 3. PhysicalCylinders - * 4. DataCylinders - * 5. AlternateCylinders - * 6. ActualCylinders - */ -static int -disk_geometry(char *media_name, ulong_t *geometry) -{ - int error; - dm_descriptor_t d; - nvlist_t *attrs; - uint32_t val32; - - d = dm_get_descriptor_by_name(DM_MEDIA, media_name, &error); - if (error != 0) { - return (1); - } - - attrs = dm_get_attributes(d, &error); - dm_free_descriptor(d); - if (error != 0) { - return (1); - } - - /* - * If nsect is not in the attr list then we have media that does - * not have geometry info on it (e.g. EFI label). So return a failure - * in this case. Otherwise, just get the attrs we can and return - * their values. - */ - if (nvlist_lookup_uint32(attrs, DM_NSECTORS, &val32) != 0) { - nvlist_free(attrs); - return (1); - } - geometry[0] = val32; - val32 = 0; - - (void) nvlist_lookup_uint32(attrs, DM_NHEADS, &val32); - geometry[1] = val32; - val32 = 0; - (void) nvlist_lookup_uint32(attrs, DM_BLOCKSIZE, &val32); - geometry[2] = (geometry[1] * geometry[0]) * val32; - val32 = 0; - (void) nvlist_lookup_uint32(attrs, DM_NPHYSCYLINDERS, &val32); - geometry[3] = val32; - val32 = 0; - (void) nvlist_lookup_uint32(attrs, DM_NCYLINDERS, &val32); - geometry[4] = val32; - val32 = 0; - (void) nvlist_lookup_uint32(attrs, DM_NALTCYLINDERS, &val32); - geometry[5] = val32; - val32 = 0; - /* This one is probably there only in x86 machines. */ - (void) nvlist_lookup_uint32(attrs, DM_NACTUALCYLINDERS, &val32); - geometry[6] = val32; - - nvlist_free(attrs); - - return (0); -} - -/* - * Use popen to execute a command. Check for failures and - * handle error reporting. - * params: - * commandLine - the command to execute - * err_file - file that receives the stderr output from the - * command - * - * Returns cim_true on success, cim_false on failure. - * - * Note: function removes the error file if it exists - */ -static CIMBool -execute_cmd(char *command_line, char *err_file) -{ - FILE *cfp; - char buf[BUFSIZ]; - int result; - int error; - - cim_logDebug("execute_cmd", "%s ", command_line); - - /* Execute the fmthard command using popen */ - if ((cfp = popen(command_line, "r")) == NULL) { - util_handleError(INVOKE_METHOD, CIM_ERR_FAILED, NULL, - NULL, &error); - return (cim_false); - } - - /* Read the commands stdout and ignore it */ - while (fgets(buf, sizeof (buf), cfp) != NULL); - result = pclose(cfp); - - /* the buf will hold any error output */ - buf[0] = '\0'; - if (strcmp(err_file, "/dev/null") != 0) { - FILE *efp; - - if ((efp = util_openFile(err_file, "r")) == NULL) { - /* - * err_file should have been created when popen executed - * 'commandLine', so the openFile shouldn't fail. Treating it - * as a failure. - */ - util_handleError(INVOKE_METHOD, CIM_ERR_FAILED, NULL, - NULL, &error); - util_removeFile(err_file); - return (cim_false); - } - - (void) fgets(buf, sizeof (buf), efp); - cim_logDebug("execute_cmd", "err output: %s", buf); - (void) util_closeFile(efp, err_file); - util_removeFile(err_file); - } - - if (strlen(buf) != 0 || - (WIFEXITED(result) != 0 && WEXITSTATUS(result) != 0)) { - - cim_logDebug("execute_cmd", "exit: %d %d", WIFEXITED(result), - WEXITSTATUS(result)); - util_handleError(INVOKE_METHOD, CIM_ERR_FAILED, NULL, NULL, &error); - return (cim_false); - } - - return (cim_true); -} - -/* - * Take the deviceID property from the object path and get the raw devpath - * of the drive that corresponds to the given device ID. - */ -static CIMBool -get_devpath(CCIMObjectPath *op, char *devpath, int len) -{ - CCIMPropertyList *prop_list = NULL; - CCIMProperty *prop = NULL; - int error; - dm_descriptor_t dp; - dm_descriptor_t *da; - nvlist_t *attrs; - char *opath; - char *keyprop; - int type = 0; - char *p; - - if (strcasecmp(op->mName, "Solaris_Disk") == 0) { - keyprop = "Tag"; - type = 1; - } else if (strcasecmp(op->mName, "Solaris_DiskDrive") == 0) { - keyprop = "deviceid"; - type = 2; - } else if (strcasecmp(op->mName, "Solaris_DiskPartition") == 0) { - keyprop = "deviceid"; - type = 3; - } else { - return (cim_false); - } - - if (op != NULL) { - prop_list = op->mKeyProperties; - } - - for (; prop_list; prop_list = prop_list->mNext) { - - if (((prop = prop_list->mDataObject) != NULL && - prop->mName != NULL && strcasecmp(prop->mName, keyprop)) == 0) { - break; - } - } - - if (prop == NULL || prop->mValue == NULL) { - return (cim_false); - } - - switch (type) { - case 1: - dp = dm_get_descriptor_by_name(DM_MEDIA, prop->mValue, &error); - if (error != 0) { - return (cim_false); - } - - da = dm_get_associated_descriptors(dp, DM_DRIVE, &error); - dm_free_descriptor(dp); - if (error != 0 || da == NULL) { - return (cim_false); - } - - if (da[0] == NULL) { - dm_free_descriptors(da); - return (cim_false); - } - - attrs = dm_get_attributes(da[0], &error); - dm_free_descriptors(da); - if (error != 0) { - return (cim_false); - } - - if (nvlist_lookup_string(attrs, DM_OPATH, &opath) != 0) { - nvlist_free(attrs); - return (cim_false); - } - (void) strlcpy(devpath, opath, len); - nvlist_free(attrs); - break; - - case 2: - dp = dm_get_descriptor_by_name(DM_DRIVE, prop->mValue, &error); - if (error != 0) { - return (cim_false); - } - - attrs = dm_get_attributes(dp, &error); - dm_free_descriptor(dp); - if (error != 0) { - return (cim_false); - } - - if (nvlist_lookup_string(attrs, DM_OPATH, &opath) != 0) { - nvlist_free(attrs); - return (cim_false); - } - (void) strlcpy(devpath, opath, len); - nvlist_free(attrs); - break; - - case 3: - /* Convert the Solaris_DiskPartition value to rdsk. */ - p = strstr(prop->mValue, "/dsk/"); - if (p == NULL || (strlen(prop->mValue) + 2) > len) { - (void) strlcpy(devpath, prop->mValue, len); - } else { - p++; - *p = 0; - (void) strcpy(devpath, prop->mValue); /* copy up to dsk/ */ - *p = 'd'; - (void) strcat(devpath, "r"); /* prefix 'r' to dsk/ */ - (void) strcat(devpath, p); /* append the rest */ - } - break; - } - - return (cim_true); -} - -/* - * Take the deviceID property from the object path and get the raw devpath - * of the drive that corresponds to the given device ID. - */ -static dm_descriptor_t * -get_partition_descs(CCIMObjectPath *op) -{ - CCIMPropertyList *prop_list = NULL; - CCIMProperty *prop = NULL; - int error; - dm_descriptor_t dp; - dm_descriptor_t *da; - dm_descriptor_t *dpa; - - if (op != NULL) { - prop_list = op->mKeyProperties; - } - - for (; prop_list; prop_list = prop_list->mNext) { - - if (((prop = prop_list->mDataObject) != NULL && - prop->mName != NULL && - strcasecmp(prop->mName, "deviceid")) == 0) { - break; - } - } - - if (prop == NULL || prop->mValue == NULL) { - return (NULL); - } - - dp = dm_get_descriptor_by_name(DM_DRIVE, prop->mValue, &error); - if (error != 0) { - return (NULL); - } - - da = dm_get_associated_descriptors(dp, DM_MEDIA, &error); - dm_free_descriptor(dp); - if (error != 0 || da == NULL) { - return (NULL); - } - - if (da[0] == NULL) { - dm_free_descriptors(da); - return (NULL); - } - - dpa = dm_get_associated_descriptors(da[0], DM_PARTITION, &error); - dm_free_descriptors(da); - if (error != 0 || dpa == NULL) { - return (NULL); - } - - if (dpa[0] == NULL) { - dm_free_descriptors(dpa); - return (NULL); - } - - return (dpa); -} - -static cimchar * -get_prop_val(CCIMProperty *prop) -{ - - int error; - - if (prop == NULL || prop->mValue == NULL) { - util_handleError(INVOKE_METHOD, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((cimchar *)NULL); - } - return (prop->mValue); -} - -static void -make_fdisk_path(char *devpath) -{ - int len; - - len = strlen(devpath) - 2; - if (len <= 0 || *(devpath + len) != 's') { - return; - } - - *(devpath + len) = 'p'; -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/common/mpxiogroup_descriptors.c b/usr/src/cmd/wbem/provider/c/wbem_disk/common/mpxiogroup_descriptors.c deleted file mode 100644 index 18e13d40e9..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/common/mpxiogroup_descriptors.c +++ /dev/null @@ -1,214 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <stdarg.h> -#include <unistd.h> -#include <strings.h> -#include <stdlib.h> -#include <errno.h> -#include <netdb.h> -#include <cimapi.h> -#include <libnvpair.h> -#include <md5.h> - -#include "libdiskmgt.h" -#include "providerNames.h" -#include "messageStrings.h" -#include "cimKeys.h" -#include "util.h" - -/* - * Convert a single descriptor in to a Solaris_MPXIOGroup instance - */ - -CCIMInstance * -mpxiogroup_descriptor_toCCIMInstance(dm_descriptor_t desc, char *provider, - int *errp) -{ - - CCIMInstance *inst = NULL; - CCIMException *ex; - char *str; - int error; - - *errp = 0; - - /* Create instance of MPXIO Group */ - - if ((inst = cim_createInstance(provider)) == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, errp); - return ((CCIMInstance *)NULL); - } - - /* First, assign the deviceID */ - - str = dm_get_name(desc, &error); - - if (error != 0) { - util_handleError(MPXIO_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_NAME_FAILURE, NULL, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - if (str == NULL) { - util_handleError(MPXIO_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_NAME_FAILURE, NULL, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - util_doProperty(NAME, string, str, cim_true, inst, errp); - dm_free_name(str); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(MPXIO_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - /* add keys */ - - util_doProperty(CREATION_CLASS, string, provider, cim_true, - inst, errp); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(MPXIO_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - util_doProperty("RedundancyStatus", string, "2", cim_false, - inst, errp); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(MPXIO_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - return (inst); -} - -/* Convert the descriptor list to a CIMInstance List */ - -CCIMInstanceList* -mpxiogroup_descriptors_toCCIMInstanceList(char *providerName, - dm_descriptor_t *dp, int *errp) -{ - CCIMInstance *inst; - CCIMInstanceList *instList = NULL; - CCIMException *ex; - nvlist_t *nvlp; - char *type = NULL; - int i; - int error = 0; - - *errp = 0; - - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, CREATE_INSTANCE_LIST_FAILURE, ex, errp); - return ((CCIMInstanceList *)NULL); - } - - for (i = 0; dp[i] != NULL; i ++) { - - nvlp = dm_get_attributes(dp[i], errp); - if (*errp != 0) { - util_handleError(MPXIO_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstanceList *)NULL); - } - /* - * Create the instance list which will store the instances - * Only create this list when we know we have a valid - * instance to create - */ - - *errp = nvlist_lookup_string(nvlp, "ctype", &type); - if (*errp != 0) { - util_handleError(MPXIO_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - NVLIST_FAILURE, NULL, errp); - nvlist_free(nvlp); - return ((CCIMInstanceList *)NULL); - } - - error = nvlist_lookup_boolean(nvlp, "multiplex"); - - /* - * Only interested in mpxio controller types since they are - * the only ones that can be in an mpxiogroup relationship. - */ - - if (strcasecmp(type, "scsi") == 0) { - if (error != 0) { - continue; - } - } else { - continue; - } - - inst = mpxiogroup_descriptor_toCCIMInstance(dp[i], providerName, - errp); - if (*errp != 0) { - /* Error handling is done in the subfunction. */ - cim_freeInstanceList(instList); - nvlist_free(nvlp); - return ((CCIMInstanceList *)NULL); - } - - /* add the instance to the instance list */ - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, ADD_INSTANCE_FAILURE, ex, errp); - cim_freeInstance(inst); - nvlist_free(nvlp); - return ((CCIMInstanceList *)NULL); - } - } - nvlist_free(nvlp); - - if (instList->mDataObject == NULL) { - cim_freeInstanceList(instList); - instList = NULL; - } - return (instList); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/common/partbasedon_descriptors.c b/usr/src/cmd/wbem/provider/c/wbem_disk/common/partbasedon_descriptors.c deleted file mode 100644 index 2da9aff309..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/common/partbasedon_descriptors.c +++ /dev/null @@ -1,281 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <unistd.h> -#include <strings.h> -#include <stdlib.h> -#include <errno.h> -#include <netdb.h> -#include <cimapi.h> -#include <libnvpair.h> -#include <md5.h> - -#include "libdiskmgt.h" -#include "providerNames.h" -#include "messageStrings.h" -#include "cimKeys.h" -#include "util.h" -#include "logicaldisk_descriptors.h" -#include "partition_descriptors.h" - -/* - * Convert a the antecedent and dependent descriptors to a - * Solaris_DiskPartitionBasedOn & Solaris_DiskPartitionBasedOnFdisk - * association instance - */ - -CCIMInstance * -partbasedon_descriptor_toCCIMInstance(char *hostname, dm_descriptor_t ant, - dm_descriptor_t dep, char *provider, int *errp) -{ - nvlist_t *nvlp; - nvpair_t *nvp; - CCIMInstance *inst = NULL; - CCIMInstance *ant_inst; - CCIMInstance *dep_inst; - CCIMObjectPath *ant_op; - CCIMObjectPath *dep_op; - CCIMException *ex; - int error; - uint64_t size; /* need these to calculate ending addr */ - uint64_t startaddr; - uint64_t endaddr; - char attrval[100]; - int isFdisk = 0; - - *errp = 0; - - /* Create instance of partition based on assoc. */ - - if ((inst = cim_createInstance(provider)) == NULL) { - ex = cim_getLastError(); - util_handleError(PARTBASEDON_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, errp); - return ((CCIMInstance *)NULL); - } - - if ((strcasecmp(provider, DISKPART_BASEDONFDISK)) == 0) { - isFdisk = 1; - } - - /* - * Now get the object path for the REF pointers. - */ - - - if (isFdisk) { - ant_inst = partition_descriptor_toCCIMInstance(hostname, ant, - DISK_PARTITION, &error); - } else { - ant_inst = logicaldisk_descriptor_toCCIMInstance(hostname, ant, - LOGICAL_DISK, &error); - } - - if (error != 0) { - util_handleError(PARTBASEDON_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, PARTBASEDON_DESC_TO_INSTANCE_FAILURE, - NULL, &error); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - dep_inst = partition_descriptor_toCCIMInstance(hostname, dep, - DISK_PARTITION, &error); - - if (error != 0) { - util_handleError(PARTBASEDON_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, PARTBASEDON_DESC_TO_INSTANCE_FAILURE, - NULL, &error); - cim_freeInstance(inst); - cim_freeInstance(ant_inst); - return ((CCIMInstance *)NULL); - } - - /* - * Get the object paths that are represented by these instances. - * Add these properties to the association instance. - */ - - ant_op = cim_createObjectPath(ant_inst); - dep_op = cim_createObjectPath(dep_inst); - cim_freeInstance(ant_inst); - cim_freeInstance(dep_inst); - - if (ant_op == NULL || dep_op == NULL) { - ex = cim_getLastError(); - util_handleError(PARTBASEDON_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, CREATE_OBJECT_PATH_FAILURE, ex, &error); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - util_doReferenceProperty(ANTECEDENT, ant_op, cim_true, inst, errp); - util_doReferenceProperty(DEPENDENT, dep_op, cim_true, inst, errp); - cim_freeObjectPath(ant_op); - cim_freeObjectPath(dep_op); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(PARTBASEDON_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - /* - * Now get the other attributes we are interested in - */ - - nvlp = dm_get_attributes(dep, &error); - if (error != 0) { - util_handleError(PARTBASEDON_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - DM_GET_ATTR_FAILURE, NULL, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - if (nvlp == NULL) { - return (inst); - } - - for (nvp = nvlist_next_nvpair(nvlp, NULL); nvp != NULL; - nvp = nvlist_next_nvpair(nvlp, nvp)) { - - char *attrname; - uint64_t ui64; - uint32_t ui32; - - attrname = nvpair_name(nvp); - if (attrname == NULL) { - continue; - } - - if (strcasecmp(attrname, DM_SIZE) == 0) { - error = nvpair_value_uint64(nvp, &ui64); - if (error != 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(PARTBASEDON_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - size = ui64; - } else if (strcasecmp(attrname, DM_START) == 0) { - error = nvpair_value_uint64(nvp, &ui64); - if (error != 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(PARTBASEDON_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - - startaddr = ui64; - error = snprintf(attrval, sizeof (attrval), "%llu", ui64); - if (error < 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(PARTBASEDON_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - - util_doProperty("StartingAddress", uint64, attrval, cim_false, - inst, errp); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(PARTBASEDON_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - nvlist_free(nvlp); - return ((CCIMInstance *)NULL); - } - } else if (strcasecmp(attrname, DM_INDEX) == 0) { - error = nvpair_value_uint32(nvp, &ui32); - if (error != 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(PARTBASEDON_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - - error = snprintf(attrval, sizeof (attrval), "%u", ui32); - if (error < 0) { - cim_freeInstance(inst); - nvlist_free(nvlp); - util_handleError(PARTBASEDON_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - - util_doProperty("OrderIndex", uint32, attrval, cim_false, - inst, errp); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(PARTBASEDON_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - nvlist_free(nvlp); - return ((CCIMInstance *)NULL); - } - } - } - - nvlist_free(nvlp); - /* - * Now add the ending address attribute. Do this here because - * there is no guarantee about the order for how these name/value - * pairs are given and without the starting address we cannot - * calculate the ending address. - */ - - endaddr = startaddr + size; - error = snprintf(attrval, sizeof (attrval), "%llu", endaddr); - if (error < 0) { - cim_freeInstance(inst); - util_handleError(PARTBASEDON_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, DM_GET_ATTR_FAILURE, NULL, errp); - return ((CCIMInstance *)NULL); - } - - util_doProperty("EndingAddress", uint64, attrval, cim_false, inst, - errp); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(PARTBASEDON_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - return (inst); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/common/partition_descriptors.c b/usr/src/cmd/wbem/provider/c/wbem_disk/common/partition_descriptors.c deleted file mode 100644 index 0ce80537d2..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/common/partition_descriptors.c +++ /dev/null @@ -1,707 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <unistd.h> -#include <strings.h> -#include <stdlib.h> -#include <errno.h> -#include <netdb.h> -#include <cimapi.h> -#include <libnvpair.h> -#include <md5.h> - -#include "libdiskmgt.h" -#include "providerNames.h" -#include "messageStrings.h" -#include "cimKeys.h" -#include "util.h" - -static void do_alias_desc(CCIMInstance *inst, dm_descriptor_t desc, - int *errp); -static void do_drive_desc(CCIMInstance *inst, dm_descriptor_t desc, - int *errp); -static void do_media_desc(CCIMInstance *inst, dm_descriptor_t desc, - uint32_t *blocksize, uint64_t *blocks_per_cyl, int *errp); -static void do_misc_attrs(CCIMInstance *inst, int *errp, uint64_t size, - uint32_t starting_cylinder, uint32_t end_cylinder, - uint32_t ncylinders); -static void do_slice_desc(CCIMInstance *inst, char *hostname, - dm_descriptor_t desc, uint64_t *numblocks, uint32_t *bcyl, - uint32_t *ecyl, uint64_t *start, int *errp); -static void do_prop64(CCIMInstance *inst, char *name, uint64_t val, - int *errp); -static void do_prop32(CCIMInstance *inst, char *name, uint32_t val, - int *errp); -static dm_descriptor_t get_first_assoc(dm_descriptor_t desc, - dm_desc_type_t type, int *errp); -static CCIMInstance *fatal(CCIMInstance *inst, dm_descriptor_t desc, int *errp); - -/* - * Convert a single descriptor in to a Solaris_DiskPartition instance - */ - -CCIMInstance * -partition_descriptor_toCCIMInstance(char *hostname, dm_descriptor_t desc, - char *provider, int *errp) -{ - - CCIMInstance *inst = NULL; - dm_descriptor_t media_desc; - dm_descriptor_t drive_desc; - dm_descriptor_t alias_desc; - uint32_t ncylinders = 0; - uint32_t bcyl = 0; - uint32_t ecyl = 0; - uint32_t starting_cylinder = 0; - uint32_t end_cylinder = 0; - uint64_t start = 0; - uint64_t numblocks = 0; - uint32_t blocksize = 0; - uint64_t blocks_per_cyl = 0; - uint64_t size = 0; - int isFdisk = 0; - - *errp = 0; - - /* Create instance of disk drive. */ - if ((inst = cim_createInstance(provider)) == NULL) - return (fatal(inst, NULL, errp)); - - do_slice_desc(inst, hostname, desc, &numblocks, &bcyl, &ecyl, &start, - errp); - if (*errp != 0) - return (fatal(inst, NULL, errp)); - - media_desc = get_first_assoc(desc, DM_MEDIA, errp); - if (*errp != 0) - return (fatal(inst, NULL, errp)); - - if (media_desc == NULL) { - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - do_media_desc(inst, media_desc, &blocksize, &blocks_per_cyl, errp); - if (*errp != 0) - return (fatal(inst, media_desc, errp)); - - drive_desc = get_first_assoc(media_desc, DM_DRIVE, errp); - if (*errp != 0) - return (fatal(inst, media_desc, errp)); - dm_free_descriptor(media_desc); - - if (drive_desc == NULL) { - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - do_drive_desc(inst, drive_desc, errp); - if (*errp != 0) - return (fatal(inst, drive_desc, errp)); - - alias_desc = get_first_assoc(drive_desc, DM_ALIAS, errp); - if (*errp != 0) - return (fatal(inst, drive_desc, errp)); - dm_free_descriptor(drive_desc); - - if (alias_desc == NULL) { - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - do_alias_desc(inst, alias_desc, errp); - if (*errp != 0) - return (fatal(inst, alias_desc, errp)); - dm_free_descriptor(alias_desc); - - if (dm_get_type(desc) == DM_PARTITION) { - isFdisk = 1; - } - - /* Partition size in bytes */ - size = (uint64_t)(numblocks * blocksize); - - /* Starting cylinder */ - if (isFdisk) { - starting_cylinder = bcyl; - } else if (blocks_per_cyl != 0) { - starting_cylinder = (uint32_t)(start / blocks_per_cyl); - } - - /* Total cylinders */ - if (isFdisk) { - ncylinders = (ecyl - bcyl) + 1; - } else if (blocks_per_cyl != 0) { - ncylinders = (uint32_t)(numblocks / blocks_per_cyl); - } - - /* ending cylinder */ - - if (isFdisk) { - end_cylinder = ecyl; - } else { - if (ncylinders == 0) { - end_cylinder = 0; - } else { - end_cylinder = (uint32_t)((ncylinders + starting_cylinder) - 1); - } - } - - do_misc_attrs(inst, errp, size, starting_cylinder, end_cylinder, - ncylinders); - if (*errp != 0) - return (fatal(inst, NULL, errp)); - - return (inst); -} - -/* Convert the descriptor list to a CIMInstance List */ - -CCIMInstanceList* -partition_descriptors_toCCIMInstanceList(char *providerName, - dm_descriptor_t *dp, dm_descriptor_t *fdp, int *errp) -{ - CCIMInstance *inst; - CCIMInstanceList *instList = NULL; - CCIMException *ex; - dm_descriptor_t desc; - int i; - int error; - - *errp = 0; - - - /* If not descriptpr list, return a NULL instance list. */ - if (dp == NULL && fdp == NULL) { - return ((CCIMInstanceList *)NULL); - } - - /* Create the instance list which will store the instances */ - instList = cim_createInstanceList(); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(PARTITION_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, CREATE_INSTANCE_LIST_FAILURE, ex, errp); - return ((CCIMInstanceList *)NULL); - } - - - for (i = 0; dp != NULL && dp[i] != NULL; i ++) { - desc = dp[i]; - inst = partition_descriptor_toCCIMInstance(hostName, desc, - providerName, &error); - if (error != 0) { - /* Error logging and exception handling done in sub function */ - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - if (inst == NULL) { - continue; - } - - /* add the instance to the instance list */ - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(PARTITION_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, ADD_INSTANCE_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - } - for (i = 0; fdp != NULL && fdp[i] != NULL; i ++) { - desc = fdp[i]; - inst = partition_descriptor_toCCIMInstance(hostName, desc, - providerName, &error); - if (error != 0) { - /* Error logging and exception handling done in sub function */ - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - if (inst == NULL) { - continue; - } - - /* add the instance to the instance list */ - instList = cim_addInstance(instList, inst); - if (instList == NULL) { - ex = cim_getLastError(); - util_handleError(PARTITION_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, ADD_INSTANCE_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstanceList *)NULL); - } - } - return (instList); -} - -static void -do_slice_desc(CCIMInstance *inst, char *hostname, dm_descriptor_t desc, - uint64_t *numblocks, uint32_t *bcyl, uint32_t *ecyl, uint64_t *start, - int *errp) -{ - nvlist_t *nvlp; - nvpair_t *nvp; - char *str; - char *ptype = "2"; /* default is vtoc */ - char *type = "3"; /* default is vtoc */ - char *validFS = "0"; - uint32_t ui32; - - *errp = 0; - *numblocks = 0; - *bcyl = 0; - *ecyl = 0; - *start = 0; - - str = dm_get_name(desc, errp); - if (*errp != 0) - return; - - if (str == NULL) { - *errp = ENOENT; - return; - } - - util_doProperty(DEVICEID, string, str, cim_true, inst, errp); - dm_free_name(str); - if (*errp != 0) - return; - - if (dm_get_type(desc) == DM_PARTITION) { - ptype = "3"; - } - - /* add keys */ - - util_doProperty(CREATION_CLASS, string, DISK_PARTITION, cim_true, - inst, errp); - if (*errp != 0) - return; - - util_doProperty(SYS_CREATION_CLASS, string, COMPUTER_SYSTEM, cim_true, - inst, errp); - if (*errp != 0) - return; - - util_doProperty(SYSTEM, string, hostname, cim_true, inst, errp); - if (*errp != 0) - return; - - nvlp = dm_get_attributes(desc, errp); - if (*errp == ENODEV || nvlp == NULL) { - /* not a failure, just a sparse slice */ - *errp = 0; - return; - } - - if (*errp != 0) - return; - - /* - * Now get the other attributes we are interested in. - */ - for (nvp = nvlist_next_nvpair(nvlp, NULL); nvp != NULL; - nvp = nvlist_next_nvpair(nvlp, nvp)) { - - char *attrname; - - attrname = nvpair_name(nvp); - if (attrname == NULL) { - continue; - } - - /* loop through the list and assign attrs to the CIMInstance. */ - - if (strcasecmp(attrname, DM_MTYPE) == 0) { - continue; - } - - if (strcasecmp(DM_SIZE, attrname) == 0) { - /* vtoc */ - *errp = nvpair_value_uint64(nvp, numblocks); - if (*errp != 0) - break; - - do_prop64(inst, "NumberOfBlocks", *numblocks, errp); - if (*errp != 0) - break; - - - } else if (strcasecmp(DM_NSECTORS, attrname) == 0) { - /* fdisk */ - *errp = nvpair_value_uint32(nvp, &ui32); - if (*errp != 0) - break; - - *numblocks = ui32; - do_prop64(inst, "NumberOfBlocks", *numblocks, errp); - if (*errp != 0) - break; - - } else if (strcasecmp(DM_BOOTID, attrname) == 0) { - /* fdisk */ - char *primary = "0"; - char *bootable = "0"; - - *errp = nvpair_value_uint32(nvp, &ui32); - if (*errp != 0) - break; - - if (ui32 == 128) { - primary = "1"; - bootable = "1"; - type = "2"; - } else { - type = "1"; - } - - util_doProperty("PrimaryPartition", boolean, primary, cim_false, - inst, errp); - if (*errp != 0) - break; - - util_doProperty("Bootable", boolean, bootable, cim_false, inst, - errp); - if (*errp != 0) - break; - - } else if (strcasecmp(DM_START, attrname) == 0) { - *errp = nvpair_value_uint64(nvp, start); - if (*errp != 0) - break; - - } else if (strcasecmp(DM_TAG, attrname) == 0) { - int error; - char buf[100]; - - *errp = nvpair_value_uint32(nvp, &ui32); - if (*errp != 0) - break; - - error = snprintf(buf, sizeof (buf), "%u", ui32); - if (error < 0) { - *errp = error; - break; - } - - util_doProperty("Tag", uint8, buf, cim_false, inst, errp); - if (*errp != 0) - break; - - } else if (strcasecmp(DM_FLAG, attrname) == 0) { - int error; - char buf[100]; - - *errp = nvpair_value_uint32(nvp, &ui32); - if (*errp != 0) - break; - - error = snprintf(buf, sizeof (buf), "%u", ui32); - if (error < 0) { - *errp = error; - break; - } - - util_doProperty("Flag", uint8, buf, cim_false, inst, errp); - if (*errp != 0) - break; - - } else if (strcasecmp(DM_MOUNTPOINT, attrname) == 0) { - validFS = "1"; - - } else if (strcasecmp(attrname, DM_BCYL) == 0) { - *errp = nvpair_value_uint32(nvp, bcyl); - if (*errp != 0) - break; - - } else if (strcasecmp(attrname, DM_ECYL) == 0) { - *errp = nvpair_value_uint32(nvp, ecyl); - if (*errp != 0) - break; - - } else if (strcasecmp(attrname, DM_PTYPE) == 0) { - int error; - char buf[100]; - - *errp = nvpair_value_uint32(nvp, &ui32); - if (*errp != 0) - break; - - error = snprintf(buf, sizeof (buf), "%u", ui32); - if (error < 0) { - *errp = error; - break; - } - - util_doProperty("PartitionSubtype", uint16, buf, cim_false, - inst, errp); - if (*errp != 0) - break; - - } else if (strcasecmp(DM_EFI, attrname) == 0) { - ptype = "4"; - } - - } /* end for */ - - if (*errp == 0) { - util_doProperty("ValidFileSystem", boolean, validFS, cim_false, - inst, errp); - } - - if (*errp == 0) { - util_doProperty("SolarisPartitionType", uint16, ptype, cim_false, - inst, errp); - } - - if (*errp == 0) { - util_doProperty("PartitionType", uint16, type, cim_false, inst, - errp); - } - - nvlist_free(nvlp); -} - -static void -do_media_desc(CCIMInstance *inst, dm_descriptor_t desc, uint32_t *blocksize, - uint64_t *blocks_per_cyl, int *errp) -{ - nvlist_t *nvlp; - nvpair_t *nvp; - uint32_t nheads = 0; - uint32_t nsecs = 0; - - *errp = 0; - *blocksize = 0; - - nvlp = dm_get_attributes(desc, errp); - if (*errp == ENODEV || nvlp == NULL) { - *errp = 0; - return; - } - - if (*errp != 0) - return; - - for (nvp = nvlist_next_nvpair(nvlp, NULL); nvp != NULL; - nvp = nvlist_next_nvpair(nvlp, nvp)) { - - char *attrname; - - attrname = nvpair_name(nvp); - if (attrname == NULL) { - continue; - } - - if (strcasecmp(attrname, DM_BLOCKSIZE) == 0) { - *errp = nvpair_value_uint32(nvp, blocksize); - if (*errp != 0) - break; - - do_prop64(inst, "BlockSize", (uint64_t)*blocksize, errp); - if (*errp != 0) - break; - - } else if (strcasecmp(DM_NHEADS, attrname) == 0) { - *errp = nvpair_value_uint32(nvp, &nheads); - if (*errp != 0) - break; - - } else if (strcasecmp(DM_NSECTORS, attrname) == 0) { - *errp = nvpair_value_uint32(nvp, &nsecs); - if (*errp != 0) - break; - } - - } /* end for */ - - nvlist_free(nvlp); - - *blocks_per_cyl = nheads * nsecs; -} - -static void -do_drive_desc(CCIMInstance *inst, dm_descriptor_t desc, int *errp) -{ - nvlist_t *nvlp; - uint32_t ui32; - char *status; - char *statusinfo; - - *errp = 0; - - nvlp = dm_get_attributes(desc, errp); - if (*errp != 0) - return; - - *errp = nvlist_lookup_uint32(nvlp, "status", &ui32); - if (*errp != 0) { - nvlist_free(nvlp); - return; - } - - if (ui32 == 0) { - statusinfo = "4"; - status = "Error"; - } else { - statusinfo = "3"; - status = "OK"; - } - - util_doProperty("StatusInfo", uint16, statusinfo, cim_false, inst, - errp); - if (*errp != 0) { - nvlist_free(nvlp); - return; - } - - util_doProperty("Status", string, status, cim_false, inst, errp); - if (*errp != 0) { - nvlist_free(nvlp); - return; - } - - nvlist_free(nvlp); -} - -static void -do_alias_desc(CCIMInstance *inst, dm_descriptor_t desc, int *errp) -{ - char *str; - - *errp = 0; - - str = dm_get_name(desc, errp); - - if (*errp != 0) - return; - - if (str != NULL) { - util_doProperty("DiskID", string, str, cim_false, inst, errp); - dm_free_name(str); - } -} - -static void -do_misc_attrs(CCIMInstance *inst, int *errp, uint64_t size, - uint32_t starting_cylinder, uint32_t end_cylinder, uint32_t ncylinders) -{ - do_prop64(inst, "PartitionSize", size, errp); - if (*errp != 0) - return; - - do_prop32(inst, "StartCylinder", starting_cylinder, errp); - if (*errp != 0) - return; - - do_prop32(inst, "TotalCylinders", ncylinders, errp); - if (*errp != 0) - return; - - do_prop32(inst, "EndCylinder", end_cylinder, errp); -} - -static void -do_prop64(CCIMInstance *inst, char *name, uint64_t val, int *errp) -{ - char buf[100]; - int error; - - error = snprintf(buf, sizeof (buf), "%llu", val); - if (error < 0) { - *errp = error; - return; - } - - util_doProperty(name, uint64, buf, cim_false, inst, errp); -} - -static void -do_prop32(CCIMInstance *inst, char *name, uint32_t val, int *errp) -{ - char buf[100]; - int error; - - error = snprintf(buf, sizeof (buf), "%u", val); - if (error < 0) { - *errp = error; - return; - } - - util_doProperty(name, uint32, buf, cim_false, inst, errp); -} - -static dm_descriptor_t -get_first_assoc(dm_descriptor_t desc, dm_desc_type_t type, int *errp) -{ - dm_descriptor_t *da; - dm_descriptor_t d; - int i; - - da = dm_get_associated_descriptors(desc, type, errp); - - if (*errp == ENODEV || da == NULL || da[0] == NULL) { - *errp = 0; - return (NULL); - } - - if (*errp != 0) { - return (NULL); - } - - d = da[0]; - - /* there shouldn't be any more, but just in case */ - for (i = 1; da[i]; i++) { - dm_free_descriptor(da[i]); - } - free(da); - - return (d); -} - -static CCIMInstance * -fatal(CCIMInstance *inst, dm_descriptor_t desc, int *errp) -{ - CCIMException *ex; - - ex = cim_getLastError(); - util_handleError(PARTITION_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - if (inst != NULL) { - cim_freeInstance(inst); - } - if (desc != NULL) { - dm_free_descriptor(desc); - } - return ((CCIMInstance *)NULL); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/common/realizesdiskdrive_descriptors.c b/usr/src/cmd/wbem/provider/c/wbem_disk/common/realizesdiskdrive_descriptors.c deleted file mode 100644 index c5bceb6888..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/common/realizesdiskdrive_descriptors.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <unistd.h> -#include <strings.h> -#include <stdlib.h> -#include <errno.h> -#include <netdb.h> -#include <cimapi.h> -#include <libnvpair.h> -#include <md5.h> - -#include "libdiskmgt.h" -#include "providerNames.h" -#include "messageStrings.h" -#include "cimKeys.h" -#include "util.h" -#include "disk_descriptors.h" - -/* - * Convert a the antecedent object path and dependent descriptor to a - * Solaris_RealizesDiskDrive association instance - */ - -CCIMInstance * -realizesdiskdrive_descriptor_toCCIMInstance(char *hostname, - CCIMObjectPath *antOp, dm_descriptor_t dep, char *provider, int *errp) -{ - CCIMInstance *inst = NULL; - CCIMInstance *ant_inst; - CCIMInstance *dep_inst; - CCIMObjectPath *ant_op; - CCIMObjectPath *dep_op; - CCIMException *ex; - int error; - - *errp = 0; - - /* Create instance of realizesdiskdrive assoc. */ - - if ((inst = cim_createInstance(provider)) == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZESDD_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, errp); - return ((CCIMInstance *)NULL); - } - - /* - * Now get the object path for the REF pointers. - */ - - dep_inst = disk_descriptor_toCCIMInstance(hostname, dep, - DISK, &error); - - if (error != 0) { - util_handleError(REALIZESDD_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, - REALIZESDD_DESC_TO_INSTANCE_FAILURE, NULL, &error); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - /* - * Since there is no provider for the physical package, we must - * get the instance from the cimom. - */ - ant_inst = cimom_getInstance(antOp, cim_true, cim_false, cim_false, - cim_false, NULL, 0); - - if (ant_inst == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZESDD_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - GET_INSTANCE, ex, errp); - free(dep_inst); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - if (ant_inst->mClassName == NULL) { - free(dep_inst); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - - /* - * Get the object paths that are represented by these instances. - * Add these properties to the association instance. - */ - - ant_op = cim_createObjectPath(ant_inst); - dep_op = cim_createObjectPath(dep_inst); - cim_freeInstance(ant_inst); - cim_freeInstance(dep_inst); - - if (ant_op == NULL || dep_op == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZESDD_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - CREATE_OBJECT_PATH_FAILURE, ex, &error); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - util_doReferenceProperty(ANTECEDENT, ant_op, cim_true, inst, errp); - cim_freeObjectPath(ant_op); - - util_doReferenceProperty(DEPENDENT, dep_op, cim_true, inst, errp); - cim_freeObjectPath(dep_op); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(REALIZESEXTENT_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - return (inst); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/common/realizesextent_descriptors.c b/usr/src/cmd/wbem/provider/c/wbem_disk/common/realizesextent_descriptors.c deleted file mode 100644 index 08403ed8ca..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/common/realizesextent_descriptors.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <unistd.h> -#include <strings.h> -#include <stdlib.h> -#include <errno.h> -#include <netdb.h> -#include <cimapi.h> -#include <libnvpair.h> -#include <md5.h> - -#include "libdiskmgt.h" -#include "providerNames.h" -#include "messageStrings.h" -#include "cimKeys.h" -#include "util.h" -#include "logicaldisk_descriptors.h" -#include "disk_descriptors.h" - -/* - * Convert a the antecedent and dependent descriptors to a - * Solaris_RealizesExtent association instance - */ - -CCIMInstance * -realizesextent_descriptor_toCCIMInstance(char *hostname, dm_descriptor_t desc, - char *provider, int *errp) -{ - CCIMInstance *inst = NULL; - CCIMInstance *ant_inst; - CCIMInstance *dep_inst; - CCIMObjectPath *ant_op; - CCIMObjectPath *dep_op; - CCIMException *ex; - int error; - - *errp = 0; - - /* Create instance of realizesextent assoc. */ - - if ((inst = cim_createInstance(provider)) == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZESEXTENT_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, errp); - return ((CCIMInstance *)NULL); - } - - /* - * Now get the object path for the REF pointers. - */ - - ant_inst = disk_descriptor_toCCIMInstance(hostname, desc, DISK, &error); - - if (error != 0) { - util_handleError(REALIZESEXTENT_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - REALIZESEXT_DESC_TO_INSTANCE_FAILURE, NULL, &error); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - dep_inst = logicaldisk_descriptor_toCCIMInstance(hostname, desc, - LOGICAL_DISK, &error); - - if (error != 0) { - util_handleError(REALIZESEXTENT_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - REALIZESEXT_DESC_TO_INSTANCE_FAILURE, NULL, &error); - cim_freeInstance(inst); - cim_freeInstance(ant_inst); - return ((CCIMInstance *)NULL); - } - - /* - * Get the object paths that are represented by these instances. - * Add these properties to the association instance. - */ - - ant_op = cim_createObjectPath(ant_inst); - dep_op = cim_createObjectPath(dep_inst); - cim_freeInstance(ant_inst); - cim_freeInstance(dep_inst); - - if (ant_op == NULL || dep_op == NULL) { - ex = cim_getLastError(); - util_handleError(REALIZESEXTENT_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - CREATE_OBJECT_PATH_FAILURE, ex, &error); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - util_doReferenceProperty(ANTECEDENT, ant_op, cim_true, inst, errp); - util_doReferenceProperty(DEPENDENT, dep_op, cim_true, inst, errp); - cim_freeObjectPath(ant_op); - cim_freeObjectPath(dep_op); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(REALIZESEXTENT_DESCRIPTOR_FUNC, CIM_ERR_FAILED, - ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - - /* - * In this case, the starting address is always 0 since this is a - * physicaldisk->logicaldisk view. - */ - util_doProperty("StartingAddress", uint64, "0", cim_false, inst, errp); - - if (*errp != 0) { - ex = cim_getLastError(); - util_handleError(REALIZESEXTENT_DESCRIPTOR_FUNC, - CIM_ERR_FAILED, ADD_PROPERTY_FAILURE, ex, errp); - cim_freeInstance(inst); - return ((CCIMInstance *)NULL); - } - return (inst); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/common/util.c b/usr/src/cmd/wbem/provider/c/wbem_disk/common/util.c deleted file mode 100644 index 58023eb043..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/common/util.c +++ /dev/null @@ -1,333 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002-2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdlib.h> -#include <strings.h> -#include <errno.h> -#include <pthread.h> - -#include "util.h" - -static void setLastError(CIMErrorReason, const cimchar *, const cimchar *, \ - int *); -static void cleanupThreadExceptions(void *pParam); - - -pthread_key_t gWbemDiskLastErrorKey; - -#pragma init(errorInit) -#pragma fini(errorFinalize) - -/* - * The infastructure will call this when - * an error occurs, it should return a - * CCIMException which describes the error. - * Caller is responsable for freeing - * memory assocaited with the returned CCIMException - */ - -CCIMException * -cp_getLastError() -{ - CCIMException *lastError = NULL; - - lastError = - (CCIMException *)pthread_getspecific(gWbemDiskLastErrorKey); - (void) pthread_setspecific(gWbemDiskLastErrorKey, NULL); - return (lastError); -} - -/* - * Handle the errors that come in from the providers. This involves writing to - * the CIM log and setting the last error on the stack for the CIMOM exception - * handling. - */ - -void -util_handleError(char *funcName, CIMErrorReason reason, char *reasonString, - CCIMException *ex, int *errp) -{ - - - /* - * Create a copy of the exception, if it exists. The caller of - * this function should free the exception passed in. - */ - if (ex != NULL) { - if (reasonString == NULL) { - setLastError(ex->mReason, ex->mErrorString, funcName, errp); - } else { - setLastError(ex->mReason, reasonString, funcName, errp); - } - cim_freeCIMException(ex); - } else { - setLastError(reason, reasonString, funcName, errp); - } -} - -void * -util_getKeyValue(CCIMPropertyList *propList, CIMType propType, - char *key, int *error) { - - CCIMProperty *pProp; - CCIMPropertyList *pList = propList; - - *error = 0; - - do { - pProp = pList->mDataObject; - if (strcasecmp(pProp->mName, key) == 0) { - break; - } - pList = pList->mNext; - } while (pList); - - if (pList == NULL) { - *error = CIM_ERR_INVALID_PARAMETER; - return ((CCIMProperty *)NULL); - } - - /* - * If reference property, then return object path. In all other cases. - * the value is a string. - */ - - if (propType == reference) { - return (pProp->mObjPathValue); - } else { - return (pProp->mValue); - } -} -void -util_doProperty(cimchar *name, CIMType type, cimchar *value, CIMBool is_key, - CCIMInstance *inst, int *error) -{ - - CCIMProperty *prop; - - *error = 0; - - prop = cim_createProperty(name, type, value, NULL, is_key); - if (prop == NULL) { - *error = CIM_ERR_FAILED; - return; - } - if ((cim_addProperty(inst, prop)) == cim_false) { - cim_freeProperty(prop); - *error = CIM_ERR_FAILED; - return; - } -} - -void -util_doReferenceProperty(cimchar *role, CCIMObjectPath *obj, CIMBool isKey, - CCIMInstance *inst, int *error) -{ - - CCIMProperty *prop; - - *error = 0; - prop = cim_createReferenceProperty(role, obj, isKey); - if (prop == NULL) { - *error = CIM_ERR_INVALID_PARAMETER; - return; - } - if (cim_addProperty(inst, prop) == cim_false) { - cim_freeProperty(prop); - *error = CIM_ERR_FAILED; - return; - } -} - -/* - * Function: openFile - * - * Parameters: fileName - char pointer to the name of the file to open. - * fMode - char pointer to the mode used to open the file. - * - * Returns: On successful completion returns the FILE pointer for - * the open file. - * On failure returns a NULL FILE pointer. - * - * Description: 'fopen's file and checks for errors. - */ -FILE * -util_openFile(char *fileName, char *fMode) -{ - FILE *pTmpFile; - int error; - - /* Open the temporary file based on fMode */ - pTmpFile = fopen(fileName, fMode); - if (pTmpFile == NULL) { - util_handleError(UTIL_OPENFILE, CIM_ERR_FAILED, - UTIL_FILEOPEN_FAILURE, NULL, &error); - return ((FILE *)NULL); - } - return (pTmpFile); -} - -/* - * Function: util_closeFile - * - * Parameters: file - FILE pointer to an open file. - * - * Returns: On successful completion returns 1. - * On failure returns 0. - * - * Description: 'fclose's file and handles errors. - */ - -/* ARGSUSED */ -int -util_closeFile(FILE *file, char *fName) -{ - int error; - - if (fclose(file) != 0) { - util_handleError(UTIL_CLOSEFILE, CIM_ERR_FAILED, - UTIL_FILECLOSE_FAILURE, NULL, &error); - return (0); - } - return (1); -} - -/* - * Function: util_removeFile - * - * Parameters: tFName - char pointer to the filename - * - * Returns: NULL - * - * Description: Removes file and releases the memory used for - * the filename. - */ -void -util_removeFile(char *tFName) -{ - int error; - - if (remove(tFName) != 0) { - util_handleError(UTIL_REMOVEFILE, CIM_ERR_FAILED, - UTIL_FILEREMOVE_FAILURE, NULL, &error); - } - - free(tFName); -} - -char * -util_routineFailureMessage(char *routine) -{ - static char msgBuf[MAXFAILSTRINGLEN]; - - /* - * TRANSLATION_NOTE - * - * "%s Failed." indicates an error returned by the function - * whose name is specified by the string used to replace %s. - */ - (void) snprintf(msgBuf, MAXFAILSTRINGLEN, - dgettext(TEXT_DOMAIN, "%s Failed."), routine); - - return (msgBuf); -} - -/* - * Function: util_routineStartDaemonMessage - * - * Parameters: dname - the name of the daemon we we're attempting to start - * - * Returns: the generated string - * - * Description: creates a localized sring for eror messages. - */ -char * -util_routineStartDaemonMessage(char *dname) -{ - static char msgBuf[MAXFAILSTRINGLEN]; - - /* - * TRANSLATION_NOTE - * - * "%s failed to start and must be started manually. " indicates - * an error stsrting the daemon specified by the string used to - * replace %s. - */ - (void) snprintf(msgBuf, MAXFAILSTRINGLEN, - dgettext(TEXT_DOMAIN, - "%s failed to start and must be started manually. "), - dname); - - return (msgBuf); -} - -static void -cleanupThreadExceptions(void *pParam) -{ - CCIMException *e = pParam; - cim_freeCIMException(e); -} - -static void errorInit() -{ - /* Create the TSD key */ - (void) pthread_key_create(&gWbemDiskLastErrorKey, - cleanupThreadExceptions); - if (gethostname(hostName, MAXHOSTNAMELEN) < 0) { - hostName[0] = '\0'; - } -} - -static void -errorFinalize() -{ - (void) pthread_key_delete(gWbemDiskLastErrorKey); -} - -static void -setLastError(CIMErrorReason pRsn, - const cimchar* pErrString, const cimchar* pCallingFunc, int *errp) -{ - char *msgp = "(null)"; - CCIMException *lastError = NULL; - - lastError = - (CCIMException *)pthread_getspecific(gWbemDiskLastErrorKey); - - if (lastError != NULL) { - cim_freeCIMException(lastError); - } - - if (pErrString != NULL) { - msgp = (char *)pErrString; - } - - lastError = cim_createException(pRsn, msgp, pCallingFunc); - (void) pthread_setspecific(gWbemDiskLastErrorKey, lastError); - *errp = 1; -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Makefile b/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Makefile deleted file mode 100644 index d43353cd3e..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Makefile +++ /dev/null @@ -1,77 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -OBJECTS = Solaris_SCSIController.o \ - Solaris_USBSCSIController.o \ - Solaris_MPXIOController.o \ - Solaris_GenericController.o \ - Solaris_IDEController.o - -LINT_OBJS = $(OBJECTS:%.o=%.ln) - -GENERAL = $(ROOTWBEMINC) \ - $(SRC)/lib/libdiskmgt/common \ - $(SRC)/cmd/wbem/provider/c/include - -CPPFLAGS += -I. $(GENERAL:%=-I%) -D_REENTRANT -Dpic -D_TS_ERRNO - -CFLAGS += $(XREGSFLAG) $(C_PICFLAGS) - -LINTFLAGS += -um -LINTLIBS = $(LDLIBS.cmd) - -POFILE = _controller.po -MSGFILES = $(OBJECTS:%.o=%.i) - -CLOBBERFILES += $(POFILE) - -.KEEP_STATE: - -all: $(OBJECTS) - -install: all - -lint: $(LINT_OBJS) - $(LINT.c) $(LINTFLAGS) $(LINT_OBJS) $(LINTLIBS) - -clean: - $(RM) $(OBJECTS) $(LINT_OBJS) $(MSGFILES) - -check: - $(CSTYLE) -p -P $(OBJECTS:%.o=%.c) *.h - $(HDRCHK) *.h - -catalog: $(POFILE) - -$(POFILE): $(MSGFILES) - $(BUILDPO.msgfiles) - -include $(SRC)/cmd/Makefile.targ -include $(SRC)/Makefile.msg.targ diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_GenericController.c b/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_GenericController.c deleted file mode 100644 index 6819452b59..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_GenericController.c +++ /dev/null @@ -1,425 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <unistd.h> -#include <netdb.h> -#include <errno.h> - -#include "util.h" -#include "cimKeys.h" -#include "ctrl_descriptors.h" -#include "providerNames.h" -#include "messageStrings.h" -#include "Solaris_GenericController.h" - -#define GENERIC_GETINSTANCE "GENERIC_CONTROLLER,GET_INSTANCE" -#define GENERIC_ENUMINSTANCES "GENERIC_CONTROLLER,ENUM_INSTANCES" -#define GENERIC_ENUMINSTANCENAMES "GENERIC_CONTROLLER,ENUM_INSTANCENAMES" -#define GENERIC_CREATEINSTANCE "GENERIC_CONTROLLER,CREATE_INSTANCE" -#define GENERIC_DELETEINSTANCE "GENERIC_CONTROLLER,DELETE_INSTANCE" -#define GENERIC_SETINSTANCE "GENERIC_CONTROLLER,SET_INSTANCE" -#define GENERIC_GETPROPERTY "GENERIC_CONTROLLER,GET_PROPERTY" -#define GENERIC_SETPROPERTY "GENERIC_CONTROLLER,SET_PROPERTY" -#define GENERIC_INVOKEMETHOD "GENERIC_CONTROLLER,INVOKE_METHOD" -#define GENERIC_EXECQUERY "GENERIC_CONTROLLER,EXEC_QUERY" - -/* - * Solaris_GenericController provider - * - * It is important to note that all memory allocated by these functions - * and passed to the CIMOM, is freed by the CIMOM as the caller. - */ - - -/* - * Name: cp_getInstance_Solaris_GenericController - * - * Description: Returns an instance which matches the passed in object path - * if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMInstance* -cp_getInstance_Solaris_GenericController(CCIMObjectPath* pOP) -{ - CCIMInstance *inst = NULL; - CCIMPropertyList *pCurPropList; - dm_descriptor_t uctrl_descriptor; - char *name; - int error; - - if (pOP == NULL || - pOP->mKeyProperties == NULL) { - util_handleError(GENERIC_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstance *)NULL); - } - - pCurPropList = pOP->mKeyProperties; - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - - if (error != 0 || name == NULL) { - util_handleError(GENERIC_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstance*)NULL); - } - - uctrl_descriptor = - dm_get_descriptor_by_name(DM_CONTROLLER, name, &error); - /* - * Not found. Return a null instance. - */ - - if (error == ENODEV) { - return ((CCIMInstance *)NULL); - } - - if (error != 0) { - util_handleError(GENERIC_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstance*)NULL); - } - - /* Turn this descriptor in to a generic controller instance */ - - inst = ctrl_descriptor_toCCIMInstance( - hostName, uctrl_descriptor, GENERIC_CONTROLLER, &error); - dm_free_descriptor(uctrl_descriptor); - - if (error != 0) { - util_handleError(GENERIC_GETINSTANCE, CIM_ERR_FAILED, - UCTRL_DESC_TO_INSTANCE_FAILURE, NULL, - &error); - return ((CCIMInstance*)NULL); - } - - return (inst); -} - -/* - * Name: cp_enumInstances_Solaris_GenericController - * - * Description: Returns an instance list of Unknown controllers, if any found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMInstanceList * if matches are found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_enumInstances_Solaris_GenericController(CCIMObjectPath* pOP) -{ - CCIMInstanceList *instList = NULL; - dm_descriptor_t *uctrl_descriptorp; - int error; - int filter[1]; - - filter[0] = DM_FILTER_END; - - uctrl_descriptorp = dm_get_descriptors(DM_CONTROLLER, filter, - &error); - - if (uctrl_descriptorp == NULL || - uctrl_descriptorp[0] == NULL) { - return ((CCIMInstanceList *)NULL); - } - if (error != 0) { - util_handleError(GENERIC_ENUMINSTANCES, CIM_ERR_FAILED, - DM_GET_DESCRIPTORS, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* convert controller to CCIMInstanceList */ - instList = ctrl_descriptors_toCCIMInstanceList(GENERIC_CONTROLLER, - uctrl_descriptorp, &error, 1, "unknown"); - dm_free_descriptors(uctrl_descriptorp); - - if (error != 0) { - util_handleError(GENERIC_ENUMINSTANCES, CIM_ERR_FAILED, - UCTRL_DESC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - return (instList); -} - -/* - * Name: cp_enumInstanceNames_Solaris_GenericController - * - * Description: Returns an objectPath list of GENERIC controllers, if any found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMObjectPathList * if matched instances are found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMObjectPathList* -cp_enumInstanceNames_Solaris_GenericController(CCIMObjectPath * pOP) { - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pOP == NULL) { - util_handleError(GENERIC_ENUMINSTANCENAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - /* - * Call into enumInstances and then convert the instance list in - * to an object list. - */ - - instList = cp_enumInstances_Solaris_GenericController(pOP); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Creating an instance of a Solaris_GenericController is not supported. - */ - -/* ARGSUSED */ -CCIMObjectPath* -cp_createInstance_Solaris_GenericController( - CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - int error; - - util_handleError(GENERIC_CREATEINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return ((CCIMObjectPath*)NULL); -} - -/* - * Deleting an instance of a Solaris_GenericController is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_GenericController(CCIMObjectPath* pInst) -{ - int error; - - util_handleError(GENERIC_DELETEINSTANCE, - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &error); - return (cim_false); -} - -/* - * Name: cp_getProperty_Solaris_GenericController - * - * Description: Returns the property requested, if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMProperty * if found. - */ - -/* ARGSUSED */ -CCIMProperty * -cp_getProperty_Solaris_GenericController(CCIMObjectPath *pOP, - char *pPropName) -{ - - CCIMProperty *prop = NULL; - CCIMInstance *inst = NULL; - int error = 0; - - if (pOP == NULL) { - util_handleError(GENERIC_GETPROPERTY, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMProperty *)NULL); - } - - inst = cp_getInstance_Solaris_GenericController(pOP); - if (inst == NULL) { - return ((CCIMProperty *)NULL); - } - - prop = cim_getProperty(inst, pPropName); - cim_freeInstance(inst); - return (prop); -} -/* - * Setting an instance of a Solaris_GenericController is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_GenericController(CCIMObjectPath* pOP, - CCIMInstance* pInst) -{ - - int error; - - util_handleError(GENERIC_SETINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - -/* - * Setting a property on an instance of a Solaris_GenericController is not - * supported. - */ -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_GenericController(CCIMObjectPath* pOP, - CCIMProperty* pProp) -{ - - int error; - - util_handleError(GENERIC_SETPROPERTY, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - -/* - * No methods available on an instance of a Solaris_GenericController - */ - -/* ARGSUSED */ -CCIMProperty* -cp_invokeMethod_Solaris_GenericController(CCIMObjectPath* op, - cimchar* methodName, CCIMPropertyList* inParams, - CCIMPropertyList* outParams) -{ - CCIMProperty *retVal = (CCIMProperty*)NULL; - return (retVal); -} - -/* - * Name: cp_execQuery_Solaris_GenericController - * - * Description: - * Returns an instance list which matches the query if any are found. - * - * Parameters: - * CCIMObjectPath *op - An CCIMObjectPath * which contains the - * information on the class for which to find the instances. - * - * selectList - Not used - * nonJoinExp - Not used - * - * Returns: - * CCIMInstanceList * if matched instances are found. Otherwise, NULL. - */ -/* - * Currently, there is no WQL parser for the C providers. As a result, - * what is returned to the CIMOM is a list of instances with - * a NULL value at the beginning of the list. This NULL value indicates - * to the CIMOM that it must do the filtering for the client. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_execQuery_Solaris_GenericController(CCIMObjectPath *op, cimchar *selectList, - cimchar *nonJoinExp, cimchar *queryExp, int queryType) -{ - CCIMInstanceList *instList = NULL; - CCIMInstanceList *result; - CCIMInstance *emptyInst; - CCIMException *ex; - int error; - - if (op == NULL) { - util_handleError(GENERIC_EXECQUERY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = cp_enumInstances_Solaris_GenericController(op); - - if (instList == NULL) { - return ((CCIMInstanceList *)NULL); - } - /* - * Create a null instance and add it to the beginning - * of the list to indicate to the CIMOM that no filtering - * was done. - */ - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError(GENERIC_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, &error); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_createInstanceList(); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(GENERIC_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_addInstance(result, emptyInst); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(GENERIC_EXECQUERY, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - /* - * Since copying the original list to the new list will - * leave no way to free the original list, manually - * concatenate the original list to the new one. - */ - - result->mNext = instList; - return (result); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_GenericController.h b/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_GenericController.h deleted file mode 100644 index 80af2e18c0..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_GenericController.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOLARIS_GENERICCONTROLLER_H_ -#define _SOLARIS_GENERICCONTROLLER_H_ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> -#include <cimprovider.h> -#include <cimomhandle.h> -#include <cimlogsvc.h> - -#include "libdiskmgt.h" - -#ifdef __cplusplus -} -#endif - -#endif /* _SOLARIS_GENERICCONTROLLER_H_ */ diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_IDEController.c b/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_IDEController.c deleted file mode 100644 index 981c7502df..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_IDEController.c +++ /dev/null @@ -1,422 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <unistd.h> -#include <netdb.h> -#include <errno.h> - -#include "util.h" -#include "cimKeys.h" -#include "ctrl_descriptors.h" -#include "providerNames.h" -#include "messageStrings.h" -#include "Solaris_IDEController.h" - -#define IDE_GETINSTANCE "IDE_CONTROLLER,GET_INSTANCE" -#define IDE_ENUMINSTANCES "IDE_CONTROLLER,ENUM_INSTANCES" -#define IDE_ENUMINSTANCENAMES "IDE_CONTROLLER,ENUM_INSTANCENAMES" -#define IDE_CREATEINSTANCE "IDE_CONTROLLER,CREATE_INSTANCE" -#define IDE_DELETEINSTANCE "IDE_CONTROLLER,DELETE_INSTANCE" -#define IDE_SETINSTANCE "IDE_CONTROLLER,SET_INSTANCE" -#define IDE_GETPROPERTY "IDE_CONTROLLER,GET_PROPERTY" -#define IDE_SETPROPERTY "IDE_CONTROLLER,SET_PROPERTY" -#define IDE_INVOKEMETHOD "IDE_CONTROLLER,INVOKE_METHOD" -#define IDE_EXECQUERY "IDE_CONTROLLER,EXEC_QUERY" - -/* - * Solaris_IDEController provider - * - * It is important to note that all memory allocated by these functions - * and passed to the CIMOM, is freed by the CIMOM as the caller. - */ - - -/* - * Name: cp_getInstance_Solaris_IDEController - * - * Description: Returns an instance which matches the passed in object path - * if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ -/* ARGSUSED */ -CCIMInstance* -cp_getInstance_Solaris_IDEController(CCIMObjectPath* pOP) -{ - CCIMInstance *inst = NULL; - CCIMPropertyList *pCurPropList; - dm_descriptor_t idectrl_descriptor; - char *name; - int error; - - if (pOP == NULL || - pOP->mKeyProperties == NULL) { - util_handleError(IDE_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstance *)NULL); - } - - pCurPropList = pOP->mKeyProperties; - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - - if (error != 0 || name == NULL) { - util_handleError(IDE_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance*)NULL); - } - - idectrl_descriptor = - dm_get_descriptor_by_name(DM_CONTROLLER, name, &error); - - /* - * Not found. Return a null instance. - */ - - if (error == ENODEV) { - return ((CCIMInstance *)NULL); - } - - if (error != 0) { - util_handleError(IDE_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstance*)NULL); - } - - /* Turn this descriptor in to a ide controller instance */ - - inst = ctrl_descriptor_toCCIMInstance( - hostName, idectrl_descriptor, IDE_CONTROLLER, &error); - dm_free_descriptor(idectrl_descriptor); - - if (error != 0) { - util_handleError(IDE_GETINSTANCE, CIM_ERR_FAILED, - IDECTRL_DESC_TO_INSTANCE_FAILURE, NULL, - &error); - return ((CCIMInstance*)NULL); - } - - return (inst); -} - -/* - * Name: cp_enumInstances_Solaris_IDEController - * - * Description: Returns an instance list of IDE controllers, if any found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMInstanceList * if matches are found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_enumInstances_Solaris_IDEController(CCIMObjectPath* pOP) -{ - CCIMInstanceList *instList = NULL; - dm_descriptor_t *idectrl_descriptorp; - int error; - int filter[1]; - - filter[0] = DM_FILTER_END; - - idectrl_descriptorp = dm_get_descriptors(DM_CONTROLLER, filter, - &error); - - if (idectrl_descriptorp == NULL || - idectrl_descriptorp[0] == NULL) { - return ((CCIMInstanceList *)NULL); - } - if (error != 0) { - util_handleError(IDE_ENUMINSTANCES, CIM_ERR_FAILED, - DM_GET_DESCRIPTORS, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* convert controller to CCIMInstanceList */ - instList = ctrl_descriptors_toCCIMInstanceList(IDE_CONTROLLER, - idectrl_descriptorp, &error, 2, "ata", "pcata"); - dm_free_descriptors(idectrl_descriptorp); - - if (error != 0) { - util_handleError(IDE_ENUMINSTANCES, CIM_ERR_FAILED, - IDECTRL_DESC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - return (instList); -} - -/* - * Name: cp_enumInstanceNames_Solaris_IDEController - * - * Description: Returns an objectPath list of IDE controllers, if any found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMObjectPathList * if matched instances are found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMObjectPathList* -cp_enumInstanceNames_Solaris_IDEController(CCIMObjectPath * pOP) { - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pOP == NULL) { - util_handleError(IDE_ENUMINSTANCENAMES, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - /* - * Call in to enumInstances and then convert the instance list in - * to an object list. - */ - - instList = cp_enumInstances_Solaris_IDEController(pOP); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Creating an instance of a Solaris_IDEController is not supported. - */ - -/* ARGSUSED */ -CCIMObjectPath* -cp_createInstance_Solaris_IDEController( - CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - int error; - - util_handleError(IDE_CREATEINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return ((CCIMObjectPath*)NULL); -} - -/* - * Deleting an instance of a Solaris_IDEController is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_IDEController(CCIMObjectPath* pInst) -{ - int error; - - util_handleError(IDE_DELETEINSTANCE, - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &error); - return (cim_false); -} - -/* - * Name: cp_getProperty_Solaris_IDEController - * - * Description: Returns the property requested, if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMProperty * if found. - */ - -/* ARGSUSED */ -CCIMProperty * -cp_getProperty_Solaris_IDEController(CCIMObjectPath *pOP, - char *pPropName) -{ - - CCIMProperty *prop = NULL; - CCIMInstance *inst = NULL; - int error = 0; - - if (pOP == NULL) { - util_handleError(IDE_GETPROPERTY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMProperty *)NULL); - } - - inst = cp_getInstance_Solaris_IDEController(pOP); - if (inst == NULL) { - return ((CCIMProperty *)NULL); - } - - prop = cim_getProperty(inst, pPropName); - cim_freeInstance(inst); - return (prop); -} -/* - * Setting an instance of a Solaris_IDEController is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_IDEController(CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - - int error; - - util_handleError(IDE_SETINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - -/* - * Setting a property on an instance of a Solaris_IDEController is not - * supported. - */ -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_IDEController(CCIMObjectPath* pOP, CCIMProperty* pProp) -{ - - int error; - - util_handleError(IDE_SETPROPERTY, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - -/* - * No methods available on an instance of a Solaris_IDEController - */ - -/* ARGSUSED */ -CCIMProperty* -cp_invokeMethod_Solaris_IDEController(CCIMObjectPath* op, cimchar* methodName, - CCIMPropertyList* inParams, CCIMPropertyList* outParams) -{ - CCIMProperty *retVal = (CCIMProperty*)NULL; - return (retVal); -} - -/* - * Name: cp_execQuery_Solaris_IDEController - * - * Description: - * Returns an instance list which matches the query if any are found. - * - * Parameters: - * CCIMObjectPath *op - An CCIMObjectPath * which contains the - * information on the class for which to find the instances. - * - * selectList - Not used - * nonJoinExp - Not used - * - * Returns: - * CCIMInstanceList * if matched instances are found. Otherwise, NULL. - */ -/* - * Currently, there is no WQL parser for the C providers. As a result, - * what is returned to the CIMOM is a list of instances with - * a NULL value at the beginning of the list. This NULL value indicates - * to the CIMOM that it must do the filtering for the client. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_execQuery_Solaris_IDEController(CCIMObjectPath *op, cimchar *selectList, - cimchar *nonJoinExp, cimchar *queryExp, int queryType) -{ - CCIMInstanceList *instList = NULL; - CCIMInstanceList *result; - CCIMInstance *emptyInst; - CCIMException *ex; - int error; - - if (op == NULL) { - util_handleError(IDE_EXECQUERY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = cp_enumInstances_Solaris_IDEController(op); - - if (instList == NULL) { - return ((CCIMInstanceList *)NULL); - } - /* - * Create a null instance and add it to the beginning - * of the list to indicate to the CIMOM that no filtering - * was done. - */ - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError(IDE_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, &error); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_createInstanceList(); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(IDE_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_addInstance(result, emptyInst); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(IDE_EXECQUERY, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - /* - * Since copying the original list to the new list will - * leave no way to free the original list, manually - * concatenate the original list to the new one. - */ - - result->mNext = instList; - return (result); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_IDEController.h b/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_IDEController.h deleted file mode 100644 index f4fa29c7bd..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_IDEController.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOLARIS_IDECONTROLLER_H_ -#define _SOLARIS_IDECONTROLLER_H_ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> -#include <cimprovider.h> -#include <cimomhandle.h> -#include <cimlogsvc.h> - -#include "libdiskmgt.h" - -#ifdef __cplusplus -} -#endif - -#endif /* _SOLARIS_IDECONTROLLER_H_ */ diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_MPXIOController.c b/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_MPXIOController.c deleted file mode 100644 index 7f0f4d48f4..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_MPXIOController.c +++ /dev/null @@ -1,430 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <unistd.h> -#include <netdb.h> -#include <errno.h> - -#include "util.h" -#include "cimKeys.h" -#include "ctrl_descriptors.h" -#include "providerNames.h" -#include "messageStrings.h" -#include "Solaris_MPXIOController.h" - -#define MPXIO_GETINSTANCE "MPXIO_CONTROLLER,GET_INSTANCE" -#define MPXIO_ENUMINSTANCES "MPXIO_CONTROLLER,ENUM_INSTANCES" -#define MPXIO_ENUMINSTANCENAMES "MPXIO_CONTROLLER,ENUM_INSTANCENAMES" -#define MPXIO_CREATEINSTANCE "MPXIO_CONTROLLER,CREATE_INSTANCE" -#define MPXIO_DELETEINSTANCE "MPXIO_CONTROLLER,DELETE_INSTANCE" -#define MPXIO_SETINSTANCE "MPXIO_CONTROLLER,SET_INSTANCE" -#define MPXIO_GETPROPERTY "MPXIO_CONTROLLER,GET_PROPERTY" -#define MPXIO_SETPROPERTY "MPXIO_CONTROLLER,SET_PROPERTY" -#define MPXIO_INVOKEMETHOD "MPXIO_CONTROLLER,INVOKE_METHOD" -#define MPXIO_EXECQUERY "MPXIO_CONTROLLER,EXEC_QUERY" - -/* - * Solaris_MPXIOController provider - * - * It is important to note that all memory allocated by these functions - * and passed to the CIMOM, is freed by the CIMOM as the caller. - */ - -/* - * Name: cp_getInstance_Solaris_MPXIOController - * - * Description: Returns an instance which matches the passed in object path - * if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMInstance* -cp_getInstance_Solaris_MPXIOController(CCIMObjectPath* pOP) -{ - CCIMInstance *inst = NULL; - CCIMPropertyList *pCurPropList; - dm_descriptor_t mpxioctrl_descriptor; - char *name; - int error; - - if (pOP == NULL || - pOP->mKeyProperties == NULL) { - util_handleError(MPXIO_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - - pCurPropList = pOP->mKeyProperties; - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - - if (error != 0 || name == NULL) { - util_handleError(MPXIO_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance*)NULL); - } - - mpxioctrl_descriptor = - dm_get_descriptor_by_name(DM_CONTROLLER, name, &error); - - /* - * Not found. Return a null instance. - */ - if (error == ENODEV) { - return ((CCIMInstance *)NULL); - } - - if (error != 0) { - util_handleError(MPXIO_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstance*)NULL); - } - - /* Turn this descriptor in to a mpxio controller instance */ - - inst = ctrl_descriptor_toCCIMInstance( - hostName, mpxioctrl_descriptor, MPXIO_CONTROLLER, &error); - dm_free_descriptor(mpxioctrl_descriptor); - - if (error != 0) { - util_handleError(MPXIO_GETINSTANCE, CIM_ERR_FAILED, - MPXIOCTRL_DESC_TO_INSTANCE_FAILURE, NULL, - &error); - return ((CCIMInstance*)NULL); - } - - return (inst); -} - -/* - * Name: cp_enumInstances_Solaris_MPXIOController - * - * Description: Returns an instancelist of MPXIO controllers, if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstanceList * if matched instance is found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_enumInstances_Solaris_MPXIOController(CCIMObjectPath* pOP) -{ - CCIMInstanceList *instList = NULL; - dm_descriptor_t *mpxioctrl_descriptorp; - int error; - int filter[1]; - - filter[0] = DM_FILTER_END; - - mpxioctrl_descriptorp = dm_get_descriptors(DM_CONTROLLER, filter, - &error); - - /* - * If no devices, return NULL. CIMOM expects NULL. Do not set - * last error. If set, the CIMOM will assume an error and - * throw an exception. - */ - - if (mpxioctrl_descriptorp == NULL || - mpxioctrl_descriptorp[0] == NULL) { - return ((CCIMInstanceList *)NULL); - } - if (error != 0) { - util_handleError(MPXIO_ENUMINSTANCES, CIM_ERR_FAILED, - DM_GET_DESCRIPTORS, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* convert controllers to CCIMInstanceList */ - instList = ctrl_descriptors_toCCIMInstanceList(MPXIO_CONTROLLER, - mpxioctrl_descriptorp, &error, 1, "scsi_vhci"); - dm_free_descriptors(mpxioctrl_descriptorp); - - if (error != 0) { - util_handleError(MPXIO_GETINSTANCE, CIM_ERR_FAILED, - MPXIOCTRL_DESC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - return (instList); -} - -/* - * Name: cp_enumInstanceNames_Solaris_MPXIOController - * - * Description: Returns an object pathlist of MPXIO controllers, if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMObjectPathList * if matched instance is found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMObjectPathList* -cp_enumInstanceNames_Solaris_MPXIOController(CCIMObjectPath * pOP) { - - CCIMInstanceList *instList = NULL; - CCIMObjectPathList *objList = NULL; - int error; - - if (pOP == NULL) { - util_handleError(MPXIO_ENUMINSTANCENAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - /* - * Call in to enumInstances and then convert the instance list in - * to an object list. - */ - - instList = cp_enumInstances_Solaris_MPXIOController(pOP); - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Creating an instance of a Solaris_MPXIOController is not supported. - */ - -/* ARGSUSED */ -CCIMObjectPath* -cp_createInstance_Solaris_MPXIOController(CCIMObjectPath* pOP, - CCIMInstance* pInst) -{ - int error; - - util_handleError(MPXIO_CREATEINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return ((CCIMObjectPath*)NULL); -} - -/* - * Deleting an instance of a Solaris_MPXIOController is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_MPXIOController(CCIMObjectPath* pInst) -{ - - int error; - - util_handleError(MPXIO_DELETEINSTANCE, - CIM_ERR_NOT_SUPPORTED, NULL, NULL, &error); - return (cim_false); -} - -/* - * Name: cp_getProperty_Solaris_MPXIOController - * - * Description: Returns the property requested, if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMProperty * if found. - */ - -/* ARGSUSED */ -CCIMProperty * -cp_getProperty_Solaris_MPXIOController(CCIMObjectPath *pOP, - char *pPropName) -{ - - CCIMProperty *prop = NULL; - CCIMInstance *inst = NULL; - int error = 0; - - if (pOP == NULL) { - util_handleError(MPXIO_GETPROPERTY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMProperty *)NULL); - } - - inst = cp_getInstance_Solaris_MPXIOController(pOP); - if (inst == NULL) { - return ((CCIMProperty *)NULL); - } - - prop = cim_getProperty(inst, pPropName); - cim_freeInstance(inst); - return (prop); -} - -/* - * Setting an instance of a Solaris_MPXIOController is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_MPXIOController(CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - - int error; - - util_handleError(MPXIO_SETINSTANCE, CIM_ERR_NOT_SUPPORTED, - NULL, NULL, &error); - return (cim_false); -} - -/* - * Setting properties on an instance of a Solaris_MPXIOController is not - * supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_MPXIOController(CCIMObjectPath* pOP, CCIMProperty* pProp) -{ - - int error; - - util_handleError(MPXIO_SETPROPERTY, CIM_ERR_NOT_SUPPORTED, - NULL, NULL, &error); - return (cim_false); -} - -/* - * No methods available on an instance of a Solaris_MPXIOController. - */ - -/* ARGSUSED */ -CCIMProperty* -cp_invokeMethod_Solaris_MPXIOController(CCIMObjectPath* op, cimchar* methodName, - CCIMPropertyList* inParams, CCIMPropertyList* outParams) -{ - CCIMProperty *retVal = (CCIMProperty*)NULL; - return (retVal); -} - -/* - * Name: cp_execQuery_Solaris_MPXIOController - * - * Description: - * Returns an instance list which matches the query if any are found. - * - * Parameters: - * CCIMObjectPath *op - An CCIMObjectPath * which contains the - * information on the class for which to find the instances. - * - * selectList - Not used - * nonJoinExp - Not used - * - * Returns: - * CCIMInstanceList * if matched instance is found. Otherwise, NULL. - */ -/* - * Currently, there is no WQL parser for the C providers. As a result, - * what is returned to the CIMOM is a list of instances with - * a NULL value at the beginning of the list. This NULL value indicates - * to the CIMOM that it must do the filtering for the client. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_execQuery_Solaris_MPXIOController(CCIMObjectPath *op, cimchar *selectList, - cimchar *nonJoinExp, cimchar *queryExp, int queryType) -{ - CCIMInstanceList *instList = NULL; - CCIMInstanceList *result; - CCIMInstance *emptyInst; - CCIMException *ex; - int error; - - if (op == NULL) { - util_handleError(MPXIO_EXECQUERY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = cp_enumInstances_Solaris_MPXIOController(op); - - if (instList == NULL) { - return ((CCIMInstanceList *)NULL); - } - /* - * Create a null instance and add it to the beginning - * of the list to indicate to the CIMOM that no filtering - * was done. - */ - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, &error); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_createInstanceList(); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_addInstance(result, emptyInst); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_EXECQUERY, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - cim_freeInstanceList(instList); - cim_freeInstance(emptyInst); - return ((CCIMInstanceList *)NULL); - } - - /* - * Since copying the original list to the new list will - * leave no way to free the original list, manually - * concatenate the original list to the new one. - */ - - result->mNext = instList; - return (result); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_MPXIOController.h b/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_MPXIOController.h deleted file mode 100644 index eeeda6be8d..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_MPXIOController.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOLARIS_MPXIOCONTROLLER_H_ -#define _SOLARIS_MPXIOCONTROLLER_H_ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> -#include <cimprovider.h> -#include <cimomhandle.h> -#include <cimlogsvc.h> - -#include "libdiskmgt.h" - -#ifdef __cplusplus -} -#endif - -#endif /* _SOLARIS_MPXIOCONTROLLER_H_ */ diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_SCSIController.c b/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_SCSIController.c deleted file mode 100644 index e465131a01..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_SCSIController.c +++ /dev/null @@ -1,423 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <unistd.h> -#include <netdb.h> -#include <errno.h> - -#include "util.h" -#include "cimKeys.h" -#include "ctrl_descriptors.h" -#include "providerNames.h" -#include "messageStrings.h" -#include "Solaris_SCSIController.h" - -#define SCSI_GETINSTANCE "SCSI_CONTROLLER,GET_INSTANCE" -#define SCSI_ENUMINSTANCES "SCSI_CONTROLLER,ENUM_INSTANCES" -#define SCSI_ENUMINSTANCENAMES "SCSI_CONTROLLER,ENUM_INSTANCENAMES" -#define SCSI_CREATEINSTANCE "SCSI_CONTROLLER,CREATE_INSTANCE" -#define SCSI_DELETEINSTANCE "SCSI_CONTROLLER,DELETE_INSTANCE" -#define SCSI_SETINSTANCE "SCSI_CONTROLLER,SET_INSTANCE" -#define SCSI_GETPROPERTY "SCSI_CONTROLLER,GET_PROPERTY" -#define SCSI_SETPROPERTY "SCSI_CONTROLLER,SET_PROPERTY" -#define SCSI_INVOKEMETHOD "SCSI_CONTROLLER,INVOKE_METHOD" -#define SCSI_EXECQUERY "SCSI_CONTROLLER,EXEC_QUERY" - -/* - * Solaris_SCSIController provider - * - * It is important to note that all memory allocated by these functions - * and passed to the CIMOM, is freed by the CIMOM as the caller. - */ - -/* - * Name: cp_getInstance_Solaris_SCSIController - * - * Description: Returns an instance which matches the passed in object path - * if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMInstance* -cp_getInstance_Solaris_SCSIController(CCIMObjectPath* pOP) -{ - CCIMInstance *inst = NULL; - CCIMPropertyList *pCurPropList; - dm_descriptor_t scsictrl_descriptor; - char *name; - int error; - - if (pOP == NULL || - pOP->mKeyProperties == NULL) { - util_handleError(SCSI_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - - pCurPropList = pOP->mKeyProperties; - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - if (error != 0 || name == NULL) { - util_handleError(SCSI_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance*)NULL); - } - - scsictrl_descriptor = - dm_get_descriptor_by_name(DM_CONTROLLER, name, &error); - /* - * Not found. Return a null instance. - */ - - if (error == ENODEV) { - return ((CCIMInstance *)NULL); - } - - if (error != 0) { - util_handleError(SCSI_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstance*)NULL); - } - /* Turn this descriptor in to a scsi controller instance */ - - inst = ctrl_descriptor_toCCIMInstance( - hostName, scsictrl_descriptor, SCSI_CONTROLLER, &error); - dm_free_descriptor(scsictrl_descriptor); - - if (error != 0) { - util_handleError(SCSI_GETINSTANCE, CIM_ERR_FAILED, - SCSICTRL_DESC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstance*)NULL); - } - - return (inst); -} - -/* - * Name: cp_enumInstances_Solaris_SCSIController - * - * Description: Returns an instancelist of SCSI controllers, if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstanceList * if matched instances are found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_enumInstances_Solaris_SCSIController(CCIMObjectPath* pOP) -{ - CCIMInstanceList *instList = NULL; - dm_descriptor_t *scsictrl_descriptorp; - int error; - int filter[1]; - - filter[0] = DM_FILTER_END; - - scsictrl_descriptorp = dm_get_descriptors(DM_CONTROLLER, filter, - &error); - - if (scsictrl_descriptorp == NULL || - scsictrl_descriptorp[0] == NULL) { - return ((CCIMInstanceList *)NULL); - } - - if (error != 0) { - util_handleError(SCSI_ENUMINSTANCES, CIM_ERR_FAILED, - DM_GET_DESCRIPTORS, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* convert controller to CCIMInstanceList */ - instList = ctrl_descriptors_toCCIMInstanceList(SCSI_CONTROLLER, - scsictrl_descriptorp, &error, 2, "scsi", "fibre channel"); - dm_free_descriptors(scsictrl_descriptorp); - - if (error != 0) { - util_handleError(SCSI_ENUMINSTANCES, CIM_ERR_FAILED, - SCSICTRL_DESC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - return (instList); -} - -/* - * Name: cp_enumInstanceNames_Solaris_SCSIController - * - * Description: Returns an object path list of SCSI controllers, if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMObjectPathList * if matched instances are found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMObjectPathList* -cp_enumInstanceNames_Solaris_SCSIController(CCIMObjectPath * pOP) { - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pOP == NULL) { - util_handleError(SCSI_ENUMINSTANCENAMES, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - /* - * Call in to enumInstances and then convert the instance list in - * to an object list. - */ - - instList = cp_enumInstances_Solaris_SCSIController(pOP); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Creating an instance of a Solaris_SCSIController is not supported. - */ - -/* ARGSUSED */ -CCIMObjectPath* -cp_createInstance_Solaris_SCSIController( - CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - int error; - - util_handleError(SCSI_CREATEINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return ((CCIMObjectPath*)NULL); -} - -/* - * Deleting an instance of a Solaris_SCSIController is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_SCSIController(CCIMObjectPath* pInst) -{ - - int error; - - util_handleError(SCSI_DELETEINSTANCE, CIM_ERR_NOT_SUPPORTED, - NULL, NULL, &error); - return (cim_false); -} - -/* - * Name: cp_getProperty_Solaris_SCSIController - * - * Description: Returns the property requested, if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMProperty * if found. - */ - -/* ARGSUSED */ -CCIMProperty * -cp_getProperty_Solaris_SCSIController(CCIMObjectPath *pOP, - char *pPropName) -{ - - CCIMProperty *prop = NULL; - CCIMInstance *inst = NULL; - int error = 0; - - if (pOP == NULL) { - util_handleError(SCSI_GETPROPERTY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMProperty *)NULL); - } - - inst = cp_getInstance_Solaris_SCSIController(pOP); - if (inst == NULL) { - return ((CCIMProperty *)NULL); - } - - prop = cim_getProperty(inst, pPropName); - cim_freeInstance(inst); - return (prop); -} - -/* - * Setting an instance of a Solaris_SCSIController is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_SCSIController(CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - - int error; - - util_handleError(SCSI_SETINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - -/* - * Setting a property of a Solaris_SCSIController is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_SCSIController(CCIMObjectPath* pOP, CCIMProperty* pProp) -{ - - int error; - - util_handleError(SCSI_SETPROPERTY, CIM_ERR_NOT_SUPPORTED, - NULL, NULL, &error); - return (cim_false); -} - -/* - * No methods available for Solaris_SCSIController. - */ - -/* ARGSUSED */ -CCIMProperty* -cp_invokeMethod_Solaris_SCSIController(CCIMObjectPath* op, cimchar* methodName, - CCIMPropertyList* inParams, CCIMPropertyList* outParams) -{ - CCIMProperty *retVal = (CCIMProperty*)NULL; - return (retVal); -} - -/* - * Name: cp_execQuery_Solaris_SCSIController - * - * Description: - * Returns an instance list which matches the query if any are found. - * - * Parameters: - * CCIMObjectPath *op - An CCIMObjectPath * which contains the - * information on the class for which to find the instances. - * - * selectList - Not used - * nonJoinExp - Not used - * - * Returns: - * CCIMInstanceList * if matched instances are found. Otherwise, NULL. - */ - -/* - * Currently, there is no WQL parser for the C providers. As a result, - * what is returned to the CIMOM is a list of instances with - * a NULL value at the beginning of the list. This NULL value indicates - * to the CIMOM that it must do the filtering for the client. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_execQuery_Solaris_SCSIController(CCIMObjectPath *op, cimchar *selectList, - cimchar *nonJoinExp, cimchar *queryExp, int queryType) -{ - CCIMInstanceList *instList = NULL; - CCIMInstanceList *result; - CCIMInstance *emptyInst; - CCIMException *ex; - int error; - - if (op == NULL) { - util_handleError(SCSI_EXECQUERY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = cp_enumInstances_Solaris_SCSIController(op); - - if (instList == NULL) { - return ((CCIMInstanceList *)NULL); - } - /* - * Create a null instance and add it to the beginning - * of the list to indicate to the CIMOM that no filtering - * was done. - */ - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError(SCSI_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, &error); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_createInstanceList(); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(SCSI_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_addInstance(result, emptyInst); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(SCSI_EXECQUERY, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - cim_freeInstanceList(instList); - cim_freeInstance(emptyInst); - return ((CCIMInstanceList *)NULL); - } - - /* - * Since copying the original list to the new list will - * leave no way to free the original list, manually - * concatenate the original list to the new one. - */ - - result->mNext = instList; - return (result); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_SCSIController.h b/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_SCSIController.h deleted file mode 100644 index 385f04230c..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_SCSIController.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOLARIS_SCSICONTROLLER_H_ -#define _SOLARIS_SCSICONTROLLER_H_ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> -#include <cimprovider.h> -#include <cimomhandle.h> -#include <cimlogsvc.h> - -#include "libdiskmgt.h" - -#ifdef __cplusplus -} -#endif - -#endif /* _SOLARIS_SCSICONTROLLER_H_ */ diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_USBSCSIController.c b/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_USBSCSIController.c deleted file mode 100644 index ae810b9a42..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_USBSCSIController.c +++ /dev/null @@ -1,430 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <unistd.h> -#include <netdb.h> -#include <errno.h> - -#include "util.h" -#include "cimKeys.h" -#include "ctrl_descriptors.h" -#include "providerNames.h" -#include "messageStrings.h" -#include "Solaris_USBSCSIController.h" - -#define USB_GETINSTANCE "USBSCSI_CONTROLLER,GET_INSTANCE" -#define USB_ENUMINSTANCES "USBSCSI_CONTROLLER,ENUM_INSTANCES" -#define USB_ENUMINSTANCENAMES "USBSCSI_CONTROLLER,ENUM_INSTANCENAMES" -#define USB_CREATEINSTANCE "USBSCSI_CONTROLLER,CREATE_INSTANCE" -#define USB_DELETEINSTANCE "USBSCSI_CONTROLLER,DELETE_INSTANCE" -#define USB_SETINSTANCE "USBSCSI_CONTROLLER,SET_INSTANCE" -#define USB_GETPROPERTY "USBSCSI_CONTROLLER,GET_PROPERTY" -#define USB_SETPROPERTY "USBSCSI_CONTROLLER,SET_PROPERTY" -#define USB_INVOKEMETHOD "USBSCSI_CONTROLLER,INVOKE_METHOD" -#define USB_EXECQUERY "USBSCSI_CONTROLLER,EXEC_QUERY" - -/* - * Solaris_USBSCSIController provider - * - * It is important to note that all memory allocated by these functions - * and passed to the CIMOM, is freed by the CIMOM as the caller. - */ - -/* - * Name: cp_getInstance_Solaris_USBSCSIController - * - * Description: Returns an instance which matches the passed in object path - * if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMInstance* -cp_getInstance_Solaris_USBSCSIController(CCIMObjectPath* pOP) -{ - CCIMInstance *inst = NULL; - CCIMPropertyList *pCurPropList; - dm_descriptor_t usbctrl_descriptor; - char *name; - int error; - - if (pOP == NULL || pOP->mKeyProperties == NULL) { - util_handleError(USB_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - - pCurPropList = pOP->mKeyProperties; - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - - if (error != 0 || name == NULL) { - util_handleError(USB_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance*)NULL); - } - - usbctrl_descriptor = - dm_get_descriptor_by_name(DM_CONTROLLER, name, &error); - /* - * Not found. Return a null instance. - */ - - if (error == ENODEV) { - return ((CCIMInstance *)NULL); - } - - if (error != 0) { - util_handleError(USB_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstance*)NULL); - } - - /* Turn this descriptor in to a usb controller instance */ - - inst = ctrl_descriptor_toCCIMInstance( - hostName, usbctrl_descriptor, USBSCSI_CONTROLLER, &error); - dm_free_descriptor(usbctrl_descriptor); - - if (error != 0) { - util_handleError(USB_GETINSTANCE, CIM_ERR_FAILED, - USBCTRL_DESC_TO_INSTANCE_FAILURE, NULL, - &error); - return ((CCIMInstance*)NULL); - } - - return (inst); -} - -/* - * Name: cp_enumInstances_Solaris_USBSCSIController - * - * Description: Returns an instance which matches the passed in object path - * if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstanceList * if matched instances are found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_enumInstances_Solaris_USBSCSIController(CCIMObjectPath* pOP) -{ - CCIMInstanceList *instList = NULL; - dm_descriptor_t *usbctrl_descriptorp; - int error; - int filter[1]; - - filter[0] = DM_FILTER_END; - - usbctrl_descriptorp = dm_get_descriptors(DM_CONTROLLER, filter, - &error); - - /* - * If no devices, return empty list. - */ - if (usbctrl_descriptorp == NULL || - usbctrl_descriptorp[0] == NULL) { - return ((CCIMInstanceList *)NULL); - } - if (error != 0) { - util_handleError(USB_ENUMINSTANCES, CIM_ERR_FAILED, - DM_GET_DESCRIPTORS, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* convert controller to CCIMInstanceList */ - instList = ctrl_descriptors_toCCIMInstanceList(USBSCSI_CONTROLLER, - usbctrl_descriptorp, &error, 1, "usb"); - dm_free_descriptors(usbctrl_descriptorp); - - if (error != 0) { - util_handleError(USB_ENUMINSTANCES, CIM_ERR_FAILED, - USBCTRL_DESC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - return (instList); -} - -/* - * Name: cp_enumInstanceNames_Solaris_USBSCSIController - * - * Description: Returns an object path list of Solaris_USBSCSIController if - * found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMObjectPathList * if matched instances are found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMObjectPathList* -cp_enumInstanceNames_Solaris_USBSCSIController(CCIMObjectPath * pOP) { - - CCIMInstanceList *instList = NULL; - CCIMObjectPathList *objList = NULL; - int error; - - if (pOP == NULL) { - util_handleError(USB_ENUMINSTANCENAMES, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - /* - * Call in to enumInstances and then convert the instance list in - * to an object list. - */ - - instList = cp_enumInstances_Solaris_USBSCSIController(pOP); - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Creating an instance of a Solaris_USBSCSIController is not supported. - */ - -/* ARGSUSED */ -CCIMObjectPath* -cp_createInstance_Solaris_USBSCSIController( - CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - int error; - - util_handleError(USB_CREATEINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return ((CCIMObjectPath*)NULL); -} - -/* - * Deleting an instance of a Solaris_USBSCSIController is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_USBSCSIController(CCIMObjectPath* pInst) -{ - - int error; - - util_handleError(USB_DELETEINSTANCE, CIM_ERR_NOT_SUPPORTED, - NULL, NULL, &error); - return (cim_false); -} - -/* - * Name: cp_getProperty_Solaris_USBSCSIController - * - * Description: Returns the property requested, if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMProperty * if found. - */ - -/* ARGSUSED */ -CCIMProperty * -cp_getProperty_Solaris_USBSCSIController(CCIMObjectPath *pOP, - char *pPropName) -{ - - CCIMProperty *prop = NULL; - CCIMInstance *inst = NULL; - int error = 0; - - if (pOP == NULL) { - util_handleError(USB_GETPROPERTY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMProperty *)NULL); - } - - inst = cp_getInstance_Solaris_USBSCSIController(pOP); - if (inst == NULL) { - return ((CCIMProperty *)NULL); - } - - prop = cim_getProperty(inst, pPropName); - cim_freeInstance(inst); - return (prop); -} -/* - * Setting an instance of a Solaris_USBSCSIController is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_USBSCSIController(CCIMObjectPath* pOP, - CCIMInstance* pInst) -{ - - int error; - - util_handleError(USB_SETINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - -/* - * Setting properties on an instance of a Solaris_USBSCSIController is not - * supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_USBSCSIController(CCIMObjectPath* pOP, - CCIMProperty* pProp) -{ - - int error; - - util_handleError(USB_SETPROPERTY, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - -/* - * No methods avialable on an instance of a Solaris_USBSCSIController - */ - -/* ARGSUSED */ -CCIMProperty* -cp_invokeMethod_Solaris_USBSCSIController(CCIMObjectPath* op, - cimchar* methodName, CCIMPropertyList* inParams, - CCIMPropertyList* outParams) -{ - CCIMProperty *retVal = (CCIMProperty*)NULL; - return (retVal); -} - -/* - * Name: cp_execQuery_Solaris_USBSCSIController - * - * Description: - * Returns an instance list which matches the query if any are found. - * - * Parameters: - * CCIMObjectPath *op - An CCIMObjectPath * which contains the - * information on the class for which to find the instances. - * - * selectList - Not used - * nonJoinExp - Not used - * - * Returns: - * CCIMInstanceList * if matched instances are found. Otherwise, NULL. - */ - -/* - * Currently, there is no WQL parser for the C providers. As a result, - * what is returned to the CIMOM is a list of instances with - * a NULL value at the beginning of the list. This NULL value indicates - * to the CIMOM that it must do the filtering for the client. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_execQuery_Solaris_USBSCSIController(CCIMObjectPath *op, cimchar *selectList, - cimchar *nonJoinExp, cimchar *queryExp, int queryType) -{ - CCIMInstanceList *instList = NULL; - CCIMInstanceList *result; - CCIMInstance *emptyInst; - CCIMException *ex; - int error; - - if (op == NULL) { - util_handleError(USB_EXECQUERY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = cp_enumInstances_Solaris_USBSCSIController(op); - - if (instList == NULL) { - return ((CCIMInstanceList *)NULL); - } - /* - * Create a null instance and add it to the beginning - * of the list to indicate to the CIMOM that no filtering - * was done. - */ - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError(USB_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, &error); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_createInstanceList(); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(USB_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_addInstance(result, emptyInst); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(USB_EXECQUERY, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - /* - * Since copying the original list to the new list will - * leave no way to free the original list, manually - * concatenate the original list to the new one. - */ - - result->mNext = instList; - return (result); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_USBSCSIController.h b/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_USBSCSIController.h deleted file mode 100644 index 25f26a378c..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_USBSCSIController.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOLARIS_USBSCSICONTROLLER_H_ -#define _SOLARIS_USBSCSICONTROLLER_H_ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> -#include <cimprovider.h> -#include <cimomhandle.h> -#include <cimlogsvc.h> - -#include "libdiskmgt.h" - -#ifdef __cplusplus -} -#endif - -#endif /* _SOLARIS_USBSCSICONTROLLER_H_ */ diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/disk/Makefile b/usr/src/cmd/wbem/provider/c/wbem_disk/disk/Makefile deleted file mode 100644 index f52a8a9514..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/disk/Makefile +++ /dev/null @@ -1,73 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -OBJECTS = Solaris_Disk.o - -LINT_OBJS = $(OBJECTS:%.o=%.ln) - -GENERAL = $(ROOTWBEMINC) \ - $(SRC)/lib/libdiskmgt/common \ - $(SRC)/cmd/wbem/provider/c/include - -CPPFLAGS += -I. $(GENERAL:%=-I%) -D_REENTRANT -Dpic -D_TS_ERRNO - -CFLAGS += $(XREGSFLAG) $(C_PICFLAGS) - -LINTFLAGS += -um -LINTLIBS = $(LDLIBS.cmd) - -POFILE = _disk.po -MSGFILES = $(OBJECTS:%.o=%.i) - -CLOBBERFILES += $(POFILE) - -.KEEP_STATE: - -all: $(OBJECTS) - -install: all - -lint: $(LINT_OBJS) - $(LINT.c) $(LINTFLAGS) $(LINT_OBJS) $(LINTLIBS) - -clean: - $(RM) $(OBJECTS) $(LINT_OBJS) $(MSGFILES) - -check: - $(CSTYLE) -p -P $(OBJECTS:%.o=%.c) *.h - $(HDRCHK) *.h - -catalog: $(POFILE) - -$(POFILE): $(MSGFILES) - $(BUILDPO.msgfiles) - -include $(SRC)/cmd/Makefile.targ -include $(SRC)/Makefile.msg.targ diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/disk/Solaris_Disk.c b/usr/src/cmd/wbem/provider/c/wbem_disk/disk/Solaris_Disk.c deleted file mode 100644 index e5194dc4ae..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/disk/Solaris_Disk.c +++ /dev/null @@ -1,432 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <unistd.h> -#include <netdb.h> -#include <errno.h> - -#include "util.h" -#include "cimKeys.h" -#include "methods.h" -#include "disk_descriptors.h" -#include "providerNames.h" -#include "messageStrings.h" - -#define DISK_GETINSTANCE "DISK,GET_INSTANCE" -#define DISK_ENUMINSTANCES "DISK,ENUM_INSTANCES" -#define DISK_ENUMINSTANCENAMES "DISK,ENUM_INSTANCENAMES" -#define DISK_CREATEINSTANCE "DISK,CREATE_INSTANCE" -#define DISK_DELETEINSTANCE "DISK,DELETE_INSTANCE" -#define DISK_SETINSTANCE "DISK,SET_INSTANCE" -#define DISK_GETPROPERTY "DISK,GET_PROPERTY" -#define DISK_SETPROPERTY "DISK,SET_PROPERTY" -#define DISK_INVOKEMETHOD "DISK,INVOKE_METHOD" -#define DISK_EXECQUERY "DISK,EXEC_QUERY" - -/* - * Solaris_Disk provider - * - * It is important to note that all memory allocated by these functions - * and passed to the CIMOM, is freed by the CIMOM as the caller. - */ - - -/* - * Name: cp_getInstance_Solaris_Disk - * - * Description: Returns an instance which matches the passed in object path - * if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMInstance* -cp_getInstance_Solaris_Disk(CCIMObjectPath* pOP) -{ - CCIMInstance *inst = NULL; - CCIMPropertyList *pCurPropList; - dm_descriptor_t disk_descriptor; - char *name; - int error; - - if (pOP == NULL || pOP->mKeyProperties == NULL) { - util_handleError(DISK_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - - pCurPropList = pOP->mKeyProperties; - name = (cimchar *)util_getKeyValue(pCurPropList, string, TAG, &error); - - if (error != 0 || name == NULL) { - util_handleError(DISK_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - - disk_descriptor = dm_get_descriptor_by_name(DM_MEDIA, name, &error); - - /* - * Not found. Return a null instance. - */ - if (error == ENODEV) { - return ((CCIMInstance *)NULL); - } - - if (error != 0) { - util_handleError(DISK_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstance *)NULL); - } - - /* Turn this descriptor in to a disk drive instance */ - - inst = disk_descriptor_toCCIMInstance( - hostName, disk_descriptor, DISK, &error); - dm_free_descriptor(disk_descriptor); - - if (error != 0) { - util_handleError(DISK_GETINSTANCE, CIM_ERR_FAILED, - DISK_DESC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstance *)NULL); - } - - return (inst); -} - -/* - * Name: cp_enumInstances_Solaris_Disk - * - * Description: Returns a list of instances if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstanceList * if matched instance is found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_enumInstances_Solaris_Disk(CCIMObjectPath* pOP) -{ - CCIMInstanceList* instList = NULL; - dm_descriptor_t *disk_descriptorp; - int error; - - disk_descriptorp = dm_get_descriptors(DM_MEDIA, NULL, &error); - - if (disk_descriptorp == NULL || - disk_descriptorp[0] == NULL) { - return ((CCIMInstanceList *)NULL); - } - if (error != 0) { - util_handleError(DISK_ENUMINSTANCENAMES, CIM_ERR_FAILED, - DM_GET_DESCRIPTORS, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* convert drive descriptors to CCIMInstanceList */ - instList = disk_descriptors_toCCIMInstanceList(DISK, - disk_descriptorp, &error); - dm_free_descriptors(disk_descriptorp); - - if (error != 0) { - util_handleError(DISK_ENUMINSTANCES, CIM_ERR_FAILED, - DISK_DESC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - return (instList); -} - -/* - * Name: cp_enumInstanceNames_Solaris_Disk - * - * Description: Returns a list of instances if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMObjectPathList * if matched instance is found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMObjectPathList* -cp_enumInstanceNames_Solaris_Disk(CCIMObjectPath * pOP) { - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pOP == NULL) { - util_handleError(DISK_ENUMINSTANCENAMES, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - /* - * Call in to enumInstances and then convert the instance list in - * to an object list. - */ - - instList = cp_enumInstances_Solaris_Disk(pOP); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Creating an instance of a Solaris_Disk is not supported. - */ - -/* ARGSUSED */ -CCIMObjectPath* -cp_createInstance_Solaris_Disk(CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - int error; - - util_handleError(DISK_CREATEINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return ((CCIMObjectPath *)NULL); -} - -/* - * Deleting an instance of a Solaris_Disk is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_Disk(CCIMObjectPath* pInst) -{ - - int error; - - util_handleError(DISK_DELETEINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - -/* - * Name: cp_getProperty_Solaris_Disk - * - * Description: Returns the property requested, if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMProperty * if found. - */ - -/* ARGSUSED */ -CCIMProperty * -cp_getProperty_Solaris_Disk(CCIMObjectPath *pOP, char *pPropName) -{ - - CCIMProperty *prop = NULL; - CCIMInstance *inst = NULL; - int error; - - if (pOP == NULL) { - util_handleError(DISK_GETPROPERTY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMProperty *)NULL); - } - - inst = cp_getInstance_Solaris_Disk(pOP); - if (inst == NULL) { - return ((CCIMProperty *)NULL); - } - - prop = cim_getProperty(inst, pPropName); - cim_freeInstance(inst); - return (prop); -} - -/* This provider cannot set an instance of a Solaris_Disk object. */ - -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_Disk(CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - - int error; - - util_handleError(DISK_SETINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, NULL, - &error); - return (cim_false); -} - -/* This provider cannot set an instance of a Solaris_Disk object. */ - -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_Disk(CCIMObjectPath* pOP, CCIMProperty* pProp) -{ - - int error; - - util_handleError(DISK_SETPROPERTY, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - -/* invokeMethod function dispatches to the various method implementations */ -CCIMProperty* -cp_invokeMethod_Solaris_Disk(CCIMObjectPath* op, cimchar* methodName, - CCIMPropertyList* inParams, CCIMPropertyList* outParams) -{ - CCIMProperty *retVal = (CCIMProperty *)NULL; - int error; - - /* dispatch code for various methods */ - if (strcasecmp("createFDiskPartitions", methodName) == 0) { - retVal = create_fdisk_partitions(inParams, op); - return (retVal); - } else if (strcasecmp("createPartitions", methodName) == 0) { - retVal = create_partitions(inParams, op); - return (retVal); - } else if (strcasecmp("labelDisk", methodName) == 0) { - retVal = label_disk(inParams, op); - return (retVal); - } else if (strcasecmp("getDiskGeometry", methodName) == 0) { - retVal = get_disk_geometry(outParams, op); - return (retVal); - } - - /* - * We fell through the dispatch logic. There is no function - * that matches 'methodName'. - */ - - util_handleError(DISK_INVOKEMETHOD, CIM_ERR_FAILED, - NO_SUCH_METHOD, NULL, &error); - return (retVal); -} - -/* - * Name: cp_execQuery_Solaris_Disk - * - * Description: - * Returns an instance list which matches the query if any are found. - * - * Parameters: - * CCIMObjectPath *op - An CCIMObjectPath * which contains the - * information on the class for which to find the instances. - * - * selectList - Not used - * nonJoinExp - Not used - * - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ - -/* - * Currently, there is no WQL parser for the C providers. As a result, - * what is returned to the CIMOM is a list of instances with - * a NULL value at the beginning of the list. This NULL value indicates - * to the CIMOM that it must do the filtering for the client. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_execQuery_Solaris_Disk(CCIMObjectPath *op, cimchar *selectList, - cimchar *nonJoinExp, cimchar *queryExp, int queryType) -{ - CCIMInstanceList *instList = NULL; - CCIMInstanceList *result; - CCIMInstance *emptyInst; - CCIMException *ex; - int error; - - if (op == NULL) { - util_handleError(DISK_EXECQUERY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = cp_enumInstances_Solaris_Disk(op); - - if (instList == NULL) { - return ((CCIMInstanceList *)NULL); - } - /* - * Create a null instance and add it to the beginning - * of the list to indicate to the CIMOM that no filtering - * was done. - */ - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError(DISK_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, &error); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_createInstanceList(); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(DISK_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_addInstance(result, emptyInst); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(DISK_EXECQUERY, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - /* - * Since copying the original list to the new list will - * leave no way to free the original list, manually - * concatenate the original list to the new one. - */ - - result->mNext = instList; - return (result); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/diskdrive/Makefile b/usr/src/cmd/wbem/provider/c/wbem_disk/diskdrive/Makefile deleted file mode 100644 index 6e3a77ca8d..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/diskdrive/Makefile +++ /dev/null @@ -1,73 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -OBJECTS = Solaris_DiskDrive.o - -LINT_OBJS = $(OBJECTS:%.o=%.ln) - -GENERAL = $(ROOTWBEMINC) \ - $(SRC)/lib/libdiskmgt/common \ - $(SRC)/cmd/wbem/provider/c/include - -CPPFLAGS += -I. $(GENERAL:%=-I%) -D_REENTRANT -Dpic -D_TS_ERRNO - -CFLAGS += $(XREGSFLAG) $(C_PICFLAGS) - -LINTFLAGS += -um -LINTLIBS = $(LDLIBS.cmd) - -POFILE = _diskdrive.po -MSGFILES = $(OBJECTS:%.o=%.i) - -CLOBBERFILES += $(POFILE) - -.KEEP_STATE: - -all: $(OBJECTS) - -install: all - -lint: $(LINT_OBJS) - $(LINT.c) $(LINTFLAGS) $(LINT_OBJS) $(LINTLIBS) - -clean: - $(RM) $(OBJECTS) $(LINT_OBJS) $(MSGFILES) - -check: - $(CSTYLE) -p -P $(OBJECTS:%.o=%.c) *.h - $(HDRCHK) *.h - -catalog: $(POFILE) - -$(POFILE): $(MSGFILES) - $(BUILDPO.msgfiles) - -include $(SRC)/cmd/Makefile.targ -include $(SRC)/Makefile.msg.targ diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/diskdrive/Solaris_DiskDrive.c b/usr/src/cmd/wbem/provider/c/wbem_disk/diskdrive/Solaris_DiskDrive.c deleted file mode 100644 index 99ed003c4a..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/diskdrive/Solaris_DiskDrive.c +++ /dev/null @@ -1,461 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <unistd.h> -#include <netdb.h> -#include <errno.h> - -#include "util.h" -#include "methods.h" -#include "cimKeys.h" -#include "drive_descriptors.h" -#include "providerNames.h" -#include "messageStrings.h" - -#define DISK_GETINSTANCE "DISK_DRIVE,GET_INSTANCE" -#define DISK_ENUMINSTANCES "DISK_DRIVE,ENUM_INSTANCES" -#define DISK_ENUMINSTANCENAMES "DISK_DRIVE,ENUM_INSTANCENAMES" -#define DISK_CREATEINSTANCE "DISK_DRIVE,CREATE_INSTANCE" -#define DISK_DELETEINSTANCE "DISK_DRIVE,DELETE_INSTANCE" -#define DISK_SETINSTANCE "DISK_DRIVE,SET_INSTANCE" -#define DISK_GETPROPERTY "DISK_DRIVE,GET_PROPERTY" -#define DISK_SETPROPERTY "DISK_DRIVE,SET_PROPERTY" -#define DISK_INVOKEMETHOD "DISK_DRIVE,INVOKE_METHOD" -#define DISK_EXECQUERY "DISK_DRIVE,EXEC_QUERY" - -/* - * Solaris_DiskDrive provider - * - * It is important to note that all memory allocated by these functions - * and passed to the CIMOM, is freed by the CIMOM as the caller. - */ - -/* - * Name: cp_getInstance_Solaris_DiskDrive - * - * Description: Returns an instance which matches the passed in object path - * if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMInstance* -cp_getInstance_Solaris_DiskDrive(CCIMObjectPath* pOP) -{ - CCIMInstance* inst = NULL; - CCIMPropertyList* pCurPropList; - dm_descriptor_t dd_descriptor; - char *name; - int error; - - - if (pOP == NULL || - pOP->mKeyProperties == NULL) { - util_handleError(DISK_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - - pCurPropList = pOP->mKeyProperties; - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - - if (error != 0 || name == NULL) { - util_handleError(DISK_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance*)NULL); - } - - - dd_descriptor = dm_get_descriptor_by_name(DM_DRIVE, name, &error); - - /* - * Not found. Return a null instance. - */ - - if (error == ENODEV) { - return ((CCIMInstance *)NULL); - } - - if (error != 0) { - util_handleError(DISK_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstance*)NULL); - } - - - /* Turn this descriptor in to a disk drive instance */ - - inst = drive_descriptor_toCCIMInstance( - hostName, dd_descriptor, DISK_DRIVE, &error); - dm_free_descriptor(dd_descriptor); - - if (error != 0) { - util_handleError(DISK_GETINSTANCE, CIM_ERR_FAILED, - DRIVE_DESC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstance*)NULL); - } - - return (inst); -} - -/* - * Name: cp_enumInstances_Solaris_DiskDrive - * - * Description: Returns a list of instances if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstanceList * if found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_enumInstances_Solaris_DiskDrive(CCIMObjectPath* pOP) -{ - CCIMInstanceList* instList = NULL; - dm_descriptor_t *ddrive_descriptorp; - int error; - int filter[5]; - - /* - * Get all disk drives, fixed or removable, but not CD-ROMs, floppy, - * etc., since those are in a different branch of the CIM model. - */ - filter[0] = DM_DT_UNKNOWN; - filter[1] = DM_DT_FIXED; - filter[2] = DM_DT_ZIP; - filter[3] = DM_DT_JAZ; - filter[4] = DM_FILTER_END; - - ddrive_descriptorp = dm_get_descriptors(DM_DRIVE, filter, &error); - if (ddrive_descriptorp == NULL) { - return ((CCIMInstanceList *)NULL); - } - - if (ddrive_descriptorp[0] == NULL) { - dm_free_descriptors(ddrive_descriptorp); - return ((CCIMInstanceList *)NULL); - } - - if (error != 0) { - util_handleError(DISK_ENUMINSTANCES, CIM_ERR_FAILED, - DM_GET_DESCRIPTORS, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* convert drive descriptors to CCIMInstanceList */ - instList = drive_descriptors_toCCIMInstanceList(DISK_DRIVE, - ddrive_descriptorp, &error); - dm_free_descriptors(ddrive_descriptorp); - - if (error != 0) { - util_handleError(DISK_ENUMINSTANCES, CIM_ERR_FAILED, - DRIVE_DESC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - return (instList); -} - -/* - * Name: cp_enumInstances_Solaris_DiskDrive - * - * Description: Returns a list of instances if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstanceList * if found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMObjectPathList* -cp_enumInstanceNames_Solaris_DiskDrive(CCIMObjectPath * pOP) { - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - - if (pOP == NULL) { - util_handleError(DISK_ENUMINSTANCENAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - /* - * Call in to enumInstances and then convert the instance list in - * to an object list. - */ - - instList = cp_enumInstances_Solaris_DiskDrive(pOP); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Creating an instance of a Solaris_DiskDrive is not supported. - */ - -/* ARGSUSED */ -CCIMObjectPath* -cp_createInstance_Solaris_DiskDrive(CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - int error; - - util_handleError(DISK_CREATEINSTANCE, CIM_ERR_NOT_SUPPORTED, - NULL, NULL, &error); - return ((CCIMObjectPath*)NULL); -} - - -/* deletes an instance */ -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_DiskDrive(CCIMObjectPath* pInst) -{ - - int error; - - util_handleError(DISK_DELETEINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - -/* - * Name: cp_getProperty_Solaris_DiskDrive - * - * Description: Returns the property requested, if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMProperty * if found. - */ - -/* ARGSUSED */ -CCIMProperty * -cp_getProperty_Solaris_DiskDrive(CCIMObjectPath *pOP, - char *pPropName) -{ - - CCIMProperty *prop = NULL; - CCIMInstance *inst = NULL; - int error = 0; - - if (pOP == NULL) { - util_handleError(DISK_GETPROPERTY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMProperty *)NULL); - } - - inst = cp_getInstance_Solaris_DiskDrive(pOP); - if (inst == NULL) { - return ((CCIMProperty *)NULL); - } - - prop = cim_getProperty(inst, pPropName); - cim_freeInstance(inst); - return (prop); -} -/* This provider cannot set an instance of a Solaris_DiskDrive object. */ - -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_DiskDrive(CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - - int error; - - util_handleError(DISK_SETINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - -/* - * Sets the property in the passed in instance to the new values of the passed - * in property - * params: - * CCIMInstance* - the instance in which teh property should be changed - * CCIMProperty* - a property structure which contains the new values - * return: - * cim_true if property was updated otherwise cim_false - * NOTE: This provider cannot set a property on a Solaris_DiskDrive object. - */ - -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_DiskDrive(CCIMObjectPath* pOP, CCIMProperty* pProp) -{ - - - int error; - - util_handleError(DISK_SETPROPERTY, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - -/* invokeMethod function dispatches to the various method implementations */ -CCIMProperty* -cp_invokeMethod_Solaris_DiskDrive(CCIMObjectPath* op, cimchar* methodName, - CCIMPropertyList* inParams, CCIMPropertyList* outParams) -{ - CCIMProperty *retVal = (CCIMProperty*)NULL; - int error; - - /* dispatch code for various methods */ - if (strcasecmp("CreateFdiskPartitions", methodName) == 0) { - retVal = create_fdisk_partitions(inParams, op); - return (retVal); - } else if (strcasecmp( - "CreateDefaultFdiskPartition", methodName) == 0) { - retVal = create_default_fdisk_partition(op); - return (retVal); - } else if (strcasecmp("GetFdiskPartitions", methodName) == 0) { - retVal = getFdisk(outParams, op); - return (retVal); - } else if (strcasecmp("LabelDisk", methodName) == 0) { - retVal = label_disk(inParams, op); - return (retVal); - } - - /* - * We fell through the dispatch logic. There is no function - * that matches 'methodName'. - */ - - util_handleError(DISK_INVOKEMETHOD, CIM_ERR_FAILED, - NO_SUCH_METHOD, NULL, &error); - return (retVal); -} -/* - * Name: cp_execQuery_Solaris_DiskDrive - * - * Description: - * Returns an instance list which matches the query if any are found. - * - * Parameters: - * CCIMObjectPath *op - An CCIMObjectPath * which contains the - * information on the class for which to find the instances. - * - * selectList - Not used - * nonJoinExp - Not used - * - * Returns: - * CCIMInstanceList * if found. Otherwise, NULL. - */ - -/* - * Currently, there is no WQL parser for the C providers. As a result, - * what is returned to the CIMOM is a list of instances with - * a NULL value at the beginning of the list. This NULL value indicates - * to the CIMOM that it must do the filtering for the client. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_execQuery_Solaris_DiskDrive(CCIMObjectPath *op, cimchar *selectList, - cimchar *nonJoinExp, cimchar *queryExp, int queryType) -{ - CCIMInstanceList *instList = NULL; - CCIMInstanceList *result; - CCIMInstance *emptyInst; - CCIMException *ex; - int error; - - if (op == NULL) { - util_handleError(DISK_EXECQUERY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = cp_enumInstances_Solaris_DiskDrive(op); - - if (instList == NULL) { - return ((CCIMInstanceList *)NULL); - } - /* - * Create a null instance and add it to the beginning - * of the list to indicate to the CIMOM that no filtering - * was done. - */ - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError(DISK_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, &error); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_createInstanceList(); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(DISK_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_addInstance(result, emptyInst); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(DISK_EXECQUERY, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - /* - * Since copying the original list to the new list will - * leave no way to free the original list, manually - * concatenate the original list to the new one. - */ - - result->mNext = instList; - return (result); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/diskpartition/Makefile b/usr/src/cmd/wbem/provider/c/wbem_disk/diskpartition/Makefile deleted file mode 100644 index 4671f14f9a..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/diskpartition/Makefile +++ /dev/null @@ -1,74 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -OBJECTS = Solaris_DiskPartition.o - -LINT_OBJS = $(OBJECTS:%.o=%.ln) - -GENERAL = $(ROOTWBEMINC) \ - $(SRC)/lib/libdiskmgt/common \ - $(SRC)/cmd/wbem/provider/c/include \ - $(SRC)/cmd/wbem/provider/c/wbem_disk/disk - -CPPFLAGS += -I. $(GENERAL:%=-I%) -D_REENTRANT -Dpic -D_TS_ERRNO - -CFLAGS += $(XREGSFLAG) $(C_PICFLAGS) - -LINTFLAGS += -um -LINTLIBS = $(LDLIBS.cmd) - -POFILE = _diskpartition.po -MSGFILES = $(OBJECTS:%.o=%.i) - -CLOBBERFILES += $(POFILE) - -.KEEP_STATE: - -all: $(OBJECTS) - -install: all - -lint: $(LINT_OBJS) - $(LINT.c) $(LINTFLAGS) $(LINT_OBJS) $(LINTLIBS) - -clean: - $(RM) $(OBJECTS) $(LINT_OBJS) $(MSGFILES) - -check: - $(CSTYLE) -p -P $(OBJECTS:%.o=%.c) *.h - $(HDRCHK) *.h - -catalog: $(POFILE) - -$(POFILE): $(MSGFILES) - $(BUILDPO.msgfiles) - -include $(SRC)/cmd/Makefile.targ -include $(SRC)/Makefile.msg.targ diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/diskpartition/Solaris_DiskPartition.c b/usr/src/cmd/wbem/provider/c/wbem_disk/diskpartition/Solaris_DiskPartition.c deleted file mode 100644 index c2be00d81e..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/diskpartition/Solaris_DiskPartition.c +++ /dev/null @@ -1,461 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <errno.h> -#include <sys/wait.h> -#include "cimKeys.h" -#include "util.h" -#include "Solaris_DiskPartition.h" -#include "partition_descriptors.h" -#include "methods.h" -#include "providerNames.h" -#include "messageStrings.h" - -#define DISK_GETINSTANCE "DISK_PARTITION,GET_INSTANCE" -#define DISK_ENUMINSTANCES "DISK_PARTITION,ENUM_INSTANCES" -#define DISK_ENUMINSTANCENAMES "DISK_PARTITION,ENUM_INSTANCENAMES" -#define DISK_CREATEINSTANCE "DISK_PARTITION,CREATE_INSTANCE" -#define DISK_DELETEINSTANCE "DISK_PARTITION,DELETE_INSTANCE" -#define DISK_SETINSTANCE "DISK_PARTITION,SET_INSTANCE" -#define DISK_GETPROPERTY "DISK_PARTITION,GET_PROPERTY" -#define DISK_SETPROPERTY "DISK_PARTITION,SET_PROPERTY" -#define DISK_INVOKEMETHOD "DISK_PARTITION,INVOKE_METHOD" -#define DISK_EXECQUERY "DISK_PARTITION,EXEC_QUERY" - -/* - * Name: cp_getInstance_Solaris_DiskPartition - * - * Description: Returns an instance which matches the passed in object path - * if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMInstance * -cp_getInstance_Solaris_DiskPartition(CCIMObjectPath *pOP) -{ - - CCIMInstance* inst = NULL; - CCIMPropertyList* pCurPropList; - CCIMException* ex; - dm_descriptor_t dp_descriptor; - char *name; - int error; - - if (pOP == NULL || - pOP->mKeyProperties == NULL) { - util_handleError(DISK_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance *)NULL); - } - - pCurPropList = pOP->mKeyProperties; - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - - if (error != 0 || name == NULL) { - util_handleError(DISK_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance*)NULL); - } - - dp_descriptor = dm_get_descriptor_by_name(DM_SLICE, name, &error); - - /* - * If not found, could be an fdisk partition. - */ - - if (error == ENODEV) { - dp_descriptor = dm_get_descriptor_by_name(DM_PARTITION, name, - &error); - if (error == ENODEV) { - return ((CCIMInstance *)NULL); - } else if (error != 0) { - util_handleError(DISK_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstance*)NULL); - } - } else if (error != 0) { - util_handleError(DISK_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstance*)NULL); - } - - /* Turn this descriptor in to a disk partition instance */ - - inst = partition_descriptor_toCCIMInstance( - hostName, dp_descriptor, DISK_PARTITION, &error); - dm_free_descriptor(dp_descriptor); - - if (error != 0) { - ex = cim_getLastError(); - util_handleError(DISK_GETINSTANCE, CIM_ERR_FAILED, - PART_DESC_TO_INSTANCE_FAILURE, ex, &error); - return ((CCIMInstance*)NULL); - } - - return (inst); -} - -/* - * Name: cp_enumInstances_Solaris_DiskPartition - * - * Description: Returns a list of instances if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_enumInstances_Solaris_DiskPartition(CCIMObjectPath* pOP) -{ - - CCIMInstanceList* instList = NULL; - dm_descriptor_t *dsolpart_descriptorp = NULL; - dm_descriptor_t *dfdiskpart_descriptorp = NULL; - int error; - int filter[2]; - - filter[0] = DM_MT_FIXED; - filter[1] = DM_FILTER_END; - - dsolpart_descriptorp = dm_get_descriptors(DM_SLICE, filter, &error); - - if (error != 0) { - util_handleError(DISK_ENUMINSTANCES, CIM_ERR_FAILED, - DM_GET_DESCRIPTORS, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - dfdiskpart_descriptorp = - dm_get_descriptors(DM_PARTITION, filter, &error); - - if (error != 0) { - if (dsolpart_descriptorp != NULL) { - dm_free_descriptors(dsolpart_descriptorp); - } - util_handleError(DISK_ENUMINSTANCES, CIM_ERR_FAILED, - DM_GET_DESCRIPTORS, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - - /* - * If both descriptor lists are null, then there is nothing to return. - * otherwise, call the conversion function and return what is found. - */ - - if (dsolpart_descriptorp == NULL && dfdiskpart_descriptorp == NULL) { - return ((CCIMInstanceList *)NULL); - } - - /* Convert the slice descriptors to a CCIMInstanceList */ - - instList = partition_descriptors_toCCIMInstanceList(DISK_PARTITION, - dsolpart_descriptorp, dfdiskpart_descriptorp, &error); - - if (dsolpart_descriptorp != NULL) { - dm_free_descriptors(dsolpart_descriptorp); - } - - if (dfdiskpart_descriptorp != NULL) { - dm_free_descriptors(dfdiskpart_descriptorp); - } - - return (instList); -} - -/* - * Name: cp_enumInstanceNames_Solaris_DiskPartition - * - * Description: Returns a list of instances if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMObjectPathList * if found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMObjectPathList * -cp_enumInstanceNames_Solaris_DiskPartition(CCIMObjectPath *pOP) { - - CCIMInstanceList *instList = NULL; - CCIMObjectPathList *objList = NULL; - int error = 0; - - if (pOP == NULL) { - util_handleError(DISK_ENUMINSTANCENAMES, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - /* - * Call to enumInstances and then convert instance list to a list - * of object list. - */ - - instList = cp_enumInstances_Solaris_DiskPartition(pOP); - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Creating an instance of a Solaris_DiskPartition is not supported. - */ - -/* ARGSUSED */ -CCIMObjectPath* -cp_createInstance_Solaris_DiskPartition(CCIMObjectPath* pOP, - CCIMInstance* pInst) -{ - int error; - - util_handleError(DISK_CREATEINSTANCE, CIM_ERR_NOT_SUPPORTED, - NULL, NULL, &error); - return ((CCIMObjectPath*)NULL); -} - -/* - * Deleting an instance of a Solaris_DiskPartition is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_DiskPartition(CCIMObjectPath* pInst) -{ - int error; - - util_handleError(DISK_DELETEINSTANCE, CIM_ERR_NOT_SUPPORTED, - NULL, NULL, &error); - return (cim_false); -} - -/* - * Name: cp_getProperty_Solaris_DiskPartition - * - * Description: Returns the property requested, if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMProperty * if found. - */ - -/* ARGSUSED */ -CCIMProperty * -cp_getProperty_Solaris_DiskPartition(CCIMObjectPath *pOP, - char *pPropName) -{ - - CCIMProperty *prop = NULL; - CCIMInstance *inst = NULL; - int error = 0; - - if (pOP == NULL) { - util_handleError(DISK_GETPROPERTY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMProperty *)NULL); - } - - inst = cp_getInstance_Solaris_DiskPartition(pOP); - if (inst == NULL) { - return ((CCIMProperty *)NULL); - } - - prop = cim_getProperty(inst, pPropName); - cim_freeInstance(inst); - return (prop); -} -/* - * Deleting an instance of a Solaris_DiskPartition is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_DiskPartition(CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - int error; - - util_handleError(DISK_DELETEINSTANCE, CIM_ERR_NOT_SUPPORTED, - NULL, NULL, &error); - return (cim_false); -} - -/* - * Setting a property on an instance of a Solaris_DiskPartition is not - * supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_DiskPartition(CCIMObjectPath* pOP, CCIMProperty* pProp) -{ - int error; - - util_handleError(DISK_SETPROPERTY, CIM_ERR_NOT_SUPPORTED, - NULL, NULL, &error); - return (cim_false); -} - -/* invokeMethod function dispatches to the various method implementations */ - -/* ARGSUSED */ -CCIMProperty* -cp_invokeMethod_Solaris_DiskPartition(CCIMObjectPath* op, cimchar* methodName, - CCIMPropertyList* inParams, CCIMPropertyList* outParams) -{ - CCIMProperty *retVal = (CCIMProperty*)NULL; - int error = 0; - - - /* dispatch code for various methods */ - if (strcasecmp("CreatePartitions", methodName) == 0) { - retVal = create_partitions(inParams, op); - return (retVal); - } else if (strcasecmp("CreateFileSystem", methodName) == 0) { - retVal = create_filesystem(op); - return (retVal); - } - - /* - * We fell through the dispatch logic. There is no function - * that matches 'methodName'. - */ - - util_handleError(DISK_INVOKEMETHOD, CIM_ERR_FAILED, - NO_SUCH_METHOD, NULL, &error); - return ((CCIMProperty*)NULL); -} - -/* - * Name: cp_execQuery_Solaris_DiskPartition - * - * Description: - * Returns an instance list which matches the query if any are found. - * - * Parameters: - * CCIMObjectPath *op - An CCIMObjectPath * which contains the - * information on the class for which to find the instances. - * - * selectList - Not used - * nonJoinExp - Not used - * - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ - -/* - * Currently, there is no WQL parser for the C providers. As a result, - * what is returned to the CIMOM is a list of instances with - * a NULL value at the beginning of the list. This NULL value indicates - * to the CIMOM that it must do the filtering for the client. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_execQuery_Solaris_DiskPartition(CCIMObjectPath *op, cimchar *selectList, - cimchar *nonJoinExp, cimchar *queryExp, int queryType) -{ - CCIMInstanceList *instList = NULL; - CCIMInstanceList *result; - CCIMInstance *emptyInst; - CCIMException *ex; - int error; - - if (op == NULL) { - util_handleError(DISK_EXECQUERY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* Enumerate all instances */ - instList = cp_enumInstances_Solaris_DiskPartition(op); - - if (instList == NULL) { - return ((CCIMInstanceList *)NULL); - } - - /* - * Create a null instance and add it to the beginning - * of the list to indicate to the CIMOM that no filtering - * was done. - */ - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError(DISK_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, &error); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_createInstanceList(); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(DISK_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_addInstance(result, emptyInst); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(DISK_EXECQUERY, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - /* - * Since copying the original list to the new list will - * leave no way to free the original list, manually - * concatenate the original list to the new one. - */ - - result->mNext = instList; - return (result); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/diskpartition/Solaris_DiskPartition.h b/usr/src/cmd/wbem/provider/c/wbem_disk/diskpartition/Solaris_DiskPartition.h deleted file mode 100644 index a0d969047f..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/diskpartition/Solaris_DiskPartition.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOLARIS_DISKPARTITION_H_ -#define _SOLARIS_DISKPARTITION_H_ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -/* include the cimapi headers */ -#include <cimapi.h> -#include <cimprovider.h> -#include <cimomhandle.h> -#include <cimlogsvc.h> -#include <cimstructs.h> - -#include "libdiskmgt.h" - -#define LINELEN 256 -#define DISKIDSIZE 32 - -#ifdef __cplusplus -} -#endif - -#endif /* _SOLARIS_DISKPARTITION_H_ */ diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/lib/Makefile b/usr/src/cmd/wbem/provider/c/wbem_disk/lib/Makefile deleted file mode 100644 index 7f4f350e84..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/lib/Makefile +++ /dev/null @@ -1,169 +0,0 @@ -# -# 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 2008 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -LIBNAME = libWBEMdisk -LIBRARY = $(LIBNAME).so -PROG = $(LIBRARY) -MSG_DOMAIN = CIM_$(LIBNAME) -TMPFILE = classes.tmp -TMPFILE1 = assocclasses.tmp - -PROV_OBJECTS = \ - ../assoc/Solaris_DiskPartitionBasedOnDisk.o \ - ../assoc/Sol_DiskPartitionBasedOnFDisk.o \ - ../assoc/Solaris_MediaPresent.o \ - ../assoc/Solaris_RealizesExtent.o \ - ../assoc/Solaris_RealizesDiskDrive.o \ - ../assoc/Solaris_SCSIInterface.o \ - ../assoc/Solaris_IDEInterface.o \ - ../assoc/Solaris_MPXIOInterface.o \ - ../assoc/Sol_MPXIOCtrlrLogicalIdentity.o \ - ../assoc/Solaris_MPXIOComponent.o \ - ../controller/Solaris_USBSCSIController.o \ - ../controller/Solaris_SCSIController.o \ - ../controller/Solaris_MPXIOController.o \ - ../controller/Solaris_IDEController.o \ - ../controller/Solaris_GenericController.o \ - ../common/util.o \ - ../common/drive_descriptors.o \ - ../common/partition_descriptors.o \ - ../common/logicaldisk_descriptors.o \ - ../common/mpxiogroup_descriptors.o \ - ../common/ctrl_descriptors.o \ - ../common/partbasedon_descriptors.o \ - ../common/mediapresent_descriptors.o \ - ../common/methods.o \ - ../common/disk_descriptors.o \ - ../common/realizesextent_descriptors.o \ - ../common/realizesdiskdrive_descriptors.o \ - ../disk/Solaris_Disk.o \ - ../diskdrive/Solaris_DiskDrive.o \ - ../diskpartition/Solaris_DiskPartition.o \ - ../logicaldisk/Solaris_LogicalDisk.o \ - ../mpxio/Solaris_MPXIOGroup.o - -# Just add the name of your provider -# to this list. -# IMPORTANT: -# $(LIBNAME) MUST be the last entry - -WBEM_DISK_CLASSES = Solaris_DiskDrive \ - Solaris_DiskPartition \ - Solaris_Disk \ - Solaris_LogicalDisk \ - Solaris_SCSIController \ - Solaris_IDEController \ - Solaris_USBSCSIController \ - Solaris_MPXIOController \ - Solaris_GenericController \ - Solaris_DiskPartitionBasedOnDisk \ - Solaris_DiskPartitionBasedOnFDisk \ - Solaris_MediaPresent \ - Solaris_RealizesExtent \ - Solaris_RealizesDiskDrive \ - Solaris_SCSIInterface \ - Solaris_MPXIOInterface \ - Solaris_IDEInterface \ - Solaris_MPXIOComponent \ - Solaris_MPXIOGroup \ - Solaris_MPXIOCtrlrLogicalIdentity \ - $(LIBNAME) - -WBEM_DISK_ASSOC_CLASSES = Solaris_DiskPartitionBasedOnDisk \ - Solaris_DiskPartitionBasedOnFDisk \ - Solaris_MediaPresent \ - Solaris_RealizesExtent \ - Solaris_RealizesDiskDrive \ - Solaris_SCSIInterface \ - Solaris_MPXIOInterface \ - Solaris_IDEInterface \ - Solaris_MPXIOComponent \ - Solaris_MPXIOCtrlrLogicalIdentity \ - $(LIBNAME) - -OBJECTS = libDispatch.o \ - localFunc.o - -LINT_OBJS = $(OBJECTS:%.o=%.ln) - -GENERAL = $(ROOTWBEMINC) \ - $(SRC)/cmd/wbem/provider/c/include - -CPPFLAGS += -I. $(GENERAL:%=-I%) -DPORTMAP -D_REENTRANT -Dpic -D_TS_ERRNO - -CFLAGS += $(XREGSFLAG) $(C_PICFLAGS) - -LINTFLAGS += -um -LINTLIBS = $(LDLIBS.cmd) - -LDFLAGS += -Mmapfile $(GSHARED) -R/usr/sadm/lib/wbem \ - $(ZTEXT) $(ZDEFS) $(SOFLAGS) - -LDLIBS += -L/usr/sadm/lib/wbem -lc -lcimapi -ldiskmgt \ - -lnvpair - -POFILE = _lib.po -MSGFILES = $(OBJECTS:%.o=%.i) - -CLEANFILES = *.tmp master.h classes assocclasses Make.obj libname $(MSGFILES) - -CLOBBERFILES += $(POFILE) - -.KEEP_STATE: - -all: master.h $(LIBRARY) - -$(LIBRARY): $(OBJECTS) - $(CC) -o $@ $(LDFLAGS) \ - $(PROV_OBJECTS) $(OBJECTS) $(LDLIBS) - $(POST_PROCESS_SO) - -catalog: master.h $(POFILE) - -$(POFILE): $(MSGFILES) - $(BUILDPO.msgfiles) - -master.h: Makefile header.sh - @echo ${WBEM_DISK_CLASSES} > ${TMPFILE} - @echo ${WBEM_DISK_ASSOC_CLASSES} > ${TMPFILE1} - sh header.sh - -install: all $(ROOTWBEMPROG) - -lint: $(LINT_OBJS) - $(LINT.c) $(LINTFLAGS) $(LINT_OBJS) $(LINTLIBS) - -clean: - $(RM) $(OBJECTS) $(LIBRARY) $(CLEANFILES) $(LINT_OBJS) - -check: - $(CSTYLE) -p -P $(OBJECTS:%.o=%.c) - -include $(SRC)/cmd/Makefile.targ -include $(SRC)/Makefile.msg.targ diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/lib/header.sh b/usr/src/cmd/wbem/provider/c/wbem_disk/lib/header.sh deleted file mode 100644 index b82a0ba971..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/lib/header.sh +++ /dev/null @@ -1,426 +0,0 @@ -#! /usr/bin/sh -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 -# -# -# ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -INFILE=classes.tmp -INFILE1=assocclasses.tmp -CLASSFILE=classes -ASSOCCLASSFILE=assocclasses -LIBFILE=libname -TMPFILE=tmp.tmp -TMPFILE1=tmp1.tmp -PWD=`pwd` - -HEADER=${PWD}/master.h - - -rm -f $HEADER $TMPFILE $TMPFILE1 $CLASSFILE $ASSOCCLASSFILE $LIBFILE - -# Convert into separate lines per class -for x in `cat $INFILE` -do - echo $x >> $TMPFILE -done - -# Convert into separate lines per class -for x in `cat $INFILE1` -do - echo $x >> $TMPFILE1 -done -##################################################### -# Create file containing only the library name -tail -1 $TMPFILE > $LIBFILE -LIBNAME=`cat $LIBFILE` - -# Create file containing only the class names -COUNT=`cat $TMPFILE | wc -l` -COUNT=`expr $COUNT - 1` -head -n $COUNT $TMPFILE > $CLASSFILE - -# Create file containing only the class names -COUNT=`cat $TMPFILE1 | wc -l` -COUNT=`expr $COUNT - 1` -head -n $COUNT $TMPFILE1 > $ASSOCCLASSFILE -############################################################## -# -# Create the header file -# -echo "#include <cimapi.h>" > $HEADER -echo "#include <cimlogsvc.h>" > $HEADER - -# -# Create the externs -# cp_enumInstances -# - -echo "" >> $HEADER -for x in `cat $TMPFILE` -do - echo "extern CCIMInstanceList*" >> $HEADER - echo "cp_enumInstances_$x(CCIMObjectPath* pOP);" >> $HEADER -done - - -# -# Create the externs -# cp_enumInstanceNames -# - -echo "" >> $HEADER -for x in `cat $TMPFILE` -do - echo "extern CCIMObjectPathList*" >> $HEADER - echo "cp_enumInstanceNames_$x(CCIMObjectPath* pOP);" >> $HEADER -done - -# -# cp_createInstance -# - -echo "" >> $HEADER -for x in `cat $TMPFILE` -do - echo "extern CCIMObjectPath*" >> $HEADER - echo "cp_createInstance_$x(CCIMObjectPath* pOP, CCIMInstance* pInst);" >> $HEADER -done - -# -# cp_deleteInstance -# - -echo "" >> $HEADER -for x in `cat $TMPFILE` -do - echo "extern CIMBool" >> $HEADER - echo "cp_deleteInstance_$x(CCIMObjectPath* pOP);" >> $HEADER -done - -# -# cp_getInstance -# - -echo "" >> $HEADER -for x in `cat $TMPFILE` -do - echo "extern CCIMInstance*" >> $HEADER - echo "cp_getInstance_$x(CCIMObjectPath* pOP);" >> $HEADER -done - -# -# cp_setInstance -# - -echo "" >> $HEADER -for x in `cat $TMPFILE` -do - echo "extern CIMBool" >> $HEADER - echo "cp_setInstance_$x(CCIMObjectPath* pOP, CCIMInstance* pInst);" >> $HEADER -done - -# -# cp_setProperty -# - -echo "" >> $HEADER -for x in `cat $TMPFILE` -do - echo "extern CIMBool" >> $HEADER - echo "cp_setProperty_$x(CCIMObjectPath* pOP, CCIMProperty* pProp);" >> $HEADER -done - -# -# cp_invokeMethod -# - -echo "" >> $HEADER -for x in `cat $TMPFILE` -do - echo "extern CCIMProperty*" >> $HEADER - echo "cp_invokeMethod_$x(CCIMObjectPath* pOP, cimchar* pName,CCIMPropertyList* pInParams,CCIMPropertyList* pInOutParams);" >> $HEADER -done - -# -# cp_execQuery -# - -echo "" >> $HEADER -for x in `cat $TMPFILE` -do - echo "extern CCIMInstanceList *" >> $HEADER - echo "cp_execQuery_$x(CCIMObjectPath* pOP, char *selectList,char *nonJoinExp, char *queryExp, char *queryType);" >> $HEADER -done - - -# -# cp_associators -# - -echo "" >> $HEADER -for x in `cat $TMPFILE1` -do - echo "extern CCIMInstanceList *" >> $HEADER - echo "cp_associators_$x(CCIMObjectPath* pAssocName, CCIMObjectPath *pObjectName, char *pResultClass, char *pRole, char *pResultRole);" >> $HEADER -done - -# -# cp_associatorNames -# - -echo "" >> $HEADER -for x in `cat $TMPFILE1` -do - echo "extern CCIMObjectPathList *" >> $HEADER - echo "cp_associatorNames_$x(CCIMObjectPath* pAssocName, CCIMObjectPath *pObjectName, char *pResultClass, char *pRole, char *pResultRole);" >> $HEADER -done - -# -# cp_reference -# - -echo "" >> $HEADER -for x in `cat $TMPFILE1` -do - echo "extern CCIMObjectPathList *" >> $HEADER - echo "cp_references_$x(CCIMObjectPath* pAssocName, CCIMObjectPath *pObjectName, char *pRole);" >> $HEADER -done - -# -# cp_referenceNames -# - -echo "" >> $HEADER -for x in `cat $TMPFILE1` -do - echo "extern CCIMObjectPathList *" >> $HEADER - echo "cp_referenceNames_$x(CCIMObjectPath* pAssocName, CCIMObjectPath *pObjectName, char *pRole);" >> $HEADER -done - -############################################################## -# -# Create the dispatch tables -# -############################################################## - - -# -# *cpInvokeMethodTable -# - -echo "" >> $HEADER -echo "CCIMProperty *" >> $HEADER -echo "(*cpInvokeMethodTable[])(CCIMObjectPath *, cimchar *, CCIMPropertyList *, CCIMPropertyList *) = {" >> $HEADER -for x in `cat $CLASSFILE` -do - echo "cp_invokeMethod_$x," >> $HEADER -done - -echo "cp_invokeMethod_$LIBNAME};" >> $HEADER - - -# -# *createInstanceTable -# - -echo "" >> $HEADER -echo "CCIMObjectPath *" >> $HEADER -echo "(*createInstanceTable[])(CCIMObjectPath *, CCIMInstance *) = {" >> $HEADER -for x in `cat $CLASSFILE` -do - echo "cp_createInstance_$x," >> $HEADER -done -echo "cp_createInstance_$LIBNAME};" >> $HEADER - -# -# *deleteInstanceTable -# - -echo "" >> $HEADER -echo "CIMBool" >> $HEADER -echo "(*deleteInstanceTable[])( CCIMObjectPath *) = {" >> $HEADER -for x in `cat $CLASSFILE` -do - echo "cp_deleteInstance_$x," >> $HEADER -done -echo "cp_deleteInstance_$LIBNAME};" >> $HEADER - -# -# *enumInstanceTable -# - -echo "" >> $HEADER -echo "CCIMInstanceList *" >> $HEADER -echo "(*enumInstanceTable[])(CCIMObjectPath *) = {" >> $HEADER -for x in `cat $CLASSFILE` -do - echo "cp_enumInstances_$x," >> $HEADER -done -echo "cp_enumInstances_$LIBNAME};" >> $HEADER - -# -# *enumInstanceNamesTable -# - -echo "" >> $HEADER -echo "CCIMObjectPathList *" >> $HEADER -echo "(*enumInstanceNamesTable[])(CCIMObjectPath *) = {" >> $HEADER -for x in `cat $CLASSFILE` -do - echo "cp_enumInstanceNames_$x," >> $HEADER -done -echo "cp_enumInstanceNames_$LIBNAME};" >> $HEADER - -# -# *getInstanceTable -# - -echo "" >> $HEADER -echo "CCIMInstance *" >> $HEADER -echo "(*getInstanceTable[])(CCIMObjectPath *) = {" >> $HEADER -for x in `cat $CLASSFILE` -do - echo "cp_getInstance_$x," >> $HEADER -done -echo "cp_getInstance_$LIBNAME};" >> $HEADER - -# -# *setInstanceTable -# - -echo "" >> $HEADER -echo "CIMBool" >> $HEADER -echo "(*setInstanceTable[])(CCIMObjectPath *, CCIMInstance *) = {" >> $HEADER -for x in `cat $CLASSFILE` -do - echo "cp_setInstance_$x," >> $HEADER -done -echo "cp_setInstance_$LIBNAME};" >> $HEADER - -# -# *setPropertyTable -# - -echo "" >> $HEADER -echo "CIMBool" >> $HEADER -echo "(*setPropertyTable[])(CCIMObjectPath *, CCIMProperty *) = {" >> $HEADER -for x in `cat $CLASSFILE` -do - echo "cp_setProperty_$x," >> $HEADER -done -echo "cp_setProperty_$LIBNAME};" >> $HEADER - -# -# *execQueryTable -# - -echo "" >> $HEADER -echo "CCIMInstanceList*" >> $HEADER -echo "(*execQueryTable[])(CCIMObjectPath *, char *, char *, char *, char*) = {" >> $HEADER -for x in `cat $CLASSFILE` -do - echo "cp_execQuery_$x," >> $HEADER -done -echo "cp_execQuery_$LIBNAME};" >> $HEADER - - -# -# *associatorsTable -# - -echo "" >> $HEADER -echo "CCIMInstanceList*" >> $HEADER -echo "(*associatorsTable[])(CCIMObjectPath *, CCIMObjectPath *, char *, char *, char*) = {" >> $HEADER -for x in `cat $ASSOCCLASSFILE` -do - echo "cp_associators_$x," >> $HEADER -done -echo "cp_associators_$LIBNAME};" >> $HEADER - -############################################################## -# -# *associatorNamesTable -# - -echo "" >> $HEADER -echo "CCIMObjectPathList*" >> $HEADER -echo "(*associatorNamesTable[])(CCIMObjectPath *, CCIMObjectPath *, char *, char *, char*) = {" >> $HEADER -for x in `cat $ASSOCCLASSFILE` -do - echo "cp_associatorNames_$x," >> $HEADER -done -echo "cp_associatorNames_$LIBNAME};" >> $HEADER - - -############################################################## -# -# *referencesTable -# - -echo "" >> $HEADER -echo "CCIMObjectPathList*" >> $HEADER -echo "(*referencesTable[])(CCIMObjectPath *, CCIMObjectPath *, char *) = {" >> $HEADER -for x in `cat $ASSOCCLASSFILE` -do - echo "cp_references_$x," >> $HEADER -done -echo "cp_references_$LIBNAME};" >> $HEADER - -############################################################## -# -# *referenceNamesTable -# - -echo "" >> $HEADER -echo "CCIMObjectPathList*" >> $HEADER -echo "(*referenceNamesTable[])(CCIMObjectPath *, CCIMObjectPath *, char *) = {" >> $HEADER -for x in `cat $ASSOCCLASSFILE` -do - echo "cp_referenceNames_$x," >> $HEADER -done -echo "cp_referenceNames_$LIBNAME};" >> $HEADER -# -# Create Class Name table -# -echo "" >> $HEADER -echo "static char *classNameTable [] = {" >> $HEADER -for x in `cat $CLASSFILE` -do - echo "\"$x\"," >> $HEADER -done -echo "\"$LIBNAME\"};" >> $HEADER - -############################################################## -# -# Create Assoc Class Name table -# -echo "" >> $HEADER -echo "static char *assocclassNameTable [] = {" >> $HEADER -for x in `cat $ASSOCCLASSFILE` -do - echo "\"$x\"," >> $HEADER -done -echo "\"$LIBNAME\"};" >> $HEADER diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/lib/libDispatch.c b/usr/src/cmd/wbem/provider/c/wbem_disk/lib/libDispatch.c deleted file mode 100644 index daac6cdc41..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/lib/libDispatch.c +++ /dev/null @@ -1,707 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <pthread.h> - -#include "master.h" -#include "util.h" -#include "providerNames.h" -#include "messageStrings.h" - -/* local function declarations */ -static int FindClassEntry(char *className); -static int FindAssocClassEntry(char *className); - - -/* - * Encodes the CIM schema and provider version - * into an unsigned long, use - * getProviderVersion & getCimVersion to decode - */ - -unsigned long -cp_getVersion() -{ - return (MAKEVERSION(1.0, 2.3)); -} - - -/* - * The function will take CCIMObjectPath - * and search the classNameTable[] - * for a className match, and then - * call the corresponding cp_enumInstance - * for that provider - */ - -CCIMInstanceList* -cp_enumInstances(CCIMObjectPath* pOP) -{ - CCIMInstanceList *instList = NULL; - int index = 0; - int error; - - /* Check if ObjectPath is NULL before continuing */ - if (pOP == NULL) { - /* Set error exception with localized message */ - util_handleError(ENUM_INSTANCES, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return (NULL); - } - - /* Object path is NOT NULL, so find the entry in the table */ - index = FindClassEntry(pOP->mName); - - /* check for error (-1) */ - if (index < 0) { - util_handleError(ENUM_INSTANCES, CIM_ERR_INVALID_CLASS, - NULL, NULL, &error); - return (NULL); - } - - /* OK, Find enumInstance */ - instList = (*enumInstanceTable[index])(pOP); - return ((CCIMInstanceList*)instList); - -} /* cp_enumInstances */ - -/* creates an instance */ - -/* - * The function will take CCIMObjectPath & CCIMInstance - * and search the classNameTable[] - * for a className match, and then - * call the corresponding cp_createInstance - * for that provider - */ - -CCIMObjectPath* -cp_createInstance(CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - CCIMObjectPath *objPath = NULL; - int index = 0; - int error; - - /* check if NULL before finding the Instance to create */ - if (pInst == NULL) { - util_handleError(CREATE_INSTANCE, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return (NULL); - } - - /* find entry in the table */ - index = FindClassEntry(pInst->mClassName); - - /* check for error (-1) */ - if (index < 0) { - util_handleError(CREATE_INSTANCE, - CIM_ERR_INVALID_CLASS, NULL, NULL, &error); - return (NULL); - } - - objPath = (*createInstanceTable[index])(pOP, pInst); - - return ((CCIMObjectPath*) objPath); - -} /* cp_createInstances */ - - -/* - * returns an array of CCIMObjectPaths for the class - * params: - * char* - the classname to enum - */ - -CCIMObjectPathList* -cp_enumInstanceNames(CCIMObjectPath* pOP) -{ - CCIMObjectPathList *objList = NULL; - CCIMInstanceList *instList = NULL; - int error = 0; - - /* - * create an instance list which contains all of the - * instances this provider will produce First check - * for valid ObjectPath - */ - if (pOP == NULL) { - util_handleError(ENUM_INSTANCENAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return (NULL); - } - - instList = cp_enumInstances(pOP); - - if (instList == NULL) { - return ((CCIMObjectPathList *)NULL); - } - - objList = cim_createObjectPathList(instList); - - /* - * we no longer need the instList so free - * the memory allocated for it - */ - - cim_freeInstanceList(instList); - return (objList); -} - -/* get an instance */ - -CCIMInstance* -cp_getInstance(CCIMObjectPath* pOP) -{ - CCIMInstance* inst = NULL; - int index = 0; - int error; - - /* Check if ObjectPath is NULL before continuing */ - if (pOP == NULL) { - util_handleError(GET_INSTANCE, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return (NULL); - } - - /* Object path is NOT NULL, so find the entry in the table */ - index = FindClassEntry(pOP->mName); - - /* check for error (-1) */ - if (index < 0) { - util_handleError(GET_INSTANCE, CIM_ERR_INVALID_CLASS, NULL, - NULL, &error); - return (NULL); - } - - inst = (*getInstanceTable[index])(pOP); - return ((CCIMInstance *)inst); -} - -/* - * returns the specified property, - * should return NULL if not found - * - * params: - * CCIMObjectPath* - ObjectPath to get the property from - * char* - The property name to get - * - */ - -CCIMProperty* -cp_getProperty(CCIMObjectPath *pOP, char *pPropName) -{ - CCIMProperty* prop = NULL; - CCIMInstance* inst = NULL; - int error; - - /* See if ObjectPath is OK */ - if (pOP == NULL) { - util_handleError(GET_PROPERTY, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return (NULL); - } - - /* Make sure property name isn't NULL */ - if (pPropName == NULL) { - util_handleError(GET_PROPERTY, CIM_ERR_INVALID_CLASS, - NULL, NULL, &error); - return (NULL); - } - - /* see if we have any instances which match the obj path */ - inst = cp_getInstance(pOP); - - /* check for valid instance */ - if (inst == NULL) { - util_handleError(GET_PROPERTY, CIM_ERR_FAILED, - NULL, NULL, &error); - return (NULL); - } - - /* see if it has the specified property */ - prop = cim_getProperty(inst, pPropName); - - /* free memory allocated for the instance */ - cim_freeInstance(inst); - - /* return the property */ - return ((CCIMProperty *)prop); -} - -/* - * Sets the property in the passed in - * instance to the new values of the - * passed in property - * - * params: - * CCIMObjectPath* - the Object Path in which the property should be changed - * CCIMProperty* - a property structure which contains the new values - * - * return: - * cim_true if property was updated otherwise cim_false - * - * - * The function will take CCIMObjectPath & CCIMProperty - * and search the classNameTable[] - * for a className match, and then - * call the corresponding setProperty - * for that provider - */ - -CIMBool -cp_setProperty(CCIMObjectPath* pObjPath, CCIMProperty* pProp) -{ - CIMBool retVal; - int index = 0; - int error; - - if (pObjPath == NULL) { - util_handleError(SET_PROPERTY, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return (NULL); - } - - index = FindClassEntry(pObjPath->mName); - - /* check for error (-1) */ - if (index < 0) { - util_handleError(SET_PROPERTY, CIM_ERR_INVALID_CLASS, - NULL, NULL, &error); - return (NULL); - } - - retVal = (*setPropertyTable[index])(pObjPath, pProp); - return ((CIMBool)retVal); -} - - -/* sets an instance */ - -/* - * The function will take CCIMObjectPath & CCIMInstance - * and search the classNameTable[] - * for a className match, and then - * call the corresponding cp_setInstance - * for that provider - */ - -CIMBool -cp_setInstance(CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - CIMBool retVal; - int index = 0; - int error; - - if (pOP == NULL) { - util_handleError(SET_INSTANCE, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return (NULL); - } - - if (pInst == NULL) { - util_handleError(SET_INSTANCE, CIM_ERR_INVALID_CLASS, - NULL, NULL, &error); - return (NULL); - } - - /* get the index into the table */ - index = FindClassEntry(pInst->mClassName); - - /* check for error (-1) */ - if (index < 0) { - util_handleError(SET_INSTANCE, CIM_ERR_INVALID_CLASS, - NULL, NULL, &error); - return (NULL); - } - - retVal = (*setInstanceTable[index])(pOP, pInst); - return ((CIMBool)retVal); -} - - -/* - * deletes an instance - * - * The function will take CCIMObjectPath - * and search the classNameTable[] - * for a className match, and then - * call the corresponding cp_deleteInstance - * for that provider - */ - -CIMBool -cp_deleteInstance(CCIMObjectPath* pOP) -{ - CIMBool retVal; - int index = 0; - int error; - - /* Verify ObjectPath is NOT NULL */ - if (pOP == NULL) { - util_handleError(DELETE_INSTANCE, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return (NULL); - } - - /* find Entry in table */ - index = FindClassEntry(pOP->mName); - - /* check for error (-1) */ - if (index < 0) { - util_handleError(DELETE_INSTANCE, CIM_ERR_INVALID_CLASS, - NULL, NULL, &error); - return (NULL); - } - - retVal = (*deleteInstanceTable[index])(pOP); - return ((CIMBool)retVal); -} - -/* - * Invokes the method and returns the results - * The caller is responsible for freeing the - * memory allocated for the returned object - * - * params: - * CCIMObjectPath* - An object path of the instance - * to invoke the function on - * char* - name of the method to invoke - * CCIMPropertyList* - input parameters to the function - * CCIMPropertyList* - input/output parameters to the function - * - * returns: - * NULL if it failed otherwise a CCIMProperty* - * which represents the return value of the function - */ - -CCIMProperty* -cp_invokeMethod(CCIMObjectPath* pOP, cimchar* pName, - CCIMPropertyList* pInParams, CCIMPropertyList* pInOutParams) -{ - CCIMProperty *prop; - int index = 0; - int error; - - /* First check for valid ObjectPath */ - if (pOP == NULL) { - util_handleError(INVOKE_METHOD, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return (NULL); - } - - /* find entry in the table */ - index = FindClassEntry(pOP->mName); - - /* check for error (-1) */ - if (index < 0) { - util_handleError(INVOKE_METHOD, CIM_ERR_INVALID_CLASS, - NULL, NULL, &error); - return (NULL); - } - - prop = (*cpInvokeMethodTable[index]) - (pOP, pName, pInParams, pInOutParams); - - return ((CCIMProperty*)prop); -} - -/* - * cp_execQuery - */ - -CCIMInstanceList* -cp_execQuery(CCIMObjectPath *pOP, char *selectList, - char *nonJoinExp, char *queryExp, char *queryType) -{ - CCIMInstanceList *instList = NULL; - int index = 0; - int error = 0; - - - /* First check for valid ObjectPath */ - if (pOP == NULL) { - util_handleError(EXEC_QUERY, CIM_ERR_INVALID_PARAMETER, NULL, NULL, - &error); - return ((CCIMInstanceList *)NULL); - } - - /* find entry in the table */ - index = FindClassEntry(pOP->mName); - - /* check for error (-1) */ - if (index < 0) { - /* Set error exception with localized message */ - util_handleError(EXEC_QUERY, CIM_ERR_INVALID_CLASS, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - instList = (*execQueryTable[index])(pOP, selectList, nonJoinExp, - queryExp, queryType); - - return (instList); -} - -/* - * cp_associators - */ - -CCIMInstanceList* -cp_associators(CCIMObjectPath *pAssocName, CCIMObjectPath *pObjectName, - char *pResultClass, char *pRole, char *pResultRole) -{ - CCIMInstanceList *instList; - int index = 0; - int error = 0; - - /* First check for valid ObjectPath */ - if (pAssocName == NULL) { - /* Set error exception with localized message */ - util_handleError(ASSOCIATORS, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* find entry in the table */ - index = FindAssocClassEntry(pAssocName->mName); - - /* check for error (-1) */ - if (index < 0) { - /* Set error exception with localized message */ - util_handleError(ASSOCIATORS, CIM_ERR_INVALID_CLASS, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* - * Call the appropriate associator function. Let the specific function - * in the c provider handle the checking for correctness of the - * other parameters. - */ - - instList = (*associatorsTable[index])(pAssocName, pObjectName, - pResultClass, pRole, pResultRole); - return ((CCIMInstanceList *)instList); -} - -/* - * cp_associatorNames - */ - -CCIMObjectPathList* -cp_associatorNames(CCIMObjectPath *pAssocName, CCIMObjectPath *pObjectName, - char *pResultClass, char *pRole, char *pResultRole) -{ - CCIMObjectPathList *objList; - int index = 0; - int error = 0; - - /* First check for valid ObjectPath */ - if (pAssocName == NULL) { - /* Set error exception with localized message */ - util_handleError(ASSOCIATORS, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - /* find entry in the table */ - index = FindAssocClassEntry(pAssocName->mName); - - /* check for error (-1) */ - if (index < 0) { - /* Set error exception with localized message */ - util_handleError(ASSOCIATORS, CIM_ERR_INVALID_CLASS, NULL, - NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - /* - * Call the appropriate associatorName function. Let the specific - * function in the c provider handle the checking for correctness of - * the other parameters. - */ - - objList = (*associatorNamesTable[index])(pAssocName, pObjectName, - pResultClass, pRole, pResultRole); - return ((CCIMObjectPathList *)objList); -} - -/* - * cp_references - */ - -CCIMInstanceList* -cp_references(CCIMObjectPath *pAssocName, CCIMObjectPath *pObjectName, - char *pRole) -{ - CCIMInstanceList *instList; - int index = 0; - int error = 0; - - /* First check for valid ObjectPath */ - if (pAssocName == NULL) { - /* Set error exception with localized message */ - util_handleError(REFERENCES, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* find entry in the table */ - index = FindAssocClassEntry(pAssocName->mName); - - /* check for error (-1) */ - if (index < 0) { - /* Set error exception with localized message */ - util_handleError(REFERENCES, CIM_ERR_INVALID_CLASS, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* - * Call the appropriate references function. Let the specific function - * in the c provider handle the checking for correctness of the - * other parameters. - */ - - instList = (*referencesTable[index])(pAssocName, pObjectName, pRole); - return ((CCIMInstanceList *)instList); -} - -/* - * InParam: Class Name - * Returns: Index into Name Table - * If it hit libWBEMdisk, then we - * have hit bottom, return err (-1) - */ - -static int -FindClassEntry(char *className) -{ - int i = 0; - - while (strcasecmp(className, classNameTable[i])) { - if (!strcasecmp(classNameTable[i], "libWBEMdisk")) { - i = -1; - break; - } - i++; - } - - return (i); -} -/* - * InParam: Class Name - * Returns: Index into Name Table - * If it hit libWBEMdisk, then we - * have hit bottom, return err (-1) - */ - -static int -FindAssocClassEntry(char *className) -{ - int i = 0; - - while (strcasecmp(className, assocclassNameTable[i])) { - if (!strcasecmp(assocclassNameTable[i], "libWBEMdisk")) { - i = -1; - break; - } - i++; - } - - return (i); -} - -/* - * cp_referenceNames - */ - -CCIMObjectPathList* -cp_referenceNames(CCIMObjectPath *pAssocName, CCIMObjectPath *pObjectName, - char *pRole) -{ - CCIMObjectPathList *objList; - int index = 0; - int error = 0; - - /* First check for valid ObjectPath */ - if (pAssocName == NULL) { - /* Set error exception with localized message */ - util_handleError(REFERENCE_NAMES, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - /* find entry in the table */ - index = FindAssocClassEntry(pAssocName->mName); - - /* check for error (-1) */ - if (index < 0) { - /* Set error exception with localized message */ - util_handleError(REFERENCE_NAMES, CIM_ERR_INVALID_CLASS, - NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - /* - * Call the appropriate referenceName function. Let the specific - * function in the c provider handle the checking for correctness of - * the other parameters. - */ - - objList = (*referenceNamesTable[index])(pAssocName, pObjectName, pRole); - return ((CCIMObjectPathList *)objList); -} - -CIMBool -cp_isAssociatorProvider(CCIMObjectPath *pOp) -{ - - int index = 0; - int error = 0; - - /* - * If the object path coming in matches any in the associator table, - * return true, otherwise, return false. - */ - - /* First check for valid ObjectPath */ - if (pOp == NULL) { - /* Set error exception with localized message */ - util_handleError(REFERENCE_NAMES, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return (cim_false); - } - - /* find entry in the table */ - index = FindAssocClassEntry(pOp->mName); - - if (index < 0) { - return (cim_false); - } - return (cim_true); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/lib/localFunc.c b/usr/src/cmd/wbem/provider/c/wbem_disk/lib/localFunc.c deleted file mode 100644 index 3808a19fd3..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/lib/localFunc.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * this is a place holder file - * for the following functions. - * They should never be called - */ -/* everything is in here */ - -#include <cimapi.h> -#include <cp_associator.h> - -/* ARGSUSED */ -CCIMInstanceList* -cp_enumInstances_libWBEMdisk(CCIMObjectPath* pOP) -{ - return ((CCIMInstanceList*) NULL); -} - -/* ARGSUSED */ -CCIMObjectPathList* -cp_enumInstanceNames_libWBEMdisk(CCIMObjectPath* pOP) -{ - return ((CCIMObjectPathList*) NULL); -} - -/* creates an instance */ - -/* ARGSUSED */ -CCIMObjectPath* -cp_createInstance_libWBEMdisk(CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - return ((CCIMObjectPath*)NULL); -} - -/* ARGSUSED */ -CCIMProperty* -cp_invokeMethod_libWBEMdisk(CCIMObjectPath* pOP, cimchar* pName, - CCIMPropertyList* pInParams, - CCIMPropertyList* pInOutParams) -{ - return ((CCIMProperty*)NULL); -} - -/* ARGSUSED */ -CIMBool -cp_setInstance_libWBEMdisk(CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - return (cim_false); -} - -/* ARGSUSED */ -CCIMInstance * -cp_getInstance_libWBEMdisk(CCIMObjectPath * pOP) -{ - return ((CCIMInstance *)NULL); -} - - -/* deletes an instance */ - -/* ARGSUSED */ -CIMBool -cp_deleteInstance_libWBEMdisk(CCIMObjectPath *pOP) -{ - return (cim_false); -} - -/* ARGSUSED */ -CIMBool -cp_setProperty_libWBEMdisk(CCIMObjectPath* pObjPath, CCIMProperty* pProp) -{ - return (cim_false); -} - -/* ARGSUSED */ -CCIMInstanceList* -cp_execQuery_libWBEMdisk(CCIMObjectPath *pOP, char *selectList, - char *nonJoinExp, char *queryExp, char *queryType) -{ - return ((CCIMInstanceList *) NULL); -} - -/* ARGSUSED */ -CCIMInstanceList* -cp_associators_libWBEMdisk(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pResultClass, char *pRole, - char *pResultRole) -{ - return ((CCIMInstanceList *) NULL); -} - -/* ARGSUSED */ -CCIMObjectPathList* -cp_associatorNames_libWBEMdisk(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pResultClass, char *pRole, - char *pResultRole) -{ - return ((CCIMObjectPathList *) NULL); -} - -/* ARGSUSED */ -CCIMInstanceList* -cp_references_libWBEMdisk(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pRole) -{ - return ((CCIMInstanceList *) NULL); -} - -/* ARGSUSED */ -CCIMObjectPathList* -cp_referenceNames_libWBEMdisk(CCIMObjectPath *pAssocName, - CCIMObjectPath *pObjectName, char *pRole) -{ - return ((CCIMObjectPathList *) NULL); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/lib/mapfile b/usr/src/cmd/wbem/provider/c/wbem_disk/lib/mapfile deleted file mode 100644 index 9d8868fa73..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/lib/mapfile +++ /dev/null @@ -1,61 +0,0 @@ -# -# Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. -# -# 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 -# - -# -# 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 -# - -$mapfile_version 2 - -SYMBOL_VERSION SUNWprivate_1.1 { - global: - cp_associatorNames ; - cp_associators ; - cp_createInstance ; - cp_deleteInstance ; - cp_enumInstanceNames ; - cp_enumInstances ; - cp_execQuery ; - cp_getInstance ; - cp_getLastError ; - cp_getProperty ; - cp_getVersion ; - cp_invokeMethod ; - cp_isAssociatorProvider ; - cp_referenceNames ; - cp_references ; - cp_setInstance ; - cp_setProperty ; - local: - *; -}; diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/logicaldisk/Makefile b/usr/src/cmd/wbem/provider/c/wbem_disk/logicaldisk/Makefile deleted file mode 100644 index 9359f87f31..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/logicaldisk/Makefile +++ /dev/null @@ -1,73 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -OBJECTS = Solaris_LogicalDisk.o - -LINT_OBJS = $(OBJECTS:%.o=%.ln) - -GENERAL = $(ROOTWBEMINC) \ - $(SRC)/lib/libdiskmgt/common \ - $(SRC)/cmd/wbem/provider/c/include - -CPPFLAGS += -I. $(GENERAL:%=-I%) -D_REENTRANT -Dpic -D_TS_ERRNO - -CFLAGS += $(XREGSFLAG) $(C_PICFLAGS) - -LINTFLAGS += -um -LINTLIBS = $(LDLIBS.cmd) - -POFILE = _logicaldisk.po -MSGFILES = $(OBJECTS:%.o=%.i) - -CLOBBERFILES += $(POFILE) - -.KEEP_STATE: - -all: $(OBJECTS) - -install: all - -lint: $(LINT_OBJS) - $(LINT.c) $(LINTFLAGS) $(LINT_OBJS) $(LINTLIBS) - -clean: - $(RM) $(OBJECTS) $(LINT_OBJS) $(MSGFILES) - -check: - $(CSTYLE) -p -P $(OBJECTS:%.o=%.c) *.h - $(HDRCHK) *.h - -catalog: $(POFILE) - -$(POFILE): $(MSGFILES) - $(BUILDPO.msgfiles) - -include $(SRC)/cmd/Makefile.targ -include $(SRC)/Makefile.msg.targ diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/logicaldisk/Solaris_LogicalDisk.c b/usr/src/cmd/wbem/provider/c/wbem_disk/logicaldisk/Solaris_LogicalDisk.c deleted file mode 100644 index 22bb253f15..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/logicaldisk/Solaris_LogicalDisk.c +++ /dev/null @@ -1,425 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <unistd.h> -#include <netdb.h> -#include <errno.h> - -#include "util.h" -#include "cimKeys.h" -#include "logicaldisk_descriptors.h" -#include "providerNames.h" -#include "messageStrings.h" - -#define DISK_GETINSTANCE "LOGICAL_DISK,GET_INSTANCE" -#define DISK_ENUMINSTANCES "LOGICAL_DISK,ENUM_INSTANCES" -#define DISK_ENUMINSTANCENAMES "LOGICAL_DISK,ENUM_INSTANCENAMES" -#define DISK_CREATEINSTANCE "LOGICAL_DISK,CREATE_INSTANCE" -#define DISK_DELETEINSTANCE "LOGICAL_DISK,DELETE_INSTANCE" -#define DISK_SETINSTANCE "LOGICAL_DISK,SET_INSTANCE" -#define DISK_GETPROPERTY "LOGICAL_DISK,GET_PROPERTY" -#define DISK_SETPROPERTY "LOGICAL_DISK,SET_PROPERTY" -#define DISK_INVOKEMETHOD "LOGICAL_DISK,INVOKE_METHOD" -#define DISK_EXECQUERY "LOGICAL_DISK,EXEC_QUERY" - -/* - * Solaris_LogicalDisk provider - * - * It is important to note that all memory allocated by these functions - * and passed to the CIMOM, is freed by the CIMOM as the caller. - */ - - -/* - * Name: cp_getInstance_Solaris_LogicalDisk - * - * Description: Returns an instance which matches the passed in object path - * if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMInstance* -cp_getInstance_Solaris_LogicalDisk(CCIMObjectPath* pOP) -{ - CCIMInstance* inst = NULL; - CCIMPropertyList* pCurPropList; - dm_descriptor_t logicaldisk_descriptor; - char *name; - int error; - - - if (pOP == NULL || - pOP->mKeyProperties == NULL) { - util_handleError(DISK_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstance *)NULL); - } - - pCurPropList = pOP->mKeyProperties; - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - - if (error != 0 || name == NULL) { - util_handleError(DISK_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance*)NULL); - } - - logicaldisk_descriptor = - dm_get_descriptor_by_name(DM_MEDIA, name, &error); - - /* - * Not found. Return a null instance. - */ - - if (error == ENODEV) { - return ((CCIMInstance *)NULL); - } - - if (error != 0) { - util_handleError(DISK_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstance*)NULL); - } - - - /* Turn this descriptor in to a disk drive instance */ - - inst = logicaldisk_descriptor_toCCIMInstance( - hostName, logicaldisk_descriptor, LOGICAL_DISK, &error); - dm_free_descriptor(logicaldisk_descriptor); - - if (error != 0) { - util_handleError(DISK_GETINSTANCE, CIM_ERR_FAILED, - LOGICALDISK_DESC_TO_INSTANCE_FAILURE, NULL, - &error); - return ((CCIMInstance*)NULL); - } - - return (inst); -} - -/* - * Name: cp_enumInstances_Solaris_LogicalDisk - * - * Description: Returns a list of instances which if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstanceList * if matched instance is found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_enumInstances_Solaris_LogicalDisk(CCIMObjectPath* pOP) -{ - CCIMInstanceList* instList = NULL; - dm_descriptor_t *logicaldisk_descriptorp; - int error; - int filter[2]; - - filter[0] = DM_MT_FIXED; - filter[1] = DM_FILTER_END; - - logicaldisk_descriptorp = dm_get_descriptors(DM_MEDIA, filter, &error); - - if (logicaldisk_descriptorp == NULL || - logicaldisk_descriptorp[0] == NULL) { - return ((CCIMInstanceList *)NULL); - } - if (error != 0) { - util_handleError(DISK_ENUMINSTANCES, CIM_ERR_FAILED, - DM_GET_DESCRIPTORS, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* convert drive descriptors to CCIMInstanceList */ - instList = logicaldisk_descriptors_toCCIMInstanceList(LOGICAL_DISK, - logicaldisk_descriptorp, &error); - dm_free_descriptors(logicaldisk_descriptorp); - - if (error != 0) { - util_handleError(DISK_ENUMINSTANCES, CIM_ERR_FAILED, - LOGICALDISK_DESC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - return (instList); -} - -/* - * Name: cp_enumInstanceNames_Solaris_LogicalDisk - * - * Description: Returns a list of instances which if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMObjectPathList * if found Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMObjectPathList* -cp_enumInstanceNames_Solaris_LogicalDisk(CCIMObjectPath * pOP) { - - CCIMInstanceList *instList; - CCIMObjectPathList *objList = NULL; - int error; - - if (pOP == NULL) { - util_handleError(DISK_ENUMINSTANCENAMES, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - /* - * Call in to enumInstances and then convert the instance list in - * to an object list. - */ - - instList = cp_enumInstances_Solaris_LogicalDisk(pOP); - - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Creating an instance of a Solaris_LogicalDisk is not supported. - */ - -/* ARGSUSED */ -CCIMObjectPath* -cp_createInstance_Solaris_LogicalDisk(CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - int error; - - util_handleError(DISK_CREATEINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return ((CCIMObjectPath*)NULL); -} - - -/* - * Deleting an instance of a Solaris_LogicalDisk is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_LogicalDisk(CCIMObjectPath* pInst) -{ - - int error; - - util_handleError(DISK_DELETEINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - -/* - * Name: cp_getProperty_Solaris_LogicalDisk - * - * Description: Returns the property requested, if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMProperty * if found. - */ - -/* ARGSUSED */ -CCIMProperty * -cp_getProperty_Solaris_LogicalDisk(CCIMObjectPath *pOP, - char *pPropName) -{ - - CCIMProperty *prop = NULL; - CCIMInstance *inst = NULL; - int error = 0; - - if (pOP == NULL) { - util_handleError(DISK_GETPROPERTY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMProperty *)NULL); - } - - inst = cp_getInstance_Solaris_LogicalDisk(pOP); - if (inst == NULL) { - return ((CCIMProperty *)NULL); - } - - prop = cim_getProperty(inst, pPropName); - cim_freeInstance(inst); - return (prop); -} -/* - * Setting an instance of a Solaris_LogicalDisk is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_LogicalDisk(CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - - int error; - - util_handleError(DISK_SETINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - -/* - * Setting a property of a Solaris_LogicalDisk is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_LogicalDisk(CCIMObjectPath* pOP, CCIMProperty* pProp) -{ - - int error; - - util_handleError(DISK_SETPROPERTY, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - -/* invokeMethod function dispatches to the various method implementations */ -/* ARGSUSED */ -CCIMProperty* -cp_invokeMethod_Solaris_LogicalDisk(CCIMObjectPath* op, cimchar* methodName, - CCIMPropertyList* inParams, CCIMPropertyList* outParams) -{ - CCIMProperty *retVal = (CCIMProperty*)NULL; - return (retVal); -} - -/* - * Name: cp_execQuery_Solaris_LogicalDisk - * - * Description: - * Returns an instance list which matches the query if any are found. - * - * Parameters: - * CCIMObjectPath *op - An CCIMObjectPath * which contains the - * information on the class for which to find the instances. - * - * selectList - Not used - * nonJoinExp - Not used - * - * Returns: - * CCIMInstanceList * if found. Otherwise, NULL. - */ - -/* - * Currently, there is no WQL parser for the C providers. As a result, - * what is returned to the CIMOM is a list of instances with - * a NULL value at the beginning of the list. This NULL value indicates - * to the CIMOM that it must do the filtering for the client. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_execQuery_Solaris_LogicalDisk(CCIMObjectPath *op, cimchar *selectList, - cimchar *nonJoinExp, cimchar *queryExp, int queryType) -{ - CCIMInstanceList *instList = NULL; - CCIMInstanceList *result; - CCIMInstance *emptyInst; - CCIMException *ex; - int error; - - if (op == NULL) { - util_handleError(DISK_EXECQUERY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = cp_enumInstances_Solaris_LogicalDisk(op); - - if (instList == NULL) { - return ((CCIMInstanceList *)NULL); - } - /* - * Create a null instance and add it to the beginning - * of the list to indicate to the CIMOM that no filtering - * was done. - */ - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError(DISK_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, &error); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_createInstanceList(); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(DISK_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, - &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_addInstance(result, emptyInst); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(DISK_EXECQUERY, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - /* - * Since copying the original list to the new list will - * leave no way to free the original list, manually - * concatenate the original list to the new one. - */ - - result->mNext = instList; - return (result); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/mpxio/Makefile b/usr/src/cmd/wbem/provider/c/wbem_disk/mpxio/Makefile deleted file mode 100644 index 6034abf2ee..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/mpxio/Makefile +++ /dev/null @@ -1,73 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -OBJECTS = Solaris_MPXIOGroup.o - -LINT_OBJS = $(OBJECTS:%.o=%.ln) - -GENERAL = $(ROOTWBEMINC) \ - $(SRC)/lib/libdiskmgt/common \ - $(SRC)/cmd/wbem/provider/c/include - -CPPFLAGS += -I. $(GENERAL:%=-I%) -D_REENTRANT -Dpic -D_TS_ERRNO - -CFLAGS += $(XREGSFLAG) $(C_PICFLAGS) - -LINTFLAGS += -um -LINTLIBS = $(LDLIBS.cmd) - -POFILE = _mpxio.po -MSGFILES = $(OBJECTS:%.o=%.i) - -CLOBBERFILES += $(POFILE) - -.KEEP_STATE: - -all: $(OBJECTS) - -install: all - -lint: $(LINT_OBJS) - $(LINT.c) $(LINTFLAGS) $(LINT_OBJS) $(LINTLIBS) - -clean: - $(RM) $(OBJECTS) $(LINT_OBJS) $(MSGFILES) - -check: - $(CSTYLE) -p -P $(OBJECTS:%.o=%.c) *.h - $(HDRCHK) *.h - -catalog: $(POFILE) - -$(POFILE): $(MSGFILES) - $(BUILDPO.msgfiles) - -include $(SRC)/cmd/Makefile.targ -include $(SRC)/Makefile.msg.targ diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/mpxio/Solaris_MPXIOGroup.c b/usr/src/cmd/wbem/provider/c/wbem_disk/mpxio/Solaris_MPXIOGroup.c deleted file mode 100644 index e6fa3ea361..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/mpxio/Solaris_MPXIOGroup.c +++ /dev/null @@ -1,432 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <unistd.h> -#include <netdb.h> -#include <errno.h> - -#include "util.h" -#include "cimKeys.h" -#include "ctrl_descriptors.h" -#include "providerNames.h" -#include "messageStrings.h" -#include "mpxiogroup_descriptors.h" -#include "Solaris_MPXIOGroup.h" - -#define MPXIO_GETINSTANCE "MPXIO_GROUP,GET_INSTANCE" -#define MPXIO_ENUMINSTANCES "MPXIO_GROUP,ENUM_INSTANCES" -#define MPXIO_ENUMINSTANCENAMES "MPXIO_GROUP,ENUM_INSTANCENAMES" -#define MPXIO_CREATEINSTANCE "MPXIO_GROUP,CREATE_INSTANCE" -#define MPXIO_DELETEINSTANCE "MPXIO_GROUP,DELETE_INSTANCE" -#define MPXIO_SETINSTANCE "MPXIO_GROUP,SET_INSTANCE" -#define MPXIO_GETPROPERTY "MPXIO_GROUP,GET_PROPERTY" -#define MPXIO_SETPROPERTY "MPXIO_GROUP,SET_PROPERTY" -#define MPXIO_INVOKEMETHOD "MPXIO_GROUP,INVOKE_METHOD" -#define MPXIO_EXECQUERY "MPXIO_GROUP,EXEC_QUERY" - - -/* - * Solaris_MPXIOGroup provider - * - * It is important to note that all memory allocated by these functions - * and passed to the CIMOM, is freed by the CIMOM as the caller. - */ - - -/* - * Name: cp_getInstance_Solaris_MPXIOGroup - * - * Description: Returns an instance which matches the passed in object path - * if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstance * if matched instance is found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMInstance* -cp_getInstance_Solaris_MPXIOGroup(CCIMObjectPath* pOP) -{ - CCIMInstance* inst = NULL; - CCIMPropertyList* pCurPropList; - dm_descriptor_t mpxioctrl_descriptor; - char *name; - int error; - - if (pOP == NULL || - pOP->mKeyProperties == NULL) { - util_handleError(MPXIO_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, - NULL, NULL, &error); - return ((CCIMInstance *)NULL); - } - - pCurPropList = pOP->mKeyProperties; - name = (cimchar *)util_getKeyValue(pCurPropList, string, DEVICEID, - &error); - - if (error != 0 || name == NULL) { - util_handleError(MPXIO_GETINSTANCE, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstance*)NULL); - } - - mpxioctrl_descriptor = - dm_get_descriptor_by_name(DM_CONTROLLER, name, &error); - - /* - * Not found. Return a null instance. - */ - - if (error == ENODEV) { - return ((CCIMInstance *)NULL); - } - - if (error != 0) { - util_handleError(MPXIO_GETINSTANCE, CIM_ERR_FAILED, - DM_GET_DESC_BYNAME_FAILURE, NULL, &error); - return ((CCIMInstance*)NULL); - } - - /* Turn this descriptor in to a mpxio group instance */ - - inst = mpxiogroup_descriptor_toCCIMInstance(mpxioctrl_descriptor, - MPXIO_GROUP, &error); - dm_free_descriptor(mpxioctrl_descriptor); - - if (error != 0) { - util_handleError(MPXIO_GETINSTANCE, CIM_ERR_FAILED, - MPXIOCTRL_DESC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstance*)NULL); - } - - return (inst); -} - -/* - * Name: cp_enumInstances_Solaris_MPXIOGroup - * - * Description: Returns a list of instances if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMInstanceList * if matched instance is found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_enumInstances_Solaris_MPXIOGroup(CCIMObjectPath* pOP) -{ - CCIMInstanceList* instList = NULL; - dm_descriptor_t *mpxioctrl_descriptorp; - int error; - int filter[1]; - - filter[0] = DM_FILTER_END; - - mpxioctrl_descriptorp = dm_get_descriptors(DM_CONTROLLER, filter, - &error); - - /* - * If no devices, return NULL. CIMOM expects NULL. Do not set - * last error. If set, the CIMOM will assume an error and - * throw an exception. - */ - - if (mpxioctrl_descriptorp == NULL || - mpxioctrl_descriptorp[0] == NULL) { - return ((CCIMInstanceList *)NULL); - } - - if (error != 0) { - util_handleError(MPXIO_ENUMINSTANCES, CIM_ERR_FAILED, - DM_GET_DESCRIPTORS, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - /* convert controller to CCIMInstanceList */ - instList = mpxiogroup_descriptors_toCCIMInstanceList(MPXIO_GROUP, - mpxioctrl_descriptorp, &error); - dm_free_descriptors(mpxioctrl_descriptorp); - - if (error != 0) { - util_handleError(MPXIO_ENUMINSTANCES, CIM_ERR_FAILED, - MPXIOCTRL_DESC_TO_INSTANCE_FAILURE, NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - return (instList); -} - -/* - * Name: cp_enumInstanceNames_Solaris_MPXIOGroup - * - * Description: Returns a list of instances if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instance. - * Returns: - * CCIMObjectPathList * if matched instance is found. Otherwise, NULL. - */ - -/* ARGSUSED */ -CCIMObjectPathList* -cp_enumInstanceNames_Solaris_MPXIOGroup(CCIMObjectPath * pOP) { - - CCIMInstanceList *instList = NULL; - CCIMObjectPathList *objList = NULL; - int error; - - if (pOP == NULL) { - util_handleError(MPXIO_ENUMINSTANCENAMES, - CIM_ERR_INVALID_PARAMETER, NULL, NULL, &error); - return ((CCIMObjectPathList *)NULL); - } - - /* - * Call in to enumInstances and then convert the instance list in - * to an object list. - */ - - instList = cp_enumInstances_Solaris_MPXIOGroup(pOP); - if (instList != NULL) { - objList = cim_createObjectPathList(instList); - cim_freeInstanceList(instList); - } - - return (objList); -} - -/* - * Creating an instance of a Solaris_MPXIOGroup is not supported. - */ - -/* ARGSUSED */ -CCIMObjectPath* -cp_createInstance_Solaris_MPXIOGroup(CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - int error; - - util_handleError(MPXIO_CREATEINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return ((CCIMObjectPath*)NULL); -} - - -/* - * Deleting an instance of a Solaris_MPXIOGroup is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_deleteInstance_Solaris_MPXIOGroup(CCIMObjectPath* pInst) -{ - - int error; - - util_handleError(MPXIO_DELETEINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - -/* - * Name: cp_getProperty_Solaris_MPXIOGroup - * - * Description: Returns the property requested, if found. - * - * Parameters: - * pOP - An CCIMObjectPath * which contains the information on - * the class for which to find the instances. - * Returns: - * CCIMProperty * if found. - */ - -/* ARGSUSED */ -CCIMProperty * -cp_getProperty_Solaris_MPXIOGroup(CCIMObjectPath *pOP, - char *pPropName) -{ - - CCIMProperty *prop = NULL; - CCIMInstance *inst = NULL; - int error = 0; - - if (pOP == NULL) { - util_handleError(MPXIO_GETPROPERTY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMProperty *)NULL); - } - - inst = cp_getInstance_Solaris_MPXIOGroup(pOP); - if (inst == NULL) { - return ((CCIMProperty *)NULL); - } - - prop = cim_getProperty(inst, pPropName); - cim_freeInstance(inst); - return (prop); -} -/* - * Setting an instance of a Solaris_MPXIOGroup is not supported. - */ - -/* ARGSUSED */ -CIMBool -cp_setInstance_Solaris_MPXIOGroup(CCIMObjectPath* pOP, CCIMInstance* pInst) -{ - - int error; - - util_handleError(MPXIO_SETINSTANCE, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} - -/* - * This provider cannot set a property on a Solaris_MPXIOGroup object. - */ - -/* ARGSUSED */ -CIMBool -cp_setProperty_Solaris_MPXIOGroup(CCIMObjectPath* pOP, CCIMProperty* pProp) -{ - - int error; - - util_handleError(MPXIO_SETPROPERTY, CIM_ERR_NOT_SUPPORTED, NULL, - NULL, &error); - return (cim_false); -} -/* - * No methods on this class. - */ - -/* ARGSUSED */ -CCIMProperty* -cp_invokeMethod_Solaris_MPXIOGroup(CCIMObjectPath* op, cimchar* methodName, - CCIMPropertyList* inParams, CCIMPropertyList* outParams) -{ - CCIMProperty *retVal = (CCIMProperty *)NULL; - return (retVal); -} - -/* - * Name: cp_execQuery_Solaris_MPXIOGroup - * - * Description: - * Returns an instance list which matches the query if any are found. - * - * Parameters: - * CCIMObjectPath *op - An CCIMObjectPath * which contains the - * information on the class for which to find the instances. - * - * selectList - Not used - * nonJoinExp - Not used - * - * Returns: - * CCIMInstanceList * if found. Otherwise, NULL. - */ - -/* - * Currently, there is no WQL parser for the C providers. As a result, - * what is returned to the CIMOM is a list of instances with - * a NULL value at the beginning of the list. This NULL value indicates - * to the CIMOM that it must do the filtering for the client. - */ - -/* ARGSUSED */ -CCIMInstanceList* -cp_execQuery_Solaris_MPXIOGroup(CCIMObjectPath *op, cimchar *selectList, - cimchar *nonJoinExp, cimchar *queryExp, int queryType) -{ - CCIMInstanceList *instList = NULL; - CCIMInstanceList *result; - CCIMInstance *emptyInst; - CCIMException *ex; - int error; - - if (op == NULL) { - util_handleError(MPXIO_EXECQUERY, CIM_ERR_INVALID_PARAMETER, NULL, - NULL, &error); - return ((CCIMInstanceList *)NULL); - } - - instList = cp_enumInstances_Solaris_MPXIOGroup(op); - - if (instList == NULL) { - return ((CCIMInstanceList *)NULL); - } - /* - * Create a null instance and add it to the beginning - * of the list to indicate to the CIMOM that no filtering - * was done. - */ - - emptyInst = cim_createInstance(""); - if (emptyInst == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_FAILURE, ex, &error); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_createInstanceList(); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_EXECQUERY, CIM_ERR_FAILED, - CREATE_INSTANCE_LIST_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - result = cim_addInstance(result, emptyInst); - if (result == NULL) { - ex = cim_getLastError(); - util_handleError(MPXIO_EXECQUERY, CIM_ERR_FAILED, - ADD_INSTANCE_FAILURE, ex, &error); - cim_freeInstance(emptyInst); - cim_freeInstanceList(instList); - return ((CCIMInstanceList *)NULL); - } - - /* - * Since copying the original list to the new list will - * leave no way to free the original list, manually - * concatenate the original list to the new one. - */ - - result->mNext = instList; - return (result); -} diff --git a/usr/src/cmd/wbem/provider/c/wbem_disk/mpxio/Solaris_MPXIOGroup.h b/usr/src/cmd/wbem/provider/c/wbem_disk/mpxio/Solaris_MPXIOGroup.h deleted file mode 100644 index b2d7288566..0000000000 --- a/usr/src/cmd/wbem/provider/c/wbem_disk/mpxio/Solaris_MPXIOGroup.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOLARIS_MPXIOGROUP_H_ -#define _SOLARIS_MPXIOGROUP_H_ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <cimapi.h> -#include <cimprovider.h> -#include <cimomhandle.h> -#include <cimlogsvc.h> - -#include "libdiskmgt.h" - -#ifdef __cplusplus -} -#endif - -#endif /* _SOLARIS_MPXIOGROUP_H_ */ |
