From 4300ced21cdd95ae6a526f1e29cac3146d92bd91 Mon Sep 17 00:00:00 2001 From: Richard Lowe Date: Sun, 15 Aug 2010 15:22:57 -0400 Subject: 29 illumos build should not depend upon 'extras' pkg repository Reviewed by: garrett@nexenta.com Approved by: garrett@nexenta.com --- usr/src/Makefile.lint | 1 - usr/src/cmd/Makefile | 2 - usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/Makefile | 1 - .../cmd/cmd-inet/usr.sadm/dhcpmgr/bin/dhcpmgr.sh | 6 +- .../sun/dhcpmgr/cli/dhcpconfig/ConfigureDhcp.java | 43 - .../dhcpmgr/cli/dhcpconfig/ConvertDataStore.java | 7 +- .../com/sun/dhcpmgr/cli/dhcpconfig/DhcpCfg.java | 11 +- .../cli/dhcpconfig/ResourceBundle.properties | 7 +- .../dhcpmgr/cli/dhcpconfig/UnconfigureDhcp.java | 12 +- .../com/sun/dhcpmgr/cli/pntadm/AddClientEntry.java | 16 +- .../sun/dhcpmgr/cli/pntadm/DeleteClientEntry.java | 13 +- .../sun/dhcpmgr/cli/pntadm/ModifyClientEntry.java | 14 +- .../dhcpmgr/com/sun/dhcpmgr/cli/pntadm/PntAdm.java | 10 +- .../sun/dhcpmgr/cli/pntadm/RemoveNetworkTable.java | 4 +- .../dhcpmgr/cli/pntadm/ResourceBundle.properties | 4 +- .../dhcpmgr/com/sun/dhcpmgr/cli/tests/cfgdhcp.san | 16 +- .../com/sun/dhcpmgr/client/AddressWizard.java | 288 +-- .../com/sun/dhcpmgr/client/ConfigWizard.java | 370 --- .../com/sun/dhcpmgr/client/ConvertWizard.java | 40 +- .../sun/dhcpmgr/client/CreateAddressDialog.java | 159 +- .../sun/dhcpmgr/client/DeleteAddressDialog.java | 58 +- .../sun/dhcpmgr/client/DeleteNetworksDialog.java | 70 +- .../sun/dhcpmgr/client/ResourceBundle.properties | 16 - .../com/sun/dhcpmgr/client/UnconfigureDialog.java | 86 +- .../com/sun/dhcpmgr/common/ExportController.java | 12 +- .../com/sun/dhcpmgr/server/DhcpHostsTable.java | 338 --- .../com/sun/dhcpmgr/server/DhcpMgrImpl.java | 48 +- .../dhcpmgr/com/sun/dhcpmgr/server/DhcpNetMgr.java | 14 +- .../com/sun/dhcpmgr/server/DhcpNetMgrImpl.java | 198 +- .../com/sun/dhcpmgr/server/DhcpServiceMgr.java | 4 - .../com/sun/dhcpmgr/server/DhcpServiceMgrImpl.java | 13 - .../dhcpmgr/com/sun/dhcpmgr/server/Makefile | 20 +- .../sun/dhcpmgr/server/ResourceBundle.properties | 34 - .../usr.sadm/dhcpmgr/help/dhcp_addr_del.html | 5 +- .../usr.sadm/dhcpmgr/help/dhcp_addr_mod.html | 9 - .../usr.sadm/dhcpmgr/help/dhcp_addr_wiz.html | 9 - .../usr.sadm/dhcpmgr/help/dhcp_config_wiz.html | 31 - usr/src/cmd/wbem/Makefile | 49 - usr/src/cmd/wbem/Makefile.cmd | 53 - usr/src/cmd/wbem/Makefile.com | 56 - usr/src/cmd/wbem/Makefile.wbem | 54 - usr/src/cmd/wbem/provider/Makefile | 64 - usr/src/cmd/wbem/provider/c/Makefile | 60 - usr/src/cmd/wbem/provider/c/filesystems/Makefile | 55 - .../wbem/provider/c/filesystems/common/Makefile | 58 - .../c/filesystems/common/cmdgeneration/Makefile | 95 - .../c/filesystems/common/cmdgeneration/cmdgen.c | 104 - .../c/filesystems/common/cmdgeneration/cmdgen.h | 61 - .../common/cmdgeneration/cmdgen_include.h | 73 - .../common/cmdgeneration/mount/Makefile | 91 - .../common/cmdgeneration/mount/cmdgen_mount.c | 66 - .../common/cmdgeneration/mount/cmdgen_mountall.c | 187 -- .../common/cmdgeneration/mount/nfs/Makefile | 65 - .../cmdgeneration/mount/nfs/cmdgen_mount_nfs.c | 488 ---- .../common/cmdgeneration/share/Makefile | 94 - .../common/cmdgeneration/share/cmdgen_share.c | 49 - .../common/cmdgeneration/share/cmdgen_shareall.c | 108 - .../common/cmdgeneration/share/nfs/Makefile | 65 - .../cmdgeneration/share/nfs/cmdgen_share_nfs.c | 356 --- .../cmdgeneration/share/nfs/nfs_share_attr.h | 52 - .../share/nfs/nfs_sharesecurity_attr.h | 52 - .../common/cmdgeneration/umount/Makefile | 64 - .../common/cmdgeneration/umount/cmdgen_umount.c | 102 - .../common/cmdgeneration/umount/cmdgen_umountall.c | 240 -- .../common/cmdgeneration/unshare/Makefile | 94 - .../common/cmdgeneration/unshare/cmdgen_unshare.c | 49 - .../cmdgeneration/unshare/cmdgen_unshareall.c | 82 - .../common/cmdgeneration/unshare/nfs/Makefile | 67 - .../cmdgeneration/unshare/nfs/cmdgen_unshare_nfs.c | 82 - .../c/filesystems/common/mount_methods/Makefile | 65 - .../common/mount_methods/mountprov_methods.c | 323 --- .../common/mount_methods/mountprov_methods.h | 49 - .../wbem/provider/c/filesystems/wbem_nfs/Makefile | 70 - .../provider/c/filesystems/wbem_nfs/assoc/Makefile | 83 - .../wbem_nfs/assoc/Solaris_HostedShare.c | 1086 --------- .../wbem_nfs/assoc/Solaris_HostedShare.h | 53 - .../filesystems/wbem_nfs/assoc/Solaris_NFSMount.c | 2467 -------------------- .../filesystems/wbem_nfs/assoc/Solaris_NFSMount.h | 189 -- .../wbem_nfs/assoc/Solaris_NFSShareEntry.c | 1329 ----------- .../wbem_nfs/assoc/Solaris_NFSShareEntry.h | 57 - .../wbem_nfs/assoc/Solaris_NFSShareSecurityModes.c | 1339 ----------- .../wbem_nfs/assoc/Solaris_NFSShareSecurityModes.h | 53 - .../assoc/Solaris_PersistentShareForSystem.c | 1113 --------- .../assoc/Solaris_PersistentShareForSystem.h | 53 - .../wbem_nfs/assoc/Solaris_SharedFileSystem.c | 1161 --------- .../wbem_nfs/assoc/Solaris_SharedFileSystem.h | 53 - .../filesystems/wbem_nfs/assoc/common_functions.c | 160 -- .../filesystems/wbem_nfs/assoc/common_functions.h | 75 - .../c/filesystems/wbem_nfs/assoc/nfs_mount_attr.h | 85 - .../c/filesystems/wbem_nfs/common/Makefile | 76 - .../wbem_nfs/common/createprop_methods.c | 347 --- .../wbem_nfs/common/createprop_methods.h | 60 - .../filesystems/wbem_nfs/common/nfsprov_methods.c | 461 ---- .../filesystems/wbem_nfs/common/nfsprov_methods.h | 56 - .../c/filesystems/wbem_nfs/include/nfs_keys.h | 76 - .../wbem_nfs/include/nfs_provider_names.h | 103 - .../wbem_nfs/include/nfs_providers_msgstrings.h | 147 -- .../filesystems/wbem_nfs/include/nfsprov_include.h | 65 - .../provider/c/filesystems/wbem_nfs/lib/Makefile | 159 -- .../provider/c/filesystems/wbem_nfs/lib/header.sh | 426 ---- .../c/filesystems/wbem_nfs/lib/libDispatch.c | 708 ------ .../c/filesystems/wbem_nfs/lib/localFunc.c | 147 -- .../provider/c/filesystems/wbem_nfs/lib/mapfile | 61 - .../c/filesystems/wbem_nfs/nfs_filesystem/Makefile | 73 - .../wbem_nfs/nfs_filesystem/Solaris_NFS.c | 1239 ---------- .../wbem_nfs/nfs_filesystem/Solaris_NFS.h | 196 -- .../c/filesystems/wbem_nfs/nfs_mount/Makefile | 78 - .../wbem_nfs/nfs_mount/Solaris_MountService.c | 220 -- .../c/filesystems/wbem_nfs/nfs_share/Makefile | 79 - .../wbem_nfs/nfs_share/Solaris_NFSShare.c | 1184 ---------- .../wbem_nfs/nfs_share/Solaris_NFSShare.h | 101 - .../wbem_nfs/nfs_share/Solaris_NFSShareSecurity.c | 820 ------- .../wbem_nfs/nfs_share/Solaris_NFSShareSecurity.h | 77 - .../wbem_nfs/nfs_share/Solaris_PersistentShare.c | 986 -------- .../wbem_nfs/nfs_share/Solaris_PersistentShare.h | 71 - .../wbem_nfs/nfs_share/Solaris_ShareService.c | 215 -- usr/src/cmd/wbem/provider/c/include/cimKeys.h | 53 - .../cmd/wbem/provider/c/include/ctrl_descriptors.h | 53 - .../cmd/wbem/provider/c/include/disk_descriptors.h | 52 - .../wbem/provider/c/include/drive_descriptors.h | 64 - .../provider/c/include/logicaldisk_descriptors.h | 52 - .../provider/c/include/mediapresent_descriptors.h | 50 - .../cmd/wbem/provider/c/include/messageStrings.h | 152 -- usr/src/cmd/wbem/provider/c/include/methods.h | 61 - .../provider/c/include/mpxiogroup_descriptors.h | 52 - .../provider/c/include/partbasedon_descriptors.h | 50 - .../provider/c/include/partition_descriptors.h | 56 - .../cmd/wbem/provider/c/include/providerNames.h | 109 - .../c/include/realizesdiskdrive_descriptors.h | 51 - .../c/include/realizesextent_descriptors.h | 50 - usr/src/cmd/wbem/provider/c/include/util.h | 71 - usr/src/cmd/wbem/provider/c/mof/CIM2.7.mof | 232 -- usr/src/cmd/wbem/provider/c/mof/Makefile | 54 - .../cmd/wbem/provider/c/mof/Solaris_DMGT1.0.mof | 789 ------- usr/src/cmd/wbem/provider/c/mof/Solaris_NFS1.0.mof | 1229 ---------- usr/src/cmd/wbem/provider/c/wbem_disk/Makefile | 72 - .../cmd/wbem/provider/c/wbem_disk/assoc/Makefile | 82 - .../assoc/Sol_DiskPartitionBasedOnFDisk.c | 1007 -------- .../assoc/Sol_DiskPartitionBasedOnFDisk.h | 48 - .../assoc/Sol_MPXIOCtrlrLogicalIdentity.c | 1044 --------- .../assoc/Sol_MPXIOCtrlrLogicalIdentity.h | 49 - .../assoc/Solaris_DiskPartitionBasedOnDisk.c | 1044 --------- .../assoc/Solaris_DiskPartitionBasedOnDisk.h | 48 - .../c/wbem_disk/assoc/Solaris_IDEInterface.c | 1183 ---------- .../c/wbem_disk/assoc/Solaris_IDEInterface.h | 49 - .../c/wbem_disk/assoc/Solaris_MPXIOComponent.c | 1095 --------- .../c/wbem_disk/assoc/Solaris_MPXIOComponent.h | 49 - .../c/wbem_disk/assoc/Solaris_MPXIOInterface.c | 1101 --------- .../c/wbem_disk/assoc/Solaris_MPXIOInterface.h | 49 - .../c/wbem_disk/assoc/Solaris_MediaPresent.c | 1065 --------- .../c/wbem_disk/assoc/Solaris_MediaPresent.h | 48 - .../c/wbem_disk/assoc/Solaris_RealizesDiskDrive.c | 1038 -------- .../c/wbem_disk/assoc/Solaris_RealizesDiskDrive.h | 48 - .../c/wbem_disk/assoc/Solaris_RealizesExtent.c | 942 -------- .../c/wbem_disk/assoc/Solaris_RealizesExtent.h | 48 - .../c/wbem_disk/assoc/Solaris_SCSIInterface.c | 1152 --------- .../c/wbem_disk/assoc/Solaris_SCSIInterface.h | 49 - .../cmd/wbem/provider/c/wbem_disk/common/Makefile | 86 - .../provider/c/wbem_disk/common/ctrl_descriptors.c | 332 --- .../provider/c/wbem_disk/common/disk_descriptors.c | 438 ---- .../c/wbem_disk/common/drive_descriptors.c | 833 ------- .../c/wbem_disk/common/logicaldisk_descriptors.c | 404 ---- .../c/wbem_disk/common/mediapresent_descriptors.c | 143 -- .../cmd/wbem/provider/c/wbem_disk/common/methods.c | 1122 --------- .../c/wbem_disk/common/mpxiogroup_descriptors.c | 214 -- .../c/wbem_disk/common/partbasedon_descriptors.c | 281 --- .../c/wbem_disk/common/partition_descriptors.c | 707 ------ .../common/realizesdiskdrive_descriptors.c | 144 -- .../wbem_disk/common/realizesextent_descriptors.c | 144 -- .../cmd/wbem/provider/c/wbem_disk/common/util.c | 333 --- .../wbem/provider/c/wbem_disk/controller/Makefile | 77 - .../controller/Solaris_GenericController.c | 425 ---- .../controller/Solaris_GenericController.h | 47 - .../c/wbem_disk/controller/Solaris_IDEController.c | 422 ---- .../c/wbem_disk/controller/Solaris_IDEController.h | 47 - .../wbem_disk/controller/Solaris_MPXIOController.c | 430 ---- .../wbem_disk/controller/Solaris_MPXIOController.h | 47 - .../wbem_disk/controller/Solaris_SCSIController.c | 423 ---- .../wbem_disk/controller/Solaris_SCSIController.h | 47 - .../controller/Solaris_USBSCSIController.c | 430 ---- .../controller/Solaris_USBSCSIController.h | 47 - .../cmd/wbem/provider/c/wbem_disk/disk/Makefile | 73 - .../wbem/provider/c/wbem_disk/disk/Solaris_Disk.c | 432 ---- .../wbem/provider/c/wbem_disk/diskdrive/Makefile | 73 - .../c/wbem_disk/diskdrive/Solaris_DiskDrive.c | 461 ---- .../provider/c/wbem_disk/diskpartition/Makefile | 74 - .../diskpartition/Solaris_DiskPartition.c | 461 ---- .../diskpartition/Solaris_DiskPartition.h | 52 - usr/src/cmd/wbem/provider/c/wbem_disk/lib/Makefile | 169 -- .../cmd/wbem/provider/c/wbem_disk/lib/header.sh | 426 ---- .../wbem/provider/c/wbem_disk/lib/libDispatch.c | 707 ------ .../cmd/wbem/provider/c/wbem_disk/lib/localFunc.c | 142 -- usr/src/cmd/wbem/provider/c/wbem_disk/lib/mapfile | 61 - .../wbem/provider/c/wbem_disk/logicaldisk/Makefile | 73 - .../c/wbem_disk/logicaldisk/Solaris_LogicalDisk.c | 425 ---- .../cmd/wbem/provider/c/wbem_disk/mpxio/Makefile | 73 - .../c/wbem_disk/mpxio/Solaris_MPXIOGroup.c | 432 ---- .../c/wbem_disk/mpxio/Solaris_MPXIOGroup.h | 47 - usr/src/cmd/wbem/provider/com/Makefile | 57 - usr/src/cmd/wbem/provider/com/sun/Makefile | 57 - usr/src/cmd/wbem/provider/com/sun/wbem/Makefile | 57 - .../provider/com/sun/wbem/solarisprovider/Makefile | 57 - .../solarisprovider/srm/ActiveProjectModel.java | 84 - .../wbem/solarisprovider/srm/ActiveUserModel.java | 83 - .../sun/wbem/solarisprovider/srm/DataModel.java | 552 ----- .../com/sun/wbem/solarisprovider/srm/Makefile | 102 - .../srm/ProcessAggregateDataModel.java | 82 - .../wbem/solarisprovider/srm/ProcessDataModel.java | 221 -- .../srm/PropertyAccessInterface.java | 70 - .../wbem/solarisprovider/srm/ResourceMonitor.java | 222 -- .../wbem/solarisprovider/srm/SRMDataReader.java | 727 ------ .../com/sun/wbem/solarisprovider/srm/SRMDebug.java | 550 ----- .../sun/wbem/solarisprovider/srm/SRMException.java | 49 - .../solarisprovider/srm/SRMProtocolException.java | 45 - .../sun/wbem/solarisprovider/srm/SRMProvider.java | 585 ----- .../solarisprovider/srm/SRMProviderDataModel.java | 231 -- .../solarisprovider/srm/SRMProviderProperties.java | 211 -- .../com/sun/wbem/solarisprovider/srm/SetProp.java | 80 - .../wbem/solarisprovider/srm/SetReal32Prop.java | 76 - .../wbem/solarisprovider/srm/SetReal64Prop.java | 76 - .../wbem/solarisprovider/srm/SetStringProp.java | 72 - .../sun/wbem/solarisprovider/srm/SetUI32Prop.java | 76 - .../sun/wbem/solarisprovider/srm/SetUI64Prop.java | 75 - .../solarisprovider/srm/Solaris_ActiveProject.java | 261 --- ...is_ActiveProjectProcessAggregateStatistics.java | 242 -- .../srm/Solaris_ActiveProjectProperties.java | 44 - .../solarisprovider/srm/Solaris_ActiveUser.java | 256 -- ...laris_ActiveUserProcessAggregateStatistics.java | 245 -- .../srm/Solaris_ActiveUserProperties.java | 45 - .../solarisprovider/srm/Solaris_Performance1.0.mof | 640 ----- .../srm/Solaris_ProcessStatisticalInformation.java | 229 -- ...is_ProcessStatisticalInformationProperties.java | 209 -- .../srm/Solaris_ProcessStatistics.java | 244 -- ...jectProcessAggregateStatisticalInformation.java | 269 --- ...UserProcessAggregateStatisticalInformation.java | 264 --- .../wbem/solarisprovider/srm/SystemDataModel.java | 67 - .../com/sun/wbem/solarisprovider/srm/Util.java | 184 -- .../solarisprovider/srm/perfprovider.properties | 106 - .../srm/resources/Exceptions.properties | 28 - .../srm/resources/LogMessages.properties | 41 - .../com/sun/wbem/solarisprovider/srm/rmon.java | 192 -- .../com/sun/wbem/solarisprovider/srm/stats.java | 477 ---- usr/src/cmd/wbem/provider/tools/Makefile | 49 - usr/src/cmd/wbem/provider/tools/rds/Makefile | 74 - usr/src/cmd/wbem/provider/tools/rds/Makefile.com | 68 - usr/src/cmd/wbem/provider/tools/rds/amd64/Makefile | 37 - usr/src/cmd/wbem/provider/tools/rds/i386/Makefile | 35 - usr/src/cmd/wbem/provider/tools/rds/prtelement.c | 112 - usr/src/cmd/wbem/provider/tools/rds/rdfile.c | 226 -- usr/src/cmd/wbem/provider/tools/rds/rdfile.h | 71 - usr/src/cmd/wbem/provider/tools/rds/rdimpl.c | 747 ------ usr/src/cmd/wbem/provider/tools/rds/rdimpl.h | 210 -- usr/src/cmd/wbem/provider/tools/rds/rdlist.c | 390 ---- usr/src/cmd/wbem/provider/tools/rds/rdlist.h | 80 - usr/src/cmd/wbem/provider/tools/rds/rdprot.c | 788 ------- usr/src/cmd/wbem/provider/tools/rds/rdprot.h | 144 -- usr/src/cmd/wbem/provider/tools/rds/rds.c | 1021 -------- usr/src/cmd/wbem/provider/tools/rds/rdtable.c | 115 - usr/src/cmd/wbem/provider/tools/rds/rdtable.h | 79 - usr/src/cmd/wbem/provider/tools/rds/rdutil.c | 323 --- usr/src/cmd/wbem/provider/tools/rds/rdutil.h | 66 - usr/src/cmd/wbem/provider/tools/rds/sparc/Makefile | 36 - .../cmd/wbem/provider/tools/rds/sparcv9/Makefile | 39 - usr/src/pkg/manifests/SUNWrmwb.mf | 9 +- .../consolidation-osnet-osnet-message-files.mf | 3 - .../pkg/manifests/developer-opensolaris-osnet.mf | 5 - .../system-management-wbem-data-management.mf | 22 - .../system-management-wbem-resource-management.mf | 49 +- 268 files changed, 332 insertions(+), 62718 deletions(-) delete mode 100644 usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpHostsTable.java delete mode 100644 usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/ResourceBundle.properties delete mode 100644 usr/src/cmd/wbem/Makefile delete mode 100644 usr/src/cmd/wbem/Makefile.cmd delete mode 100644 usr/src/cmd/wbem/Makefile.com delete mode 100644 usr/src/cmd/wbem/Makefile.wbem delete mode 100644 usr/src/cmd/wbem/provider/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/cmdgen.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/cmdgen.h delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/cmdgen_include.h delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/mount/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/mount/cmdgen_mount.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/mount/cmdgen_mountall.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/mount/nfs/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/mount/nfs/cmdgen_mount_nfs.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/cmdgen_share.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/cmdgen_shareall.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/nfs/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/nfs/cmdgen_share_nfs.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/nfs/nfs_share_attr.h delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/share/nfs/nfs_sharesecurity_attr.h delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/umount/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/umount/cmdgen_umount.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/umount/cmdgen_umountall.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/unshare/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/unshare/cmdgen_unshare.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/unshare/cmdgen_unshareall.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/unshare/nfs/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/cmdgeneration/unshare/nfs/cmdgen_unshare_nfs.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/mount_methods/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/mount_methods/mountprov_methods.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/common/mount_methods/mountprov_methods.h delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_HostedShare.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_HostedShare.h delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_NFSMount.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_NFSMount.h delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_NFSShareEntry.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_NFSShareEntry.h delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_NFSShareSecurityModes.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_NFSShareSecurityModes.h delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_PersistentShareForSystem.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_PersistentShareForSystem.h delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_SharedFileSystem.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/Solaris_SharedFileSystem.h delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/common_functions.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/common_functions.h delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/assoc/nfs_mount_attr.h delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/common/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/common/createprop_methods.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/common/createprop_methods.h delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/common/nfsprov_methods.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/common/nfsprov_methods.h delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/include/nfs_keys.h delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/include/nfs_provider_names.h delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/include/nfs_providers_msgstrings.h delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/include/nfsprov_include.h delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/lib/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/lib/header.sh delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/lib/libDispatch.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/lib/localFunc.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/lib/mapfile delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_filesystem/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_filesystem/Solaris_NFS.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_filesystem/Solaris_NFS.h delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_mount/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_mount/Solaris_MountService.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_NFSShare.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_NFSShare.h delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_NFSShareSecurity.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_NFSShareSecurity.h delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_PersistentShare.c delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_PersistentShare.h delete mode 100644 usr/src/cmd/wbem/provider/c/filesystems/wbem_nfs/nfs_share/Solaris_ShareService.c delete mode 100644 usr/src/cmd/wbem/provider/c/include/cimKeys.h delete mode 100644 usr/src/cmd/wbem/provider/c/include/ctrl_descriptors.h delete mode 100644 usr/src/cmd/wbem/provider/c/include/disk_descriptors.h delete mode 100644 usr/src/cmd/wbem/provider/c/include/drive_descriptors.h delete mode 100644 usr/src/cmd/wbem/provider/c/include/logicaldisk_descriptors.h delete mode 100644 usr/src/cmd/wbem/provider/c/include/mediapresent_descriptors.h delete mode 100644 usr/src/cmd/wbem/provider/c/include/messageStrings.h delete mode 100644 usr/src/cmd/wbem/provider/c/include/methods.h delete mode 100644 usr/src/cmd/wbem/provider/c/include/mpxiogroup_descriptors.h delete mode 100644 usr/src/cmd/wbem/provider/c/include/partbasedon_descriptors.h delete mode 100644 usr/src/cmd/wbem/provider/c/include/partition_descriptors.h delete mode 100644 usr/src/cmd/wbem/provider/c/include/providerNames.h delete mode 100644 usr/src/cmd/wbem/provider/c/include/realizesdiskdrive_descriptors.h delete mode 100644 usr/src/cmd/wbem/provider/c/include/realizesextent_descriptors.h delete mode 100644 usr/src/cmd/wbem/provider/c/include/util.h delete mode 100644 usr/src/cmd/wbem/provider/c/mof/CIM2.7.mof delete mode 100644 usr/src/cmd/wbem/provider/c/mof/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/mof/Solaris_DMGT1.0.mof delete mode 100644 usr/src/cmd/wbem/provider/c/mof/Solaris_NFS1.0.mof delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Sol_DiskPartitionBasedOnFDisk.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Sol_DiskPartitionBasedOnFDisk.h delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Sol_MPXIOCtrlrLogicalIdentity.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Sol_MPXIOCtrlrLogicalIdentity.h delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_DiskPartitionBasedOnDisk.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_DiskPartitionBasedOnDisk.h delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_IDEInterface.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_IDEInterface.h delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_MPXIOComponent.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_MPXIOComponent.h delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_MPXIOInterface.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_MPXIOInterface.h delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_MediaPresent.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_MediaPresent.h delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_RealizesDiskDrive.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_RealizesDiskDrive.h delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_RealizesExtent.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_RealizesExtent.h delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_SCSIInterface.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/assoc/Solaris_SCSIInterface.h delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/common/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/common/ctrl_descriptors.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/common/disk_descriptors.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/common/drive_descriptors.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/common/logicaldisk_descriptors.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/common/mediapresent_descriptors.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/common/methods.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/common/mpxiogroup_descriptors.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/common/partbasedon_descriptors.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/common/partition_descriptors.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/common/realizesdiskdrive_descriptors.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/common/realizesextent_descriptors.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/common/util.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/controller/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_GenericController.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_GenericController.h delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_IDEController.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_IDEController.h delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_MPXIOController.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_MPXIOController.h delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_SCSIController.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_SCSIController.h delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_USBSCSIController.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/controller/Solaris_USBSCSIController.h delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/disk/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/disk/Solaris_Disk.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/diskdrive/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/diskdrive/Solaris_DiskDrive.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/diskpartition/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/diskpartition/Solaris_DiskPartition.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/diskpartition/Solaris_DiskPartition.h delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/lib/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/lib/header.sh delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/lib/libDispatch.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/lib/localFunc.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/lib/mapfile delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/logicaldisk/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/logicaldisk/Solaris_LogicalDisk.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/mpxio/Makefile delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/mpxio/Solaris_MPXIOGroup.c delete mode 100644 usr/src/cmd/wbem/provider/c/wbem_disk/mpxio/Solaris_MPXIOGroup.h delete mode 100644 usr/src/cmd/wbem/provider/com/Makefile delete mode 100644 usr/src/cmd/wbem/provider/com/sun/Makefile delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/Makefile delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/Makefile delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/ActiveProjectModel.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/ActiveUserModel.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/DataModel.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Makefile delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/ProcessAggregateDataModel.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/ProcessDataModel.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/PropertyAccessInterface.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/ResourceMonitor.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMDataReader.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMDebug.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMException.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMProtocolException.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMProvider.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMProviderDataModel.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMProviderProperties.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SetProp.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SetReal32Prop.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SetReal64Prop.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SetStringProp.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SetUI32Prop.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SetUI64Prop.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ActiveProject.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ActiveProjectProcessAggregateStatistics.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ActiveProjectProperties.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ActiveUser.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ActiveUserProcessAggregateStatistics.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ActiveUserProperties.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_Performance1.0.mof delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ProcessStatisticalInformation.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ProcessStatisticalInformationProperties.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ProcessStatistics.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ProjectProcessAggregateStatisticalInformation.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_UserProcessAggregateStatisticalInformation.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SystemDataModel.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Util.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/perfprovider.properties delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/resources/Exceptions.properties delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/resources/LogMessages.properties delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/rmon.java delete mode 100644 usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/stats.java delete mode 100644 usr/src/cmd/wbem/provider/tools/Makefile delete mode 100644 usr/src/cmd/wbem/provider/tools/rds/Makefile delete mode 100644 usr/src/cmd/wbem/provider/tools/rds/Makefile.com delete mode 100644 usr/src/cmd/wbem/provider/tools/rds/amd64/Makefile delete mode 100644 usr/src/cmd/wbem/provider/tools/rds/i386/Makefile delete mode 100644 usr/src/cmd/wbem/provider/tools/rds/prtelement.c delete mode 100644 usr/src/cmd/wbem/provider/tools/rds/rdfile.c delete mode 100644 usr/src/cmd/wbem/provider/tools/rds/rdfile.h delete mode 100644 usr/src/cmd/wbem/provider/tools/rds/rdimpl.c delete mode 100644 usr/src/cmd/wbem/provider/tools/rds/rdimpl.h delete mode 100644 usr/src/cmd/wbem/provider/tools/rds/rdlist.c delete mode 100644 usr/src/cmd/wbem/provider/tools/rds/rdlist.h delete mode 100644 usr/src/cmd/wbem/provider/tools/rds/rdprot.c delete mode 100644 usr/src/cmd/wbem/provider/tools/rds/rdprot.h delete mode 100644 usr/src/cmd/wbem/provider/tools/rds/rds.c delete mode 100644 usr/src/cmd/wbem/provider/tools/rds/rdtable.c delete mode 100644 usr/src/cmd/wbem/provider/tools/rds/rdtable.h delete mode 100644 usr/src/cmd/wbem/provider/tools/rds/rdutil.c delete mode 100644 usr/src/cmd/wbem/provider/tools/rds/rdutil.h delete mode 100644 usr/src/cmd/wbem/provider/tools/rds/sparc/Makefile delete mode 100644 usr/src/cmd/wbem/provider/tools/rds/sparcv9/Makefile (limited to 'usr/src') diff --git a/usr/src/Makefile.lint b/usr/src/Makefile.lint index a14f7c3725..ccf0a103b5 100644 --- a/usr/src/Makefile.lint +++ b/usr/src/Makefile.lint @@ -305,7 +305,6 @@ COMMON_SUBDIRS = \ cmd/vrrpadm \ cmd/vt \ cmd/wall \ - cmd/wbem \ cmd/who \ cmd/whodo \ cmd/wracct \ diff --git a/usr/src/cmd/Makefile b/usr/src/cmd/Makefile index 0f60386f21..77ada6cd19 100644 --- a/usr/src/cmd/Makefile +++ b/usr/src/cmd/Makefile @@ -429,7 +429,6 @@ COMMON_SUBDIRS= \ vt \ w \ wall \ - wbem \ which \ who \ whodo \ @@ -723,7 +722,6 @@ MSGSUBDIRS= \ vrrpadm \ vscan \ w \ - wbem \ who \ whodo \ wracct \ diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/Makefile b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/Makefile index 36cd44b3d2..6e04681792 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/Makefile +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/Makefile @@ -45,7 +45,6 @@ GUI_JARFILES= com/sun/dhcpmgr/client/*.class \ SERVER_JAR= dhcpsvc.jar SERVER_JARFILES= com/sun/dhcpmgr/server/*.class \ com/sun/dhcpmgr/bridge/*.class \ - com/sun/dhcpmgr/server/*.properties \ com/sun/dhcpmgr/bridge/*.properties diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/bin/dhcpmgr.sh b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/bin/dhcpmgr.sh index cdd696b129..09e5828788 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/bin/dhcpmgr.sh +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/bin/dhcpmgr.sh @@ -25,14 +25,10 @@ DMDIR=/usr/sadm/admin/dhcpmgr DLDIR=/usr/lib/inet/dhcp/svcadm L10NDIR=/usr/share/lib/locale -WBEMDIR=/usr/sadm/lib/wbem -CLASSPATH=${L10NDIR}:${DMDIR}/dhcpmgr.jar:${DMDIR}/SUNWfiles.jar:${DMDIR}/SUNWbinfiles.jar:${DLDIR}/dhcpsvc.jar:${DLDIR}/dhcpcommon.jar:${WBEMDIR}/providerutility.jar +CLASSPATH=${L10NDIR}:${DMDIR}/dhcpmgr.jar:${DMDIR}/SUNWfiles.jar:${DMDIR}/SUNWbinfiles.jar:${DLDIR}/dhcpsvc.jar:${DLDIR}/dhcpcommon.jar export CLASSPATH -LD_LIBRARY_PATH=${WBEMDIR} -export LD_LIBRARY_PATH - # add /usr/dt/bin so sdtwebclient will be available for help PATH=${PATH}:/usr/dt/bin export PATH diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ConfigureDhcp.java b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ConfigureDhcp.java index 997eb627ff..1f11c41854 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ConfigureDhcp.java +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ConfigureDhcp.java @@ -45,8 +45,6 @@ public class ConfigureDhcp extends DhcpCfgFunction { */ static final int supportedOptions[] = { DhcpCfg.NON_NEGOTIABLE_LEASE, - DhcpCfg.HOSTS_RESOURCE, - DhcpCfg.HOSTS_DOMAIN, DhcpCfg.LEASE_LENGTH, DhcpCfg.DNS_ADDRESSES, DhcpCfg.DNS_DOMAIN, @@ -130,41 +128,6 @@ public class ConfigureDhcp extends DhcpCfgFunction { return (DhcpCfg.FAILURE); } - // Retrieve the hosts resource and domain options and validate. - // - String hostsResource = options.valueOf(DhcpCfg.HOSTS_RESOURCE); - String hostsDomain = options.valueOf(DhcpCfg.HOSTS_DOMAIN); - - if (hostsResource == null) { - if (hostsDomain != null) { - String msg = getString("config_requires_hosts_resource_error"); - throw new IllegalArgumentException(msg); - } - } else if (hostsResource.equals(DhcpdOptions.DSVC_CV_DNS)) { - if (hostsDomain == null) { - Object [] arguments = new Object[1]; - arguments[0] = hostsResource; - printErrMessage( - getString("config_requires_hosts_domain_error"), - arguments); - return (DhcpCfg.FAILURE); - } - } else if (hostsResource.equals(DhcpdOptions.DSVC_CV_FILES)) { - if (hostsDomain != null) { - Object [] arguments = new Object[1]; - arguments[0] = hostsResource; - printErrMessage(getString("config_hosts_domain_ignored_error"), - arguments); - return (DhcpCfg.FAILURE); - } - } else { - Object [] arguments = new Object[1]; - arguments[0] = hostsResource; - printErrMessage(getString("config_invalid_hosts_resource_error"), - arguments); - return (DhcpCfg.FAILURE); - } - // Retrieve the leaseLength option and check its validity. // The default (3600*24 = 1 day) should be defined as static somewhere. // @@ -238,12 +201,6 @@ public class ConfigureDhcp extends DhcpCfgFunction { DhcpdOptions dhcpdOptions = new DhcpdOptions(); dhcpdOptions.setDaemonEnabled(true); dhcpdOptions.setDhcpDatastore(getDhcpDatastore()); - if (hostsResource != null) { - dhcpdOptions.setHostsResource(hostsResource); - } - if (hostsDomain != null) { - dhcpdOptions.setHostsDomain(hostsDomain); - } try { getSvcMgr().writeDefaults(dhcpdOptions); printMessage(getString("config_create_conf_progress")); diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ConvertDataStore.java b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ConvertDataStore.java index 4db430ef91..d66367a442 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ConvertDataStore.java +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ConvertDataStore.java @@ -20,8 +20,6 @@ * CDDL HEADER END */ /* - * ident "%Z%%M% %I% %E% SMI" - * * Copyright (c) 2001 by Sun Microsystems, Inc. * All rights reserved. */ @@ -73,7 +71,7 @@ public class ConvertDataStore extends DhcpCfgFunction { options.valueOf(DhcpCfg.RESOURCE))); getDhcpDatastore().setLocation(options.valueOf(DhcpCfg.PATH)); getDhcpDatastore().setConfig( - options.valueOf(DhcpCfg.RESOURCE_CONFIG)); + options.valueOf(DhcpCfg.RESOURCE_CONFIG)); } catch (Throwable e) { // resource will not be valid } @@ -218,8 +216,7 @@ public class ConvertDataStore extends DhcpCfgFunction { for (int i = 0; i < networks.length; ++i) { String netString = networks[i].toString(); try { - getNetMgr().deleteNetwork(netString, false, false, - oldDatastore); + getNetMgr().deleteNetwork(netString, false, oldDatastore); Object [] arguments = new Object[1]; arguments[0] = netString; printMessage(getString("convert_delete_network_progress"), diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/DhcpCfg.java b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/DhcpCfg.java index 1e1d76f52c..2369d1be57 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/DhcpCfg.java +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/DhcpCfg.java @@ -20,8 +20,6 @@ * CDDL HEADER END */ /* - * ident "%Z%%M% %I% %E% SMI" - * * Copyright 2001-2002 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -36,7 +34,7 @@ import java.text.MessageFormat; * This class represents the entry point to the DHCP CLI dhcp configuration * administration. */ -public class DhcpCfg +public class DhcpCfg extends DhcpCliProgram { /** @@ -48,7 +46,7 @@ public class DhcpCfg * The valid options for all DhcpCfg administration. */ private static String optString = - "DUCnfxbkgh;I:R:N:X:r;p:u:l:d;a:m:t:y:s:o:P;Seq"; + "DUCnfxbkgI:R:N:X:r;p:u:l:d;a:m:t:y:s:o:P;Seq"; public static final int CONFIGURE_DHCP = 'D'; public static final int CONFIGURE_BOOTP = 'R'; @@ -66,8 +64,6 @@ public class DhcpCfg public static final int DELETE_TABLES = 'x'; public static final int KEEP_TABLES = 'k'; public static final int POINT_TO_POINT = 'b'; - public static final int HOSTS_RESOURCE = 'h'; - public static final int DELETE_HOSTS = 'h'; public static final int RESOURCE = 'r'; public static final int RESOURCE_CONFIG = 'u'; public static final int PATH = 'p'; @@ -82,7 +78,6 @@ public class DhcpCfg public static final int OPTION_LIST = 'o'; public static final int ROUTER_ADDRESSES = 't'; public static final int NIS_DOMAIN = 'y'; - public static final int HOSTS_DOMAIN = 'y'; public static final int SIGHUP = 'g'; public static final int SERVICE_ENABLE = 'e'; public static final int SERVICE_REENABLE = 'r'; @@ -177,7 +172,7 @@ public class DhcpCfg * @param value the option value(if any) * @exception IllegalArgumentException if an invalid argument was entered */ - public void processArg(int option, String value) + public void processArg(int option, String value) throws IllegalArgumentException { switch (option) { diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ResourceBundle.properties b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ResourceBundle.properties index 63c0fd001c..f85392bc03 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ResourceBundle.properties +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ResourceBundle.properties @@ -1,6 +1,4 @@ # -#ident "%Z%%M% %I% %E% SMI" -# # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -32,10 +30,7 @@ config_bootp_configured_error=Error - server is already configured as a BOOTP re config_null_datastore_error=Error - cannot configure without resource and path options. config_invalid_resource_error=Error - {0} is not a valid resource. config_make_location_error=Error - creating location: {0}. -config_requires_hosts_domain_error=Error - host resource requires a host domain. config_hosts_domain_ignored_error=Error - host domain does not make sense for a host resource type - {0} -config_invalid_hosts_resource_error=Error - host resource is invalid - {0} -config_requires_hosts_resource_error=Error - host domain requires a host resource. config_lease_error=Error - the lease value specified is not valid. config_lease_zero_error=Error - a lease value of zero is not valid. config_dns_error=Error - DNS domain or server information is incomplete. @@ -141,7 +136,7 @@ sighup_failed=Unable to signal the daemon to reload the dhcptab # dhcpcfg_invalid_arg=Invalid argument - {0} dhcpcfg_no_function_error=Error - must specify one of 'D', 'R', 'U', 'N', 'C', 'X', 'I', 'P' or 'S'. -dhcpcfg_usage=dhcpconfig (options)\n\nWhere (options) is one of:\n\n -D -r (resource) -p (path) Configure the DHCP service. Sub-options:\n [-u (uninterpreted data)]\n [-h (host resource)]\n [-y (host domain)]\n [-l (lease length)]\n [-n] Leases are not negotiable\n [-d (DNS domain)]\n [-a (DNS servers)]\n\n -R (server addresses) Configure BOOTP relay service.\n\n -U Unconfigure DHCP or BOOTP relay service. Sub-options:\n [-f] No confirmation prompt\n [-x] Delete dhcptab and network tables\n [-h] Delete host entries\n\n -N (network address) Configure network. Sub-options:\n [-m (subnet mask)]\n [-t (router addresses)]\n [-y (NIS domain)]\n [-a (NIS addreses)]\n [-b] Network is point-to-point\n [-g] Signal daemon\n\n -C -r (resource) -p (path) Convert to new data store. Sub-options:\n [-u (uninterpreted data)]\n [-f] No confirmation prompt\n [-k] Do not delete original files\n\n -X (export filename) Export data. Sub-options:\n [-m (macro list)]\n [-o (option list)]\n [-a (network addresses)]\n [-f] Overwrite an existing export file\n [-x] Delete exported data\n [-g] Signal daemon\n\n -I (import filename) Import data. Sub-options:\n [-f] Overwrite existing data\n [-g] Signal daemon\n\n -P [parameter[=value]] Configure or print DHCP server parameters.\n\n -S Control the DHCP server. Sub-options:\n [-e] Enable and start the DHCP server\n [-d] Disable and stop the DHCP server\n [-r] Re-enable the DHCP server\n [-q] Query the DHCP server status\n +dhcpcfg_usage=dhcpconfig (options)\n\nWhere (options) is one of:\n\n -D -r (resource) -p (path) Configure the DHCP service. Sub-options:\n [-u (uninterpreted data)]\n [-l (lease length)]\n [-n] Leases are not negotiable\n [-d (DNS domain)]\n [-a (DNS servers)]\n\n -R (server addresses) Configure BOOTP relay service.\n\n -U Unconfigure DHCP or BOOTP relay service. Sub-options:\n [-f] No confirmation prompt\n [-x] Delete dhcptab and network tables\n\n -N (network address) Configure network. Sub-options:\n [-m (subnet mask)]\n [-t (router addresses)]\n [-y (NIS domain)]\n [-a (NIS addreses)]\n [-b] Network is point-to-point\n [-g] Signal daemon\n\n -C -r (resource) -p (path) Convert to new data store. Sub-options:\n [-u (uninterpreted data)]\n [-f] No confirmation prompt\n [-k] Do not delete original files\n\n -X (export filename) Export data. Sub-options:\n [-m (macro list)]\n [-o (option list)]\n [-a (network addresses)]\n [-f] Overwrite an existing export file\n [-x] Delete exported data\n [-g] Signal daemon\n\n -I (import filename) Import data. Sub-options:\n [-f] Overwrite existing data\n [-g] Signal daemon\n\n -P [parameter[=value]] Configure or print DHCP server parameters.\n\n -S Control the DHCP server. Sub-options:\n [-e] Enable and start the DHCP server\n [-d] Disable and stop the DHCP server\n [-r] Re-enable the DHCP server\n [-q] Query the DHCP server status\n # # ServerParameter errors. diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/UnconfigureDhcp.java b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/UnconfigureDhcp.java index 76f02f2eb4..bcc2b9cff5 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/UnconfigureDhcp.java +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/UnconfigureDhcp.java @@ -20,8 +20,6 @@ * CDDL HEADER END */ /* - * ident "%Z%%M% %I% %E% SMI" - * * Copyright (c) 2001 by Sun Microsystems, Inc. * All rights reserved. */ @@ -45,8 +43,7 @@ public class UnconfigureDhcp extends DhcpCfgFunction { */ static final int supportedOptions[] = { DhcpCfg.FORCE, - DhcpCfg.DELETE_TABLES, - DhcpCfg.DELETE_HOSTS + DhcpCfg.DELETE_TABLES }; /** @@ -119,10 +116,6 @@ public class UnconfigureDhcp extends DhcpCfgFunction { // boolean deleteTables = options.isSet(DhcpCfg.DELETE_TABLES); - // Should we delete the host entries? - // - boolean deleteHosts = options.isSet(DhcpCfg.DELETE_HOSTS); - // If this server is just acting as a relay then we don't need to // clean up the dhcptab or the networks. // @@ -164,8 +157,7 @@ public class UnconfigureDhcp extends DhcpCfgFunction { for (int i = 0; i < networks.length; ++i) { String netString = networks[i].toString(); try { - getNetMgr().deleteNetwork(netString, false, - deleteHosts); + getNetMgr().deleteNetwork(netString, false); Object [] arguments = new Object[1]; arguments[0] = netString; printMessage(getString("unconfigure_network_progress"), diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/AddClientEntry.java b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/AddClientEntry.java index f5d342a76f..d34356f535 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/AddClientEntry.java +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/AddClientEntry.java @@ -20,8 +20,6 @@ * CDDL HEADER END */ /* - * ident "%Z%%M% %I% %E% SMI" - * * Copyright 2001-2002 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -48,7 +46,6 @@ public class AddClientEntry extends PntAdmFunction { PntAdm.COMMENT, PntAdm.LEASE_EXPIRATION, PntAdm.FLAGS, - PntAdm.HOST_NAME, PntAdm.CLIENTID, PntAdm.CONVERT_CLIENTID, PntAdm.MACRO_NAME, @@ -85,7 +82,7 @@ public class AddClientEntry extends PntAdmFunction { /** * Executes the "add client" functionality. - * @return PntAdm.SUCCESS, PntAdm.EXISTS, PntAdm.WARNING, or + * @return PntAdm.SUCCESS, PntAdm.EXISTS, PntAdm.WARNING, or * PntAdm.CRITICAL */ public int execute() @@ -116,15 +113,6 @@ public class AddClientEntry extends PntAdmFunction { dhcpClientRecord.setFlags(flags); } - String clientName = options.valueOf(PntAdm.HOST_NAME); - if (clientName != null) { - if (isHostsManaged()) { - dhcpClientRecord.setClientName(clientName); - } else { - returnCode = PntAdm.WARNING; - } - } - String serverIP = options.valueOf(PntAdm.SERVER); if (serverIP == null) { serverIP = getSvcMgr().getServerName(); @@ -143,7 +131,7 @@ public class AddClientEntry extends PntAdmFunction { String msg = getString("no_macro_specified"); throw new IllegalArgumentException(msg); } - + // Create a Macro entry so that we can check to see if it // exists in the dhcptab. // diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/DeleteClientEntry.java b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/DeleteClientEntry.java index c7a66f9b74..fc6bf65f90 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/DeleteClientEntry.java +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/DeleteClientEntry.java @@ -20,8 +20,6 @@ * CDDL HEADER END */ /* - * ident "%Z%%M% %I% %E% SMI" - * * Copyright (c) 2001 by Sun Microsystems, Inc. * All rights reserved. */ @@ -43,7 +41,6 @@ public class DeleteClientEntry extends PntAdmFunction { * The valid options associated with deleting a client entry. */ static final int supportedOptions[] = { - PntAdm.DELETE_HOST, PntAdm.RESOURCE, PntAdm.RESOURCE_CONFIG, PntAdm.PATH @@ -83,14 +80,6 @@ public class DeleteClientEntry extends PntAdmFunction { int returnCode = PntAdm.SUCCESS; - // Check to see if the user wants the host deleted. - // - boolean deleteHost = options.isSet(PntAdm.DELETE_HOST); - if (deleteHost && !isHostsManaged()) { - deleteHost = false; - returnCode = PntAdm.WARNING; - } - // Build up a DhcpClientRecord from the user specified options. // try { @@ -108,7 +97,7 @@ public class DeleteClientEntry extends PntAdmFunction { // if requested. // getNetMgr().deleteClient(dhcpClientRecord, network.toString(), - deleteHost, getDhcpDatastore()); + getDhcpDatastore()); } catch (NoEntryException e) { printErrMessage(getMessage(e)); diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/ModifyClientEntry.java b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/ModifyClientEntry.java index d92c43426c..9985026e50 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/ModifyClientEntry.java +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/ModifyClientEntry.java @@ -20,8 +20,6 @@ * CDDL HEADER END */ /* - * ident "%Z%%M% %I% %E% SMI" - * * Copyright 2001-2002 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -49,7 +47,6 @@ public class ModifyClientEntry extends PntAdmFunction { PntAdm.COMMENT, PntAdm.LEASE_EXPIRATION, PntAdm.FLAGS, - PntAdm.HOST_NAME, PntAdm.CLIENTID, PntAdm.CONVERT_CLIENTID, PntAdm.MACRO_NAME, @@ -146,15 +143,6 @@ public class ModifyClientEntry extends PntAdmFunction { newDhcpClientRecord.setFlags(flags); } - String clientName = options.valueOf(PntAdm.HOST_NAME); - if (clientName != null) { - if (isHostsManaged()) { - newDhcpClientRecord.setClientName(clientName); - } else { - returnCode = PntAdm.WARNING; - } - } - String serverIP = options.valueOf(PntAdm.SERVER); if (serverIP == null) { serverIP = getSvcMgr().getServerName(); @@ -173,7 +161,7 @@ public class ModifyClientEntry extends PntAdmFunction { String msg = getString("no_macro_specified"); throw new IllegalArgumentException(msg); } - + // Create a Macro entry so that we can check to see if it // exists in the dhcptab. // diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/PntAdm.java b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/PntAdm.java index ca78306375..ccb8c47805 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/PntAdm.java +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/PntAdm.java @@ -20,8 +20,6 @@ * CDDL HEADER END */ /* - * ident "%Z%%M% %I% %E% SMI" - * * Copyright (c) 2001 by Sun Microsystems, Inc. * All rights reserved. */ @@ -46,7 +44,7 @@ public class PntAdm /** * The valid options for all PntAdm administration. */ - private static String optString = "LPCRyavxA:D:M:r:p:u:s:i:f:e:h:m:c:n:B;"; + private static String optString = "LPCRyavxA:D:M:r:p:u:s:i:f:e:m:c:n:B;"; public static final int ADD_CLIENT_ENTRY = 'A'; public static final int MODIFY_CLIENT_ENTRY = 'M'; @@ -58,7 +56,6 @@ public class PntAdm public static final int BATCH_EXECUTION = 'B'; public static final int VERIFY_MACRO = 'y'; - public static final int DELETE_HOST = 'y'; public static final int CONVERT_CLIENTID = 'a'; public static final int RAW = 'x'; public static final int VERBOSE = 'v'; @@ -69,7 +66,6 @@ public class PntAdm public static final int CLIENTID = 'i'; public static final int FLAGS = 'f'; public static final int LEASE_EXPIRATION = 'e'; - public static final int HOST_NAME = 'h'; public static final int MACRO_NAME = 'm'; public static final int COMMENT = 'c'; public static final int NEW_IP = 'n'; @@ -186,7 +182,7 @@ public class PntAdm DhcpCliPrint.printErrMessage(msg.toString()); returnCode = CRITICAL; } - + return (returnCode); } // execute @@ -197,7 +193,7 @@ public class PntAdm * @param value the option value(if any) * @exception IllegalArgumentException if an invalid argument was entered */ - public void processArg(int option, String value) + public void processArg(int option, String value) throws IllegalArgumentException { switch (option) { diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/RemoveNetworkTable.java b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/RemoveNetworkTable.java index 561d8ac087..958e899c4a 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/RemoveNetworkTable.java +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/RemoveNetworkTable.java @@ -20,8 +20,6 @@ * CDDL HEADER END */ /* - * ident "%Z%%M% %I% %E% SMI" - * * Copyright (c) 2001 by Sun Microsystems, Inc. * All rights reserved. */ @@ -87,7 +85,7 @@ public class RemoveNetworkTable extends PntAdmFunction { // Delete the network table. // - getNetMgr().deleteNetwork(network.toString(), false, false, + getNetMgr().deleteNetwork(network.toString(), false, getDhcpDatastore()); } catch (NoTableException e) { printErrMessage(getMessage(e)); diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/ResourceBundle.properties b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/ResourceBundle.properties index 334edb9073..b7fa8c2ca9 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/ResourceBundle.properties +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/ResourceBundle.properties @@ -1,6 +1,4 @@ # -#ident "%Z%%M% %I% %E% SMI" -# # Copyright 2005 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -95,4 +93,4 @@ invalid_args=Invalid arguments on command line. # # Usage # -usage=pntadm [-r (resource)] [-p (path)] [-u (uninterpreted data)] (options) [(network ip or name)]\n\nWhere (options) is one of:\n\n -C Create the named table\n\n -A (client ip or name) Add client entry. Sub-options:\n [-c (comment)]\n [-e (lease expiration)]\n [-f (flags)]\n [-h (client host name)]\n [-i (client identifier)[-a]]\n [-m (dhcptab macro reference)[-y]]\n [-s (server ip or name)]\n\n -M (client ip or name) Modify client entry. Sub-options:\n [-c (new comment)]\n [-e (new lease expiration)]\n [-f (new flags)]\n [-h (new client host name)]\n [-i (new client identifier)[-a]]\n [-m (new dhcptab macro reference)[-y]]\n [-n (new client ip)]\n [-s (new server ip or name)]\n\n -D (client ip or name) Delete client entry. Sub-options:\n [-y] Remove hosts table entry\n\n -R Remove the named table\n\n -P Display the named table. Sub-options:\n [-v] Display lease time in full format.\n [-x] Display lease time in raw format.\n\n -L List the configured DHCP networks\n\n -B [batchfile] Run command in batch input mode. Sub-options:\n [-v] Output commands as they are processed.\n\n The network ip or name argument is required for all options except -L and -B\n +usage=pntadm [-r (resource)] [-p (path)] [-u (uninterpreted data)] (options) [(network ip or name)]\n\nWhere (options) is one of:\n\n -C Create the named table\n\n -A (client ip or name) Add client entry. Sub-options:\n [-c (comment)]\n [-e (lease expiration)]\n [-f (flags)]\n [-i (client identifier)[-a]]\n [-m (dhcptab macro reference)[-y]]\n [-s (server ip or name)]\n\n -M (client ip or name) Modify client entry. Sub-options:\n [-c (new comment)]\n [-e (new lease expiration)]\n [-f (new flags)]\n [-i (new client identifier)[-a]]\n [-m (new dhcptab macro reference)[-y]]\n [-n (new client ip)]\n [-s (new server ip or name)]\n\n -D (client ip or name) Delete client entry.\n\n -R Remove the named table\n\n -P Display the named table. Sub-options:\n [-v] Display lease time in full format.\n [-x] Display lease time in raw format.\n\n -L List the configured DHCP networks\n\n -B [batchfile] Run command in batch input mode. Sub-options:\n [-v] Output commands as they are processed.\n\n The network ip or name argument is required for all options except -L and -B\n diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/tests/cfgdhcp.san b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/tests/cfgdhcp.san index c100676a0d..36338c0a0b 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/tests/cfgdhcp.san +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/tests/cfgdhcp.san @@ -21,8 +21,6 @@ # CDDL HEADER END # # -#ident "%Z%%M% %I% %E% SMI" -# # Copyright (c) 2001 by Sun Microsystems, Inc. # All rights reserved. # @@ -119,7 +117,6 @@ get_dns_parms() # SRVNAME=`uname -n` SRVADDR=`get_server_ip` -DHCPHOSTS_RSRC=files DHCP_DEFAULTS=/etc/inet/dhcpsvc.conf # @@ -136,7 +133,7 @@ rm -f ${DHCP_DEFAULTS} >>${OUTFILE} 2>&1 # # Config. # -/usr/sbin/dhcpconfig -D -r ${DHCPRSRC} -p ${DHCPPATH} -h ${DHCPHOSTS_RSRC} >>${OUTFILE} 2>&1 +/usr/sbin/dhcpconfig -D -r ${DHCPRSRC} -p ${DHCPPATH} >>${OUTFILE} 2>&1 RET=$? if [ "${RET}" != "0" ] then @@ -188,17 +185,6 @@ then exit 1 fi -# -# Verify that the hosts resource was defined in the defaults file -# -DEFLINE=`grep "HOSTS_RESOURCE=${DHCPHOSTS_RSRC}" ${DHCP_DEFAULTS}` -if [ -z "${DEFLINE}" ] -then - echo "HOSTS_RESOURCE not set correctly in ${DHCP_DEFAULTS}" - echo "${TESTNAME} - Test failed!" - exit 1 -fi - # # Verify that the dhcptab data was created. # diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressWizard.java b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressWizard.java index 2ebcab6d1c..aa52424417 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressWizard.java +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressWizard.java @@ -20,8 +20,6 @@ * CDDL HEADER END */ /* - * ident "%Z%%M% %I% %E% SMI" - * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -57,8 +55,6 @@ public class AddressWizard extends Wizard { private String server = DataManager.get().getShortServerName(); private IPAddress serverIP; private IPAddress startAddress; - private boolean generateNames = false; - private String baseName = DataManager.get().getShortServerName(); private String macro = DataManager.get().getShortServerName(); private boolean unusable = false; private boolean dynamic = true; @@ -68,26 +64,26 @@ public class AddressWizard extends Wizard { class Address { IPAddress addr; String name; - + public Address() { addr = null; name = ""; } - + public Address(int a, String n) { name = n; setAddr(a); } - + public Address(String a, String n) { name = n; setAddr(a); } - + public void setAddr(int a) { addr = new IPAddress(a); } - + public void setAddr(String a) { try { addr = new IPAddress(a); @@ -95,7 +91,7 @@ public class AddressWizard extends Wizard { // Do nothing } } - + public String toString() { return addr.getHostAddress(); } @@ -103,15 +99,15 @@ public class AddressWizard extends Wizard { class WizardTableModel extends AbstractTableModel { private Vector addrs = new Vector(); - + public int getRowCount() { return addrs.size(); } - + public int getColumnCount() { return 2; } - + public Object getValueAt(int row, int column) { if (column == 0) { return ((Address)addrs.elementAt(row)).addr; @@ -119,7 +115,7 @@ public class AddressWizard extends Wizard { return ((Address)addrs.elementAt(row)).name; } } - + public Class getColumnClass(int column) { if (column == 0) { return IPAddress.class; @@ -127,7 +123,7 @@ public class AddressWizard extends Wizard { return String.class; } } - + public String getColumnName(int column) { if (column == 0) { return ResourceStrings.getString("address_column"); @@ -135,7 +131,7 @@ public class AddressWizard extends Wizard { return ResourceStrings.getString("client_name_column"); } } - + public long generateAddresses() { if (!network.containsAddress(startAddress)) { return 0; @@ -190,14 +186,7 @@ public class AddressWizard extends Wizard { } if (searchAddress != address) { // found an empty slot; create the address - Address addr; - if (generateNames) { - addr = new Address((int)address, - baseName + "-" + String.valueOf(index)); - } else { - addr = new Address((int)address, ""); - } - addrs.addElement(addr); + addrs.addElement(new Address((int)address, "")); ++count; } ++index; @@ -207,34 +196,34 @@ public class AddressWizard extends Wizard { fireTableDataChanged(); return count; } - + public Address getAddressAt(int index) { return (Address)addrs.elementAt(index); } } - + // This step selects the number of addresses and a comment class NumberStep implements WizardStep { private Box stepBox; private IntegerField addressCount; private JTextField commentField; - + public NumberStep() { stepBox = Box.createVerticalBox(); - + // Explanatory text at the top stepBox.add(Wizard.createTextArea( ResourceStrings.getString("add_wiz_explain"), 4, 45)); stepBox.add(Box.createVerticalStrut(10)); stepBox.add(Box.createVerticalGlue()); - + // Get the number of addresses to create stepBox.add(Wizard.createTextArea( ResourceStrings.getString("add_wiz_count_explain"), 1, 45)); Mnemonic mnCount = new Mnemonic(ResourceStrings.getString("add_wiz_count_label")); - JLabel label = new JLabel(mnCount.getString()); + JLabel label = new JLabel(mnCount.getString()); addressCount = new IntegerField(); // Ensure numeric input addressCount.setMaximumSize(addressCount.getPreferredSize()); @@ -249,7 +238,7 @@ public class AddressWizard extends Wizard { box.add(addressCount); box.add(Box.createHorizontalGlue()); stepBox.add(box); - + stepBox.add(Box.createVerticalStrut(10)); stepBox.add(Box.createVerticalGlue()); stepBox.add(Wizard.createTextArea( @@ -274,7 +263,7 @@ public class AddressWizard extends Wizard { box.add(commentField); stepBox.add(box); stepBox.add(Box.createVerticalGlue()); - + /* * This listener ensures that the forward button is enabled only * when there is a count of addresses in the addressCount field. @@ -292,21 +281,21 @@ public class AddressWizard extends Wizard { } }); } - + public String getDescription() { return ResourceStrings.getString("add_wiz_number_desc"); } - + public Component getComponent() { return stepBox; } - + public void setActive(int direction) { addressCount.setValue(number); commentField.setText(comment); setForwardEnabled(addressCount.getValue() != 0); } - + public boolean setInactive(int direction) { number = addressCount.getValue(); if (number == 0) { @@ -329,17 +318,15 @@ public class AddressWizard extends Wizard { class ServerStep implements WizardStep { private Box stepBox; private IPAddressField startField; - private HostnameField baseNameField; - private JCheckBox generateNamesBox; private HostnameField serverField; - + public ServerStep() { stepBox = Box.createVerticalBox(); - + // Explanatory text at the top stepBox.add(Wizard.createTextArea( ResourceStrings.getString("add_wiz_server_explain"), 1, 45)); - + // Server to own these addresses Mnemonic mnMan = new Mnemonic(ResourceStrings.getString("add_wiz_server_label")); @@ -350,17 +337,17 @@ public class AddressWizard extends Wizard { serverField = new HostnameField("", 15); jl.setLabelFor(serverField); jl.setToolTipText(mnMan.getString()); - jl.setDisplayedMnemonic(mnMan.getMnemonic()); + jl.setDisplayedMnemonic(mnMan.getMnemonic()); serverField.setMaximumSize(serverField.getPreferredSize()); box.add(serverField); box.add(Box.createHorizontalGlue()); stepBox.add(box); - + // Add some spacing stepBox.add(Box.createVerticalStrut(5)); stepBox.add(Box.createVerticalGlue()); - + // Starting address stepBox.add(Wizard.createTextArea( ResourceStrings.getString("add_wiz_start_explain"), 2, 45)); @@ -379,60 +366,7 @@ public class AddressWizard extends Wizard { startField.setMaximumSize(startField.getPreferredSize()); box.add(startField); stepBox.add(box); - - // Add some more spacing, and an explanation of generating names - stepBox.add(Box.createVerticalStrut(5)); - stepBox.add(Box.createVerticalGlue()); - stepBox.add(Wizard.createTextArea( - ResourceStrings.getString("add_wiz_generate_explain"), 4, 45)); - - // Control to indicate whether names should be generated - JPanel panel = new JPanel(new GridLayout(2, 1, 0, 0)); - generateNamesBox = new JCheckBox( - ResourceStrings.getString("add_wiz_generate_label")); - generateNamesBox.setToolTipText( - ResourceStrings.getString("add_wiz_generate_label")); - panel.add(generateNamesBox); - generateNamesBox.setEnabled(true); - try { - DhcpdOptions opts = - DataManager.get().getDhcpServiceMgr().readDefaults(); - if (opts.getHostsResource() == null) { - generateNamesBox.setEnabled(false); - } - } catch (BridgeException e) { - // Assume set - } - - baseNameField = new HostnameField(); - baseNameField.setEnabled(false); - baseNameField.setMaximumSize(baseNameField.getPreferredSize()); - box = Box.createHorizontalBox(); - box.add(Box.createHorizontalStrut(17)); - - Mnemonic mnRoot = - new Mnemonic(ResourceStrings.getString( - "add_wiz_rootname_label")); - JLabel rootNameLbl = new JLabel(mnRoot.getString()); - box.add(rootNameLbl); - rootNameLbl.setLabelFor(baseNameField); - rootNameLbl.setToolTipText(mnRoot.getString()); - rootNameLbl.setDisplayedMnemonic(mnRoot.getMnemonic()); - - box.add(Box.createHorizontalStrut(5)); - box.add(baseNameField); - panel.add(box); - stepBox.add(panel); - stepBox.add(Box.createVerticalGlue()); - - // Only enable the text input if name generation is requested - generateNamesBox.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - baseNameField.setEnabled(generateNamesBox.isSelected()); - } - }); - DocumentListener docListener = new DocumentListener() { public void insertUpdate(DocumentEvent e) { setForwardEnabled((startField.getText().length() != 0) @@ -445,27 +379,25 @@ public class AddressWizard extends Wizard { insertUpdate(e); } }; - + startField.getDocument().addDocumentListener(docListener); serverField.getDocument().addDocumentListener(docListener); } - + public String getDescription() { return ResourceStrings.getString("add_wiz_server_desc"); } - + public Component getComponent() { return stepBox; } - + public void setActive(int direction) { serverField.setText(server); startField.setValue(startAddress); - baseNameField.setText(baseName); - generateNamesBox.setSelected(generateNames); setForwardEnabled(true); } - + public boolean setInactive(int direction) { if (direction == FORWARD) { // Validate that address is on the network we're working on @@ -514,30 +446,28 @@ public class AddressWizard extends Wizard { } server = serverField.getText(); startAddress = startField.getValue(); - generateNames = generateNamesBox.isSelected(); - baseName = baseNameField.getText(); return true; } } - + // This step confirms the list of addresses to be generated class ConfirmStep implements WizardStep { private JPanel stepPanel; private JTable addressTable; - + public ConfirmStep() { stepPanel = new JPanel(new BorderLayout(10, 10)); - + // Explanatory text at the top stepPanel.add(Wizard.createTextArea( ResourceStrings.getString("add_wiz_confirm_explain"), 3, 45), BorderLayout.NORTH); - + // Label the table - JPanel panel = new JPanel(new BorderLayout()); + JPanel panel = new JPanel(new BorderLayout()); panel.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 15)); Mnemonic mnIP = - new Mnemonic(ResourceStrings.getString( + new Mnemonic(ResourceStrings.getString( "add_wiz_confirm_label")); JLabel label = new JLabel(mnIP.getString()); panel.add(label, BorderLayout.NORTH); @@ -562,15 +492,15 @@ public class AddressWizard extends Wizard { panel.add(scrollPane, BorderLayout.CENTER); stepPanel.add(panel, BorderLayout.CENTER); } - + public String getDescription() { return ResourceStrings.getString("add_wiz_confirm_desc"); } - + public Component getComponent() { return stepPanel; } - + public void setActive(int direction) { /* * If we're activating coming from the previous step, @@ -608,12 +538,12 @@ public class AddressWizard extends Wizard { setForwardEnabled(true); } } - + public boolean setInactive(int direction) { return true; // Nothing to do when leaving } } - + // This step selects the macro and flags class ConfigureStep implements WizardStep { @@ -622,7 +552,7 @@ public class AddressWizard extends Wizard { implements ComboBoxModel { private Object currentValue; private Macro data[] = null; - + public int getSize() { if (data == null) { try { @@ -641,7 +571,7 @@ public class AddressWizard extends Wizard { return data.length+1; } } - + public Object getElementAt(int index) { if (data == null) { try { @@ -659,7 +589,7 @@ public class AddressWizard extends Wizard { return data[index-1].getKey(); } } - + public void setSelectedItem(Object anItem) { currentValue = noMacro.getKey(); for (int i = 0; data != null && i < data.length; i++) { @@ -669,11 +599,11 @@ public class AddressWizard extends Wizard { } fireContentsChanged(this, -1, -1); } - + public Object getSelectedItem() { return currentValue; } - + public Macro getMacroAt(int index) { if (index == 0) { return noMacro; @@ -682,13 +612,13 @@ public class AddressWizard extends Wizard { } } } - + private Box stepBox; private JComboBox macroBox; private MacroListModel macroBoxModel; private JButton viewButton; private JCheckBox unusableBox; - + public ConfigureStep() { stepBox = Box.createVerticalBox(); @@ -699,7 +629,7 @@ public class AddressWizard extends Wizard { stepBox.add(component); // Add some spacing stepBox.add(Box.createVerticalStrut(10)); - + // Let 'em select the macro to use Mnemonic mnConf = new Mnemonic(ResourceStrings.getString("add_wiz_macro_label")); @@ -717,16 +647,16 @@ public class AddressWizard extends Wizard { panel.add(macroBox); // Button to view the contents of the selected macro - Mnemonic mnView = - new Mnemonic(ResourceStrings.getString("add_wiz_view_button")); + Mnemonic mnView = + new Mnemonic(ResourceStrings.getString("add_wiz_view_button")); viewButton = new JButton(mnView.getString()); viewButton.setToolTipText(mnView.getString()); - viewButton.setMnemonic(mnView.getMnemonic()); + viewButton.setMnemonic(mnView.getMnemonic()); panel.add(viewButton); panel.setAlignmentX(Component.LEFT_ALIGNMENT); stepBox.add(panel); - + // Give the option to mark them unusable for now component = Wizard.createTextArea( ResourceStrings.getString("add_wiz_flag_explain"), 2, 45); @@ -737,7 +667,7 @@ public class AddressWizard extends Wizard { unusableBox.setAlignmentX(Component.LEFT_ALIGNMENT); stepBox.add(unusableBox); stepBox.add(Box.createVerticalGlue()); - + // When user presses View, show the macro's contents viewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -747,51 +677,51 @@ public class AddressWizard extends Wizard { * context with the task. */ ViewMacroDialog d = new ViewMacroDialog( - AddressWizard.this, viewButton, + AddressWizard.this, viewButton, macroBoxModel.getMacroAt(macroBox.getSelectedIndex())); d.pack(); d.setVisible(true); } }); } - + public String getDescription() { return ResourceStrings.getString("add_wiz_configure_desc"); } - + public Component getComponent() { return stepBox; } - + public void setActive(int direction) { macroBox.setSelectedItem(macro); unusableBox.setSelected(unusable); setForwardEnabled(true); } - + public boolean setInactive(int direction) { macro = (String)macroBox.getSelectedItem(); unusable = unusableBox.isSelected(); return true; } } - + // This step selects the lease type class LeaseStep implements WizardStep { private Box stepBox; private JRadioButton dynamicButton, permanentButton; private ButtonGroup buttonGroup; - + public LeaseStep() { stepBox = Box.createVerticalBox(); - + // Start with explanatory text JComponent component = Wizard.createTextArea( ResourceStrings.getString("add_wiz_lease_explain"), 0, 45); component.setAlignmentX(Component.LEFT_ALIGNMENT); stepBox.add(component); stepBox.add(Box.createVerticalStrut(10)); - + // User has choice of dynamic or permanent leases Mnemonic mnLease = new Mnemonic(ResourceStrings.getString("add_wiz_lease_label")); @@ -816,26 +746,26 @@ public class AddressWizard extends Wizard { stepBox.add(panel); stepBox.add(Box.createVerticalGlue()); } - + public String getDescription() { return ResourceStrings.getString("add_wiz_lease_desc"); } - + public Component getComponent() { return stepBox; } - + public void setActive(int direction) { dynamicButton.setSelected(dynamic); setForwardEnabled(true); } - + public boolean setInactive(int direction) { dynamic = dynamicButton.isSelected(); return true; } } - + // Last chance to check work before committing to it class ReviewStep implements WizardStep { private Box stepBox; @@ -847,15 +777,15 @@ public class AddressWizard extends Wizard { private JLabel macroLabel; private JLabel flagLabel; private JLabel leaseLabel; - + public ReviewStep() { stepBox = Box.createVerticalBox(); stepBox.add(Wizard.createTextArea( ResourceStrings.getString("add_wiz_review_explain"), 4, 45)); - + panel = new JPanel(new FieldLayout()); JLabel tmpL; - + tmpL = addLabelMnemonic("add_wiz_count_label"); numberLabel = addField("20"); tmpL.setLabelFor(numberLabel); @@ -876,17 +806,17 @@ public class AddressWizard extends Wizard { flagLabel = addField("Yes"); tmpL.setLabelFor(flagLabel); tmpL.setToolTipText( - ResourceStrings.getString("add_wiz_review_unusable")); - + ResourceStrings.getString("add_wiz_review_unusable")); + tmpL = addLabelMnemonic("add_wiz_lease_label"); leaseLabel = addField(ResourceStrings.getString("dynamic")); tmpL.setLabelFor(leaseLabel); - + panel.setAlignmentX(Component.LEFT_ALIGNMENT); stepBox.add(panel); - + stepBox.add(Box.createVerticalStrut(5)); - + Mnemonic mnAdd = new Mnemonic(ResourceStrings.getString( "add_wiz_confirm_label")); @@ -912,9 +842,9 @@ public class AddressWizard extends Wizard { stepBox.add(scrollPane); stepBox.add(Box.createVerticalGlue()); } - + private JLabel addLabel(String s) { - JLabel l = new JLabel(ResourceStrings.getString(s)); + JLabel l = new JLabel(ResourceStrings.getString(s)); panel.add(FieldLayout.LABEL, l); return l; } @@ -927,22 +857,22 @@ public class AddressWizard extends Wizard { panel.add(FieldLayout.LABEL, l); return l; } - + private JLabel addField(String s) { JLabel l = new JLabel(s); l.setForeground(Color.black); panel.add(FieldLayout.FIELD, l); return l; } - + public String getDescription() { return ResourceStrings.getString("add_wiz_review_desc"); } - + public Component getComponent() { return stepBox; } - + public void setActive(int direction) { // Use number of addresses actually generated, not requested numberLabel.setText( @@ -962,21 +892,21 @@ public class AddressWizard extends Wizard { } setFinishEnabled(true); } - + public boolean setInactive(int direction) { // Nothing to do return true; } } - + public AddressWizard(Frame owner, Network net) { super(owner, ""); setTitle(MessageFormat.format( ResourceStrings.getString("address_wizard_title"), net.toString())); - + network = net; startAddress = network.getAddress(); - + try { noMacro = new Macro(ResourceStrings.getString("no_macro_item")); } catch (ValidationException e) { @@ -994,7 +924,7 @@ public class AddressWizard extends Wizard { addStep(new ReviewStep()); showFirstStep(); } - + public void doFinish() { /* * Method here is as follows: @@ -1036,7 +966,7 @@ public class AddressWizard extends Wizard { rec.setMacro(macro); } rec.setComment(comment); - + // This is final so it can be used in the errorDisplay Runnable final ErrorTable failedTable = new ErrorTable( ResourceStrings.getString("address_column"), @@ -1052,12 +982,12 @@ public class AddressWizard extends Wizard { rec.setClientIP(addr.addr); rec.setClientName(addr.name); server.addClient(rec, network.toString()); - progress.update(i+1, addr.addr.toString()); + progress.update(i+1, addr.addr.toString()); } catch (InterruptedException e) { - SwingUtilities.invokeLater(finisher); + SwingUtilities.invokeLater(finisher); return; } catch (Throwable e) { - // Pick the best message for the exception thrown + // Pick the best message for the exception thrown String msg; if (e instanceof ExistsException) { msg = ResourceStrings.getString("address_exists"); @@ -1069,33 +999,33 @@ public class AddressWizard extends Wizard { failedTable.addError(addr.addr, msg); } } - + // If any errors occurred, display them all at once. if (!failedTable.isEmpty()) { Runnable errorDisplay = new Runnable() { - public void run() { + public void run() { Object [] objs = new Object[2]; objs[0] = - ResourceStrings.getString("add_wiz_error"); + ResourceStrings.getString("add_wiz_error"); JScrollPane scrollPane = - new JScrollPane(failedTable); + new JScrollPane(failedTable); // Resize the table to something kind of small Dimension d = - failedTable. + failedTable. getPreferredScrollableViewportSize(); d.height = 80; failedTable.setPreferredScrollableViewportSize(d); objs[1] = scrollPane; JOptionPane.showMessageDialog(AddressWizard.this, - objs, - ResourceStrings.getString("server_error_title"), - JOptionPane.ERROR_MESSAGE); - } + objs, + ResourceStrings.getString("server_error_title"), + JOptionPane.ERROR_MESSAGE); + } }; try { - SwingUtilities.invokeAndWait(errorDisplay); + SwingUtilities.invokeAndWait(errorDisplay); } catch (Throwable e) { - e.printStackTrace(); + e.printStackTrace(); } } SwingUtilities.invokeLater(finisher); @@ -1103,7 +1033,7 @@ public class AddressWizard extends Wizard { }; addThread.start(); } - + protected void reallyFinish() { super.doFinish(); } diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConfigWizard.java b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConfigWizard.java index d9b5d96dc2..0f240cb654 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConfigWizard.java +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConfigWizard.java @@ -64,347 +64,6 @@ public class ConfigWizard extends DSWizard { ResourceStrings.getString("cfg_wiz_days"), ResourceStrings.getString("cfg_wiz_weeks") }; private static final int [] unitMultiples = { 60*60, 24*60*60, 7*24*60*60 }; - private HostResource hostResource = null; - - /** - * This class defines a host resource component. - */ - private class HostResource extends Box { - - /** - * The host resource(eg., files, dns). - */ - private String resource = null; - - /** - * The description of the resource. - */ - private String description = null; - - /** - * The button for the resource. - */ - private HostButton hostButton = null; - - /** - * The domain field for the resource (if any) - */ - private NoSpaceField domainField = null; - - /** - * The constructor. - * @param resource the resource value for the config file - * @param description description of the resource - * @param defaultdomain default domain (if any) for the resource - * @param enabled determines whether resource is selectable - */ - public HostResource(String resource, String description, - String defaultDomain, String domainDescription, boolean enabled) { - - super(BoxLayout.X_AXIS); - - this.resource = resource; - this.description = description; - - // Every host resource needs a button even if the resource - // isn't one that will be selectable. - // - hostButton = new HostButton(this, false); - hostButton.setAlignmentX(Component.LEFT_ALIGNMENT); - add(hostButton); - if (!enabled) { - hostButton.setEnabled(false); - defaultDomain = new String(); - } - - // If the defaultDomain is null, then the host resource - // does not require a domain. Otherwise, the resource - // must have a text field so that the user can supply - // a domain. - // - if (defaultDomain != null) { - add(Box.createHorizontalStrut(20)); - - Box domainBox = Box.createHorizontalBox(); - - JLabel label = new JLabel(domainDescription); - label.setForeground(Color.black); - domainBox.add(label); - - domainField = new NoSpaceField(defaultDomain, 10); - domainField.setEnabled(false); - domainField.setMaximumSize(domainField.getPreferredSize()); - - label.setLabelFor(domainField); - domainBox.add(domainField); - label.setToolTipText(description); - - add(domainBox); - - if (!enabled) { - domainField.setEditable(false); - label.setEnabled(false); - } else { - // Disable the forward button if domain empty. - DocumentListener listener = new DocumentListener() { - public void insertUpdate(DocumentEvent e) { - setForwardEnabled( - domainField.getText().length() != 0); - } - public void changedUpdate(DocumentEvent e) { - insertUpdate(e); - } - public void removeUpdate(DocumentEvent e) { - insertUpdate(e); - } - }; - domainField.getDocument().addDocumentListener(listener); - } - - } - - } // constructor - - /** - * Sets or unsets the host resource. - * @param isSelected if true, sets the resource, else unsets it - */ - public void setSelected(boolean isSelected) { - if (isSelected) { - setHostResource(this); - if (!hostButton.isSelected()) { - hostButton.setSelected(true); - } - if (domainField != null) { - domainField.setEnabled(true); - setForwardEnabled(domainField.getText().length() != 0); - } else { - setForwardEnabled(true); - } - } else { - if (domainField != null) { - domainField.setEnabled(false); - } - } - } // setSelected - - /** - * Returns the host resource. - * @return the host resource. - */ - public String getResource() { - return resource; - } // getResource - - /** - * Returns the resource description. - * @return the resource description. - */ - public String getDescription() { - return description; - } // getDescription - - /** - * Returns the domain for this component. - * @return the domain for this component. - */ - public String getDomain() { - if (domainField == null) { - return null; - } else { - return domainField.getText(); - } - } // getDomain - - /** - * Returns the HostButton contained in this component. - * @return the HostButton contained in this component. - */ - public HostButton getHostButton() { - return hostButton; - } // getHostButton - - } // hostResource - - /** - * This class maps a radio button to its HostResource - */ - private class HostButton extends JRadioButton { - - /** - * The HostResource to link to the radio button. - */ - private HostResource hostResource = null; - - /** - * Constructs a HostButton from a HostResource and determines - * whether the button should be selected using the boolean argument. - * @param hostResource the HostResource to map to the radio button. - * @param selected select the radio button? - */ - public HostButton(HostResource hostResource, boolean selected) { - super(hostResource.getDescription(), selected); - this.hostResource = hostResource; - } // constructor - - /** - * Returns the HostResource mapped to the radio button. - * @return the HostResource mapped to the radio button. - */ - public HostResource getHostResource() { - return hostResource; - } // getHostResource - - } // HostButton - - // Select where host data will be stored. - class HostDataStep implements WizardStep { - - /** - * The component provided to the wizard. - */ - private Box stepBox; - - /** - * The basic constructor for the wizard step. - */ - public HostDataStep() { - - stepBox = Box.createVerticalBox(); - - // Explanatory step text - // - JComponent c = Wizard.createTextArea( - ResourceStrings.getString("cfg_wiz_host_explain"), 2, 45); - c.setAlignmentX(Component.LEFT_ALIGNMENT); - stepBox.add(c); - stepBox.add(Box.createVerticalStrut(5)); - - // Create button listener, that will set the selected - // host resource when the button is selected. - // - ChangeListener buttonListener = new ChangeListener() { - public void stateChanged(ChangeEvent e) { - HostButton button = (HostButton)e.getSource(); - HostResource hostResource = button.getHostResource(); - hostResource.setSelected(button.isSelected()); - } - }; - - // Create panel that will contain the buttons. - // - JPanel boxPanel = new JPanel(); - boxPanel.setAlignmentX(Component.LEFT_ALIGNMENT); - boxPanel.setLayout(new GridLayout(4, 1)); - - // List the host resource choices. - // - ButtonGroup buttonGroup = new ButtonGroup(); - - // The "do not manage hosts" option. - // - String hostDescription = - ResourceStrings.getString("cfg_wiz_no_host_management"); - HostResource hostResource = new HostResource(null, - hostDescription, null, null, true); - HostButton hbMgt = hostResource.getHostButton(); - hbMgt.setToolTipText(hostDescription); - hostResource.setSelected(true); - hostResource.getHostButton().addChangeListener(buttonListener); - buttonGroup.add(hostResource.getHostButton()); - boxPanel.add(hostResource); - - // The "files" option. - // - hostDescription = - ResourceStrings.getString("cfg_wiz_files"); - hostResource = new HostResource(DhcpConfigOpts.DSVC_CV_FILES, - hostDescription, null, null, true); - HostButton hb = hostResource.getHostButton(); - hb.setToolTipText(hostDescription); - hostResource.getHostButton().addChangeListener(buttonListener); - buttonGroup.add(hostResource.getHostButton()); - boxPanel.add(hostResource); - - // The "dns" option. Only enabled if it can be managed - // from the selected server. - // - String domainDefault = null; - boolean enabled = false; - String domainDescription = - ResourceStrings.getString("cfg_wiz_domain") + " "; - try { - domainDefault = - server.getStringOption(StandardOptions.CD_DNSDOMAIN, ""); - } catch (Throwable e) { - domainDefault = new String(); - } - - try { - enabled = - server.isHostsValid(DhcpConfigOpts.DSVC_CV_DNS, ""); - } catch (Throwable e) { - enabled = false; - } - - hostDescription = - ResourceStrings.getString("cfg_wiz_dns"); - - hostResource = new HostResource(DhcpConfigOpts.DSVC_CV_DNS, - hostDescription, domainDefault, domainDescription, enabled); - HostButton hbDNS = hostResource.getHostButton(); - hbDNS.setToolTipText(hostDescription); - hostResource.getHostButton().addChangeListener(buttonListener); - buttonGroup.add(hostResource.getHostButton()); - boxPanel.add(hostResource); - - // Add the panel to the stepBox component. - // - stepBox.add(boxPanel); - stepBox.add(Box.createVerticalStrut(10)); - stepBox.add(Box.createVerticalGlue()); - - } // constructor - - public String getDescription() { - return ResourceStrings.getString("cfg_wiz_hostdata_desc"); - } // getDescription - - public Component getComponent() { - return stepBox; - } // getComponent - - public void setActive(int direction) { - setForwardEnabled(true); - } // setActive - - public boolean setInactive(int direction) { - - // If moving forward, validate that the host resource/domain - // input by the user is manageable from the selected server. - // - boolean valid = true; - if (direction == FORWARD) { - String resource = getHostResource().getResource(); - String domain = getHostResource().getDomain(); - if (resource != null) { - try { - valid = server.isHostsValid(resource, domain); - } catch (Throwable e) { - valid = false; - } - } - if (!valid) { - JOptionPane.showMessageDialog(ConfigWizard.this, - ResourceStrings.getString("cfg_wiz_invalid_host"), - ResourceStrings.getString("input_error"), - JOptionPane.ERROR_MESSAGE); - } - } - return (valid); - } // setInactive - - } // HostDataStep // This step specifies lease length and renewal policies for the server class LeaseStep implements WizardStep { @@ -1161,7 +820,6 @@ public class ConfigWizard extends DSWizard { class ReviewStep implements WizardStep { private JLabel storeLabel; - private JLabel hostLabel; private JLabel leaseLabel; private JLabel networkLabel; private JLabel netTypeLabel; @@ -1193,9 +851,6 @@ public class ConfigWizard extends DSWizard { addLabel("cfg_wiz_datastore"); storeLabel = addField("uninitialized"); - addLabel("cfg_wiz_hosts_resource"); - hostLabel = addField("uninitialized"); - jlTmp = addLabelMnemonic("cfg_wiz_lease_length"); leaseLabel = addField("1 day"); @@ -1276,7 +931,6 @@ public class ConfigWizard extends DSWizard { setFinishEnabled(true); if (fullConfig) { storeLabel.setText(getDsconf().getModule().getDescription()); - hostLabel.setText(getHostResource().getDescription()); // Display lease length, reducing to largest units possible int lengthVal = 0; @@ -1378,7 +1032,6 @@ public class ConfigWizard extends DSWizard { ResourceStrings.getString("cfg_wiz_explain"), ResourceStrings.getString("cfg_wiz_store_explain"))); addStep(new DatastoreModuleStep()); - addStep(new HostDataStep()); addStep(new LeaseStep()); addStep(new DnsStep()); } @@ -1428,12 +1081,6 @@ public class ConfigWizard extends DSWizard { DhcpdOptions options = new DhcpdOptions(); options.setDaemonEnabled(true); options.setDhcpDatastore(getDsconf().getDS()); - if (getHostResource().getResource() != null) { - options.setHostsResource(getHostResource().getResource()); - } - if (getHostResource().getDomain() != null) { - options.setHostsDomain(getHostResource().getDomain()); - } try { server.writeDefaults(options); } catch (Throwable e) { @@ -1537,21 +1184,4 @@ public class ConfigWizard extends DSWizard { DhcpmgrApplet.showHelp("network_wizard"); } } - - /** - * Sets hostResource. - * @param hostResource the host resource value. - */ - public void setHostResource(HostResource hostResource) { - this.hostResource = hostResource; - } // setHostResource - - /** - * Returns the hostResource. - * @return the hostResource. - */ - public HostResource getHostResource() { - return hostResource; - } // getHostResource - } diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConvertWizard.java b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConvertWizard.java index 980c7fd55f..23636aec16 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConvertWizard.java +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConvertWizard.java @@ -20,8 +20,6 @@ * CDDL HEADER END */ /* - * ident "%Z%%M% %I% %E% SMI" - * * Copyright 2001-2002 by Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -120,7 +118,7 @@ public class ConvertWizard extends DSWizard { saveTables = new JCheckBox( ResourceStrings.getString("cvt_wiz_save_label"), false); saveTables.setToolTipText( - ResourceStrings.getString("cvt_wiz_save_label")); + ResourceStrings.getString("cvt_wiz_save_label")); saveTables.setAlignmentX(Component.LEFT_ALIGNMENT); stepBox.add(saveTables); stepBox.add(Box.createVerticalGlue()); @@ -193,7 +191,7 @@ public class ConvertWizard extends DSWizard { stepBox.add(Wizard.createTextArea( ResourceStrings.getString("cvt_wiz_review_explain"), 3, 45)); - + panel = new JPanel(new FieldLayout()); addLabel("cvt_wiz_old_datastore").setToolTipText( @@ -223,12 +221,12 @@ public class ConvertWizard extends DSWizard { * @param s the label string. */ private JLabel addLabel(String s) { - JLabel addLbl = + JLabel addLbl = new JLabel(ResourceStrings.getString(s)); panel.add(FieldLayout.LABEL, addLbl); return addLbl; } // addLabel - + /** * Adds a field to the review panel. * @param s the field value. @@ -240,15 +238,15 @@ public class ConvertWizard extends DSWizard { panel.add(FieldLayout.FIELD, l); return l; } // addField - + public String getDescription() { return ResourceStrings.getString("cvt_wiz_review_desc"); } // getDescription - + public Component getComponent() { return stepBox; } // getComponent - + public void setActive(int direction) { setFinishEnabled(true); @@ -274,17 +272,17 @@ public class ConvertWizard extends DSWizard { message = ResourceStrings.getString("no"); } saveLabel.setText(message); - + } // setActive - + public boolean setInactive(int direction) { return true; } // setInactive } // ReviewStep - + /** - * Constructor for the ConvertWizard. + * Constructor for the ConvertWizard. * @param owner owner of the wizard. * @param title title of the wizard. */ @@ -343,7 +341,7 @@ public class ConvertWizard extends DSWizard { addStep(new ReviewStep()); showFirstStep(); } - + public void doFinish() { /* * To convert the data store, we have to do the following items: @@ -438,7 +436,7 @@ public class ConvertWizard extends DSWizard { // Thread convertThread = new Thread() { public void run() { - + String message = null; MessageFormat form; MessageFormat errForm; @@ -446,7 +444,7 @@ public class ConvertWizard extends DSWizard { boolean saveTables = saveTablesStep.isSaveTablesSelected(); - // This is final so it can be used in the + // This is final so it can be used in the // errorDisplay Runnable. // final ErrorTable failedTable = new ErrorTable( @@ -556,7 +554,7 @@ public class ConvertWizard extends DSWizard { String netString = networks[i].toString(); args[0] = netString; try { - netServer.deleteNetwork(netString, false, false, + netServer.deleteNetwork(netString, false, oldDhcpDatastore); message = form.format(args); } catch (Throwable e) { @@ -609,7 +607,7 @@ public class ConvertWizard extends DSWizard { message = ResourceStrings.getString( "cvt_wiz_server_started"); } catch (Throwable e) { - message = + message = ResourceStrings.getString("cvt_wiz_start_err"); failedTable.addError("", e.getMessage()); } finally { @@ -645,12 +643,12 @@ public class ConvertWizard extends DSWizard { objs, ResourceStrings.getString("server_error_title"), JOptionPane.ERROR_MESSAGE); - } + } }; try { SwingUtilities.invokeAndWait(errorDisplay); } catch (Throwable e) { - e.printStackTrace(); + e.printStackTrace(); } } SwingUtilities.invokeLater(finisher); @@ -658,7 +656,7 @@ public class ConvertWizard extends DSWizard { }; convertThread.start(); } - + public void doHelp() { DhcpmgrApplet.showHelp("convert_wizard"); } diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/CreateAddressDialog.java b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/CreateAddressDialog.java index ab83ce99fc..883999f516 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/CreateAddressDialog.java +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/CreateAddressDialog.java @@ -20,8 +20,6 @@ * CDDL HEADER END */ /* - * ident "%Z%%M% %I% %E% SMI" - * * Copyright 1998-2002 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -58,11 +56,11 @@ public class CreateAddressDialog extends JDialog private Object currentValue; private Macro [] data = null; private String noMacro; - + public MacroListModel() { try { noMacro = ResourceStrings.getString("no_macro_item"); - DhcptabMgr server = DataManager.get().getDhcptabMgr(); + DhcptabMgr server = DataManager.get().getDhcptabMgr(); data = server.getMacros(); } catch (NoTableException e) { // can function without table @@ -70,14 +68,14 @@ public class CreateAddressDialog extends JDialog e.printStackTrace(); } } - + public int getSize() { if (data == null) return 1; else return data.length+1; } - + public Object getElementAt(int index) { if (index == 0) { return noMacro; @@ -85,12 +83,12 @@ public class CreateAddressDialog extends JDialog return data[index-1].getKey(); } } - + public void setSelectedItem(Object anItem) { currentValue = anItem; fireContentsChanged(this, -1, -1); } - + public Object getSelectedItem() { return currentValue; } @@ -99,11 +97,10 @@ public class CreateAddressDialog extends JDialog public static final int CREATE = 0; public static final int EDIT = 1; public static final int DUPLICATE = 2; - + private int mode = EDIT; private Network network; private IPAddressField address; - private HostnameField name; private JTextField server; private JComboBox macro; private JTextField clientId; @@ -120,7 +117,7 @@ public class CreateAddressDialog extends JDialog private Vector listeners; private DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); - + public CreateAddressDialog(Frame f, int mode, DhcpClientRecord rec, Network net) { super(f); @@ -142,11 +139,11 @@ public class CreateAddressDialog extends JDialog default: break; } - + getContentPane().setLayout(new BorderLayout()); - + JTabbedPane tabbedPane = new JTabbedPane(); - + GridBagLayout bag = new GridBagLayout(); JPanel mainPanel = new JPanel(bag); GridBagConstraints c = new GridBagConstraints(); @@ -155,7 +152,7 @@ public class CreateAddressDialog extends JDialog c.fill = GridBagConstraints.HORIZONTAL; c.insets = new Insets(5, 5, 5, 5); c.weightx = c.weighty = 1.0; - + // Label and text field for address Mnemonic mnIP = new Mnemonic(ResourceStrings.getString("ip_address_label")); @@ -173,35 +170,6 @@ public class CreateAddressDialog extends JDialog ++c.gridx; bag.setConstraints(address, c); mainPanel.add(address); - - // Label and text field for name - Mnemonic mnClient = - new Mnemonic(ResourceStrings.getString("hostname_label")); - l = new JLabel(mnClient.getString(), SwingConstants.RIGHT); - ++c.gridy; - c.gridx = 0; - bag.setConstraints(l, c); - mainPanel.add(l); - name = new HostnameField(); - - l.setLabelFor(name); - l.setToolTipText(mnClient.getString()); - l.setDisplayedMnemonic(mnClient.getMnemonic()); - - ++c.gridx; - bag.setConstraints(name, c); - mainPanel.add(name); - - name.setEditable(true); - try { - DhcpdOptions opts = - DataManager.get().getDhcpServiceMgr().readDefaults(); - if (opts.getHostsResource() == null) { - name.setEditable(false); - } - } catch (BridgeException e) { - // Assume set - } // label and field for owning server Mnemonic mnOwn = @@ -220,7 +188,7 @@ public class CreateAddressDialog extends JDialog ++c.gridx; bag.setConstraints(server, c); mainPanel.add(server); - + // label and combo box for macro Mnemonic mnMacro = new Mnemonic(ResourceStrings.getString("config_macro_label")); @@ -240,7 +208,7 @@ public class CreateAddressDialog extends JDialog ++c.gridx; bag.setConstraints(macro, c); mainPanel.add(macro); - + // Comment Mnemonic mnComm = new Mnemonic(ResourceStrings.getString("comment_label")); @@ -258,13 +226,13 @@ public class CreateAddressDialog extends JDialog ++c.gridx; bag.setConstraints(comment, c); mainPanel.add(comment); - + // Create first panel of tabs tabbedPane.addTab(ResourceStrings.getString("address_tab_label"), mainPanel); - + mainPanel = new JPanel(new BorderLayout(5, 5)); - + // Client ID Mnemonic mnID = new Mnemonic(ResourceStrings.getString("client_id_label")); @@ -277,14 +245,14 @@ public class CreateAddressDialog extends JDialog l.setToolTipText(mnID.getString()); l.setDisplayedMnemonic(mnID.getMnemonic()); idPanel.add(clientId); - + manual = new JCheckBox(ResourceStrings.getString("manual_checkbox")); idPanel.add(manual); manual.setToolTipText( ResourceStrings.getString("manual_checkbox")); mainPanel.add(idPanel, BorderLayout.NORTH); - + // radio buttons for lease state bag = new GridBagLayout(); JPanel leasePanel = new JPanel(bag); @@ -297,11 +265,11 @@ public class CreateAddressDialog extends JDialog BorderFactory.createLineBorder(Color.black)); leasePanel.setBorder(BorderFactory.createTitledBorder(b, ResourceStrings.getString("lease_policy_label"))); - + // Reset constraints c.gridx = c.gridy = 0; c.gridwidth = 1; - + buttonGroup = new ButtonGroup(); temporary = new JRadioButton(); buttonGroup.add(temporary); @@ -316,7 +284,7 @@ public class CreateAddressDialog extends JDialog c.weightx = 1.0; bag.setConstraints(l, c); leasePanel.add(l); - + expirationDate = new JTextField(30); l.setLabelFor(expirationDate); @@ -326,7 +294,7 @@ public class CreateAddressDialog extends JDialog ++c.gridy; bag.setConstraints(expirationDate, c); leasePanel.add(expirationDate); - + permanent = new JRadioButton(); buttonGroup.add(permanent); ++c.gridy; @@ -348,43 +316,43 @@ public class CreateAddressDialog extends JDialog leasePanel.add(l); mainPanel.add(leasePanel, BorderLayout.CENTER); - + // Flag checkboxes JPanel southPanel = new JPanel(new BorderLayout(5, 5)); southPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); bootp = new JCheckBox(ResourceStrings.getString("bootp_checkbox")); bootp.setToolTipText( - ResourceStrings.getString("bootp_checkbox")); + ResourceStrings.getString("bootp_checkbox")); bootp.setHorizontalAlignment(SwingConstants.LEFT); southPanel.add(bootp, BorderLayout.CENTER); - + unusable = new JCheckBox( ResourceStrings.getString("unusable_checkbox")); unusable.setToolTipText( - ResourceStrings.getString("unusable_checkbox")); + ResourceStrings.getString("unusable_checkbox")); unusable.setHorizontalAlignment(SwingConstants.LEFT); southPanel.add(unusable, BorderLayout.SOUTH); - + mainPanel.add(southPanel, BorderLayout.SOUTH); - + tabbedPane.addTab(ResourceStrings.getString("lease_tab_label"), mainPanel); JPanel borderPanel = new JPanel(new BorderLayout()); borderPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); borderPanel.add(tabbedPane, BorderLayout.CENTER); - + getContentPane().add(borderPanel, BorderLayout.CENTER); - + buttonPanel = new ButtonPanel(true); buttonPanel.addButtonPanelListener(this); getContentPane().add(buttonPanel, BorderLayout.SOUTH); - + setClient(rec); - + DocumentListener docListener = new DocumentListener() { public void insertUpdate(DocumentEvent e) { buttonPanel.setOkEnabled(address.getDocument().getLength() != 0 @@ -400,32 +368,23 @@ public class CreateAddressDialog extends JDialog address.getDocument().addDocumentListener(docListener); server.getDocument().addDocumentListener(docListener); - + if (mode == EDIT) { buttonPanel.setOkEnabled(true); } } - + public void setClient(DhcpClientRecord c) { originalClient = (DhcpClientRecord)c.clone(); client = c; resetValues(); } - + private void resetValues() { if (mode == DUPLICATE) { address.setText(""); - name.setText(""); } else { - String a = client.getClientIPAddress(); - String n = client.getClientName(); - address.setText(a); - if (a.equals(n)) { - // If name == address, there is no name, so leave it blank - name.setText(""); - } else { - name.setText(n); - } + address.setText(client.getClientIPAddress()); } if (mode == CREATE && (client.getServerName() == null || client.getServerName().length() == 0)) { @@ -455,14 +414,14 @@ public class CreateAddressDialog extends JDialog expirationDate.setText(dateFormat.format(d)); } } - + public void buttonPressed(int buttonId) { switch (buttonId) { case OK: IPAddress addr = address.getValue(); if (addr == null) { - // Bad IP address - MessageFormat form = new MessageFormat( + // Bad IP address + MessageFormat form = new MessageFormat( ResourceStrings.getString("invalid_address")); Object [] args = new Object[] { address.getText() }; JOptionPane.showMessageDialog(this, form.format(args), @@ -471,7 +430,7 @@ public class CreateAddressDialog extends JDialog return; } if (!network.containsAddress(addr)) { - // Address is not on the network we're editing + // Address is not on the network we're editing MessageFormat form = new MessageFormat( ResourceStrings.getString("bad_network_address")); Object [] args = new Object[] { @@ -484,23 +443,11 @@ public class CreateAddressDialog extends JDialog return; } try { - client.setClientIP(address.getValue()); + client.setClientIP(address.getValue()); } catch (ValidationException e) { - // This shouldn't happen, should have caught any problem already + // This shouldn't happen, should have caught any problem already } - // This logic is needed because if the original client name - // was equal to its IP address, then this really means that - // that the name was not set. If this is the case and the - // name field is empty, then no change was made. In all other - // cases we can be assured that the client name was changed - // or is valid. - // - if (!(name.getText().length() == 0 && - originalClient.getClientIPAddress().equals( - originalClient.getClientName()))) { - client.setClientName(name.getText()); - } try { if (!server.getText().equals(client.getServerName())) { // Don't bother resetting if it hasn't changed @@ -508,7 +455,7 @@ public class CreateAddressDialog extends JDialog } } catch (ValidationException e) { // Bad server name - MessageFormat form = new MessageFormat( + MessageFormat form = new MessageFormat( ResourceStrings.getString("invalid_server")); Object [] args = new Object[] { server.getText() }; JOptionPane.showMessageDialog(this, form.format(args), @@ -524,10 +471,10 @@ public class CreateAddressDialog extends JDialog } client.setComment(comment.getText()); try { - client.setClientId(clientId.getText()); + client.setClientId(clientId.getText()); } catch (ValidationException e) { - // Bad client ID - MessageFormat form = new MessageFormat( + // Bad client ID + MessageFormat form = new MessageFormat( ResourceStrings.getString("invalid_client_id")); Object [] args = new Object[] { clientId.getText() }; JOptionPane.showMessageDialog(this, form.format(args), @@ -547,8 +494,8 @@ public class CreateAddressDialog extends JDialog client.setExpiration(d); } } catch (ParseException e) { - // Bad date/time entered - MessageFormat form = new MessageFormat( + // Bad date/time entered + MessageFormat form = new MessageFormat( ResourceStrings.getString("invalid_date")); Object [] args = new Object[] { expirationDate.getText(), @@ -564,7 +511,7 @@ public class CreateAddressDialog extends JDialog DhcpNetMgr server = DataManager.get().getDhcpNetMgr(); if (mode == EDIT) { server.modifyClient(originalClient, client, - network.toString()); + network.toString()); } else { server.addClient(client, network.toString()); } @@ -623,15 +570,15 @@ public class CreateAddressDialog extends JDialog break; } } - + public void addActionListener(ActionListener l) { listeners.addElement(l); } - + public void removeActionListener(ActionListener l) { listeners.removeElement(l); } - + protected void fireActionPerformed() { String command = null; switch (mode) { diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DeleteAddressDialog.java b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DeleteAddressDialog.java index fff51a2071..e388cf9178 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DeleteAddressDialog.java +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DeleteAddressDialog.java @@ -20,8 +20,6 @@ * CDDL HEADER END */ /* - * ident "%Z%%M% %I% %E% SMI" - * * Copyright 1998-2002 by Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -44,10 +42,9 @@ import com.sun.dhcpmgr.bridge.BridgeException; */ public class DeleteAddressDialog extends MultipleOperationDialog { - private JCheckBox hostsBox; private DhcpClientRecord [] recs; private String table; - + // Model for the list of addresses to be deleted class AddressTableModel extends AbstractTableModel { public int getRowCount() { @@ -57,11 +54,11 @@ public class DeleteAddressDialog extends MultipleOperationDialog { return recs.length; } } - + public int getColumnCount() { return 2; } - + public Object getValueAt(int row, int column) { if (column == 0) { return recs[row].getClientIP(); @@ -75,7 +72,7 @@ public class DeleteAddressDialog extends MultipleOperationDialog { } } } - + public Class getColumnClass(int column) { if (column == 0) { return IPAddress.class; @@ -91,8 +88,8 @@ public class DeleteAddressDialog extends MultipleOperationDialog { return ResourceStrings.getString("client_name_column"); } } - } - + } + public DeleteAddressDialog(Frame f, DhcpClientRecord [] clients, String table) { // Create the dialog without a reset button @@ -100,7 +97,7 @@ public class DeleteAddressDialog extends MultipleOperationDialog { recs = clients; this.table = table; } - + public String getTitle() { return ResourceStrings.getString("delete_address_title"); } @@ -108,7 +105,7 @@ public class DeleteAddressDialog extends MultipleOperationDialog { protected JPanel getMainPanel() { JPanel mainPanel = new JPanel(new BorderLayout(10, 10)); mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - + // Place a message at the top of the display JLabel message = new JLabel( ResourceStrings.getString("delete_address_confirm")); @@ -118,7 +115,7 @@ public class DeleteAddressDialog extends MultipleOperationDialog { ResourceStrings.getString("delete_address_confirm")); mainPanel.add(message, BorderLayout.NORTH); - + // Now show the list of addresses to be deleted in a table in the middle JTable addressTable = new JTable(new AddressTableModel()); JScrollPane scrollPane = new JScrollPane(addressTable); @@ -128,27 +125,6 @@ public class DeleteAddressDialog extends MultipleOperationDialog { addressTable.setDefaultRenderer(IPAddress.class, new ExtendedCellRenderer()); mainPanel.add(scrollPane, BorderLayout.CENTER); - - // Allow user to specify if hosts records will be deleted, too - hostsBox = new JCheckBox( - ResourceStrings.getString("delete_hosts_checkbox"), true); - hostsBox.setToolTipText( - ResourceStrings.getString("delete_hosts_checkbox")); - - hostsBox.setHorizontalAlignment(SwingConstants.CENTER); - mainPanel.add(hostsBox, BorderLayout.SOUTH); - - hostsBox.setEnabled(true); - try { - DhcpdOptions opts = - DataManager.get().getDhcpServiceMgr().readDefaults(); - if (opts.getHostsResource() == null) { - hostsBox.setEnabled(false); - hostsBox.setSelected(false); - } - } catch (BridgeException e) { - // Assume set - } buttonPanel.setOkEnabled(true); return mainPanel; @@ -175,24 +151,16 @@ public class DeleteAddressDialog extends MultipleOperationDialog { return new Thread() { public void run() { DhcpNetMgr server = DataManager.get().getDhcpNetMgr(); - boolean deleteHosts = hostsBox.isSelected(); for (int i = 0; i < recs.length; ++i) { try { - server.deleteClient(recs[i], table, deleteHosts); + server.deleteClient(recs[i], table); updateProgress(i+1, recs[i].getClientIPAddress()); } catch (InterruptedException e) { // User asked us to stop closeDialog(); return; } catch (Throwable e) { - if (e.getMessage().equals("hosts")) { - // Failure was in deleting hosts entry - addError(recs[i].getClientIP(), - ResourceStrings.getString( - "hosts_entry_missing")); - } else { - addError(recs[i].getClientIP(), e.getMessage()); - } + addError(recs[i].getClientIP(), e.getMessage()); } } // Errors occurred, display them @@ -200,7 +168,7 @@ public class DeleteAddressDialog extends MultipleOperationDialog { displayErrors( ResourceStrings.getString("delete_address_error")); } - closeDialog(); + closeDialog(); } }; } @@ -208,7 +176,7 @@ public class DeleteAddressDialog extends MultipleOperationDialog { protected String getHelpKey() { return "delete_address"; } - + protected void fireActionPerformed() { fireActionPerformed(this, DialogActions.DELETE); } diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DeleteNetworksDialog.java b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DeleteNetworksDialog.java index 36db3c36a7..2b12f83b5f 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DeleteNetworksDialog.java +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DeleteNetworksDialog.java @@ -20,8 +20,6 @@ * CDDL HEADER END */ /* - * ident "%Z%%M% %I% %E% SMI" - * * Copyright 1998-2002 by Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -46,19 +44,19 @@ import com.sun.dhcpmgr.bridge.BridgeException; * A dialog to remove one or more networks from the DHCP configuration. */ public class DeleteNetworksDialog extends MultipleOperationDialog { - + class NetworkListModel extends AbstractListModel { private Vector networks; - + public NetworkListModel() { networks = new Vector(); } - + public void setNetworks(Network [] nets) { networks.removeAllElements(); addNetworks(nets); } - + public void addNetworks(Object [] nets) { if (nets != null) { for (int i = 0; i < nets.length; ++i) { @@ -67,28 +65,27 @@ public class DeleteNetworksDialog extends MultipleOperationDialog { } fireContentsChanged(this, 0, networks.size()-1); } - + public void deleteNetworks(Object [] nets) { for (int i = 0; i < nets.length; ++i) { networks.removeElement((Network)nets[i]); } fireContentsChanged(this, 0, networks.size()-1); } - + public Object getElementAt(int index) { return networks.elementAt(index); } - + public int getSize() { return networks.size(); - } + } } - + private JList keepNets, deleteNets; - private JCheckBox deleteHosts; private LeftButton leftButton; private RightButton rightButton; - + public DeleteNetworksDialog(Frame f) { // We want a reset button super(f, true); @@ -101,7 +98,7 @@ public class DeleteNetworksDialog extends MultipleOperationDialog { protected JPanel getMainPanel() { JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - + JPanel netBox = new JPanel(new ProportionalLayout()); JPanel panel = new JPanel(new BorderLayout(5, 5)); @@ -119,7 +116,7 @@ public class DeleteNetworksDialog extends MultipleOperationDialog { JScrollPane scrollPane = new JScrollPane(keepNets); panel.add(scrollPane, BorderLayout.CENTER); netBox.add("2", panel); - + panel = new JPanel(new VerticalButtonLayout()); leftButton = new LeftButton(); rightButton = new RightButton(); @@ -128,7 +125,7 @@ public class DeleteNetworksDialog extends MultipleOperationDialog { panel.add(rightButton); panel.add(leftButton); netBox.add("1", panel); - + panel = new JPanel(new BorderLayout(5, 5)); Mnemonic mnDel = @@ -147,29 +144,9 @@ public class DeleteNetworksDialog extends MultipleOperationDialog { scrollPane = new JScrollPane(deleteNets); panel.add(scrollPane, BorderLayout.CENTER); netBox.add("2", panel); - - mainPanel.add(netBox, BorderLayout.CENTER); - - deleteHosts = new JCheckBox( - ResourceStrings.getString("delete_networks_delete_hosts")); - deleteHosts.setToolTipText( - ResourceStrings.getString("delete_networks_delete_hosts")); - panel = new JPanel(); - panel.add(deleteHosts); - mainPanel.add(panel, BorderLayout.SOUTH); + mainPanel.add(netBox, BorderLayout.CENTER); - deleteHosts.setEnabled(true); - try { - DhcpdOptions opts = - DataManager.get().getDhcpServiceMgr().readDefaults(); - if (opts.getHostsResource() == null) { - deleteHosts.setEnabled(false); - } - } catch (BridgeException e) { - // Assume set - } - // Handle enable and disable of buttons based on selection state keepNets.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { @@ -179,7 +156,7 @@ public class DeleteNetworksDialog extends MultipleOperationDialog { } } }); - + deleteNets.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { leftButton.setEnabled(!deleteNets.isSelectionEmpty()); @@ -188,7 +165,7 @@ public class DeleteNetworksDialog extends MultipleOperationDialog { } } }); - + // Handle button presses rightButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -205,7 +182,7 @@ public class DeleteNetworksDialog extends MultipleOperationDialog { keepNets.clearSelection(); } }); - + leftButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Object [] nets = deleteNets.getSelectedValues(); @@ -226,11 +203,10 @@ public class DeleteNetworksDialog extends MultipleOperationDialog { return mainPanel; } - + protected void doReset() { try { buttonPanel.setOkEnabled(false); - deleteHosts.setSelected(false); ((NetworkListModel)deleteNets.getModel()).setNetworks(null); ((NetworkListModel)keepNets.getModel()).setNetworks( DataManager.get().getNetworks(false)); @@ -247,7 +223,7 @@ public class DeleteNetworksDialog extends MultipleOperationDialog { protected int getProgressLength() { return deleteNets.getModel().getSize(); } - + protected String getErrorHeading() { return ResourceStrings.getString("network_column"); } @@ -255,13 +231,13 @@ public class DeleteNetworksDialog extends MultipleOperationDialog { protected Thread getOperationThread() { return new Thread() { public void run() { - NetworkListModel model = + NetworkListModel model = (NetworkListModel)deleteNets.getModel(); for (int i = 0; i < model.getSize(); ++i) { Network net = (Network)model.getElementAt(i); try { DataManager.get().getDhcpNetMgr().deleteNetwork( - net.toString(), true, deleteHosts.isSelected()); + net.toString(), true); updateProgress(i+1, net.toString()); } catch (InterruptedException e) { // User asked us to stop @@ -273,7 +249,7 @@ public class DeleteNetworksDialog extends MultipleOperationDialog { } if (errorsOccurred()) { displayErrors( - ResourceStrings.getString("delete_networks_error")); + ResourceStrings.getString("delete_networks_error")); } closeDialog(); } @@ -283,7 +259,7 @@ public class DeleteNetworksDialog extends MultipleOperationDialog { protected String getHelpKey() { return "delete_network"; } - + protected void fireActionPerformed() { fireActionPerformed(this, DialogActions.OK); } diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ResourceBundle.properties b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ResourceBundle.properties index 2bf976ca67..c83f34a533 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ResourceBundle.properties +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ResourceBundle.properties @@ -247,7 +247,6 @@ invalid_date=The expiration date you entered, {0}, is not valid.\nDates must be address_tab_label=Address lease_tab_label=Lease ip_address_label=&IP Address: -hostname_label=C&lient Name: owning_server_label=O&wned by Server: config_macro_label=Configuration &Macro: client_id_label=C&lient ID: @@ -265,8 +264,6 @@ no_macro_item=(no macro assigned) # delete_address_title=Delete Address delete_address_confirm=OK to delete the following addresses? -delete_hosts_checkbox=Delete from hosts table -hosts_entry_missing=No entry was found in the server's hosts table, address was not deleted. delete_address_error=The following errors occurred while deleting addresses: delete_addr_progress=Deleting address: @@ -290,9 +287,6 @@ add_wiz_server_explain=Which DHCP server will manage these addresses? add_wiz_server_label=&Managed by Server: add_wiz_start_explain=What is the first IP number of the range of addresses you want to add? add_wiz_start_label=S&tarting IP Address: -add_wiz_generate_explain=Would you like this program to generate a list of client names for you? For example, if you specify the root name "sales", client names will be sales-1, sales-2, etc. -add_wiz_generate_label=Generate Client Names -add_wiz_rootname_label=&Root Name: add_wiz_invalid_address={0} is not a valid IP address. Please enter a correctly formatted IP address. add_wiz_confirm_desc=Confirm the IP address list. @@ -372,14 +366,6 @@ cfg_wiz_title=DHCP Configuration Wizard cfg_wiz_explain=This wizard will help you configure the system as a DHCP server. cfg_wiz_store_explain=Where would you like to store the DHCP configuration data? -cfg_wiz_host_explain=Which of the following nameservices should be used to store hosts records? -cfg_wiz_no_host_management=Do not manage hosts records -cfg_wiz_files=/etc/hosts -cfg_wiz_dns=DNS -cfg_wiz_hostdata_desc=Select hosts nameservice -cfg_wiz_domain=Domain: -cfg_wiz_invalid_host=Unable to manage defined hosts table - cfg_wiz_lease_explain=How long can clients use the IP addresses assigned by this server? cfg_wiz_lease_length=&Length of Lease: cfg_wiz_negotiable_explain=Check the box below to enable clients to renew their leases prior to expiration. If you uncheck it, clients will be forced to reboot to obtain a new address when the lease expires. @@ -537,7 +523,6 @@ delete_networks=Delete &Networks delete_networks_title=Delete Networks delete_networks_keep=&Keep Networks: delete_networks_delete=&Delete Networks: -delete_networks_delete_hosts=Delete hosts table entries delete_networks_error=The following networks were not deleted: network_column=Network delete_networks_progress=Deleting network: @@ -551,7 +536,6 @@ unconfigure_dhcp=Are you sure it is OK to unconfigure the DHCP service? If you unconfigure_bootp=Are you sure it is OK to unconfigure the BOOTP relay service? This may cause clients to be unable to access the network. unconfigure_shutdown=DHCP Manager will exit once the service has been unconfigured. unconfigure_delete_tables=Remove the dhcptab and all DHCP network tables -unconfigure_delete_hosts=Remove all hosts table entries for DHCP addresses unconfigure_progress=Unconfiguring the service unconfigure_error_heading=Operation diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/UnconfigureDialog.java b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/UnconfigureDialog.java index 09567d7fdd..45f5a98564 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/UnconfigureDialog.java +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/UnconfigureDialog.java @@ -20,8 +20,6 @@ * CDDL HEADER END */ /* - * ident "%Z%%M% %I% %E% SMI" - * * Copyright 1998-2002 by Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -47,7 +45,7 @@ import com.sun.dhcpmgr.ui.*; * A dialog to confirm the user's request to unconfigure the service. */ public class UnconfigureDialog extends MultipleOperationDialog { - private JCheckBox deleteTables, deleteHosts; + private JCheckBox deleteTables; private int networkCount = 0; private Network [] nets = new Network[0]; @@ -61,12 +59,12 @@ public class UnconfigureDialog extends MultipleOperationDialog { } protected JPanel getMainPanel() { - + JPanel mainPanel = new JPanel(); mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - + Box box = Box.createVerticalBox(); - + if (!DhcpmgrApplet.modeIsRelay) { JComponent c = Wizard.createTextArea( ResourceStrings.getString("unconfigure_dhcp"), 4, 30); @@ -76,41 +74,10 @@ public class UnconfigureDialog extends MultipleOperationDialog { deleteTables = new JCheckBox( ResourceStrings.getString("unconfigure_delete_tables"), false); deleteTables.setToolTipText( - ResourceStrings.getString("unconfigure_delete_tables")); + ResourceStrings.getString("unconfigure_delete_tables")); deleteTables.setAlignmentX(Component.LEFT_ALIGNMENT); box.add(deleteTables); box.add(Box.createVerticalStrut(10)); - deleteHosts = new JCheckBox( - ResourceStrings.getString("unconfigure_delete_hosts"), false); - deleteHosts.setToolTipText( - ResourceStrings.getString("unconfigure_delete_hosts")); - deleteHosts.setAlignmentX(Component.LEFT_ALIGNMENT); - deleteHosts.setEnabled(false); - box.add(deleteHosts); - deleteTables.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - if (!deleteTables.isSelected()) { - deleteHosts.setEnabled(false); - return; - } - - // If the host resource is set in the configuration - // file (or we can't tell), then enable the deleteHosts - // checkbox. - try { - DhcpServiceMgr serviceMgr = - DataManager.get().getDhcpServiceMgr(); - DhcpdOptions opts = serviceMgr.readDefaults(); - if (opts.getHostsResource() != null) { - deleteHosts.setEnabled(true); - } - } catch (BridgeException ex) { - // Assume set - deleteHosts.setEnabled(true); - } - } - }); } else { JComponent c = Wizard.createTextArea( ResourceStrings.getString("unconfigure_bootp"), 4, 30); @@ -126,7 +93,7 @@ public class UnconfigureDialog extends MultipleOperationDialog { buttonPanel.setOkEnabled(true); return mainPanel; } - + protected String getProgressMessage() { return ResourceStrings.getString("unconfigure_progress"); } @@ -138,12 +105,12 @@ public class UnconfigureDialog extends MultipleOperationDialog { // Add one for deleting defaults file, and one for deleting macro length += 2; if (deleteTables.isSelected()) { - try { + try { nets = DataManager.get().getNetworks(false); - } catch (Throwable t) { - // Ignore - } - length += nets.length + 1; // Add one for dhcptab + } catch (Throwable t) { + // Ignore + } + length += nets.length + 1; // Add one for dhcptab } } return length; @@ -156,7 +123,7 @@ public class UnconfigureDialog extends MultipleOperationDialog { protected Thread getOperationThread() { return new Thread() { public void run() { - int checkpoint = 0; + int checkpoint = 0; DhcpServiceMgr serviceMgr = DataManager.get().getDhcpServiceMgr(); // Shut down the server @@ -164,7 +131,7 @@ public class UnconfigureDialog extends MultipleOperationDialog { serviceMgr.shutdown(); } catch (Throwable e) { addError( - ResourceStrings.getString("unconfigure_error_shutdown"), + ResourceStrings.getString("unconfigure_error_shutdown"), e.getMessage()); } try { @@ -175,24 +142,24 @@ public class UnconfigureDialog extends MultipleOperationDialog { return; } - // If this was a relay we're done - if (!DhcpmgrApplet.modeIsRelay) { + // If this was a relay we're done + if (!DhcpmgrApplet.modeIsRelay) { // Remove the server macro try { - DataManager.get().getDhcptabMgr().deleteRecord( + DataManager.get().getDhcptabMgr().deleteRecord( new Macro(DataManager.get().getShortServerName()), false); } catch (Throwable e) { addError(ResourceStrings.getString( "unconfigure_error_macro"), - e.getMessage()); + e.getMessage()); } try { updateProgress(++checkpoint, ResourceStrings.getString( "unconfigure_macro_deleted")); } catch (InterruptedException e) { closeDialog(); - return; + return; } // Delete all the network tables and the dhcptab @@ -210,8 +177,7 @@ public class UnconfigureDialog extends MultipleOperationDialog { args[0] = netString; try { DataManager.get().getDhcpNetMgr(). - deleteNetwork(netString, true, - deleteHosts.isSelected()); + deleteNetwork(netString, true); } catch (Throwable e) { addError(errForm.format(args), e.getMessage()); @@ -219,19 +185,19 @@ public class UnconfigureDialog extends MultipleOperationDialog { try { updateProgress(++checkpoint, progForm.format(args)); - } catch (InterruptedException e) { + } catch (InterruptedException e) { closeDialog(); return; } } } - try { + try { DataManager.get().getDhcptabMgr().deleteDhcptab(); - } catch (Throwable e) { + } catch (Throwable e) { addError(ResourceStrings.getString( - "unconfigure_error_dhcptab"), + "unconfigure_error_dhcptab"), e.getMessage()); - } + } try { updateProgress(++checkpoint, ResourceStrings.getString( @@ -262,7 +228,7 @@ public class UnconfigureDialog extends MultipleOperationDialog { displayErrors(ResourceStrings.getString( "unconfigure_error_messages")); } - closeDialog(); + closeDialog(); } }; } @@ -274,7 +240,7 @@ public class UnconfigureDialog extends MultipleOperationDialog { return "unconfigure_server"; } } - + protected void fireActionPerformed() { fireActionPerformed(this, DialogActions.OK); } diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/common/ExportController.java b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/common/ExportController.java index c90bb3ddf8..a6edc3a52e 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/common/ExportController.java +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/common/ExportController.java @@ -20,8 +20,6 @@ * CDDL HEADER END */ /* - * ident "%Z%%M% %I% %E% SMI" - * * Copyright (c) 2001 by Sun Microsystems, Inc. * All rights reserved. */ @@ -195,7 +193,7 @@ public class ExportController { // Load network list setNetworks(server.getNetMgr().getNetworks()); } catch (Exception e) { - displayException(e, + displayException(e, ResourceStrings.getString("exp_err_loading_networks")); return false; } @@ -264,7 +262,7 @@ public class ExportController { ResourceStrings.getString("exp_exporting_options")); } try { - server.exportOptions(ref, allOptions, options); + server.exportOptions(ref, allOptions, options); } catch (BridgeException e) { displayException(e, ResourceStrings.getString("exp_err_exporting_options")); @@ -280,7 +278,7 @@ public class ExportController { // Now export the macros try { - server.exportMacros(ref, allMacros, macros); + server.exportMacros(ref, allMacros, macros); } catch (BridgeException e) { displayException(e, ResourceStrings.getString("exp_err_exporting_macros")); @@ -363,7 +361,7 @@ public class ExportController { nets[0] = networks[i].toString(); exporter.updateProgress(progress, form.format(nets)); try { - server.getNetMgr().deleteNetwork(nets[0], false, true); + server.getNetMgr().deleteNetwork(nets[0], false); } catch (BridgeException e) { errList.add(new ActionError(nets[0], e)); } @@ -410,7 +408,7 @@ public class ExportController { } finally { // Always close before leaving; display any resulting errors try { - server.closeExportFile(ref, deleteFile); + server.closeExportFile(ref, deleteFile); } catch (IOException e) { displayException(e, ResourceStrings.getString("exp_err_closing_file")); diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpHostsTable.java b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpHostsTable.java deleted file mode 100644 index babe1dd0a3..0000000000 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpHostsTable.java +++ /dev/null @@ -1,338 +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. - */ -package com.sun.dhcpmgr.server; - -import com.sun.dhcpmgr.bridge.*; -import com.sun.dhcpmgr.data.*; -import com.sun.wbem.utility.directorytable.*; - -import java.net.*; - -/** - * This class provides the capabilities for managing the hosts table. - */ -public class DhcpHostsTable { - - /** - * This is the handle to the host table as defined by the config file - * Access to this handle is synchronized. - */ - private static DhcpHostsTable cfgHostsTable = null; - - private DirectoryTable hostsTable; - private int addrColumn = 0; - private int cnameColumn = 0; - private int aliasesColumn = 0; - private int commentColumn = 0; - - /** - * Create a new DhcpHostsTable of type resource in the specified domain - * @param resource the host resource(eg., files, dns) - * @param domain the domain (if any) for the host resource - */ - public DhcpHostsTable(String resource, String domain) - throws BridgeException { - - // Determine the local host name. Directory table url requires it. - // - String server = null; - try { - server = InetAddress.getLocalHost().getHostName(); - } catch (Throwable e) { - throw new BridgeException( - ResourceStrings.getString("get_host_err")); - } - - // Build the url. - // - StringBuffer url = new StringBuffer(); - if (resource.equals(DhcpConfigOpts.DSVC_CV_FILES)) { - url.append("file"); - } else { - url.append(resource); - } - url.append(":/"); - url.append(server); - url.append("/"); - if (resource.equals(DhcpConfigOpts.DSVC_CV_FILES)) { - url.append(server); - } else { - url.append(domain); - } - try { - DirectoryTableFactory factory = new DirectoryTableFactory(); - hostsTable = factory.getDirectoryTableInstance(url.toString()); - - TableDefinitions defs = hostsTable.getTableDefinitionsInstance(); - defs.loadTableDefinitions(TableDefinitions.TN_HOSTS); - addrColumn = - defs.getColumnNumber(TableDefinitions.CN_HOSTS_ADDR); - cnameColumn = - defs.getColumnNumber(TableDefinitions.CN_HOSTS_CNAME); - aliasesColumn = - defs.getColumnNumber(TableDefinitions.CN_HOSTS_ALIASES); - commentColumn = - defs.getColumnNumber(TableDefinitions.CN_HOSTS_COMMENT); - } catch (Throwable e) { - throw new BridgeException( - ResourceStrings.getString("hosts_access_err")); - } - - } // end constructor - - /** - * Checks access on the host table. - * @param requestedAccess the desired access - * @return true if the desired access can be granted - */ - public synchronized boolean canAccessTable(int requestedAccess) - throws BridgeException { - - int access = DirectoryTable.NO_ACCESS; - - try { - access = hostsTable.access(TableDefinitions.TN_HOSTS); - } catch (Throwable e) { - // No access apparently - } - - return ((access & requestedAccess) == requestedAccess); - } // openTable - - /** - * Opens the host table. - */ - public synchronized void openTable() - throws BridgeException { - - try { - hostsTable.open(TableDefinitions.TN_HOSTS); - } catch (Throwable e) { - throw new BridgeException( - ResourceStrings.getString("hosts_open_err")); - } - - } // openTable - - /** - * Closes the host table. - */ - public synchronized void closeTable() - throws BridgeException { - - try { - hostsTable.close(); - } catch (Throwable e) { - throw new BridgeException( - ResourceStrings.getString("hosts_close_err")); - } - - } // closeTable - - - /** - * Finds a host entry by name and returns its address. - * @param name host name - * @return address of entry or null if entry does not exist. - */ - public synchronized String getHostAddress(String name) { - - String address = null; - try { - DirectoryRow record = hostsTable.getRowInstance(); - record.putColumn(addrColumn, ""); - record.putColumn(cnameColumn, name); - record.putColumn(aliasesColumn, ""); - record.putColumn(commentColumn, ""); - - record = hostsTable.getFirstRow(record); - - address = record.getColumn(addrColumn); - - } catch (Throwable e) { - // Nothing to do - } - - return address; - } - - /** - * Finds a host entry by address and returns its name. - * @param address host address - * @return name of entry or null if entry does not exist. - */ - public synchronized String getHostName(String address) { - - String name = null; - try { - DirectoryRow record = hostsTable.getRowInstance(); - record.putColumn(addrColumn, address); - record.putColumn(cnameColumn, ""); - record.putColumn(aliasesColumn, ""); - record.putColumn(commentColumn, ""); - - record = hostsTable.getFirstRow(record); - - name = record.getColumn(cnameColumn); - - } catch (Throwable e) { - // Nothing to do - } - - return name; - } - - /** - * Add an entry to the hosts table. - * @param addr host address - * @param name host name - * @param comment comment for host entry - */ - public synchronized void createHostsRecord(String addr, String name, - String comment) throws BridgeException { - - if (getHostName(addr) != null) { - throw new HostExistsException(addr); - } - - if (getHostAddress(name) != null) { - throw new HostExistsException(name); - } - - try { - DirectoryRow record = hostsTable.getRowInstance(); - - record.putColumn(addrColumn, addr); - record.putColumn(cnameColumn, name); - record.putColumn(aliasesColumn, ""); - record.putColumn(commentColumn, comment); - - hostsTable.addRow(record); - } catch (Throwable e) { - throw new BridgeException( - ResourceStrings.getString("hosts_add_err")); - } - - } // createHostsRecord - - /** - * Remove an entry from the hosts table - * @param addr host address of entry to remove - */ - public synchronized void deleteHostsRecord(String addr) - throws BridgeException { - - try { - DirectoryRow record = hostsTable.getRowInstance(); - record.putColumn(addrColumn, addr); - hostsTable.deleteRow(record); - } catch (DirectoryTableRowNotFoundException e) { - throw new NoHostsEntryException(addr); - } catch (Throwable e) { - throw new BridgeException( - ResourceStrings.getString("hosts_remove_err")); - } - - } // deleteHostsRecord - - /** - * Modify an entry on the hosts table. - * @param oldAddr host address of entry to modify - * @param newAddr new host address for entry - * @param name new host name - * @param comment new comment for host entry - */ - public synchronized void modifyHostsRecord(String oldAddr, String newAddr, - String name, String comment) throws BridgeException { - - if (getHostAddress(name) != null) { - throw new HostExistsException(name); - } - - try { - DirectoryRow oldRecord = hostsTable.getRowInstance(); - oldRecord.putColumn(addrColumn, oldAddr); - - DirectoryRow newRecord = hostsTable.getRowInstance(); - newRecord.putColumn(addrColumn, newAddr); - newRecord.putColumn(cnameColumn, name); - newRecord.putColumn(aliasesColumn, ""); - newRecord.putColumn(commentColumn, comment); - - hostsTable.modifyRow(oldRecord, newRecord); - } catch (DirectoryTableRowNotFoundException e) { - throw new NoHostsEntryException(oldAddr); - } catch (Throwable e) { - throw new BridgeException( - ResourceStrings.getString("hosts_modify_err")); - } - } // modifyHostsRecord - - /** - * Determines the whether or not the hosts table under a given - * name service can be managed. - * @param resource name service resource (files, dns) - * @param domain the name service domain (ignored for files) - * @return true if the user can manage the table - */ - public static boolean isHostsValid(String resource, String domain) { - - boolean result = false; - try { - DhcpHostsTable hostsTable = new DhcpHostsTable(resource, domain); - result = hostsTable.canAccessTable(DirectoryTable.MODIFY_ACCESS); - } catch (Throwable e) { - // No access apparently - } - return (result); - } // isHostsManageable - - /** - * Constructs a DhcpHostsTable as defined by the DHCP config file. - * This object is a singleton (only one will ever be created and will - * be cached). - * @param bridge the bridge object to the native library - * @return the DhcpHostsTable - */ - public static synchronized DhcpHostsTable getCfgHostsTable(Bridge bridge) - throws BridgeException { - - if (cfgHostsTable == null) { - try { - DhcpdOptions options = bridge.readDefaults(); - String resource = options.getHostsResource(); - if (resource != null) { - String domain = options.getHostsDomain(); - cfgHostsTable = new DhcpHostsTable(resource, domain); - } - } catch (Throwable e) { - throw new BridgeException(e.getMessage()); - } - } - return cfgHostsTable; - - } // getCfgHostsTable - -} // DhcpHostsTable diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpMgrImpl.java b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpMgrImpl.java index 9e7cdfeed5..cde7ba9a63 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpMgrImpl.java +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpMgrImpl.java @@ -20,8 +20,6 @@ * CDDL HEADER END */ /* - * ident "%Z%%M% %I% %E% SMI" - * * Copyright (c) 1998-2001 by Sun Microsystems, Inc. * All rights reserved. */ @@ -44,25 +42,25 @@ public class DhcpMgrImpl implements DhcpMgr { private static final File lockFile = new File(LOCK_FILE); private File currentlyOpenFile = null; private Object currentStream = null; - + public DhcpMgrImpl() { bridge = new Bridge(); } - + public DhcpNetMgr getNetMgr() { if (netMgr == null) { netMgr = new DhcpNetMgrImpl(bridge); } return netMgr; } - + public DhcptabMgr getDhcptabMgr() { if (dtMgr == null) { dtMgr = new DhcptabMgrImpl(bridge); } return dtMgr; } - + public DhcpServiceMgr getDhcpServiceMgr() { if (srvMgr == null) { srvMgr = new DhcpServiceMgrImpl(bridge); @@ -166,7 +164,7 @@ public class DhcpMgrImpl implements DhcpMgr { } // openExportFile /** - * Close an export file, delete it if need be + * Close an export file, delete it if need be * @param ref Reference to the open file, returned from openExportFile * @param delete true if file is to be deleted on close, false otherwise. */ @@ -218,9 +216,9 @@ public class DhcpMgrImpl implements DhcpMgr { // Return reference caller can use to actually do the import return file; } - + /** - * Close an import file, delete it if need be + * Close an import file, delete it if need be * @param ref Reference to the open file, returned from openImportFile * @param delete true if file is to be deleted on close, false otherwise. */ @@ -276,23 +274,23 @@ public class DhcpMgrImpl implements DhcpMgr { } return recArr; } - + /** * Export a list of macros specified by name to a file. * @param ref A reference to the file, acquired from openExportFile() * @param allMacros true if all macros are to be exported * @param names names of macros to be exported if allMacros is false */ - public void exportMacros(Object ref, boolean allMacros, String [] names) - throws BridgeException, IOException { + public void exportMacros(Object ref, boolean allMacros, String [] names) + throws BridgeException, IOException { if (!isFileOpen((File)ref)) { - // throw an exception that this is a bad reference + // throw an exception that this is a bad reference throw new FileNotFoundException(((File)ref).getName()); } - + Macro [] macros = getDhcptabMgr().getMacros(); if (!allMacros) { - // Grab only the ones we want + // Grab only the ones we want ArrayList macArr = getSelectedRecs(names, macros); macros = (Macro [])macArr.toArray(new Macro[0]); } @@ -313,7 +311,7 @@ public class DhcpMgrImpl implements DhcpMgr { // throw an exception that this is a bad reference throw new FileNotFoundException(((File)ref).getName()); } - + Option [] options = getDhcptabMgr().getOptions(); if (!allOptions) { // Grab only the ones we want @@ -333,10 +331,10 @@ public class DhcpMgrImpl implements DhcpMgr { public void exportNetwork(Object ref, Network net) throws BridgeException, IOException { if (!isFileOpen((File)ref)) { - // throw an exception that this is a bad reference + // throw an exception that this is a bad reference throw new FileNotFoundException(((File)ref).getName()); } - + // Get clients from database DhcpClientRecord [] clients = getNetMgr().loadNetworkCompletely(net.toString()); @@ -362,7 +360,7 @@ public class DhcpMgrImpl implements DhcpMgr { DhcptabRecord [] recs = new DhcptabRecord[0]; if (!isFileOpen((File)ref)) { - // No such file open; throw an exception + // No such file open; throw an exception throw new FileNotFoundException(((File)ref).getName()); } ObjectInputStream ois = (ObjectInputStream)currentStream; @@ -415,7 +413,7 @@ public class DhcpMgrImpl implements DhcpMgr { * @return An array of errors in the import process; empty if all OK */ public ActionError [] importOptions(Object ref, boolean overwrite) - throws IOException, OptionalDataException, ClassNotFoundException { + throws IOException, OptionalDataException, ClassNotFoundException { return importDhcptabRecs(DhcptabRecord.OPTION, ref, overwrite); } @@ -426,7 +424,7 @@ public class DhcpMgrImpl implements DhcpMgr { * @return An array of errors in the import process; empty if all OK */ public ActionError [] importMacros(Object ref, boolean overwrite) - throws IOException, OptionalDataException, ClassNotFoundException { + throws IOException, OptionalDataException, ClassNotFoundException { return importDhcptabRecs(DhcptabRecord.MACRO, ref, overwrite); } @@ -441,10 +439,10 @@ public class DhcpMgrImpl implements DhcpMgr { */ public ActionError [] importNetwork(Network net, Object ref, boolean overwrite) throws IOException, OptionalDataException, - ClassNotFoundException, BridgeException { + ClassNotFoundException, BridgeException { if (!isFileOpen((File)ref)) { - // No such file open; throw an exception + // No such file open; throw an exception throw new FileNotFoundException(((File)ref).getName()); } @@ -478,7 +476,7 @@ public class DhcpMgrImpl implements DhcpMgr { if (overwrite && netExisted) { try { /* - * Hack alert! We reset the signature to a default value + * Hack alert! We reset the signature to a default value * that the datastores will not interpret. This allows us * to forcibly delete the record, even if it came from a * previous attempt to import this record. Without this @@ -491,7 +489,7 @@ public class DhcpMgrImpl implements DhcpMgr { * in the mix which uses serialization, such as RMI. */ clients[i].setSignature(DhcpClientRecord.DEFAULT_SIGNATURE); - mgr.deleteClient(clients[i], networkName, true); + mgr.deleteClient(clients[i], networkName); } catch (Throwable t) { // Ignore delete error, we'll probably have an error on add } diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpNetMgr.java b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpNetMgr.java index 645a128194..58efbcf3bf 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpNetMgr.java +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpNetMgr.java @@ -20,8 +20,6 @@ * CDDL HEADER END */ /* - * ident "%Z%%M% %I% %E% SMI" - * * Copyright (c) 1998-2001 by Sun Microsystems, Inc. * All rights reserved. */ @@ -58,10 +56,10 @@ public interface DhcpNetMgr { public void addClient(DhcpClientRecord client, String table) throws BridgeException; public void deleteClient(DhcpClientRecord client, String table, - boolean deleteHosts, DhcpDatastore datastore) + DhcpDatastore datastore) throws BridgeException; - public void deleteClient(DhcpClientRecord client, String table, - boolean deleteHosts) throws BridgeException; + public void deleteClient(DhcpClientRecord client, String table) + throws BridgeException; public DhcpClientRecord getClient(DhcpClientRecord client, String table, DhcpDatastore datastore) throws BridgeException; public void cvtNetwork(String network, @@ -71,8 +69,8 @@ public interface DhcpNetMgr { public void createNetwork(String network) throws BridgeException; public void deleteNetwork(String network, boolean deleteMacro, - boolean deleteHosts, DhcpDatastore datastore) + DhcpDatastore datastore) throws BridgeException; - public void deleteNetwork(String network, boolean deleteMacro, - boolean deleteHosts) throws BridgeException; + public void deleteNetwork(String network, boolean deleteMacro) + throws BridgeException; } diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpNetMgrImpl.java b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpNetMgrImpl.java index 4a74ed4dae..86653f56da 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpNetMgrImpl.java +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpNetMgrImpl.java @@ -20,8 +20,6 @@ * CDDL HEADER END */ /* - * ident "%Z%%M% %I% %E% SMI" - * * Copyright (c) 1998-2001 by Sun Microsystems, Inc. * All rights reserved. */ @@ -30,8 +28,6 @@ package com.sun.dhcpmgr.server; import com.sun.dhcpmgr.bridge.*; import com.sun.dhcpmgr.data.*; -import com.sun.wbem.utility.directorytable.*; - import java.net.InetAddress; import java.net.UnknownHostException; @@ -45,7 +41,7 @@ public class DhcpNetMgrImpl implements DhcpNetMgr { public DhcpNetMgrImpl(Bridge bridge) { this.bridge = bridge; } - + /** * Return the Network corresponding to the network string * @return a Network @@ -68,7 +64,7 @@ public class DhcpNetMgrImpl implements DhcpNetMgr { throws BridgeException { return bridge.getNetworks(datastore); } - + /** * Return the list of addresses managed by DHCP on a given network * @param network the dotted-decimal representation of the network address @@ -78,7 +74,7 @@ public class DhcpNetMgrImpl implements DhcpNetMgr { throws BridgeException { return loadNetwork(network, null); } - + /** * Return the list of addresses managed by DHCP on a given network * @param network the dotted-decimal representation of the network address @@ -96,8 +92,8 @@ public class DhcpNetMgrImpl implements DhcpNetMgr { * @param network the dotted-decimal representation of the network address * @return an array of records for the addresses defined on that network */ - public DhcpClientRecord [] loadNetworkCompletely(String network) - throws BridgeException { + public DhcpClientRecord [] loadNetworkCompletely(String network) + throws BridgeException { DhcpClientRecord [] clients = loadNetwork(network); // Force loading of client name for each client for (int i = 0; i < clients.length; ++i) { @@ -105,7 +101,7 @@ public class DhcpNetMgrImpl implements DhcpNetMgr { } return clients; } - + /** * Modify an existing client record, and update the associated hosts * record if needed. @@ -131,54 +127,11 @@ public class DhcpNetMgrImpl implements DhcpNetMgr { DhcpClientRecord newClient, String table, DhcpDatastore datastore) throws BridgeException { - boolean nameChanged = !oldClient.getClientName().equals( - newClient.getClientName()); - boolean commentChanged = !oldClient.getComment().equals( - newClient.getComment()); - /* - * If the name changed, need to update hosts. If comment changed, - * hosts is only updated if there was already a hosts record. - */ - if (nameChanged) { - /* - * If new name is empty, delete the hosts entry. Otherwise - * try to modify it. - */ - if (newClient.getClientName().length() == 0) { - try { - deleteHostsRecord(newClient.getClientIPAddress()); - } catch (Throwable e) { - throw new NoHostsEntryException( - newClient.getClientIPAddress()); - } - } else { - try { - modifyHostsRecord(oldClient.getClientIPAddress(), - newClient.getClientIPAddress(), - newClient.getClientName(), newClient.getComment()); - } catch (NoHostsEntryException e) { - // Must not be one, so create it instead - createHostsRecord(newClient.getClientIPAddress(), - newClient.getClientName(), newClient.getComment()); - } - } - } else if (commentChanged) { - // Try to modify, but toss all exceptions as this isn't a big deal - try { - modifyHostsRecord(oldClient.getClientIPAddress(), - newClient.getClientIPAddress(), newClient.getClientName(), - newClient.getComment()); - } catch (Throwable e) { - // Ignore - } - } - // Update the network table record bridge.modifyDhcpClientRecord(oldClient, newClient, table, datastore); - } - + /** * Create a new record in the given table, and create a hosts record. * @param client the client to create @@ -199,32 +152,21 @@ public class DhcpNetMgrImpl implements DhcpNetMgr { public void addClient(DhcpClientRecord client, String table, DhcpDatastore datastore) throws BridgeException { - /* - * If a name was supplied and we can't resolve it to this address, - * create a hosts record. - */ - if (client.getClientName().length() != 0 - && !client.getClientName().equals(client.getClientIPAddress())) { - createHostsRecord(client.getClientIPAddress(), - client.getClientName(), client.getComment()); - } - // Create the record in the per-network table bridge.createDhcpClientRecord(client, table, datastore); } - + /** * Delete a record from the given table, and delete the associated hosts * record if requested. * @param client the client to delete * @param table the network to delete the client from - * @param deleteHosts true if the hosts record should be removed as well */ - public void deleteClient(DhcpClientRecord client, String table, - boolean deleteHosts) throws BridgeException { + public void deleteClient(DhcpClientRecord client, String table) + throws BridgeException { - deleteClient(client, table, deleteHosts, null); + deleteClient(client, table, null); } /** @@ -232,26 +174,16 @@ public class DhcpNetMgrImpl implements DhcpNetMgr { * record if requested. * @param client the client to delete * @param table the network to delete the client from - * @param deleteHosts true if the hosts record should be removed as well * @param datastore user-supplied datastore attributes */ public void deleteClient(DhcpClientRecord client, String table, - boolean deleteHosts, DhcpDatastore datastore) + DhcpDatastore datastore) throws BridgeException { // Delete the client record from the per-network table bridge.deleteDhcpClientRecord(client, table, datastore); - - // Delete hosts if requested - if (deleteHosts) { - try { - deleteHostsRecord(client.getClientIPAddress()); - } catch (NoEntryException e) { - throw new NoEntryException("hosts"); - } - } } - + /** * Retrieve a client record from the given table. @@ -268,7 +200,7 @@ public class DhcpNetMgrImpl implements DhcpNetMgr { return clientRecord; } - + /** * Create a new per-network table for the given network by converting the * one from the server's data store into a new data store. @@ -279,7 +211,7 @@ public class DhcpNetMgrImpl implements DhcpNetMgr { DhcpDatastore datastore) throws BridgeException { bridge.cvtNetwork(network, datastore); } - + /** * Create a new per-network table for the given network. * @param network the network number in dotted-decimal form. @@ -299,17 +231,16 @@ public class DhcpNetMgrImpl implements DhcpNetMgr { DhcpDatastore datastore) throws BridgeException { bridge.createDhcpNetwork(network, datastore); } - + /** * Delete a per-network table, the macro associated with the network number, * and optionally deleting the associated hosts records. * @param network the network number in dotted-decimal form. * @param deleteMacro true if the network macro should be deleted - * @param deleteHosts true if the associated hosts records should be deleted */ - public void deleteNetwork(String network, boolean deleteMacro, - boolean deleteHosts) throws BridgeException { - deleteNetwork(network, deleteMacro, deleteHosts, null); + public void deleteNetwork(String network, boolean deleteMacro) + throws BridgeException { + deleteNetwork(network, deleteMacro, null); } /** @@ -317,108 +248,21 @@ public class DhcpNetMgrImpl implements DhcpNetMgr { * and optionally deleting the associated hosts records. * @param network the network number in dotted-decimal form. * @param deleteMacro true if the network macro should be deleted - * @param deleteHosts true if the associated hosts records should be deleted * @param datastore user-supplied datastore attributes */ public void deleteNetwork(String network, boolean deleteMacro, - boolean deleteHosts, DhcpDatastore datastore) + DhcpDatastore datastore) throws BridgeException { - // If we're supposed to clean up hosts, do so - if (deleteHosts) { - DhcpClientRecord [] recs = - bridge.loadNetwork(network, datastore); - if (recs != null) { - for (int i = 0; i < recs.length; ++i) { - try { - deleteHostsRecord(recs[i].getClientIPAddress()); - } catch (Throwable e) { - // Ignore errors here; they're not important - } - } - } - } - // Delete network table, then the macro for the network bridge.deleteDhcpNetwork(network, datastore); try { if (deleteMacro) { - bridge.deleteDhcptabRecord(new Macro(network), + bridge.deleteDhcptabRecord(new Macro(network), datastore); } } catch (Throwable e) { // All the errors here are ignorable } } - - /** - * Add a record to the hosts table. - * @param addr address of entry to add to the hosts table - * @param name alias for the entry - * @param comment comment for the entry - */ - private void createHostsRecord(String addr, String name, - String comment) throws BridgeException { - - DhcpHostsTable hostsTable = null; - try { - hostsTable = DhcpHostsTable.getCfgHostsTable(bridge); - if (hostsTable != null) { - hostsTable.openTable(); - hostsTable.createHostsRecord(addr, name, comment); - } - } finally { - if (hostsTable != null) { - hostsTable.closeTable(); - } - } - - } // createHostsRecord - - /** - * Delete a record from the hosts table. - * @param addr address of entry to remove from the hosts table - */ - private void deleteHostsRecord(String addr) - throws BridgeException { - - DhcpHostsTable hostsTable = null; - try { - hostsTable = DhcpHostsTable.getCfgHostsTable(bridge); - if (hostsTable != null) { - hostsTable.openTable(); - hostsTable.deleteHostsRecord(addr); - } - } finally { - if (hostsTable != null) { - hostsTable.closeTable(); - } - } - - } // deleteHostsRecord - - /** - * Modify a record in the hosts table. - * @param oldAddr address of entry to modify in the hosts table - * @param newAddr new address of entry - * @param name alias for the entry - * @param comment comment for the entry - */ - private void modifyHostsRecord(String oldAddr, - String newAddr, String name, String comment) throws BridgeException { - - DhcpHostsTable hostsTable = null; - try { - hostsTable = DhcpHostsTable.getCfgHostsTable(bridge); - if (hostsTable != null) { - hostsTable.openTable(); - hostsTable.modifyHostsRecord(oldAddr, newAddr, name, comment); - } - } finally { - if (hostsTable != null) { - hostsTable.closeTable(); - } - } - - } // modifyHostsRecord } diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpServiceMgr.java b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpServiceMgr.java index 58affe47c7..38aad9f083 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpServiceMgr.java +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpServiceMgr.java @@ -20,8 +20,6 @@ * CDDL HEADER END */ /* - * ident "%Z%%M% %I% %E% SMI" - * * Copyright (c) 1998-2001 by Sun Microsystems, Inc. * All rights reserved. */ @@ -64,6 +62,4 @@ public interface DhcpServiceMgr { throws BridgeException; public boolean isServerRunning() throws BridgeException; public boolean isVersionCurrent() throws BridgeException; - public boolean isHostsValid(String resource, String domain) - throws BridgeException; } diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpServiceMgrImpl.java b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpServiceMgrImpl.java index 1b4ed406a2..48ba400e6c 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpServiceMgrImpl.java +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpServiceMgrImpl.java @@ -236,17 +236,4 @@ public class DhcpServiceMgrImpl implements DhcpServiceMgr { public boolean isServerRunning() throws BridgeException { return bridge.isServerRunning(); } - - /** - * Determines the whether or not the hosts table under a given - * name service can be managed. - * @param resource name service resource (files, dns) - * @param domain the name service domain (ignored for files) - * @return true if the user can manage the table - */ - public boolean isHostsValid(String resource, String domain) { - - return DhcpHostsTable.isHostsValid(resource, domain); - - } // isHostsManageable } diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/Makefile b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/Makefile index 17ff6e3fe2..76ae00d480 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/Makefile +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/Makefile @@ -19,8 +19,7 @@ # # CDDL HEADER END # -# -#ident "%Z%%M% %I% %E% SMI" + # # Copyright 1999-2002 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. @@ -33,15 +32,12 @@ CLASSFILES = DhcpMgrImpl.class \ DhcpNetMgrImpl.class \ DhcpServiceMgrImpl.class \ - DhcptabMgrImpl.class \ - DhcpHostsTable.class \ - ResourceStrings.class + DhcptabMgrImpl.class include $(SRC)/lib/Makefile.lib -DIRTABLE_JAR = /usr/sadm/lib/wbem/providerutility.jar -CLASSPATH= $(SRC)/cmd/cmd-inet/usr.sadm/dhcpmgr:$(DIRTABLE_JAR) +CLASSPATH= $(SRC)/cmd/cmd-inet/usr.sadm/dhcpmgr JAVAFILES = $(CLASSFILES:.class=.java) @@ -52,8 +48,6 @@ MSGDIRS = $(ROOT)/usr/share/lib/locale \ $(ROOT)/usr/share/lib/locale/com/sun/dhcpmgr \ $(MSGDIR) -MSGFILES = ResourceBundle.properties -MSGS = $(MSGFILES:%=$(MSGDIR)/%) CLEANFILES= *.class CLOBBERFILES= @@ -64,12 +58,6 @@ all: $(CLASSFILES) install: all -_msg: $(MSGDIRS) $(MSGS) - -$(MSGDIR)/%: % - $(INS.file) - -$(MSGDIRS): - $(INS.dir) +_msg: include $(SRC)/lib/Makefile.targ diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/ResourceBundle.properties b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/ResourceBundle.properties deleted file mode 100644 index 31154d9a5b..0000000000 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/ResourceBundle.properties +++ /dev/null @@ -1,34 +0,0 @@ -# -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# 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 -# - -get_host_err=Internal error, obtaining local host name -hosts_access_err=Error accessing host table -hosts_open_err=Error opening host table -hosts_close_err=Error closing host table -hosts_add_err=Error adding entry to hosts table -hosts_remove_err=Error removing entry from hosts table -hosts_modify_err=Error modifying hosts table table entry diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/help/dhcp_addr_del.html b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/help/dhcp_addr_del.html index 0310e91024..4d20213f11 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/help/dhcp_addr_del.html +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/help/dhcp_addr_del.html @@ -1,5 +1,4 @@ @@ -116,8 +115,6 @@ from the selected DHCP network.

Click OK to remove the selected addresses from the network table.

-Click Delete From Hosts Table to also remove the entries associated -with these addresses from the hosts table.

 

diff --git a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/help/dhcp_addr_mod.html b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/help/dhcp_addr_mod.html index 41397a6360..3a18484c7c 100644 --- a/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/help/dhcp_addr_mod.html +++ b/usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/help/dhcp_addr_mod.html @@ -1,5 +1,4 @@ -Data store path
- -If you chose text files or binary files as your data store, enter the path to the - data (default=/var/dhcp).

-

- - - - Hosts name service
- - Select the name service that the DHCP server should use to register host names associated with IP addresses that it allocates to clients. - - - - - - - - - - - - - -
Do not manage hosts recordsThe DHCP server will not attempt to add host name entries to any name service. An administrator should add the names manually to a name service.
/etc/hostsThe DHCP server will add host name entries to the servers /etc/hosts table.
DNSThe DHCP server will add host name entries to DNS if the DHCP daemon and DNS daemon are running on the same system. You must supply the DNS domain name.
- - - - - Lease Policy
Enter the length of time before a lease expires. diff --git a/usr/src/cmd/wbem/Makefile b/usr/src/cmd/wbem/Makefile deleted file mode 100644 index c09abf80b0..0000000000 --- a/usr/src/cmd/wbem/Makefile +++ /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-2003 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -# include global definitions -include ./Makefile.wbem - -SUBDIRS= provider - -all:= TARGET= all -install:= TARGET= install -clean:= TARGET= clean -clobber:= TARGET= clobber -check:= TARGET= check -lint:= TARGET= lint -_msg:= TARGET= _msg - -.KEEP_STATE: - -all install clean clobber check lint _msg: $(SUBDIRS) - -$(SUBDIRS): FRC - cd $@; pwd; $(MAKE) $(TARGET) - -FRC: diff --git a/usr/src/cmd/wbem/Makefile.cmd b/usr/src/cmd/wbem/Makefile.cmd deleted file mode 100644 index 94f0484a9e..0000000000 --- a/usr/src/cmd/wbem/Makefile.cmd +++ /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 (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. -# -# cmd/wbem/Makefile.cmd -# -# Definitions common to command source for wbem provider helper commands. -# -# include global definitions; SRC should be defined in the shell. -# SRC is needed until RFE 1026993 is implemented. - - -include $(SRC)/cmd/wbem/Makefile.com - -ROOTWBEM32= $(ROOTWBEM)/$(MACH32) -ROOTWBEM64= $(ROOTWBEM)/$(MACH64) - -ROOTWBEMPROG32= $(PROG:%=$(ROOTWBEM32)/%) -ROOTWBEMPROG64= $(PROG:%=$(ROOTWBEM64)/%) - -WBEMTOOLDIRS= $(ROOTWBEM32) -WBEMTOOLDIRS += $(BUILD64)$(ROOTWBEM64) - -$(ROOTWBEM32) $(ROOTWBEM64): $(ROOTWBEMDIRS) - $(INS.dir) - -DIRMODE= 755 -FILEMODE= 755 - -$(ROOTWBEM32)/%: % - $(INS.file) - -$(ROOTWBEM64)/%: % - $(INS.file) diff --git a/usr/src/cmd/wbem/Makefile.com b/usr/src/cmd/wbem/Makefile.com deleted file mode 100644 index dbd973d926..0000000000 --- a/usr/src/cmd/wbem/Makefile.com +++ /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 (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. -# -# cmd/wbem/Makefile.com -# -# Definitions common to both helper commands and providers. -# - -include $(SRC)/cmd/Makefile.cmd - -ROOTSADM= $(ROOT)/usr/sadm -ROOTMOF= $(ROOTSADM)/mof -ROOTSADMLIB= $(ROOTSADM)/lib -ROOTWBEM= $(ROOTSADMLIB)/wbem -ROOTWBEMINC= /usr/sadm/lib/wbem/include -ROOTUSRMENU= $(ROOT)/usr/lib/locale/C - -ROOTWBEMPROG= $(PROG:%=$(ROOTWBEM)/%) -ROOTMOFPROG= $(PROG:%=$(ROOTMOF)/%) - -ROOTWBEMDIRS= $(ROOTSADM) $(ROOTSADMLIB) $(ROOTWBEM) $(ROOTMOF) - -DIRMODE= 755 -FILEMODE= 755 - -$(ROOTMOFPROG) := FILEMODE= 644 - -$(ROOTWBEMDIRS): - $(INS.dir) - -$(ROOTWBEM)/%: % - $(INS.file) - -$(ROOTMOF)/%: % - $(INS.file) diff --git a/usr/src/cmd/wbem/Makefile.wbem b/usr/src/cmd/wbem/Makefile.wbem deleted file mode 100644 index a4ece8d68f..0000000000 --- a/usr/src/cmd/wbem/Makefile.wbem +++ /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, 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" -# -# cmd/wbem/Makefile.wbem -# -# Definitions common to provider implementations. -# The WBEM Services runtime and SDK are assumed to be installed. -# -# Copyright (c) 2001 by Sun Microsystems, Inc. -# All rights reserved. -# - -include $(SRC)/cmd/wbem/Makefile.com - -PLATFORM = solaris -TARG_SYS= $(MACH) - -# for classpath: root of the com.sun.wbem hieararchy in the source tree -PROVIDERSRC= $(SRC)/cmd/wbem/provider - -# for classpath: where the /usr/sadm/lib directory should be read from -USRSADMLIB= /usr/sadm/lib - -# for classpath: where the /usr/sadm/lib/wbem directory should be read from -USRSADMLIBWBEM= $(USRSADMLIB)/wbem - -CLASSPATH = .:$(PROVIDERSRC):$(USRSADMLIBWBEM)/cimapi.jar:$(USRSADMLIBWBEM)/solarisprovider.jar:$(USRSADMLIB)/wbem.jar:$(USRSADMLIBWBEM)/providerutility.jar:$(USRSADMLIB)/xml.jar - -INCLUDE = $(JAVA_HOME)/include -LIB = $(JAVA_HOME)/lib - -# tell jstyle to ignore contents of block comments -JSTYLE_TAIL = -C diff --git a/usr/src/cmd/wbem/provider/Makefile b/usr/src/cmd/wbem/provider/Makefile deleted file mode 100644 index c6866ad817..0000000000 --- a/usr/src/cmd/wbem/provider/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 2001-2003 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# -# cmd/wbem/provider/Makefile -# - -# include global definitions -include $(SRC)/cmd/wbem/Makefile.wbem - -SUBDIRS= com tools c -POSUBDIRS= c - -# make only these for 'check' -CHECK_SUBDIRS= com c - -# make only these for 'lint' -LINT_SUBDIRS= tools c - -all:= TARGET= all -install:= TARGET= install -clean:= TARGET= clean -clobber:= TARGET= clobber -check:= TARGET= check -lint:= TARGET= lint -_msg:= TARGET= _msg - -.KEEP_STATE: - -all install clean clobber: $(SUBDIRS) - -_msg: $(POSUBDIRS) - -lint: $(LINT_SUBDIRS) - -check: $(CHECK_SUBDIRS) - -$(SUBDIRS) : FRC - cd $@; pwd; $(MAKE) $(TARGET) - -FRC: 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 -#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 - -/* - * 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 -#include - -/* - * 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 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 -#include -#include -#include -#include - -/* - * 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\=" or - * just "". 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 -#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 - -/* - * 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 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 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 - - - -/* - * 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 - -#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 - -/* - * 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 -#include -#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 -#include -#include - -/* - * 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:= devid:=" format, for the devid. - * - * Parameters: - * - char *keyValue - The string which is in the - * "resource:= 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:= devid:=" format, for the resource. - * - * Parameters: - * - char *keyValue - The string which is in the - * "resource:= 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 -#include -#include -#include -#include -#include -#include -#include -#include -#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 -#include -#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 -#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 -#include -#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 -#include -#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 - -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 -#include -#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 - -/* - * Method declaration - */ - -/* - * Method: create_association_instList - * - * Description: This method creates instances of the association - * out of the and parameters. The roles of - * and are defined by and - * 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 in the association. - * For example, this could be "Antecedent", "Dependent", "Element", etc. - * CCIMObjectPathList *pObjPathList - The other association keys that will - * be associated to . - * cimchar *pRole - The role of in the association. - * int *errp - The error pointer. - * - * Returns: - * An instance list filled with instances of the 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 -#include -#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 - -/* - * 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 - -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 - -/* - * 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 " > $HEADER -echo "#include " > $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 - -#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 -#include - -/* 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 -#include -#include - -#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:= 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 -#include -#include -#include -#include -#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 -#include - - -/* - * 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 -#include -#include -#include -#include -#include -#include - -/* - * 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 -#include -#include -#include -#include -#include -#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 -#include -#include - -/* - * 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 -#include -#include -#include -#include -#include -#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 -#include -#include - -/* - * 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 -#include -#include -#include -#include -#include -#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 -#include - - -/* - * 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 -#include -#include -#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 -#include -#include -#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 -#include -#include -#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 -#include -#include -#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 -#include -#include -#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 -#include -#include - -/* 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 -#include -#include -#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 -#include -#include -#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 -#include -#include -#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 -#include -#include -#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 -#include -#include -#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 -#include -#include -#include -#include -#include -#include - -#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" - " \n" - " 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 " - "_ structure of Schema class names.) " - "The purpose of is to ensure that is truly " - "unique across multiple vendor implementations. If such a " - "name is not used, the defining entity MUST assure that the " - " portion of the Instance ID is unique when compared with " - "other instance providers. For DMTF defined instances, the " - " is 'CIM'. \n" - " 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= 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:= 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 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 "}] - 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 "}] - 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 -#include -#include - -#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 -#include -#include -#include -#include - -#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 -#include -#include - -#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 -#include -#include -#include -#include -#include - -#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 -#include -#include - -#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 -#include -#include -#include -#include - -#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 -#include - -#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 -#include -#include -#include -#include -#include - -#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 -#include -#include - -#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 -#include -#include -#include -#include -#include - -#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 -#include -#include - -#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 -#include -#include -#include -#include -#include - -#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 -#include -#include - -#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 -#include -#include -#include -#include - -#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 -#include -#include - -#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 -#include -#include -#include -#include - -#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 -#include -#include - -#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 -#include -#include -#include -#include - -#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 -#include -#include - -#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 -#include -#include -#include -#include -#include - -#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 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#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 -#include -#include -#include -#include -#include -#include -#include -#include - -#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 -#include -#include -#include -#include -#include -#include -#include -#include - -#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 -#include -#include -#include -#include -#include -#include -#include -#include - -#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 -#include -#include -#include -#include -#include -#include -#include -#include - -#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 -#include -#include -#include -#include -#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 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#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 -#include -#include -#include -#include -#include -#include -#include -#include - -#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 -#include -#include -#include -#include -#include -#include -#include -#include - -#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 -#include -#include -#include -#include -#include -#include -#include -#include - -#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 -#include -#include -#include -#include -#include -#include -#include -#include - -#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 -#include -#include -#include - -#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 -#include -#include - -#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 -#include -#include -#include - -#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 -#include -#include - -#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 -#include -#include -#include - -#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 -#include -#include - -#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 -#include -#include -#include - -#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 -#include -#include - -#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 -#include -#include -#include - -#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 -#include -#include - -#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 -#include -#include -#include - -#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 -#include -#include - -#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 -#include -#include - -#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 -#include -#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 -#include -#include -#include -#include - -#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 " > $HEADER -echo "#include " > $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 - -#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 -#include - -/* 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 -#include -#include - -#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 -#include -#include - -#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 -#include -#include -#include - -#include "libdiskmgt.h" - -#ifdef __cplusplus -} -#endif - -#endif /* _SOLARIS_MPXIOGROUP_H_ */ diff --git a/usr/src/cmd/wbem/provider/com/Makefile b/usr/src/cmd/wbem/provider/com/Makefile deleted file mode 100644 index 57a6dbcad9..0000000000 --- a/usr/src/cmd/wbem/provider/com/Makefile +++ /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 -# -# -#ident "%Z%%M% %I% %E% SMI" -# -# cmd/wbem/provider/com/Makefile -# -# Copyright (c) 2001 Sun Microsystems, Inc. -# All Rights Reserved. -# - -# include global definitions -include $(SRC)/cmd/wbem/Makefile.wbem - -sparc_SUBDIRS = - -i386_SUBDIRS = - -ppc_SUBDIRS = - -COMMON_SUBDIRS= sun - -SUBDIRS= $(COMMON_SUBDIRS) $($(ARCH)_SUBDIRS) - -all:= TARGET= all -install:= TARGET= install -clean:= TARGET= clean -clobber:= TARGET= clobber -check:= TARGET= check - -.KEEP_STATE: - -all install check clean clobber : $(SUBDIRS) - -$(SUBDIRS): FRC - cd $@; pwd; $(MAKE) $(TARGET) - -FRC: diff --git a/usr/src/cmd/wbem/provider/com/sun/Makefile b/usr/src/cmd/wbem/provider/com/sun/Makefile deleted file mode 100644 index 852eedbef6..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/Makefile +++ /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 -# -# -#ident "%Z%%M% %I% %E% SMI" -# -# cmd/wbem/provider/com/sun/Makefile -# -# Copyright (c) 2001 Sun Microsystems, Inc. -# All rights reserved. -# - -# include global definitions -include $(SRC)/cmd/wbem/Makefile.wbem - -sparc_SUBDIRS = - -i386_SUBDIRS = - -ppc_SUBDIRS = - -COMMON_SUBDIRS= wbem - -SUBDIRS= $(COMMON_SUBDIRS) $($(ARCH)_SUBDIRS) - -all:= TARGET= all -install:= TARGET= install -clean:= TARGET= clean -clobber:= TARGET= clobber -check:= TARGET= check - -.KEEP_STATE: - -all install check clean clobber: $(SUBDIRS) - -$(SUBDIRS): FRC - cd $@; pwd; $(MAKE) $(TARGET) - -FRC: diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/Makefile b/usr/src/cmd/wbem/provider/com/sun/wbem/Makefile deleted file mode 100644 index f6caccc08b..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/Makefile +++ /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 -# -# -#ident "%Z%%M% %I% %E% SMI" -# -# cmd/wbem/provider/com/sun/wbem/Makefile -# -# Copyright (c) 2001 Sun Microsystems, Inc. -# All Rights Reserved. -# - -# include global definitions -include $(SRC)/cmd/wbem/Makefile.wbem - -sparc_SUBDIRS = - -i386_SUBDIRS = - -ppc_SUBDIRS = - -COMMON_SUBDIRS= solarisprovider - -SUBDIRS= $(COMMON_SUBDIRS) $($(ARCH)_SUBDIRS) - -all:= TARGET= all -install:= TARGET= install -clean:= TARGET= clean -clobber:= TARGET= clobber -check:= TARGET= check - -.KEEP_STATE: - -all install check clean clobber: $(SUBDIRS) - -$(SUBDIRS): FRC - cd $@; pwd; $(MAKE) $(TARGET) - -FRC: diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/Makefile b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/Makefile deleted file mode 100644 index 473298af09..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/Makefile +++ /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 -# -# -#ident "%Z%%M% %I% %E% SMI" -# -# cmd/wbem/provider/com/sun/wbem/solarisprovider/Makefile -# -# Copyright (c) 2001 Sun Microsystems, Inc. -# All Rights Reserved. -# - -# include global definitions -include $(SRC)/cmd/wbem/Makefile.wbem - -sparc_SUBDIRS = - -i386_SUBDIRS = - -ppc_SUBDIRS = - -COMMON_SUBDIRS= srm - -SUBDIRS= $(COMMON_SUBDIRS) $($(ARCH)_SUBDIRS) - -all:= TARGET= all -install:= TARGET= install -clean:= TARGET= clean -clobber:= TARGET= clobber -check:= TARGET= check - -.KEEP_STATE: - -all install check clean clobber: $(SUBDIRS) - -$(SUBDIRS): FRC - cd $@; pwd; $(MAKE) $(TARGET) - -FRC: diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/ActiveProjectModel.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/ActiveProjectModel.java deleted file mode 100644 index 04b2f54495..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/ActiveProjectModel.java +++ /dev/null @@ -1,84 +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 (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * ActiveProjectModel.java - */ - -package com.sun.wbem.solarisprovider.srm; - -import javax.wbem.cim.*; - -import java.util.LinkedHashMap; - - -/** - * Data model of a Solaris project. - * It encapsulates a CIM instance of the Solaris_ActiveProject class. - * @author Sun Microsystems - */ - -public class ActiveProjectModel extends SRMProviderDataModel - implements SRMProviderProperties, Solaris_ActiveProjectProperties { - - /** - * Construct an active project model and set the project name property - * to projName. - * @param projName the project name - */ - public ActiveProjectModel(String projName) { - name = projName; - } - - /** - * Returns the string value of this object - */ - public String toString() { - return "Project: " + name + "\n" + super.toString(); - } - - protected void setOpPropertiesVector() { - opProperties.add(new CIMProperty(CSCREATIONCLASSNAME, - new CIMValue(SOLARIS_COMPUTERSYSTEM))); - opProperties.add(new CIMProperty(CSNAME, new CIMValue(csName))); - opProperties.add(new CIMProperty(OSCREATIONCLASSNAME, - new CIMValue(SOLARIS_OPERATINGSYSTEM))); - opProperties.add(new CIMProperty(OSNAME, new CIMValue(osName))); - opProperties.add(new CIMProperty(PROJECTNAME, new CIMValue(name))); - } - - protected void setCIMInstance(boolean newInstance) { - setStrProp(newInstance, CSCREATIONCLASSNAME, SOLARIS_COMPUTERSYSTEM); - setStrProp(newInstance, CSNAME, csName); - setStrProp(newInstance, OSCREATIONCLASSNAME, SOLARIS_OPERATINGSYSTEM); - setStrProp(newInstance, OSNAME, osName); - setStrProp(newInstance, CREATIONCLASSNAME, SOLARIS_ACTIVEPROJECT); - } - - protected void initKeyValTable() { - keyValTab = new LinkedHashMap(2); - keyValTab.put(PROJECTID_KEY, new SetUI32Prop(PROJECTID)); - keyValTab.put(PROJECTNAME_KEY, new SetStringProp(PROJECTNAME)); - } - -} // end class ActiveProjectModel diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/ActiveUserModel.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/ActiveUserModel.java deleted file mode 100644 index 8608c3ab98..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/ActiveUserModel.java +++ /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 (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * ActiveUserModel.java - */ - -package com.sun.wbem.solarisprovider.srm; - -import javax.wbem.cim.*; - -import java.util.LinkedHashMap; - - -/** - * Data model of an active user that is actively running on an OperatingSystem. - * It encapsulates a CIM instance of the Solaris_ActiveUser class. - * @author Sun Microsystems - */ -public class ActiveUserModel extends SRMProviderDataModel - implements SRMProviderProperties, Solaris_ActiveUserProperties { - - /** - * Construct an active user model and set the user id property - * to uidStr. - * @param uidStr the user id as a string - */ - public ActiveUserModel(String uidStr) { - name = uidStr; - } - - /** - * Returns the string value of this object - */ - public String toString() { - return "\nUser ID " + name + '\n' + super.toString(); - } - - protected void setCIMInstance(boolean newInstance) { - setStrProp(newInstance, CSCREATIONCLASSNAME, SOLARIS_COMPUTERSYSTEM); - setStrProp(newInstance, CSNAME, csName); - setStrProp(newInstance, OSCREATIONCLASSNAME, SOLARIS_OPERATINGSYSTEM); - setStrProp(newInstance, OSNAME, osName); - setStrProp(newInstance, CREATIONCLASSNAME, SOLARIS_ACTIVEUSER); - } - - protected void setOpPropertiesVector() { - opProperties.add(new CIMProperty(CSCREATIONCLASSNAME, - new CIMValue(SOLARIS_COMPUTERSYSTEM))); - opProperties.add(new CIMProperty(CSNAME, new CIMValue(csName))); - opProperties.add(new CIMProperty(OSCREATIONCLASSNAME, - new CIMValue(SOLARIS_OPERATINGSYSTEM))); - opProperties.add(new CIMProperty(OSNAME, new CIMValue(osName))); - opProperties.add(new CIMProperty(USERID, new CIMValue(name))); - } - - protected void initKeyValTable() { - keyValTab = new LinkedHashMap(2); - keyValTab.put(USERID_KEY, new SetUI32Prop(USERID)); - keyValTab.put(USERNAME_KEY, new SetStringProp(USERNAME)); - } - -} // end class ActiveUserModel diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/DataModel.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/DataModel.java deleted file mode 100644 index 2548a463dd..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/DataModel.java +++ /dev/null @@ -1,552 +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 (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * DataModel.java - */ - -package com.sun.wbem.solarisprovider.srm; - -import java.util.HashMap; -import java.util.Vector; -import java.util.Iterator; - - -/** - * Aggregation of all users, projects, and sets metrics data. - * Implements the singleton pattern - * @author Sun Microsystems, Inc. - */ -class DataModel { - - private static DataModel dm; - private static SRMDataReader dr; - private static boolean doAlive; - /** - * syncObject guards the calls of SRMDataReader methods between the - * current data model thread and the KeepAlive thread. - */ - private static Object syncObject; - /** - * rdsKeepAliveTimeout: how long the KeepAlive thread should keep - * the connection opened. - */ - private static int rdsKeepAliveTimeout = 30 * 60000; - private static KeepAlive ka; - private static boolean kaError; - private static boolean msacct = false; - - private static final int PROCESSESHASHSIZE = 500; - private static final int USERPROCSHASHSIZE = 200; - private static final int PROJPROCSHASHSIZE = 100; - private static final int USERSHASHSIZE = 200; - private static final int PROJSHASHSIZE = 100; - private static final int L_PRC_SI = 1; - private static final int L_USR_SI = 2; - private static final int L_PRJ_SI = 3; - private static final int L_AC_USR = 4; - private static final int L_AC_PRJ = 5; - private static final int L_SYSTEM = 6; - private static final int L_ALL = 20; - - // RDS exec command - private static final String RDSPGM = "/usr/sadm/lib/wbem/rds"; - - private static final int TIMEOUTIDX = 3; - private static final int INTERVALIDX = 5; - - // RDS commands - private static final String CMD_GETALL = "-pUuJjS"; - private static final String CMD_GETPL = "-p"; - private static final String CMD_GETUL = "-u"; - private static final String CMD_GETAUL = "-U"; - private static final String CMD_GETJL = "-j"; - private static final String CMD_GETAJL = "-J"; - private static final String CMD_GETASL = "-S"; - private static final String CMD_ALIVE = "alive"; - private static final String CMD_EXIT = "exit"; - - private static boolean updating; // set if udpdateing is in progress - private static boolean running; // set if the rds is running - - private int rdsTimeout; - private int rdsInterval; - private String rdsArgs[]; - protected HashMap processes = new HashMap(PROCESSESHASHSIZE); - protected HashMap users = new HashMap(USERSHASHSIZE); - protected HashMap userprocs = new HashMap(USERPROCSHASHSIZE); - protected HashMap projs = new HashMap(PROJSHASHSIZE); - protected HashMap projprocs = new HashMap(PROJPROCSHASHSIZE); - protected SystemDataModel sdm = new SystemDataModel(); - - /** - * Default constructor - */ - private DataModel() { - } - - /** - * Should be used to obtain the singleton instance of this class - * @return the singleton instance of this class - */ - static DataModel getHandle(Object syncObj) { - - if (dm == null) { - dm = new DataModel(); - dr = new SRMDataReader(dm); - syncObject = syncObj; - try { - if (Util.propertyKEEPALIVETIMEOUT != null) { - rdsKeepAliveTimeout = - Integer.parseInt(Util.propertyKEEPALIVETIMEOUT); - } - if (Util.propertyMSACCT != null) { - msacct = Util.propertyMSACCT.equalsIgnoreCase("true"); - } - } catch (Exception e) { }; - } - return dm; - } - - /** - * Initialize the rds timeouts, the actually opening is deleted - * until the first update call. - */ - void open(int rdsTimeout, int rdsInterval) { - Vector args = new Vector(6); - String dbfile = null; - - this.rdsTimeout = rdsTimeout; - this.rdsInterval = rdsInterval; - args.add(RDSPGM); - args.add("-a"); - args.add("-t"); - args.add(""+rdsTimeout); - args.add("-i"); - args.add(""+rdsInterval); - if (Util.propertyRDSDATABASE != null) { - args.add("-f"); - args.add(Util.propertyRDSDATABASE); - } - if (Util.propertyMSACCT != null && - Util.propertyMSACCT.equalsIgnoreCase("true")) { - args.add("-m"); - } - if (Util.propertyRDSLOGFILE != null) { - args.add("-L"); - args.add(Util.propertyRDSLOGFILE); - } - rdsArgs = new String[args.size()]; - args.toArray(rdsArgs); - - } // end open - - /** - * Close the rds communication pipe. - */ - void close() { - - if (running) { - doAlive = false; - ka.interrupt(); - synchronized (syncObject) { - /* - * check again, since AliveThread could already close RDS - * when this thread was waiting on syncObject - */ - if (running) { - dr.closeRDS(); - running = false; - } - } - } - - } // end close - - /** - * Close the rds communication pipe after an error has raised. In this - * case the rds will be shutdown instead of gently closed. - */ - void closeONError() { - doAlive = false; - ka.interrupt(); - dr.shutdownRDS(); - running = false; - } - - /** - * Get a provider data model object identified by id from the list defined - * by listt. - * @return the provider data model object or null if other the list type - * or the provider object id are unsupported. - */ - SRMProviderDataModel getProviderDataModel(int listt, String id) { - - try { - switch (listt) { - case L_PRC_SI : return getProcess(Integer.parseInt(id)); - case L_USR_SI : return getUserprocs(id); - case L_PRJ_SI : return getProjprocs(id); - case L_AC_USR : return getUser(id); - case L_AC_PRJ : return getProject(id); - case L_SYSTEM : return sdm; - default: return null; - } - } catch (NumberFormatException e) { - return null; - } - } - - /** - * Get process metrics object. - * @param pid the process id - * @return metrics object with process metrics or new empty - * object at first call. - */ - ProcessDataModel getProcess(int pid) { - - ProcessDataModel pdm = null; - Integer pidI = new Integer(pid); - - if ((pdm = (ProcessDataModel) processes.get(pidI)) == null) { - if (updating == false) - return null; - pdm = new ProcessDataModel(pid); - processes.put(pidI, pdm); - } - if (updating == true) - pdm.setUpdated(true); - - return pdm; - } - - /** - * Get user metrics object. - * @param uid the user id - * @return metrics object with process metrics or new empty object at - * first call. - */ - UserProcessAggregateDataModel getUserprocs(String uidStr) { - - UserProcessAggregateDataModel padm = null; - - if ((padm = (UserProcessAggregateDataModel) - userprocs.get(uidStr)) == null) { - if (updating == false) - return null; - padm = new UserProcessAggregateDataModel(uidStr); - userprocs.put(uidStr, padm); - } - - if (updating == true) - padm.setUpdated(true); - - return padm; - } - - /** - * Get project metrics object. - * @return metrics object with process metrics or new empty - * object at first call. - */ - ProjectProcessAggregateDataModel getProjprocs(String name) { - - ProjectProcessAggregateDataModel padm = null; - - if ((padm = (ProjectProcessAggregateDataModel) - projprocs.get(name)) == null) { - if (updating == false) - return null; - padm = new ProjectProcessAggregateDataModel(name); - projprocs.put(name, padm); - } - if (updating == true) - padm.setUpdated(true); - - return padm; - } - - /** - * Get active user object. - * @param name the user id as string - * @return active user object. - */ - ActiveUserModel getUser(String name) { - - ActiveUserModel aum = null; - - if ((aum = (ActiveUserModel) users.get(name)) == null) { - if (updating == false) - return null; - aum = new ActiveUserModel(name); - users.put(name, aum); - } - if (updating == true) - aum.setUpdated(true); - - return aum; - } - - /** - * Get active project object. - * @param name the project - * @return project object. - */ - ActiveProjectModel getProject(String name) { - - ActiveProjectModel apm = null; - - if ((apm = (ActiveProjectModel) projs.get(name)) == null) { - if (updating == false) - return null; - apm = new ActiveProjectModel(name); - projs.put(name, apm); - } - if (updating == true) - apm.setUpdated(true); - - return apm; - } - - /** - * Returns an iterator over the Processes. - * @return iterator - */ - Iterator getProcessIterator() { - return processes.values().iterator(); - } - - /** - * Returns an iterator over the Users. - * @return iterator - */ - Iterator getUserIterator() { - return users.values().iterator(); - } - - /** - * Returns an iterator over the Projects. - * @return iterator - */ - Iterator getProjectIterator() { - return projs.values().iterator(); - } - - /** - * Returns an iterator over the user process aggregation. - * @return iterator - */ - Iterator getUserprocsIterator() { - return userprocs.values().iterator(); - } - - /** - * Returns an iterator over the project process aggregation. - * @return iterator - */ - Iterator getProjprocsIterator() { - return projprocs.values().iterator(); - } - - /** - * Update the metrics data. - * @exception SRMProtocolException - */ - void update() throws SRMProtocolException { - - SRMProviderDataModel pdm; - int tries = 2; - - while (tries-- > 0) { - if (!running) { - dr.startRDS(rdsArgs); - running = true; - ka = new KeepAlive(rdsKeepAliveTimeout); - ka.start(); - } - try { - synchronized (syncObject) { - /* check if AliveThread has set error flag */ - if (kaError) { - closeONError(); - continue; - /* - * check if rds is still running, since AliveThread - * could already close RDS when this thread was waiting - * on syncObject - */ - } else if (running) { - updating = true; - dr.getUpdate(CMD_GETALL); - } else { - tries = 2; - continue; - } - } - ka.resetTimeout(); - updating = false; - tries = 0; - } catch (SRMProtocolException e) { - SRMDebug.trace(SRMDebug.TRACE_ALL, e.getMessage()); - closeONError(); - if (tries == 0) - throw e; - } - } - cleanUp(); - - } // end update - - /** - * Remove all dead processes, users or projects. - */ - private void cleanUp() { - - cleanUpList(processes); - cleanUpList(users); - cleanUpList(userprocs); - cleanUpList(projs); - cleanUpList(projprocs); - } - - /** - * Remove all elements that heven't been updated in last update. - */ - private void cleanUpList(HashMap map) { - Iterator i; - SRMProviderDataModel pdm; - - for (i = map.values().iterator(); i.hasNext(); ) { - if (!((pdm = (SRMProviderDataModel) i.next()).isUpdated())) { - i.remove(); - } else { - pdm.setUpdated(false); - } - } - } - - /** - * This thread keeps the rds and the communication with it alive by - * sending the alive message to rds. - */ - class KeepAlive extends Thread { - int keepAliveTimeout, save; - - /** - * Constructor - * @param timeout how long to run at all - */ - public KeepAlive(int timeout) { - super("KeepAlive"); - kaError = false; - keepAliveTimeout = timeout; - save = keepAliveTimeout; - } - - synchronized public void run() { - int myTimeout = 0; - int waitTime = rdsTimeout / 2; - - doAlive = true; - - while (doAlive) { - /* - * the keepAliveTimeout value is set in constructor and - * in the resetTimeout() method. If its value is reseted - * the internal timer myTimeout value will be wind up. - */ - if (keepAliveTimeout > 0) { - myTimeout = keepAliveTimeout; - keepAliveTimeout = 0; - } - try { - synchronized (syncObject) { - /* - * this thread has gained the sync object, but it - * also should check the doAlive flag since - * the dataModel thread could already removed it - * because of a protocol error - */ - if (doAlive) { - myTimeout -= waitTime; - kaError = true; - if (myTimeout <= 0) { - dr.closeRDS(); - running = false; - return; - } else { - dr.alive(); - } - kaError = false; - } else { - return; - } - } - wait(waitTime); - } catch (InterruptedException e) { - SRMDebug.trace(SRMDebug.TRACE_ALL, e.getMessage()); - return; - } catch (SRMProtocolException e) { - SRMDebug.trace(SRMDebug.TRACE_ALL, e.getMessage()); - return; - } - } - } - - /** - * Reset the absolute timeout - */ - public void resetTimeout() { - keepAliveTimeout = save; - } - - } // end class KeepAlive - - - class ProjectProcessAggregateDataModel extends ProcessAggregateDataModel { - public ProjectProcessAggregateDataModel(String id) { - super(id); - } - - protected void setCIMInstance(boolean newInstance) { - super.setCIMInstance(newInstance); - setStrProp(newInstance, CREATIONCLASSNAME, - SOLARIS_PROJECTPROCESSAGGREGATESTATISTICALINFORMATION); - setStrProp(newInstance, NAME, name); - } - } - - class UserProcessAggregateDataModel extends ProcessAggregateDataModel { - public UserProcessAggregateDataModel(String id) { - super(id); - } - - protected void setCIMInstance(boolean newInstance) { - super.setCIMInstance(newInstance); - setStrProp(newInstance, CREATIONCLASSNAME, - SOLARIS_USERPROCESSAGGREGATESTATISTICALINFORMATION); - setStrProp(newInstance, NAME, name); - } - } - -} // end class DataModel diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Makefile b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Makefile deleted file mode 100644 index d2bf7f352b..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Makefile +++ /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 (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 -# -# cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Makefile -# -# Copyright 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -include $(SRC)/cmd/wbem/Makefile.wbem - -JARFILE= perfprovider.jar -PACKAGEPATH= com/sun/wbem/solarisprovider/srm -RESOURCE_PACKAGEPATH= $(PACKAGEPATH)/resources -DOCDIR= doc - -DIRMODE= 755 -FILEMODE= 644 - -ROOTCOM= $(ROOTWBEM)/com -ROOTCOMSUN= $(ROOTCOM)/sun -ROOTCOMSUNWBEM= $(ROOTCOMSUN)/wbem -ROOTCOMSUNWBEMSOLARISPROVIDER= $(ROOTCOMSUNWBEM)/solarisprovider -ROOTCOMSUNWBEMSOLARISPROVIDERSRM= $(ROOTCOMSUNWBEMSOLARISPROVIDER)/srm -ROOTCOMSUNWBEMSOLARISPROVIDERSRMRESOURCES= $(ROOTCOMSUNWBEMSOLARISPROVIDERSRM)/resources - -PROVIDERDIRS= $(ROOTCOM) \ - $(ROOTCOMSUN) \ - $(ROOTCOMSUNWBEM) \ - $(ROOTCOMSUNWBEMSOLARISPROVIDER) \ - $(ROOTCOMSUNWBEMSOLARISPROVIDERSRM) \ - $(ROOTCOMSUNWBEMSOLARISPROVIDERSRMRESOURCES) - -ROOTPROVIDERFILE= $(FILE:%=$(ROOTCOMSUNWBEMSOLARISPROVIDERSRM)/%) -ROOTRESOURCEFILE= $(FILE:%=$(ROOTCOMSUNWBEMSOLARISPROVIDERSRMRESOURCES)/%) - -$(PROVIDERDIRS): $(ROOTWBEMDIRS) - $(INS.dir) - -$(ROOTCOMSUNWBEMSOLARISPROVIDERSRM)/%: % - $(INS.file) - -$(ROOTCOMSUNWBEMSOLARISPROVIDERSRMRESOURCES)/%: % - $(INS.file) - -SOURCE:sh = ls *.java - -CLASSES:sh = ls *.class 2> /dev/null | sed 's/\$/\$\$/' - - -all: $(PROVIDERDIRS) jar - -install: all resources mof $(PROG) - -resources: $(ROOTCOMSUNWBEMSOLARISPROVIDERSRMRESOURCES)/LogMessages.properties \ - $(ROOTCOMSUNWBEMSOLARISPROVIDERSRMRESOURCES)/Exceptions.properties \ - $(ROOTCOMSUNWBEMSOLARISPROVIDERSRM)/perfprovider.properties - - -mof: $(ROOTMOF)/Solaris_Performance1.0.mof - -jar: jarfile $(ROOTWBEM)/$(JARFILE) - -jarfile: $(SOURCE:java=class) - cd $(PROVIDERSRC);\ - $(JAR) -cvf0M $(JARFILE) $(PACKAGEPATH)/*class; \ - cd $(PROVIDERSRC);\ - $(JAR) -uvf0M $(JARFILE) $(RESOURCE_PACKAGEPATH:%=%/*.properties); - $(MV) $(PROVIDERSRC)/$(JARFILE) . - -doc: .FORCE - $(JAVADOC) -d $(DOCDIR) -classpath $(CLASSPATH) $(SOURCE) - -clobber: clean - -clean: - $(RM) *.class - -check: - $(JSTYLE) $(JSTYLE_TAIL) $(SOURCE) - -.WAIT: - -.FORCE: - diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/ProcessAggregateDataModel.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/ProcessAggregateDataModel.java deleted file mode 100644 index 83ac52a68a..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/ProcessAggregateDataModel.java +++ /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 (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * ProcessAggregateDataModel.java - */ - -package com.sun.wbem.solarisprovider.srm; - -import javax.wbem.cim.*; - - -/** - * Data model of aggregated process utilization - * It encapsulates a CIM instance of - * a Solaris_ProjectProcessAggregateStatisticalInformation - * or Solaris_UserProcessAggregateStatisticalInformation class. - * @author Sun Microsystems - */ -public class ProcessAggregateDataModel extends ProcessDataModel { - - - /** - * Construct an aggregated process utilization model and set the user id - * or the project name propertyto uidStr. - * @param idStr the user id or project name - */ - public ProcessAggregateDataModel(String idStr) { - name = idStr; - } - - protected void setOpPropertiesVector() { - - opProperties.add(new CIMProperty(SYSTEMNAME, - new CIMValue(csName))); - - opProperties.add(new CIMProperty(SYSTEMCREATIONCLASSNAME, - new CIMValue(SOLARIS_COMPUTERSYSTEM))); - - opProperties.add(new CIMProperty(NAME, - new CIMValue(name))); - } - - protected void setCIMInstance(boolean newInstance) { - super.setCIMInstance(newInstance); - setStrProp(newInstance, CREATIONCLASSNAME, - SOLARIS_PROCESSAGGREGATESTATISTICALINFORMATION); - } - - /** - * Returns the string value of this object - */ - public String toString() { - return super.toString() + "Name " + name + "\n" + super.toString(); - } - - protected void initKeyValTable() { - super.initKeyValTable(); - keyValTab.put("id_nproc", new SetUI64Prop("NumProcs")); - } - -} // end class ProcessAggregateDataModel diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/ProcessDataModel.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/ProcessDataModel.java deleted file mode 100644 index 260e621167..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/ProcessDataModel.java +++ /dev/null @@ -1,221 +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 (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * ProcessDataModel.java - */ - -package com.sun.wbem.solarisprovider.srm; - -import javax.wbem.cim.*; - -import java.util.*; - - -/** - * Data model of Process Utilization. It encapsulates a CIM instance of - * a Solaris_ProcessStatisticalInformation class. - * @author Sun Microsystems - */ -public class ProcessDataModel extends SRMProviderDataModel - implements SRMProviderProperties, - Solaris_ProcessStatisticalInformationProperties { - - /** - * Object path to the Solaris_Process instance - */ - protected CIMObjectPath opForProc; - int pid; - - - public ProcessDataModel() { - super(); - } - - - public ProcessDataModel(int pid) { - this.pid = pid; - } - - - /** - * Get a CIM object path to a Solaris_Process object. - * @returns object path to the Solaris_Process instance. - */ - public CIMObjectPath getCIMObjectPathForProc() { - if (opForProc == null) { - - opForProc = new CIMObjectPath(SOLARIS_PROCESS); - opForProc.setNameSpace(NAMESPACE); - - Vector properties = new Vector(5); - - properties.add( - new CIMProperty(CSCREATIONCLASSNAME, - new CIMValue(SOLARIS_COMPUTERSYSTEM))); - - properties.add( - new CIMProperty(CSNAME, - new CIMValue(csName))); - - properties.add( - new CIMProperty(OSCREATIONCLASSNAME, - new CIMValue(SOLARIS_OPERATINGSYSTEM))); - - properties.add( - new CIMProperty(OSNAME, - new CIMValue(osName))); - - properties.add( - new CIMProperty(HANDLE, - new CIMValue(Long.toString(pid)))); - - opForProc.setKeys(properties); - } - return opForProc; - } - - - public String toString() { - - return "Name " + pid + "\n" + super.toString(); - } - - - protected void setOpPropertiesVector() { - - opProperties.add( - new CIMProperty(CSCREATIONCLASSNAME, - new CIMValue(SOLARIS_COMPUTERSYSTEM))); - - opProperties.add( - new CIMProperty(CSNAME, - new CIMValue(csName))); - - opProperties.add( - new CIMProperty(OSCREATIONCLASSNAME, - new CIMValue(SOLARIS_OPERATINGSYSTEM))); - - opProperties.add( - new CIMProperty(OSNAME, - new CIMValue(osName))); - - opProperties.add( - new CIMProperty(NAME, - new CIMValue(Long.toString(pid)))); - } - - - protected void setCIMInstance(boolean newInstance) { - - setStrProp(newInstance, - SYSTEMCREATIONCLASSNAME, - SOLARIS_COMPUTERSYSTEM); - - setStrProp(newInstance, - SYSTEMNAME, - csName); - - setStrProp(newInstance, - CREATIONCLASSNAME, - SOLARIS_PROCESSSTATISTICALINFORMATION); - - setStrProp(newInstance, - CAPTION, - ""); - - setStrProp(newInstance, - DESCRIPTION, - ""); - - setStrProp(newInstance, - NAME, - Long.toString(pid)); - } - - - protected void initKeyValTable() { - keyValTab = new LinkedHashMap(30); - - keyValTab.put(WAITCPUTIME_KEY, - new SetReal64Prop(WAITCPUTIME)); - keyValTab.put(USERMODETIME_KEY, - new SetReal64Prop(USERMODETIME)); - keyValTab.put(SYSTEMMODETIME_KEY, - new SetReal64Prop(SYSTEMMODETIME)); - keyValTab.put(SYSTEMTRAPTIME_KEY, - new SetReal64Prop(SYSTEMTRAPTIME)); - keyValTab.put(TEXTPAGEFAULTSLEEPTIME_KEY, - new SetReal64Prop(TEXTPAGEFAULTSLEEPTIME)); - keyValTab.put(DATAPAGEFAULTSLEEPTIME_KEY, - new SetReal64Prop(DATAPAGEFAULTSLEEPTIME)); - keyValTab.put(SYSTEMPAGEFAULTSLEEPTIME_KEY, - new SetReal64Prop(SYSTEMPAGEFAULTSLEEPTIME)); - keyValTab.put(USERLOCKWAITSLEEPTIME_KEY, - new SetReal64Prop(USERLOCKWAITSLEEPTIME)); - keyValTab.put(OTHERSLEEPTIME_KEY, - new SetReal64Prop(OTHERSLEEPTIME)); - keyValTab.put(STOPPEDTIME_KEY, - new SetReal64Prop(STOPPEDTIME)); - keyValTab.put(MINORPAGEFAULTS_KEY, - new SetUI64Prop(MINORPAGEFAULTS)); - keyValTab.put(MAJORPAGEFAULTS_KEY, - new SetUI64Prop(MAJORPAGEFAULTS)); - keyValTab.put(SWAPOPERATIONS_KEY, - new SetUI64Prop(SWAPOPERATIONS)); - keyValTab.put(BLOCKSREAD_KEY, - new SetUI64Prop(BLOCKSREAD)); - keyValTab.put(BLOCKSWRITTEN_KEY, - new SetUI64Prop(BLOCKSWRITTEN)); - keyValTab.put(MESSAGESSENT_KEY, - new SetUI64Prop(MESSAGESSENT)); - keyValTab.put(MESSAGESRECEIVED_KEY, - new SetUI64Prop(MESSAGESRECEIVED)); - keyValTab.put(SIGNALSRECEIVED_KEY, - new SetUI64Prop(SIGNALSRECEIVED)); - keyValTab.put(VOLUNTARYCONTEXTSWITCHES_KEY, - new SetUI64Prop(VOLUNTARYCONTEXTSWITCHES)); - keyValTab.put(INVOLUNTARYCONTEXTSWITCHES_KEY, - new SetUI64Prop(INVOLUNTARYCONTEXTSWITCHES)); - keyValTab.put(SYSTEMCALLSMADE_KEY, - new SetUI64Prop(SYSTEMCALLSMADE)); - keyValTab.put(CHARACTERIOUSAGE_KEY, - new SetUI64Prop(CHARACTERIOUSAGE)); - keyValTab.put(PROCESSHEAPSIZE_KEY, - new SetUI64Prop(PROCESSHEAPSIZE)); - keyValTab.put(PROCESSVMSIZE_KEY, - new SetUI64Prop(PROCESSVMSIZE)); - keyValTab.put(PROCESSRESIDENTSETSIZE_KEY, - new SetUI64Prop(PROCESSRESIDENTSETSIZE)); - keyValTab.put(PERCENTCPUTIME_KEY, - new SetReal32Prop(PERCENTCPUTIME)); - keyValTab.put(PERCENTMEMORYSIZE_KEY, - new SetReal32Prop(PERCENTMEMORYSIZE)); - keyValTab.put(USERSYSTEMMODETIME_KEY, - new SetUI64Prop(USERSYSTEMMODETIME)); - keyValTab.put(NUMTHREADS_KEY, - new SetUI64Prop(NUMTHREADS)); - keyValTab.put(TIMESTAMP_KEY, - new SetUI64Prop(TIMESTAMP)); - } -} diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/PropertyAccessInterface.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/PropertyAccessInterface.java deleted file mode 100644 index e3f9309f4b..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/PropertyAccessInterface.java +++ /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 - */ -/* - * ident "%Z%%M% %I% %E% SMI" - * - * Copyright (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * PropertyAccessInterface.java - */ - - -package com.sun.wbem.solarisprovider.srm; - -import javax.wbem.cim.*; - - -/** - * Defines the access methods to a properties of a CIM instance. - */ -interface PropertyAccessInterface { - - static final byte CACHE = 1; - static final byte FLUSH = 2; - static final byte CHECK_WTHROUGH = 3; - - /** - * Set the property to the value val. The action specifies how to access - * the property. - * CACHE - only cache the value, don't write it to the CIM instance. - * FLUSH - flush the cached value to the CIM instance. - * CHECK_WTHROUGH - if the value doesn't equal the current value do nothing, - * otherwise write the internal and the CIM instance value. - * @param ci the CIM instance - * @param action the set type (CACHE, FLUSH or CHECK_WTHROUGH) - * @param val the set value - */ - void set(CIMInstance ci, byte action, String val) - throws NumberFormatException; - - /** - * Returns the string value of this object - */ - String toString(); - - /** - * Returns value string of this property - */ - public String getValue(); - -} // end interface PropertyAccessInterface diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/ResourceMonitor.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/ResourceMonitor.java deleted file mode 100644 index 0f27d35db4..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/ResourceMonitor.java +++ /dev/null @@ -1,222 +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 (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * ResourceMonitor.java - */ - - -package com.sun.wbem.solarisprovider.srm; - -import java.util.HashSet; - -/** - * Mediator between data model the native interface and the client. - * Implements the singleton pattern. - * @author Sun Microsystems, Inc. - */ -public final class ResourceMonitor { - /** - * The UPDATETIME defines a time window in which a data request will - * be served from internal data cache instead of accessing rds, 5 sec. - */ - private static final int UPDATETIME = 5000; - - /** - * The RDSTIMEOUT defines the timeout after which the rds - * rds will exit, if it hasn't received command from client, 30 sec. - */ - private static final int RDSTIMEOUT = 30000; - /** - * The RDSINTERVAL defines a interval in which the rds - * will update its data, 1 sec. - */ - private static final int RDSINTERVAL = 1000; - - private static ResourceMonitor rm; - private static DataModel dataModel; - private long lastUpdateTime; - private int updateTime = UPDATETIME; - private int rdsTimeout = RDSTIMEOUT; - private int rdsInterval = RDSINTERVAL; - - /** - * threads that hold access into the data model - */ - private int activeClients; - - /** - * Ensure that DataModel will be opened and closed once. - */ - private boolean ifOpened = false; - - /** - * Default constructor - */ - private ResourceMonitor() { - } - - /** - * Should be used to obtain the singleton instance of this class - * @return the singleton instance of this class - */ - public static synchronized ResourceMonitor getHandle() { - if (rm == null) { - rm = new ResourceMonitor(); - // The provider data model used by this monitor - dataModel = DataModel.getHandle(rm); - } - return rm; - } - - /** - * Open the data model used by this monitor with the following default - * times, timeout after which the rds rds will exit 30 sec., interval in - * which the rds will update its data 1 sec., time in which the data model - * will refresh its cache 5 sec. - */ - public synchronized void openDataModel() { - openDataModel(rdsTimeout, rdsInterval, updateTime); - } - - /** - * Open the data model used by this monitor. - * @param rdsTimeout timeout after which the rds rds will exit, - * if -1 the default value 30 sec. will be used - * @param rdsInterval interval in which the rds will update its data - * if -1 the default value 1 sec. will be used - * @param updateTime time in which the data model will refresh its cache - * if -1 the default value 5 sec. will be used - */ - public synchronized void openDataModel(int rdsTimeout, - int rdsInterval, int updateTime) { - - if (ifOpened == false) { - if (updateTime != -1) - this.updateTime = updateTime; - if (rdsTimeout != -1) - this.rdsTimeout = rdsTimeout; - if (rdsTimeout != -1) - this.rdsInterval = rdsInterval; - dataModel.open(rdsTimeout, rdsInterval); - ifOpened = true; - } - - } // end openDataModel - - /** - * Close the data model used by this monitor. - */ - public synchronized void closeDataModel() { - - if (ifOpened == true) { - dataModel.close(); - ifOpened = false; - } - - } // end closeDataModel - - /** - * Get the access to the data model. The caller should invoke - * releaseDataModel() in order to allow the refresh of the data - * model cache after it has finished the data processing. - * @return the data model - * @throws com.sun.wbem.solarisprovider.srm.SRMException - * if the data model couldn't be updated. - */ - public synchronized - DataModel getDataModel(boolean forceUpdate) - throws SRMException { - - if (ifOpened == false) - throw new SRMException("Resource Data Model is not opened"); - - if (forceUpdate == true) { - update(); - } else { - long currentTime = System.currentTimeMillis(); - if ((currentTime - lastUpdateTime) > updateTime) { - lastUpdateTime = currentTime; - update(); - } - } - activeClients++; - SRMDebug.trace(SRMDebug.THREAD_SYNC, "srm data cache update locked by " - + activeClients + " clients"); - return dataModel; - - } // end getDataModel - - /** - * Release the lock into the data model. This allows the refresh of the - * data model cache. - * @param dm the data got from getDataModel() model must not be zero - */ - public synchronized DataModel releaseDataModel(DataModel dm) { - - if (dm != null) { - activeClients--; - SRMDebug.trace(SRMDebug.THREAD_SYNC, - "srm data cache update locked by " - + activeClients + " clients"); - notifyAll(); - } - return null; - } // end releaseDataModel - - /** - * Wait till all data model readers release their lock, then do the update - */ - private void update() throws SRMException { - - beforeUpdate(); - SRMDebug.trace(SRMDebug.THREAD_SYNC, - "starting srm data cache update, at: " - +System.currentTimeMillis()+"ms"); - dataModel.update(); - SRMDebug.trace(SRMDebug.THREAD_SYNC, - "finished srm data cache update, at: " - +System.currentTimeMillis()+"ms"); - } - - private static final int WAITTIME = 500; - - /** - * Wait till all data model readers release their lock. To ensure - * liveness only wait max. 10 * WAITTIME; - */ - private synchronized void beforeUpdate() { - int tries = 10; - - while (activeClients > 0) { - try { - --tries; - wait(WAITTIME); - if (tries == 0) - activeClients = 0; - } catch (InterruptedException ex) { - } - } - } - -} // end class ResourceMonitor diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMDataReader.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMDataReader.java deleted file mode 100644 index cdb503dc66..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMDataReader.java +++ /dev/null @@ -1,727 +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" - * - * Copyright (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * SRMDataReader.java - */ - - -package com.sun.wbem.solarisprovider.srm; - -import java.io.*; - - -/** - * This class works out the protocol layer of the unidirectional data interface - * between the rds and the client. The protocol contains a header with a lists - * of data. Each list has a header and some elements, which have again a header - * and some fields of data: - * protocol = { pheader, n * list } - * pheader == { "@RDS-MAG@", PROTV, LISTN } - * PROTV == { protocol version } - * LISTN == { number of lists } - * list == { lheader, n * element } - * lheader == { LISTT, ELEMN } - * LISTT == { type of the list } - * ELEMN == { number of elements in the list } - * element == { eheader, field } - * eheader == { ELMID, FILDN } - * ELMID == { element id, like pid, uid, project name } - * field == { KEY, VALUE } - * All protocol elements has a key and a value separated by one space. - * The value begins after the first space and ends at the new line character. - * Protocol keys are: "@RDS-MAG@", PROTV, LISTN, LISTT, ELEMN ELMID, FILDN, - * RDERR. The special key RDERR can occur in any line indicates error condition, - * where the VALUE is the error message from rds. - * @author Sun Microsystems, Inc. - * @version 1.1 08/31/01 - */ -class SRMDataReader { - - // Protocol keys - private static final String PROTM = "@RDS-MAG@"; // protocol starts with it - private static final String RDERR = "RDERR"; // error notification from rds - private static final String PROTV = "PROTV"; // protocol version - private static final String LISTT = "LISTT"; // list type - private static final String LISTN = "LISTN"; // number of lists - private static final String ELEMN = "ELEMN"; // number of elements in a list - private static final String ELMID = "ELMID"; // element id - private static final String FILDN = "FILDN"; // number of fields in element - private static final String BUSY = "BUSY"; // busy notification from rds - - private static final String RDS_PV_ERR = "RDS protocol violation: "; - private static final int PROT_VERSION = 100; // supported protocol version - - private static final String COMMAND = "command "; - private static final String PROMPT = "@RDS@>"; - private static final String PROMPT_WHAT = " ?"; - - // RDS commands - private static final String CMD_ALIVE = "alive"; - private static final String CMD_EXIT = "exit"; - - private DataModel dm; - private Process p; - private int exitV; - private BufferedReader in, err; - private PrintWriter pw; - private String line; // last read line - private String stdErrline; // last read line - private String errline; // last read error line - private String key; // last read key - private String val; // last read value - - // Timeout for waiting for the first line from rds after its start. - // Since rds can be busy for a long time reading and scanning its - // persistence file, this time must set be relative high. - private static final int OPEN_READTIMEOUT = 30000; // ms - - // Default timeout for reading RDS responses - private static final int DEFAULT_READTIMEOUT = 1000; // ms - - // If rds is too busy to respond, wait this long before retrying - private static final int RDS_RETRY_SLEEPTIME = 500; // milliseconds - - // Retry and rds command no more than this many times - private static final int MAX_RDS_RETRIES = 140; - - protected int readTimeout = DEFAULT_READTIMEOUT; - - private long charsRead = 0; - - private SRMWorker worker; - - /** - * Constructor. - * @param dm data model that reads and interprets the protocol data - * fields. - */ - public SRMDataReader(DataModel dm) { - this.dm = dm; - - // initialize the response timeout according to resource property - String s = Util.propertyREADTIMEOUT; - - if (s != null && s.length() > 0) { - try { - readTimeout = Integer.parseInt(s); - } catch (Exception e) { - SRMDebug.trace(SRMDebug.TRACE_ALL, e.getMessage()); - } - } - worker = new SRMWorker(); - worker.start(); - } - - /** - * Start the by cmdArgs defined rds, and check the protocol header. - * @param cmdArgs contains the path of rds and the arguments to use. - * @exception SRMProtocolException if a protocol violation has occurred. - */ - public void startRDS(String []cmdArgs) throws SRMProtocolException { - worker.start(cmdArgs, OPEN_READTIMEOUT); - } - - /** - * Send exit command to rds and close the rds pipe. - */ - public void closeRDS() { - worker.close(readTimeout); - } - - /** - * Close the rds pipe and shutdown the rds procces. - */ - public void shutdownRDS() { - worker.shutdown(readTimeout); - } - - /** - * Start the udpate. - * If parse returns an error code it is assumed that rds is busy. - * The request will then be retried. - * - * @param option defines the rds command opion, -S -p ... - * @exception SRMProtocolException if a protocol violation has occurred. - */ - public void getUpdate(String option) throws SRMProtocolException { - worker.update(option, readTimeout); - } - - /** - * Force the RDS to keep alive by sending the ALIVE command - * @exception SRMProtocolException if a protocol violation has occurred. - */ - public void alive() throws SRMProtocolException { - worker.alive(readTimeout); - } - - /** - * Start the by cmdArgs defined rds, and check the protocol header. - * This method is called by the worker thread. - * @param cmdArgs contains the path of rds and the arguments to use. - * @exception SRMProtocolException if a protocol violation has occurred. - */ - private void _startRDS(String []cmdArgs) throws SRMProtocolException { - open(cmdArgs); - try { - readHeader(); - } catch (SRMProtocolException e) { - SRMDebug.trace(SRMDebug.TRACE_ALL, e.getMessage()); - shutdownRDS(); - throw e; - } - } - - - /** - * Send exit command to rds and close the rds pipe. - * This method is called by the worker thread. - */ - private void _closeRDS() { - - /* - * First we try to close rds carefully by sending an exit command. - * If it failed we will destroy the rds process. In both cases - * we will wait for its termination. - */ - try { - wrCmd(CMD_EXIT); - checkPrompt(); - SRMDebug.trace(SRMDebug.RDS_CMD_IFC, - "waiting for rds to terminate"); - p.waitFor(); - close(); - } catch (SRMProtocolException e) { - shutdownRDS(); - } catch (InterruptedException e) { - SRMDebug.trace(SRMDebug.TRACE_ALL, e.getMessage()); - } - SRMDebug.trace(SRMDebug.RDS_CMD_IFC, "done"); - } - - /** - * Close the rds pipe and shutdown the rds procces. - * This method is called by the worker thread. - */ - private void _shutdownRDS() { - - /* - * First check if it is still running if so destroy it and wait - * for its termination. - */ - if (checkRDSrunning()) { - p.destroy(); - try { - SRMDebug.trace(SRMDebug.RDS_CMD_IFC, - "waiting for rds to terminate"); - p.waitFor(); - } catch (InterruptedException e) { - SRMDebug.trace(SRMDebug.TRACE_ALL, e.getMessage()); - } - SRMDebug.trace(SRMDebug.RDS_CMD_IFC, "done"); - } - close(); - } - - /** - * Start the udpate. - * This method is called by the worker thread. - * If parse returns an error code it is assumed that rds is busy. - * The request will then be retried. - * - * @param option defines the rds command opion, -S -p ... - * @exception SRMProtocolException if a protocol violation has occurred. - */ - private void _getUpdate(String option) throws SRMProtocolException { - int numRetries = MAX_RDS_RETRIES; - - do { - wrCmd(option); - if (parse() == 0 || numRetries <= 0) - break; - - try { - Thread.sleep(RDS_RETRY_SLEEPTIME, 0); - } catch (InterruptedException x) { - ; - } - } while (numRetries-- > 0); - - if (numRetries == 0) { - throw new SRMProtocolException( - "Cannot read rds '" + option + "' command output"); - } else { - SRMDebug.trace(SRMDebug.RDS_CMD_IFC, "charsRead = " + charsRead); - } - } - - /** - * Force the RDS to keep alive - * This method is called by the worker thread. - * @exception SRMProtocolException if a protocol violation has occurred. - */ - private void _alive() throws SRMProtocolException { - wrCmd(CMD_ALIVE); - } - - /** - * Start the rds and create a BufferedReader input stream. - * @param cmdArgs contains the path of rds and the arguments to use. - */ - private void open(String []cmdArgs) throws SRMProtocolException { - - InputStream is, errs; - OutputStream os; - Runtime r = Runtime.getRuntime(); - - if (SRMDebug.isOn(SRMDebug.RDS_CMD_IFC)) { - StringBuffer rdsCallStr = new StringBuffer(cmdArgs[0]); - for (int i = 1; i < cmdArgs.length; i++) { - rdsCallStr.append(" " + cmdArgs[i]); - } - SRMDebug.trace(SRMDebug.RDS_CMD_IFC, rdsCallStr.toString()); - } - try { - p = r.exec(cmdArgs); - is = p.getInputStream(); - errs = p.getErrorStream(); - os = p.getOutputStream(); - } catch (IOException e) { - throw new SRMProtocolException("Cannot start 'rds', " + - e.getMessage()); - } - if (!checkRDSrunning()) { - throw new SRMProtocolException("Cannot start 'rds', " + - "rds terminated with exit code =" + exitV); - } - in = new BufferedReader(new InputStreamReader(is)); - err = new BufferedReader(new InputStreamReader(errs)); - pw = new PrintWriter(os); - - } // end open - - /** - * Close the data stream to rds. - */ - private void close() { - - SRMDebug.trace(SRMDebug.RDS_CMD_IFC, ""); - try { - in.close(); - pw.close(); - err.close(); - } catch (IOException e) { - SRMDebug.trace(SRMDebug.TRACE_ALL, e.getMessage()); - } - - } // end close - - /** - * Read the data stream and wait for RDS protocol header, check version. - * @exception SRMProtocolException if a protocol violation has occurred. - */ - private void readHeader() throws SRMProtocolException { - - int protv; - try { - // Waiting for header with the magic value @RDS-MAG@ - while ((line = in.readLine()) != null) { - if (line.length() < PROTM.length()) - continue; - if (line.equals(PROTM)) - break; - } - if (line == null) { - throw new SRMProtocolException( - "Unexpected end of RDS input stream"); - } - // Check the protocol version - parseKeyValue(); - if (!key.equals(PROTV)) { - throw new SRMProtocolException(RDS_PV_ERR + line); - } else { - protv = Integer.parseInt(val); - if (PROT_VERSION != protv) { - throw new SRMProtocolException( - "Unsupported RDS protocol version: ex:" + - PROT_VERSION + ", ac: " + protv); - } - } - - } catch (IOException e) { - if (SRMDebug.isOn(SRMDebug.RDS_CMD_IFC)) - dumpStdErr(); - throw new SRMProtocolException("Cannot read RDS protocol header, " + - e.getMessage()); - } - - } // end readHeader - - /** - * Parse the data stream from rds, evaluate and strip the protocol elements. - * - * Returns 0 if OK, 1 if rds responded 'busy' - * - * @exception SRMProtocolException if a protocol violation has occurred. - */ - private int parse() throws SRMProtocolException { - - int protv, listn, listt, elemn; - try { - // fetch the number of lists (or maybe it's busy) - parseKeyValue(); - if (!key.equals(LISTN)) { - throw new SRMProtocolException(RDS_PV_ERR + line); - } else { - listn = Integer.parseInt(val); - } - - for (int lno = 0; lno < listn; lno++) { - - // read the type of the list - parseKeyValue(); - if (!key.equals(LISTT)) { - throw new SRMProtocolException(RDS_PV_ERR + line); - } else { - listt = Integer.parseInt(val); - } - - // read the number of elements in the list - parseKeyValue(); - if (!key.equals(ELEMN)) { - throw new SRMProtocolException(RDS_PV_ERR + line); - } else { - elemn = Integer.parseInt(val); - } - for (int eno = 0; eno < elemn; eno++) { - parseElement(listt); - } - } - - } catch (NumberFormatException e) { - throw new SRMProtocolException(RDS_PV_ERR + line); - } catch (SRMProtocolBusyException b) { - return 1; - } - - return 0; - - } // end parse - - /** - * Parse the fields in a element of a list of type listt. The client - * should know the how to interpret the fields of a element of a particular - * list type. - * @param listt the type of the list. - * @exception SRMProtocolException if a protocol violation has occurred. - */ - private void parseElement(int listt) throws SRMProtocolException { - - int fieldn; - SRMProviderDataModel pdm; - String elemidStr; - - parseKeyValue(); - if (!key.equals(ELMID)) { - throw new SRMProtocolException(RDS_PV_ERR + line); - } else { - // get the consumer of fields of this element. - if ((pdm = dm.getProviderDataModel(listt, val)) == null) { - throw new SRMProtocolException(RDS_PV_ERR + - "wrong list type: " + line); - } - } - parseKeyValue(); - if (!key.equals(FILDN)) { - throw new SRMProtocolException(RDS_PV_ERR + line); - } else { - fieldn = Integer.parseInt(val); - } - for (int fno = 0; fno < fieldn; fno++) { - parseKeyValue(); - // The provider data model will take the value and set its property - pdm.setProperty(key, val); - } - - } // end parseElement - - /** - * Parse one line of the input stream and split it into a KEY - * and VALUE. The read line is stored in the class field line, - * the KEY in key and VALUE in value. These fields should - * remains unchanged till the next call of this method. Since they - * are used in several places in this class. - * @exception SRMProtocolBusyException if the key is "busy" - * @exception SRMProtocolException if a protocol violation has occurred. - */ - private void parseKeyValue() throws SRMProtocolException { - - int idx; - try { - if ((line = in.readLine()) != null) { - if (line.startsWith(BUSY)) { - throw new SRMProtocolBusyException("RDS busy"); - } else if ((idx = line.indexOf(' ')) == -1) { - throw new SRMProtocolException(RDS_PV_ERR + line); - } else { - key = line.substring(0, idx); - val = line.substring(idx + 1); - if (key.equals(RDERR)) { - throw new SRMProtocolException("RDS error: " + val); - } - } - } - - } catch (IOException e) { - throw new SRMProtocolException("Cannot read 'rds' input, " + - e.getMessage()); - } - - } // end parseKeyValue - - /** - * To synchronize the protocol wait for RDS prompt and then send - * a given command to RDS. - * @param cmd defines the rds command, -S -p ... - * @throws SRMProtocolException if a protocol violation has occurred. - */ - private void wrCmd(String cmd) throws SRMProtocolException { - - if (checkPrompt()) { - SRMDebug.trace(SRMDebug.RDS_CMD_IFC, "> " + COMMAND + cmd); - pw.println(COMMAND + cmd); - pw.flush(); - } else { - throw new SRMProtocolException( - "Cannot execute \"" + cmd + "\" command"); - } - - } // end wrCmd - - /** - * Read the data stream and wait for RDS prompt. This will synchronize - * the protocol flow. - * @throws SRMProtocolException if a protocol violation has occurred. - */ - private boolean checkPrompt() throws SRMProtocolException { - - int tries = 1000; - int idx; - try { - while (tries-- > 0) { - if ((line = in.readLine()) != null) { - SRMDebug.trace(SRMDebug.RDS_CMD_IFC, "< " + line); - if ((idx = line.indexOf(' ')) == -1) { - key = line; - if (key.equals(PROMPT)) { - return true; - } else { - continue; - } - } else { - key = line.substring(0, idx); - val = line.substring(idx + 1); - if (key.equals(RDERR)) { - throw new SRMProtocolException("RDS error: " + val); - } else if (key.equals(PROMPT)) { - return false; - } else { - continue; - } - } - - } else { - throw new SRMProtocolException("Cannot read 'rds' prompt"); - } - } - - } catch (IOException e) { - throw new SRMProtocolException("Cannot read 'rds' prompt," + - e.getMessage()); - } - return false; - - } // end checkPrompt - - /** - * Check if rds is still running - */ - private boolean checkRDSrunning() { - - try { - exitV = p.exitValue(); - return false; - } catch (IllegalThreadStateException e) { - return true; - } - } - - /** - * Dump remianders from rds stderr stream. - */ - private void dumpStdErr() { - String inLine; - - try { - while (err.ready()) { - inLine = err.readLine(); - SRMDebug.trace2("RDS stderr: " + inLine); - } - } catch (IOException e) { - SRMDebug.trace(SRMDebug.TRACE_ALL, e.getMessage()); - } - } - - private synchronized String readLine() - throws IOException { - - return in.readLine(); - } - - /** - * This thread carries out the public methods start, update, - * alive, close and shutdown in its own execution thread. The caller - * of these methods waits for the results the from him specified timeout. - */ - class SRMWorker extends Thread { - // internal code method calls - private final static int START_METHOD = 1; - private final static int UPDATE_METHOD = 2; - private final static int ALIVE_METHOD = 3; - private final static int CLOSE_METHOD = 4; - private final static int SHUTDOWN_METHOD = 5; - // last method's exception is end in ran method and checked - // in - private SRMProtocolException methodException; - // method to be called in run - private int methodToRun; - private boolean methodFinished = false; - // args to be passed in run - private String args; - private String argsArray[]; - // All clients should check this flag before calling notifyAll(). - // If false, the client should call wait() and wait till this - // thread is executing its run() method. - private boolean readyToRun = false; - - public SRMWorker() { - super("SRMWorker"); - } - - public void start(String []cmdArgs, int timeout) - throws SRMProtocolException { - argsArray = cmdArgs; - runMethod(START_METHOD, timeout); - } - public void update(String option, int timeout) - throws SRMProtocolException { - args = option; - runMethod(UPDATE_METHOD, timeout); - } - public void alive(int timeout) throws SRMProtocolException { - args = null; - runMethod(ALIVE_METHOD, timeout); - } - public void close(int timeout) { - args = null; - try { - runMethod(CLOSE_METHOD, timeout); - } catch (SRMProtocolException e) {}; - } - public void shutdown(int timeout) { - args = null; - try { - runMethod(SHUTDOWN_METHOD, timeout); - } catch (SRMProtocolException e) {}; - } - - public synchronized void run() { - - readyToRun = true; // synchronize with posible clients - notifyAll(); - try { - while (true) { - wait(); // wait for task - try { - switch (methodToRun) { - case START_METHOD : _startRDS(argsArray); break; - case UPDATE_METHOD: _getUpdate(args); break; - case ALIVE_METHOD: _alive(); break; - case CLOSE_METHOD : _closeRDS(); break; - case SHUTDOWN_METHOD : _shutdownRDS(); break; - default : methodException = - new SRMProtocolException("unknown method: " + - methodToRun); - } - } catch (SRMProtocolException e) { - // pass it to the caller - methodException = e; - } - methodFinished = true; - notifyAll(); - } - } catch (InterruptedException e) {}; - } - - private synchronized void runMethod(int method, int timeout) - throws SRMProtocolException { - - methodToRun = method; - methodException = null; - methodFinished = false; - try { - // wait till this thread has reached its run method. - if (readyToRun == false) { - wait(timeout); - } - notifyAll(); // kick it off - wait(timeout); - } catch (InterruptedException e) { - return; - } - // pass an exception if any - if (methodException != null) - throw methodException; - // check if the call was finished in the given time - if (methodFinished == false) - throw new - SRMProtocolException("can't execute rds command, timeout"); - } - } - - /** - * An exception thrown by the parsing code if rds reports 'busy'. - */ - class SRMProtocolBusyException extends SRMProtocolException { - - public SRMProtocolBusyException(String s) { - super(s); - } - - } // end class SRMProtocolBusyException - -} // end class SRMDataReader diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMDebug.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMDebug.java deleted file mode 100644 index 0a443fedd1..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMDebug.java +++ /dev/null @@ -1,550 +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" - * - * Copyright (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * SRMDebug.java - */ - - -package com.sun.wbem.solarisprovider.srm; - -import java.io.*; -import java.util.*; -import java.text.*; -import java.sql.Time; - -/** - * This class is a COPY of the com.sun.wbem.client.Debug class. It is - * slightly modified for the srm package requirements. - * - * The Debug class provides the ability to write debug trace statements - * to an output device; either stdout, stderr, or a file. Tracing is - * controlled by two perfprovider properties: - *.p - * ProviderDEBUGLEVEL - Sets the level of detail of tracing statements - * ProviderDEBUGDEVICE - Sets the output device: stdout, sdterr, file - *.p - * The trace level is a combination of detail level and optional - * information to be included on each statement. The level is - * a hexadecimal value from zero to 0xff: - * bits 7 6 5 4 3 2 1 0 - * ^ ^ ^ ^ ^ ^ ^ ^----- - provider method calls - * | | | | | | +------- - provider method return values - * | | | | | +--------- - rds command interface - * | | | | +----------- - rds data flow - * | | | | - * | | | +------------- - thread synchronization - * | | +--------------- - unused - * | +----------------- - unused - * +------------------- - unused - * - * Optional information is - * controlled by adding one or more modifiers to the level number, - * including "t" to include a time stamp, "m" to include the class - * and method name writing the trace statement, and "p" to include - * the thread identifier. Thus, a value for ProviderDEBUGLEVEL - * might appear as - *.p - * ProviderDEBUGLEVEL =01tmp - *.p - * If the debug device is set to "file", a default trace filename - * consisting of the name "wbem_client_mmdd_hhmm" is used for client - * side tracing, and the name "perfprovider_mmdd_hhmm" is used for - * server side tracing. The mmdd_hhmm is the current time the trace - * file is opened. The default directory for the trace file is - * /var/tmp. The debug device may be set to a fully qualified - * file path name, if desired. If the client application cannot - * write to the log file, tracing will be turned off. - * - * @version 1.5 05/29/01 - * @author Sun Microsystems, Inc. - */ -public final class SRMDebug { - - // ===================================================================== - // - // Static define constant to control compilation of trace methods - // - // ===================================================================== - - // If this flag is set to true, the trace method implementation code - // will be active and tracing can be controlled through the runtime - // wbem.debug.level system property. If this flag is set to false, - // the compiler should remove the method implementation, leaving an - // empty method. This should allow JIT compilers to inline these - // methods, resulting in the debugging trace method call being - // removed from the tracing code! - - // XXXX - Typically set to true for development phases, reset to - // XXXX - false for shipped code. - - private static final boolean ON = true; - - // ===================================================================== - // - // Private define constants - // - // ===================================================================== - - private final static String TRACE_DIR = "/var/tmp"; - private final static String TRACE_STDERR_NAME = "stderr"; - private final static int TRACE_OFF = 0; - private final static int TRACE_STDERR = 2; - private final static int TRACE_FILE = 3; - private final static int TRACE_RETRY = 5; - - // ===================================================================== - // - // Private attributes - // - // ===================================================================== - - // Private static attributes - private static boolean trace_init = false; - private static int trace_level = TRACE_OFF; - private static boolean trace_time = false; - private static boolean trace_method = false; - private static boolean trace_thread = false; - private static int trace_out = TRACE_STDERR; - private static FileWriter trace_fw; - private static BufferedWriter trace_bw; - private static PrintWriter trace_pw; - - // ===================================================================== - // - // Public static attributes - // - // ===================================================================== - - static final int METHOD_CALL = 0x01; - static final int METHOD_RETV = 0x02; - static final int RDS_CMD_IFC = 0x04; - static final int RDS_DATAFLW = 0x08; - static final int THREAD_SYNC = 0x10; - static final int UNUSED1 = 0x20; - static final int UNUSED2 = 0x40; - static final int UNUSED3 = 0x80; - static final int TRACE_ALL = 0xFF; - - // ===================================================================== - // - // Public static methods - // - // ===================================================================== - - /** - * The traceOpen method initializes the client or server - * for debug tracing. The level of tracing is specified as a hexadecimal - * from zero (no tracing) to ff (most detailed tracing) with - * optional characters to indicate additional message prefix informatino. - * The trace file name argument can specify output to standard out, - * standard error, or a specific log trace file name. The management - * client and management server will each specify a different trace - * file name. The trace file will be written to the local system's - * /var/log directory. - * - * @param level The debug trace level: {0|1|2|3} + t, m, p - * @param filename The debug trace log file name, stdout, or stderr - */ - public static final void traceOpen(String level, String filename) { - - if (SRMDebug.ON) { - openTrace(level, filename); - } - - } - - /** - * The isOn method returns true if debug tracing is configured - * and the debug trace level is greater than zero (tracing is - * enabled at some level). - * - * @return True if some level of tracing is enabled - */ - public static final boolean isOn() { - - if (SRMDebug.ON) { - if (trace_level > 0) { - return (true); - } - } - return (false); - - } - - /** - * The isOn method returns true if debug tracing is configured - * and the debug trace level mask is equal to the level. - * - * @return True if some level of tracing is enabled - */ - public static final boolean isOn(int level) { - - if (SRMDebug.ON) { - if ((trace_level & level) != 0) { - return (true); - } - } - return (false); - - } - - /** - * This debug trace message method writes the message to the trace - * log device if we are tracing at the level mask given by level. - * - * @param message The debug trace message - */ - public static final void trace(int level, String message) { - - if (SRMDebug.ON) { - if ((trace_level & level) != 0) { - writeTrace(message); - } - } - - } - - /** - * This debug trace message method writes the message and an exception - * stack trace to the log if we are tracing at level 1. - * - * @param message The debug trace message - * @param ex The exception to trace back - */ - public static final void trace1(String message, Throwable ex) { - - if (SRMDebug.ON) { - if (trace_level > 0) { - writeTrace(message); - if (ex != null) { - writeStackTrace(ex); - } - } - } - - } - - /** - * This debug trace message method writes the message to the trace - * log device if we are tracing at level 2. - * - * @param message The debug trace message - */ - public static final void trace2(String message) { - - if (SRMDebug.ON) { - if (trace_level > 1) { - writeTrace(message); - } - } - - } - - /** - * This debug trace message method writes the message and an exception - * stack trace to the log if we are tracing at level 2. - * - * @param message The debug trace message - * @param ex The exception to trace back - */ - public static final void trace2(String message, Throwable ex) { - - if (SRMDebug.ON) { - if (trace_level > 1) { - writeTrace(message); - if (ex != null) { - writeStackTrace(ex); - } - } - } - - } - - /** - * This debug trace message method writes the message to the trace - * log device if we are tracing at level 3. - * - * @param message The debug trace message - */ - public static final void trace3(String message) { - - if (SRMDebug.ON) { - if (trace_level > 2) { - writeTrace(message); - } - } - - } - - /** - * This debug trace message method writes the message and an exception - * stack trace to the log if we are tracing at level 3. - * - * @param message The debug trace message - * @param ex The exception to trace back - */ - public static final void trace3(String message, Throwable ex) { - - if (SRMDebug.ON) { - if (trace_level > 2) { - writeTrace(message); - if (ex != null) { - writeStackTrace(ex); - } - } - } - - } - - // ******************************************************************** - // - // Private methods - // - // ******************************************************************* - - // Internal method to open the trace log file - private static void openTrace(String level, String filename) { - - String trace_file = null; - String trace_sufx = null; - int i; - - if (trace_init) - return; - - // Get the trace level and any optional flags - trace_level = TRACE_OFF; - trace_time = false; - trace_method = false; - trace_thread = false; - if (level != null) { - try { - trace_level = Integer.parseInt(level.substring(0, 2), 16); - } catch (Exception ex) { - trace_level = 0; - } - if (level.indexOf('t') > 0) { - trace_time = true; - } - if (level.indexOf('m') > 0) { - trace_method = true; - } - if (level.indexOf('p') > 0) { - trace_thread = true; - } - } - - // If tracing turned off at runtime, just return. - if (trace_level == 0) { - return; - } - - // Set the output device for tracing. Must be stdout, stderr, - // or a file name. If invalid, set tracing off silently! - if ((filename != null) && (filename.trim().length() != 0)) { - if (filename.equals(TRACE_STDERR_NAME)) - trace_out = TRACE_STDERR; - else { - trace_out = TRACE_FILE; - trace_file = filename.trim(); - } - } else { - // Invalid or null trace file name; default to stderr. - trace_level = TRACE_STDERR; - } - - // If tracing to a file, form the fully qualified path name to the - // file. Trace file suffix is .MMDD_HHMM from current time. - // Trace file will be opened in the system temp directory. - // If it already exists, add a numeric suffix until not found. - if ((trace_out == TRACE_FILE) && (trace_level > 0)) { - if (trace_file.indexOf(File.separatorChar) < 0) { - trace_file = getLogDir() + File.separator + trace_file; - } - SimpleDateFormat sdf = new SimpleDateFormat("MMdd_HHmm"); - trace_sufx = "_" + sdf.format(new Date()); - trace_file = trace_file + trace_sufx; - String name = trace_file; - for (i = 1; i < TRACE_RETRY; i++) { - try { - File fd1 = new File(name); - if (!(fd1.exists())) - break; - name = trace_file + "_" + i; - } catch (Exception ex) { - // Eat exceptions - } - } // End of for - if (i < TRACE_RETRY) { - try { - trace_fw = new FileWriter(name); - trace_bw = new BufferedWriter(trace_fw); - trace_pw = new PrintWriter(trace_bw, true); - } catch (Exception ex) { - // Eat exceptions and turn off tracing if errors - trace_level = 0; - } - } else // File already exists! - trace_level = 0; - } - - // Indicate we have initialized tracing - trace_init = true; - - } - - // Internal method to write an exception stack trace to the log. - - private static void writeStackTrace(Throwable ex) { - - try { - if (trace_out == TRACE_FILE) { - ex.printStackTrace(trace_pw); - } else if (trace_out == TRACE_STDERR) { - ex.printStackTrace(System.err); - } - } catch (Exception x) { - // Eat exceptions - } - - } - - // Return the trace log file directory - - private static String getLogDir() { - - // For now, this is fixed. Need to make is smarter when - // running client on a Wintel machine. - return (TRACE_DIR); - - } - - // Return the class name and method name that called the trace method. - - private static String getClassMethod() { - - String line; - String clm; - - clm = null; - try { - InputStream is = getStackStream(); - BufferedReader br = new BufferedReader(new InputStreamReader(is)); - br.readLine(); // Skip top five lines... - br.readLine(); - br.readLine(); - br.readLine(); - br.readLine(); - line = br.readLine(); // This should be caller from stack - clm = getCaller(line); // Pull out class and method name - br.close(); - } catch (Exception ex) { - clm = "??:??"; // If any errors, don't know names - } - - return (clm); - } - - // Write trace message. Ignore exceptions... - - private static synchronized void writeTrace(String msg) { - - String trace_msg = ""; - if (trace_time) { - Time tim = new Time(System.currentTimeMillis()); - trace_msg = tim.toString() + " | "; - } - if (trace_thread) { - Thread th = Thread.currentThread(); - trace_msg = trace_msg + th.getName() + " | "; - } - if (trace_method) { - trace_msg = trace_msg + getClassMethod() + " | "; - } - trace_msg = trace_msg + msg; - try { - if (trace_out == TRACE_FILE) { - trace_pw.println(trace_msg); - } else if (trace_out == TRACE_STDERR) { - System.err.println(trace_msg); - } - } catch (Exception ex) { - // Eat exceptions - } - - } - - // Get stack trace for determining calling class and method - - private static InputStream getStackStream() { - - ByteArrayInputStream is = null; - ByteArrayOutputStream os = new ByteArrayOutputStream(); - - try { - PrintWriter pw = new PrintWriter(os); - new Exception().printStackTrace(pw); - pw.close(); - is = new ByteArrayInputStream(os.toByteArray()); - } catch (Exception ex) { - is = null; - } - - return (is); - - } - - // Get class name and method name from stack trace line - - private static String getCaller(String line) { - - String str, mth, cls; - int i; - - str = line; - i = line.indexOf('('); - if (i > 0) - str = line.substring(0, i); - i = str.indexOf("at"); - if (i > 0) - str = str.substring(i+3); - i = str.lastIndexOf('.'); - if (i > 0) { - mth = str.substring(i+1); - str = str.substring(0, i); - i = str.lastIndexOf('.'); - if (i > 0) - cls = str.substring(i+1); - else - cls = str; - str = cls + ":" + mth; - } - - return (str); - } - -} diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMException.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMException.java deleted file mode 100644 index 9ba9bc3435..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMException.java +++ /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 - */ -/* - * ident "%Z%%M% %I% %E% SMI" - * - * Copyright (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * SRMException.java - */ - - -package com.sun.wbem.solarisprovider.srm; - - -/** - * The class Exception and its subclasses indicate error conditions in the - * Solaris resource management classes. - */ -class SRMException extends Exception { - - public SRMException() { - super(); - } - - public SRMException(String s) { - super(s); - } - -} // end class SRMException diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMProtocolException.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMProtocolException.java deleted file mode 100644 index 6dced86a3f..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMProtocolException.java +++ /dev/null @@ -1,45 +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" - * - * Copyright (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * SRMProtocolException.java - */ - - -package com.sun.wbem.solarisprovider.srm; - - -/** - * The class Exception indicate error conditions in the - * protocol between rds application and srm classes - */ -class SRMProtocolException extends SRMException { - - public SRMProtocolException(String s) { - super(s); - } - -} // end class SRMProtocolException diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMProvider.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMProvider.java deleted file mode 100644 index eb77fadcaa..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMProvider.java +++ /dev/null @@ -1,585 +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 (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * SRMProvider.java - */ - - -package com.sun.wbem.solarisprovider.srm; - -import javax.wbem.cim.*; -import javax.wbem.client.*; -import javax.wbem.provider.*; -import javax.wbem.query.*; - -import com.sun.wbem.utility.log.*; -import com.sun.wbem.utility.authorization.AuthorizationUtility; -import com.sun.wbem.solarisprovider.common.ProviderUtility; - -import java.util.Vector; - - -/** - * This is the base class for the SRM providers. - * It contains default implementations of the WBEM provider API methods which - * return the CIM_ERR_NOTSUPPORTED error. Each concrete user manager provider - * subclass overrides the methods with its own implementation. This class also - * contains several utility methods which may be useful to the individual - * provider classes. - * @author Sun Microsystems - */ -public abstract class SRMProvider - implements InstanceProvider, MethodProvider, SRMProviderProperties { - - /** - * The handle to the CIMOM. - */ - private CIMOMHandle cimomhandle = null; - - /** - * Handle to the log service. - */ - LogUtil logUtil = null; - - /** - * Some often used exception are defined here to save some memory. - */ - protected static final CIMProviderException notFoundEx = - new CIMProviderException(CIMException.CIM_ERR_NOT_FOUND); - - protected static final CIMProviderException generalEx = - new CIMProviderException(CIMProviderException.GENERAL_EXCEPTION); - - protected static final CIMException notSupported = - new CIMException(CIMException.CIM_ERR_NOT_SUPPORTED); - - /** - * Severity indicator 'ERROR' for logging. - */ - protected static final int LOGERROR = LogUtil.ERROR; - - /** - * Severity indicator 'WARNING' for logging. - */ - protected static final int LOGWARNING = LogUtil.WARNING; - - /** - * Severity indicator 'INFO' for logging. - */ - protected static final int LOGINFO = LogUtil.INFO; - - /** - * Classname of resource messages for logging. - */ - protected static final String RESOURCEBUNDLE = - "com.sun.wbem.solarisprovider.srm.resources.LogMessages"; - - /** - * Handle to the resource monitor, which controls the access - * into the resource data cache (DataModel). - */ - ResourceMonitor resourceMonitor; - - /** - * This must be implemented by each subclass to make its - * class name visible. - * @returns String provider class name - */ - protected abstract String getProviderName(); - - - // - // Default implementations of the WBEM Provider API methods - // - - - /** - * Called by the CIMOM when the provider is initialized. - * - * @exception CIMException the client connection failed - */ - public void initialize(CIMOMHandle cimomhandle) - throws CIMException { - - int updateTime = -1; - int rdsTimeout = -1; - int rdsInterval = -1; - - // Save the cimomhandle. - this.cimomhandle = cimomhandle; - - // Establish the logging facility - logUtil = LogUtil.getInstance(cimomhandle); - - try { - if (Util.propertyUPDATETIME != null) { - updateTime = Integer.parseInt(Util.propertyUPDATETIME); - } - if (Util.propertyRDSTIMEOUT != null) { - rdsTimeout = Integer.parseInt(Util.propertyRDSTIMEOUT); - } - if (Util.propertyRDSINTERVAL != null) { - rdsInterval = Integer.parseInt(Util.propertyRDSINTERVAL); - } - } catch (Exception e) { }; - - try { - resourceMonitor = ResourceMonitor.getHandle(); - resourceMonitor.openDataModel(rdsTimeout, rdsInterval, updateTime); - } catch (Exception e) { - String msg = writeLog(LOGERROR, "SRM_1000", "SRM_10000"); - writeLog(LOGERROR, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - - } // end initialize - - /** - * Called by the CIMOM when the provider is removed. Currently the CIMOM - * does not remove providers, but this method is provided for future - * versions. - * - * @exception CIMException The method cleanup() throws a CIMException. - */ - public void cleanup() throws CIMException { - - SRMDebug.trace(SRMDebug.METHOD_CALL, "closing rds data model"); - resourceMonitor.closeDataModel(); - } - - /** - * This method must be implemented by instance providers to create - * the instance specified in the object path. If the instance does - * exist, CIMInstanceException with ID CIM_ERR_ALREADY_EXISTS - * must be thrown. The parameter should be the instance name. - * - * @param op The path of the instance to be set. The important part - * in this parameter is the namespace component. - * @param ci The instance to be set. - * @return CIMObjectPath of the instance that was created. - * @exception CIMException This method throws a CIMException. - */ - public synchronized CIMObjectPath createInstance(CIMObjectPath op, - CIMInstance ci) - throws CIMException { - - throw notSupported; - } - - /** - * Retrieves the instance specified in the argument CIMObjectPath. - * - * @param op - the name of the instance to be retrieved. This must include - * all of the keys and values for the instance. - * @param localOnly - if true, only the local properties of the class are - * returned, otherwise all properties are required - * @param includeQualifiers - if true, the qualifiers are returned as part - * of of the returned instancei, otherwise no qualifiers will be returned - * @param includeClassOrigin - if true, the class origin of each property - * will be returned - * @param String[] - if null, all properties are returned, otherwise only - * the properties specified will be returned. Any duplicate properties will - * be ignored. - * @param cc - the class reference - * - * @return CIMInstance the retrieved instance. - * @exception CIMException - the method getInstance throws a CIMException - * if the CIMObjectPath is incorrect or does not exist. - */ - public synchronized CIMInstance getInstance(CIMObjectPath op, - boolean localOnly, - boolean includeQualifiers, - boolean includeClassOrigin, - String[] propList, - CIMClass cc) - throws CIMException { - - throw notSupported; - } - - /** - * This method must be implemented by instance providers to set - * the instance specified in the object path. If the instance does - * not exist, CIMInstanceException with ID CIM_ERR_NOT_FOUND - * must be thrown. The parameter should be the instance name. - * - * @param op The path of the instance to be set. The important part - * in this parameter is the namespace component. - * @param ci The instance to be set. - * @exception CIMException The setInstance method throws a CIMException. - */ - public synchronized void setInstance(CIMObjectPath op, - CIMInstance ci) - throws CIMException { - - throw notSupported; - } - - /** - * This method must be implemented by instance providers to delete - * the instance specified in the object path. - * - * @param ci The instance to be deleted. - * @exception CIMException The deleteInstance method throws a - * CIMException. - */ - public synchronized void deleteInstance(CIMObjectPath op) - throws CIMException { - - throw notSupported; - } - - /** - * Enumerates all instances of the class which is specified by the - * CIMObjectPath argument. The entire instances and not just the names - * are returned. - * - * @param op - the object path specifies the class to be enumerated - * localOnly - if true, only the local properties of the class are returned, - * otherwise all properties are required - * @param includeQualifiers - if true, the qualifiers are returned as part - * of of the returned instancei, otherwise no qualifiers will be returned - * @param includeClassOrigin - if true, the class origin of each property - * will be returned - * @param String[] - if null, all properties are returned, otherwise only - * the properties specified will be - * returned. Any duplicate properties will be ignored. - * @param cc - the class reference - * @return An array of CIMInstance - * @exception CIMException - if the CIMObjectPath is incorrect or does not - * exist. - */ - public synchronized CIMInstance[] enumerateInstances(CIMObjectPath op, - boolean localOnly, - boolean includeQualifiers, - boolean includeClassOrigin, - String[] propList, - CIMClass cc) - throws CIMException { - - throw notSupported; - } - - /** - * Enumerates all of the instances of the class which is specified by - * the CIMObjectPath argument. Only the class name portion of the - * CIMObjectPath argument is used, any additional information will be - * ignored - * - * @param op - the class name to enumerate the instances - * @param cc - the class reference passed to the provider - * @return an array of CIMObjectPath containing names of the enumerated - * instances. - * @exception CIMException - if the classname is null or does not exist. - */ - public synchronized CIMObjectPath[] enumerateInstanceNames(CIMObjectPath op, - boolean deep, - CIMClass cc) - throws CIMException { - - throw notSupported; - } - - /** - * This method must be implemented by instance providers to enumerate - * instances of the class which is specified in op which meet the criteria - * defined by the query string. - * - * @param op The object path specifies the class that must - * be enumerated. - * @param query The criteria. - * @param ql The CIM query. - * @param cc The class reference. - * @return CIMInstance The retrieved instance. - * @exception CIMException This method throws a CIMException message if the - * if operation is not supported. - */ - public synchronized CIMInstance[] execQuery(CIMObjectPath op, - String query, - String ql, - CIMClass cc) - throws CIMException { - - writeLog(LOGINFO, - "SRM_0001", - "SRM_5003", - op.toString(), query, ql); - - throw notSupported; - } - - /** - * This method contains the implementation for the method. The CIMOM calls - * this method when the method specified in the parameters is to be invoked. - * @param op Contains the path to the instance whose method must be - * invoked. - * @param methodName The name of the method. - * @param inParams This is a vector of CIMValues which are the input - * parameters for the method. - * @param outParams This is a vector of CIMValues which are the output - * parameters for the method. - * @return CIMValue The return value of the method. If the method has no - * return value, it must return null. - * @exception CIMException This method throws a CIMException - */ - public synchronized CIMValue invokeMethod(CIMObjectPath op, - String methodName, Vector inParams, Vector outParams) - throws CIMException { - - SRMDebug.trace(SRMDebug.METHOD_CALL, op.toString() + methodName); - if (methodName.equalsIgnoreCase("getBulkData")) { - return getBulkData(outParams); - } else { - throw new CIMMethodException(CIMMethodException.NO_SUCH_METHOD, - methodName, op.getObjectName()); - } - - } // end invokeMethod - - /** - * This method contains the implementation for the method. The CIMOM calls - * this method when the method specified in the parameters is to be invoked. - * @param op Contains the path to the instance whose method must be - * invoked. - * @param methodName The name of the method. - * @param outParams This is a vector of CIMValues which are the output - * parameters for the method. - * @return CIMValue The return value of the method. If the method has - * no return value, it must return null. - * @exception CIMException The invokeMethod method throws a CIMException. - */ - protected CIMValue getBulkData(Vector outParams) - throws CIMException { - throw notSupported; - } - - // - // Logging methods. - // - - /** - * Utility logging method. - * @return the log message. - * @param severity the reported severity level. - * @param x an Exception to be logged. - */ - protected String writeLog(int severity, Exception x) { - return writeLog(severity, x.toString()); - } - - - /** - * Utility logging method. - * @return the log message. - * @param severity the reported severity level. - * @param summary the short summary to be logged. - * @param x an Exception to be logged. - */ - protected String writeLog(int severity, - String summary, - Exception x) { - return writeLog(severity, summary, x.toString()); - } - - - /** - * Utility logging method. - * @return the log message. - * @param severity the reported severity level. - * @param summary the short summary to be logged. - * @param detail the detailed message to be logged. - * @param x an Exception to be logged. - */ - protected String writeLog(int severity, - String summary, - String detail, - Exception x) { - return writeLog(severity, summary, detail, x.toString()); - } - - - /** - * Utility logging method. - * @return the log message. - * @param severity the reported severity level. - * @param summary the short summary to be logged. - */ - protected String writeLog(int severity, String summary) { - return writeLog(severity, - summary, - null, - null, - null, - null, - null); - } - - - /** - * Utility logging method. - * @return the log message. - * @param severity the reported severity level. - * @param summary the short summary to be logged. - * @param detail the detailed message to be logged. - */ - protected String writeLog(int severity, - String summary, - String detail) { - return writeLog(severity, - summary, - detail, - null, - null, - null, - null); - } - - - /** - * Utility logging method. - * @return the log message. - * @param severity the reported severity level. - * @param summary the short summary to be logged. - * @param detail the detailed message to be logged. - * @param arg1 the first parameter to substitute - * into the logged message. - */ - protected String writeLog(int severity, - String summary, - String detail, - String arg1) { - return writeLog(severity, - summary, - detail, - arg1, - null, - null, - null); - } - - - /** - * Utility logging method. - * @return the log message. - * @param severity the reported severity level. - * @param summary the short summary to be logged. - * @param detail the detailed message to be logged. - * @param arg1 the first parameter to substitute - * into the logged message. - * @param arg2 the second parameter to substitute - * into the logged message. - */ - protected String writeLog(int severity, - String summary, - String detail, - String arg1, - String arg2) { - return writeLog(severity, - summary, - detail, - arg1, - arg2, - null, - null); - } - - - /** - * Utility logging method. - * @return the log message. - * @param severity the reported severity level. - * @param summary the short summary to be logged. - * @param detail the detailed message to be logged. - * @param arg1 the first parameter to substitute - * into the logged message. - * @param arg2 the second parameter to substitute - * into the logged message. - * @param arg3 the third parameter to substitute - * into the logged message. - */ - protected String writeLog(int severity, String summary, - String detail, - String arg1, - String arg2, - String arg3) { - return writeLog(severity, - summary, - detail, - arg1, - arg2, - arg3, - null); - } - - - /** - * Utility logging method (bottom-level implementation). - * @return a formatted version of the log message - * (: ). - * @param severity the reported severity level. - * @param summary the short summary to be logged. - * @param detail the detailed message to be logged. - * @param arg1 the first parameter to substitute into the logged message. - * @param arg2 the second parameter to substitute into the logged message. - * @param arg3 the third parameter to substitute into the logged message. - * @param arg4 the fourth parameter to substitute into the logged message. - */ - protected String writeLog(int severity, - String summary, - String detail, - String arg1, - String arg2, - String arg3, - String arg4) { - String[] args = {arg1, arg2, arg3, arg4}; - String logmsg = ""; - - try { - logUtil.writeLog( - getProviderName(), - summary, - detail, - args, - "", - true, - LogUtil.APPLICATION_LOG, - severity, - RESOURCEBUNDLE); - - logmsg = getProviderName() + - ": " + - logUtil.getSummaryMesg(summary, true, RESOURCEBUNDLE); - } catch (Exception x) { - System.err.println("writeLog threw " + x); - x.printStackTrace(); - } - - return logmsg; - } - - protected static String getBundleName() { - return (RESOURCEBUNDLE); - } - -} // end class SRMProvider diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMProviderDataModel.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMProviderDataModel.java deleted file mode 100644 index 5b5c086992..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMProviderDataModel.java +++ /dev/null @@ -1,231 +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 (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * SRMProviderDataModel.java - */ - - -package com.sun.wbem.solarisprovider.srm; - -import javax.wbem.cim.*; - -import java.util.LinkedHashMap; -import java.util.Iterator; -import java.util.Vector; - -/** - * This is the base class for the SRM provider data models. - * @author Sun Microsystems - */ -abstract class SRMProviderDataModel implements SRMProviderProperties { - - /* - * The updated flag is set if this data model has been updated, data model - * be reomoved from their list.that hasn't been - */ - private boolean updated; - private CIMObjectPath op; // the CIM object path to 'ci' - protected CIMInstance ci; // the CIM instance of this data model - protected Vector opProperties; // object path properties - - /** - * The keyValTab table contains, for each properties of the CIM class, - * one entry, where the hash key is the key from the RDS protocol and - * the hash value is a object of a class that implements the - * PropertyAccessInterface interface. It knows the type of the property - * and consequently how to access it. - */ - protected LinkedHashMap keyValTab; - - // Computer name, common for all instances - protected static String csName = null; - // OS name, common for all instances - protected static String osName = null; - // provider's key name - protected String name = null; - - - /** - * Constructor, initialize the keyValTab. So, the setProperty() method can - * find the suitable property access object. - */ - public SRMProviderDataModel() { - initKeyValTable(); - } - - /** - * Get a cim object path to a Solaris_SRMxxy object. - * @param cc - the class reference - * @return object path to a Solaris_SRMxxyy instance - * hosted by this object. - */ - public CIMInstance getCIMInstance(CIMClass cc) { - - if (ci == null) { - ci = cc.newInstance(); - Iterator i = keyValTab.values().iterator(); - while (i.hasNext()) { - ((PropertyAccessInterface) i.next()). - set(ci, PropertyAccessInterface.FLUSH, null); - } - setCIMInstance(true); - } - return ci; - } - - /** - * Get a CIM object path to the CIM instance hosted by this object. - * @param elementName The name of the instance - * @return object path to the CIM instance hosted by this object. - */ - public CIMObjectPath getCIMObjectPath(String elementName) { - - if (op == null) { - op = new CIMObjectPath(elementName); - op.setNameSpace(NAMESPACE); - if (opProperties == null) { - opProperties = new Vector(); - setOpPropertiesVector(); - } - op.setKeys(opProperties); - } - return op; - } - - /** - * Return all properties of this CIM instance as a string of name and - * values pairs. - * @return String of properties name and value pairs. - */ - public String toString() { - - Iterator i = keyValTab.values().iterator(); - StringBuffer sb = new StringBuffer(); - while (i.hasNext()) { - sb.append(((PropertyAccessInterface) i.next()).toString()); - } - return sb.toString(); - } - - /** - * Return all property values of this CIM instance as a string. The - * values are in order defined in mof file and separated by ' '. - * @return String of property values separated by ' '. - */ - public String toBulkData() { - - Iterator i = keyValTab.values().iterator(); - StringBuffer sb = new StringBuffer(); - sb.append(name + ' '); - while (i.hasNext()) { - sb.append(((PropertyAccessInterface) i.next()).getValue() + ' '); - } - sb.append("\n"); - return sb.toString(); - } - - /** - * Set a property to the given value. Which property and how to access it - * will be find in the keyValTab according to the given key. - * @param key hash key value - * @param val the property value - */ - void setProperty(String key, String val) { - - PropertyAccessInterface ac; - - if ((ac = (PropertyAccessInterface) keyValTab.get(key)) == null) { - /* - * The rds has sent unknown key value pair, - * just keep it secret - */ - } else { - /* - * Since, this method can be called before the cim instance has been - * created we have to check that. - * If ci hasn't been created keep the value in cache, otherwise - * write it through the cache into the CIM instance. - */ - ac.set(ci, (ci == null) ? PropertyAccessInterface.CACHE : - PropertyAccessInterface.CHECK_WTHROUGH, val); - } - - } // end setProperty - - /** - * If the value v is different form the current property value, - * set a string property. - * @param b force to set the property - * @param n the name of the property - * @param v the property value - */ - void setStrProp(boolean b, String n, String v) { - - if (b || v.equals((String) (ci.getProperty(n).getValue().getValue()))) - ci.setProperty(n, new CIMValue(v)); - } - - /** - * Should be used to mark this data model as updated. - * @param b true marks this model as currently updated. - */ - void setUpdated(boolean b) { - updated = b; - } - - /** - * Returns true if this data model has been updated in the last update - * process. - * @return the updated flag - */ - boolean isUpdated() { - return updated; - } - - /** - * Set additional properties, that can't be set through the setProperty - * method. - * @param newInstance indicates a new instance and therefore force to - * to set all properties. - * @return the updated flag - */ - abstract protected void setCIMInstance(boolean newInstance); - - /** - * Set the properties of the CIM object path instance. The properties - * are saved in the opProperties class field. - */ - abstract protected void setOpPropertiesVector(); - - /** - * Set the keyValTab hash table. - * The keyValTab table contains, for each properties of the CIM class, - * one entry, where the hash key is the key from the RDS protocol and - * the hash value is a object of a class that implements the - * PropertyAccessInterface interface. This object knows the type of - * the property and consequently how to access it. - */ - abstract protected void initKeyValTable(); - -} // end class SRMProviderDataModel diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMProviderProperties.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMProviderProperties.java deleted file mode 100644 index 67aff31cc8..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SRMProviderProperties.java +++ /dev/null @@ -1,211 +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 (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * SRMProviderProperties.java - */ - - -package com.sun.wbem.solarisprovider.srm; - -/** - * This class defines common properties used in Acacia - * providers. - * @author SMI - */ -public interface SRMProviderProperties { - - // Solaris classes - - /** - * CIM class name - */ - static final String SOLARIS_ACTIVEPROJECT = "Solaris_ActiveProject"; - - /** - * CIM class name - */ - static final String SOLARIS_ACTIVEUSER = "Solaris_ActiveUser"; - - /** - * CIM class name - */ - static final String SOLARIS_ACTIVEUSERPROCESSAGGREGATESTATISTICS = - "Solaris_ActiveUserProcessAggregateStatistics"; - - /** - * CIM class name - */ - static final String SOLARIS_ACTIVEPROJECTPROCESSAGGREGATESTATISTICS = - "Solaris_ActiveProjectProcessAggregateStatistics"; - - /** - * CIM class name - */ - static final String SOLARIS_PROCESSSTATISTICS = - "Solaris_ProcessStatistics"; - - /** - * CIM class name - */ - static final String SOLARIS_PROCESSSTATISTICALINFORMATION = - "Solaris_ProcessStatisticalInformation"; - - /** - * CIM class name - */ - static final String SOLARIS_PROCESS = - "Solaris_Process"; - - /** - * CIM class name - */ - static final String SOLARIS_PROCESSAGGREGATESTATISTICALINFORMATION = - "Solaris_ProcessAggregateStatisticalInformation"; - - /** - * CIM class name - */ - static final String SOLARIS_USERPROCESSAGGREGATESTATISTICALINFORMATION = - "Solaris_UserProcessAggregateStatisticalInformation"; - - /** - * CIM class name - */ - static final String SOLARIS_PROJECTPROCESSAGGREGATESTATISTICALINFORMATION = - "Solaris_ProjectProcessAggregateStatisticalInformation"; - - /** - * CIM class name - */ - static final String SOLARIS_PROCESSAGGREGATESTATISTICS = - "Solaris_ProcessAggregateStatistics"; - - - // Common properties - - /** - * Reference to the monitoring object - */ - static final String ELEMENT = "Element"; - - /** - * Reference to the statistical information object - */ - static final String STATS = "Stats"; - static final String NAME = "Name"; - - /** - * The scoping ComputerSystem's CreationClassName. - */ - static final String CSCREATIONCLASSNAME = "CSCreationClassName"; - - /** - * The scoping ComputerSystem's Name. - */ - static final String CSNAME = "CSName"; - - /** - * The key of CSNAME property in RDS protocol - */ - static final String CSNAME_KEY = "sys_name"; - - /** - * The scoping OperatingSystem's CreationClassName. - */ - static final String OSCREATIONCLASSNAME = "OSCreationClassName"; - - /** - * The scoping OperatingSystem's Name. - */ - static final String OSNAME = "OSName"; - - /** - * The key of OSNAME property in RDS protocol - */ - static final String OSNAME_KEY = "sys_nodename"; - - /** - * CreationClassName indicates the name of the class or the subclass - * used in the creation of an instance. When used with the other key - * properties of this class, this property allows all instances of - * this class and its subclasses to be uniquely identified. - */ - static final String CREATIONCLASSNAME = "CreationClassName"; - - /** - * The scoping ComputerSystem's CreationClassName. - */ - static final String SYSTEMCREATIONCLASSNAME = "SystemCreationClassName"; - - /** - * The scoping ComputerSystem's Name. - */ - static final String SYSTEMNAME = "SystemName"; - - - // properties in the CIM_ManagedElement supersupersuperclass - - /** - * The Caption property is a short textual description (one-line string - * of the object. - */ - static String CAPTION = "Caption"; - - /** - * The Description property provides a textual description of the object. - */ - static String DESCRIPTION = "Description"; - - - // properties in the CIM_ManagedSystemElement supersuperclass - - /** - * A datetime value indicating when the object was installed. A lack of - * a value does not indicate that the object is not installed. - */ - static String INSTALL_DATE = "InstallDate"; - - static String STATUS = "Status"; - - - // properties in the CIM_Process - static String HANDLE = "Handle"; - - - // common properties value - - /** - * Value of the SOLARIS_CSCREATIONCLASSNAME property - */ - static String SOLARIS_COMPUTERSYSTEM = "Solaris_ComputerSystem"; - - /** - * Value of the SOLARIS_OSCREATIONCLASSNAME property - */ - static String SOLARIS_OPERATINGSYSTEM = "Solaris_OperatingSystem"; - - - // common constants - static String NAMESPACE = "root/cimv2"; -} diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SetProp.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SetProp.java deleted file mode 100644 index 586c94c3c0..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SetProp.java +++ /dev/null @@ -1,80 +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 (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * SetProp.java - */ - - -package com.sun.wbem.solarisprovider.srm; - -import javax.wbem.cim.*; - -/** - * This is the base class for set property classes. Each - * derived class can format a string into one CIM data format. - * @author Sun Microsystems - */ -abstract class SetProp implements PropertyAccessInterface { - - protected String n; // the property name - protected String vs; // property value as a string - - /** - * Constructor - * @param n - the name of this property - */ - public SetProp(String name) { - n = name; - } - - /** - * Set the property value. Depending of the action flag perform - * the following actions: - * CACHE: only save it in the vs variable - * FLASH: format the value in vs variable and set it in ci instance - * CHECK_WTHROUGH: save val in vs and check if it is deferent form - * the property in ci instance, if so set a new property value. - * @param ci a cim instance - * @param action the action to be done: CACHE, FLASH or CHECK_WTHROUGH - * @param val the property value - */ - abstract public void set(CIMInstance ci, byte action, String val); - - /** - * Returns a formated name value string of this property - * @return formated name value string of this property - */ - public String toString() { - return (n + " " + vs + '\n'); - } - - /** - * Returns value string of this property - * @return value string of this property - */ - public String getValue() { - return vs; - } - -} // end class SetProp diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SetReal32Prop.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SetReal32Prop.java deleted file mode 100644 index c4984091b0..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SetReal32Prop.java +++ /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 - */ -/* - * ident "%Z%%M% %I% %E% SMI" - * - * Copyright (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * SetReal32Prop.java - */ - - -package com.sun.wbem.solarisprovider.srm; - -import javax.wbem.cim.*; - - -class SetReal32Prop extends SetProp { - - private float v; // value - - /** - * Constructor - * @param n - the name of this property - */ - public SetReal32Prop(String name) { - super(name); - } - - /** - * Set the property value. Depending of the action flag perform - * the following actions: - * CACHE: only save it in the vs variable - * FLASH: format the value in vs variable and set it in ci instance - * CHECK_WTHROUGH: save val in vs and check if it is deferent form - * the property in ci instance, if so set a new property value. - * @param ci a cim instance - * @param action the action to be done: CACHE, FLASH or CHECK_WTHROUGH - * @param val the property value - */ - public void set(CIMInstance ci, byte action, String val) - throws NumberFormatException { - - vs = val; - if (action != FLUSH) - v = Float.parseFloat(val); - switch (action) { - case CACHE : break; - case CHECK_WTHROUGH : - if (v == ((Float)(ci.getProperty(n). - getValue().getValue())).floatValue()) - break; - default: ci.setProperty(n, new CIMValue(new Float(v))); - } - } - -} // end class SetReal32Prop diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SetReal64Prop.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SetReal64Prop.java deleted file mode 100644 index d6c33694e2..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SetReal64Prop.java +++ /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 - */ -/* - * ident "%Z%%M% %I% %E% SMI" - * - * Copyright (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * SetReal64Prop.java - */ - - -package com.sun.wbem.solarisprovider.srm; - -import javax.wbem.cim.*; - - -class SetReal64Prop extends SetProp { - - private double v; // value - - /** - * Constructor - * @param n - the name of this property - */ - public SetReal64Prop(String name) { - super(name); - } - - /** - * Set the property value. Depending of the action flag perform - * the following actions: - * CACHE: only save it in the vs variable - * FLASH: format the value in vs variable and set it in ci instance - * CHECK_WTHROUGH: save val in vs and check if it is deferent form - * the property in ci instance, if so set a new property value. - * @param ci a cim instance - * @param action the action to be done: CACHE, FLASH or CHECK_WTHROUGH - * @param val the property value - */ - public void set(CIMInstance ci, byte action, String val) - throws NumberFormatException { - - vs = val; - if (action != FLUSH) - v = Double.parseDouble(val); - switch (action) { - case CACHE : break; - case CHECK_WTHROUGH : - if (v == ((Double)(ci.getProperty(n). - getValue().getValue())).doubleValue()) - break; - default: ci.setProperty(n, new CIMValue(new Double(v))); - } - } - -} // end class SetReal64Prop diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SetStringProp.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SetStringProp.java deleted file mode 100644 index c0ebd6f97b..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SetStringProp.java +++ /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 - */ -/* - * ident "%Z%%M% %I% %E% SMI" - * - * Copyright (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * SetStringProp.java - */ - -package com.sun.wbem.solarisprovider.srm; - -import javax.wbem.cim.*; - -class SetStringProp extends SetProp { - - private String v; // the cached property value - - /** - * Constructor - * @param n - the name of this property - */ - public SetStringProp(String name) { - super(name); - } - - /** - * Set the property value. Depending of the action flag perform - * the following actions: - * CACHE: only save it in the vs variable - * FLASH: format the value in vs variable and set it in ci instance - * CHECK_WTHROUGH: save val in vs and check if it is deferent form - * the property in ci instance, if so set a new property value. - * @param ci a cim instance - * @param action the action to be done: CACHE, FLASH or CHECK_WTHROUGH - * @param val the property value - */ - public void set(CIMInstance ci, byte action, String val) { - - vs = val; - if (action != FLUSH) - v = val; - switch (action) { - case CACHE : break; - case CHECK_WTHROUGH : - if (v.equals((String)(ci.getProperty(n).getValue().getValue()))) - break; - default: ci.setProperty(n, new CIMValue(v)); - } - } - -} // end class SetStringProp diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SetUI32Prop.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SetUI32Prop.java deleted file mode 100644 index d4a581927f..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SetUI32Prop.java +++ /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 - */ -/* - * ident "%Z%%M% %I% %E% SMI" - * - * Copyright (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * SetUI32Prop.java - */ - - -package com.sun.wbem.solarisprovider.srm; - -import javax.wbem.cim.*; - -class SetUI32Prop extends SetProp { - - private int v; // value - - /** - * Constructor - * @param n - the name of this property - */ - public SetUI32Prop(String name) { - super(name); - } - - /** - * Set the property value. Depending of the action flag perform - * the following actions: - * CACHE: only save it in the vs variable - * FLASH: format the value in vs variable and set it in ci instance - * CHECK_WTHROUGH: save val in vs and check if it is deferent form - * the property in ci instance, if so set a new property value. - * @param ci a cim instance - * @param action the action to be done: CACHE, FLASH or CHECK_WTHROUGH - * @param val the property value - */ - public void set(CIMInstance ci, byte action, String val) - throws NumberFormatException { - - vs = val; - if (action != FLUSH) - v = Integer.parseInt(val); - switch (action) { - case CACHE : break; - case CHECK_WTHROUGH : - if (v == ((UnsignedInt32)(ci.getProperty(n). - getValue().getValue())).longValue()) - break; - default: ci.setProperty(n, new CIMValue(new UnsignedInt32(v))); - } - - } // end set - -} // end class SetUI32Prop diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SetUI64Prop.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SetUI64Prop.java deleted file mode 100644 index f2df247d10..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SetUI64Prop.java +++ /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 - */ -/* - * ident "%Z%%M% %I% %E% SMI" - * - * Copyright (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * SetUI64Prop.java - */ - - -package com.sun.wbem.solarisprovider.srm; - -import javax.wbem.cim.*; - -class SetUI64Prop extends SetProp { - - private long v; // value - - /** - * Constructor - * @param n - the name of this property - */ - public SetUI64Prop(String name) { - super(name); - } - - /** - * Set the property value. Depending of the action flag perform - * the following actions: - * CACHE: only save it in the vs variable - * FLASH: format the value in vs variable and set it in ci instance - * CHECK_WTHROUGH: save val in vs and check if it is deferent form - * the property in ci instance, if so set a new property value. - * @param ci a cim instance - * @param action the action to be done: CACHE, FLASH or CHECK_WTHROUGH - * @param val the property value - */ - public void set(CIMInstance ci, byte action, String val) - throws NumberFormatException { - - vs = val; - if (action != FLUSH) - v = Long.parseLong(val); - switch (action) { - case CACHE : break; - case CHECK_WTHROUGH : - if (v == ((UnsignedInt64)(ci.getProperty(n). - getValue().getValue())).longValue()) - break; - default: ci.setProperty(n, new CIMValue(Util.longToUI64(v))); - } - } - -} // end class SetUI64Prop diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ActiveProject.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ActiveProject.java deleted file mode 100644 index 6c88e43d98..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ActiveProject.java +++ /dev/null @@ -1,261 +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 (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * Solaris_ActiveProject.java - */ - - -package com.sun.wbem.solarisprovider.srm; - -import javax.wbem.cim.*; -import javax.wbem.client.*; -import javax.wbem.provider.*; -import javax.wbem.query.*; - -import com.sun.wbem.solarisprovider.common.ProviderUtility; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.Vector; - - -/** - * Provider of the Solaris_ActiveProject class. This class represents - * a Project that is actively running on an OperatingSystem. - * @author Sun Microsystems - */ -public class Solaris_ActiveProject extends SRMProvider - implements Authorizable, Solaris_ActiveProjectProperties { - - /** - * The name of the provider implemented by this class. - */ - protected String providerName = SOLARIS_ACTIVEPROJECT; - - /** - * Get the name of the provider implemented by this class. - * @returns String provider name - */ - protected String getProviderName() { - return providerName; - } - - - /** - * Returns a specific CIMInstance. - * @param op - the name of the instance to be retrieved. This must include - * all of the keys and values for the instance. - * @param localOnly - if true, only the local properties of the class are - * returned, otherwise all properties are required - * @param includeQualifiers - if true, the qualifiers are returned as part - * of of the returned instancei, otherwise no qualifiers will be returned - * @param includeClassOrigin - if true, the class origin of each property - * will be returned - * @param String[] - if null, all properties are returned, otherwise only - * the properties specified will be returned. Any duplicate properties will - * be ignored. - * @param cc - the class reference - * - * @return CIMInstance the retrieved instance. - * @exception CIMException - the method getInstance throws a CIMException - * if the CIMObjectPath is incorrect or does not exist. - */ - public synchronized CIMInstance getInstance(CIMObjectPath op, - boolean localOnly, - boolean includeQualifiers, - boolean includeClassOrigin, - String[] propList, - CIMClass cc) - throws CIMException { - - - String projName = null; - CIMProperty cp; - CIMInstance ci = null; - DataModel dm = null; - ActiveProjectModel apm; - - SRMDebug.trace(SRMDebug.METHOD_CALL, op.toString()); - try { - Enumeration e = op.getKeys().elements(); - while (e.hasMoreElements()) { - cp = (CIMProperty) e.nextElement(); - if (cp.getName().equalsIgnoreCase(PROJECTNAME)) { - projName = - (String) (((CIMValue)(cp.getValue())).getValue()); - } - } - dm = resourceMonitor.getDataModel(false); - if ((apm = dm.getProject(projName)) == null) { - resourceMonitor.releaseDataModel(dm); - throw notFoundEx; - } - ci = apm.getCIMInstance(cc); - dm = resourceMonitor.releaseDataModel(dm); - } catch (Exception e) { - dm = resourceMonitor.releaseDataModel(dm); - String msg = writeLog(LOGERROR, "SRM_1001"); - writeLog(LOGERROR, e); - msg += " (" + e.getClass().toString() + ")"; - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - SRMDebug.trace(SRMDebug.METHOD_RETV, ci.toString()); - return ci; - - } // end getInstance - - - /** - * Returns all instances of Solaris_ActiveProject. - * @param op - the object path specifies the class to be enumerated - * localOnly - if true, only the local properties of the class are returned, - * otherwise all properties are required - * @param includeQualifiers - if true, the qualifiers are returned as part - * of of the returned instancei, otherwise no qualifiers will be returned - * @param includeClassOrigin - if true, the class origin of each property - * will be returned - * @param String[] - if null, all properties are returned, otherwise only - * the properties specified will be - * returned. Any duplicate properties will be ignored. - * @param cc - the class reference - * @return An array of CIMInstance - * @exception CIMException - if the CIMObjectPath is incorrect or does not - * exist. - */ - public synchronized CIMInstance[] enumerateInstances(CIMObjectPath op, - boolean localOnly, - boolean includeQualifiers, - boolean includeClassOrigin, - String[] propList, - CIMClass cc) - throws CIMException { - DataModel dm = null; - - SRMDebug.trace(SRMDebug.METHOD_CALL, op.toString()); - try { - Vector projInstances = new Vector(); - CIMInstance ci; - dm = resourceMonitor.getDataModel(false); - Iterator i = dm.getProjectIterator(); - - while (i.hasNext()) { - ci = ((ActiveProjectModel) i.next()).getCIMInstance(cc); - projInstances.addElement(ci); - } - dm = resourceMonitor.releaseDataModel(dm); - CIMInstance[] ciArray = new CIMInstance[projInstances.size()]; - projInstances.toArray(ciArray); - SRMDebug.trace(SRMDebug.METHOD_RETV, "instance[0]: " + - ciArray[0].toString()); - return ciArray; - } catch (Exception e) { - dm = resourceMonitor.releaseDataModel(dm); - String msg = writeLog(LOGERROR, "SRM_1002"); - writeLog(LOGERROR, e); - msg += " (" + e.getClass().toString() + ")"; - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - - } // end enumerateInstances - - - /** - * Returns the names of all Solaris_ActiveProject instances, - * - * @param op - the class name to enumerate the instances - * @param cc - the class reference passed to the provider - * @return an array of CIMObjectPath containing names of the enumerated - * instances. - * @exception CIMException - if the classname is null or does not exist. - */ - public synchronized CIMObjectPath[] enumerateInstanceNames(CIMObjectPath op, - CIMClass cc) - throws CIMException { - - DataModel dm = null; - - SRMDebug.trace(SRMDebug.METHOD_CALL, op.toString()); - try { - ActiveProjectModel apm; - Vector projInstances = new Vector(); - CIMObjectPath cop; - dm = resourceMonitor.getDataModel(false); - Iterator i = dm.getProjectIterator(); - while (i.hasNext()) { - apm = (ActiveProjectModel) i.next(); - cop = new CIMObjectPath(op.getObjectName(), op.getNameSpace()); - cop.addKey(PROJECTNAME, new CIMValue(apm.name)); - projInstances.addElement(cop); - } - dm = resourceMonitor.releaseDataModel(dm); - CIMObjectPath[] copArray = new CIMObjectPath[projInstances.size()]; - projInstances.toArray(copArray); - SRMDebug.trace(SRMDebug.METHOD_RETV, "instanceName[0]: " - + copArray[0].toString()); - return copArray; - } catch (Exception e) { - dm = resourceMonitor.releaseDataModel(dm); - String msg = writeLog(LOGERROR, "SRM_1002"); - writeLog(LOGERROR, e); - msg += " (" + e.getClass().toString() + ")"; - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - - } // end enumerateInstanceNames - - protected CIMValue getBulkData(Vector outParams) throws CIMException { - DataModel dm = null; - - try { - dm = resourceMonitor.getDataModel(false); - Iterator i = dm.getProjectIterator(); - // Fill the array; each obj takes the bulk data for one user. - Vector vOutParam = new Vector(); - while (i.hasNext()) { - vOutParam.addElement(((ActiveProjectModel) i.next()). - toBulkData()); - } - // rem: we can only return CIMValues in our outParams - CIMDataType dtype = new CIMDataType(CIMDataType.STRING_ARRAY); - CIMValue outVal = new CIMValue(vOutParam, dtype); - outParams.addElement(outVal); - - dm = resourceMonitor.releaseDataModel(dm); - - } catch (Exception e) { - dm = resourceMonitor.releaseDataModel(dm); - String msg = writeLog(LOGERROR, "SRM_1002"); - writeLog(LOGERROR, e); - msg += " (" + e.getClass().toString() + ")"; - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - - CIMValue rv = new CIMValue(new Integer(0)); - return (rv); - } // end getBulkData - -} // end class Solaris_ActiveProject diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ActiveProjectProcessAggregateStatistics.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ActiveProjectProcessAggregateStatistics.java deleted file mode 100644 index 5f806a6dae..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ActiveProjectProcessAggregateStatistics.java +++ /dev/null @@ -1,242 +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 (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * Solaris_ActiveProjectProcessAggregateStatistics.java - */ - - -package com.sun.wbem.solarisprovider.srm; - -import javax.wbem.cim.*; -import javax.wbem.provider.*; - -import java.util.Enumeration; -import java.util.Iterator; -import java.util.Vector; - - -/** - * Provider of the Solaris_ActiveProjectProcessAggregateStatistics class. - * This class represents a link between a Project active on a system and the - * aggregated resource usage of its Process(es). - * @author Sun Microsystems - */ -public class Solaris_ActiveProjectProcessAggregateStatistics - extends SRMProvider { - - /** - * The name of the provider implemented by this class - */ - protected String providerName = - SOLARIS_ACTIVEPROJECTPROCESSAGGREGATESTATISTICS; - - - /** - * Get the name of the provider implemented by this class. - * @returns String provider name - */ - protected String getProviderName() { - return providerName; - } - - - /** - * Returns a specific CIMInstance. - * @param op - the name of the instance to be retrieved. This must include - * all of the keys and values for the instance. - * @param localOnly - if true, only the local properties of the class are - * returned, otherwise all properties are required - * @param includeQualifiers - if true, the qualifiers are returned as part - * of of the returned instancei, otherwise no qualifiers will be returned - * @param includeClassOrigin - if true, the class origin of each property - * will be returned - * @param String[] - if null, all properties are returned, otherwise only - * the properties specified will be returned. Any duplicate properties will - * be ignored. - * @param cc - the class reference - * - * @return CIMInstance the retrieved instance. - * @exception CIMException - the method getInstance throws a CIMException - * if the CIMObjectPath is incorrect or does not exist. - */ - public synchronized CIMInstance getInstance(CIMObjectPath op, - boolean localOnly, - boolean includeQualifiers, - boolean includeClassOrigin, - String[] propList, - CIMClass cc) - throws CIMException { - - CIMObjectPath procaggreCOP = null; - CIMObjectPath activeprojCOP = null; - CIMInstance ci = null; - CIMProperty cp; - - SRMDebug.trace(SRMDebug.METHOD_CALL, op.toString()); - try { - Enumeration e = op.getKeys().elements(); - while (e.hasMoreElements()) { - cp = (CIMProperty) e.nextElement(); - if (cp.getName().equalsIgnoreCase(ELEMENT)) { - activeprojCOP = (CIMObjectPath)((CIMValue)(cp.getValue())). - getValue(); - } - if (cp.getName().equalsIgnoreCase(STATS)) { - procaggreCOP = (CIMObjectPath)((CIMValue)(cp.getValue())). - getValue(); - } - } - - ci = cc.newInstance(); - ci.setProperty(ELEMENT, new CIMValue(activeprojCOP)); - ci.setProperty(STATS, new CIMValue(procaggreCOP)); - - } catch (Exception e) { - String msg = writeLog(LOGERROR, "SRM_1001"); - writeLog(LOGERROR, e); - msg += " (" + e.getClass().toString() + ")"; - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - SRMDebug.trace(SRMDebug.METHOD_RETV, ci.toString()); - return ci; - - } // end getInstance - - - /** - * Enumerates all instances of Solaris_ActiveProjectAggregateStatistics. - * @param op - the object path specifies the class to be enumerated - * localOnly - if true, only the local properties of the class are returned, - * otherwise all properties are required - * @param includeQualifiers - if true, the qualifiers are returned as part - * of of the returned instancei, otherwise no qualifiers will be returned - * @param includeClassOrigin - if true, the class origin of each property - * will be returned - * @param String[] - if null, all properties are returned, otherwise only - * the properties specified will be - * returned. Any duplicate properties will be ignored. - * @param cc - the class reference - * @return An array of CIMInstance - * @exception CIMException - if the CIMObjectPath is incorrect or does not - * exist. - */ - public synchronized CIMInstance[] enumerateInstances(CIMObjectPath op, - boolean localOnly, - boolean includeQualifiers, - boolean includeClassOrigin, - String[] propList, - CIMClass cc) - throws CIMException { - - Vector installedElements = new Vector(); - ActiveProjectModel apm; - CIMObjectPath procaggreCOP; - CIMObjectPath activeprojCOP; - CIMInstance ci; - DataModel dm = null; - - SRMDebug.trace(SRMDebug.METHOD_CALL, op.toString()); - try { - dm = resourceMonitor.getDataModel(false); - for (Iterator i = dm.getProjectIterator(); i.hasNext(); ) { - apm = (ActiveProjectModel) i.next(); - activeprojCOP = apm.getCIMObjectPath(SOLARIS_ACTIVEPROJECT); - procaggreCOP = dm.getProjprocs(apm.name).getCIMObjectPath( - SOLARIS_PROJECTPROCESSAGGREGATESTATISTICALINFORMATION); - ci = cc.newInstance(); - ci.setProperty(ELEMENT, new CIMValue(activeprojCOP)); - ci.setProperty(STATS, new CIMValue(procaggreCOP)); - installedElements.addElement(ci); - } - dm = resourceMonitor.releaseDataModel(dm); - } catch (Exception e) { - dm = resourceMonitor.releaseDataModel(dm); - String msg = writeLog(LOGERROR, "SRM_1002"); - writeLog(LOGERROR, e); - msg += " (" + e.getClass().toString() + ")"; - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - CIMInstance[] ciArray = new CIMInstance[installedElements.size()]; - installedElements.toArray(ciArray); - SRMDebug.trace(SRMDebug.METHOD_RETV, "instance[0]: " - + ciArray[0].toString()); - return ciArray; - - } // end enumerateInstances - - - /** - * Returns all object paths. - * - * @param op - the class name to enumerate the instances - * @param cc - the class reference passed to the provider - * @return an array of CIMObjectPath containing names of the enumerated - * instances. - * @exception CIMException - if the classname is null or does not exist. - */ - public synchronized CIMObjectPath[] - enumerateInstanceNames(CIMObjectPath op, CIMClass cc) - throws CIMException { - - Vector installedElements = new Vector(); - ActiveProjectModel apm; - CIMObjectPath procaggreCOP; - CIMObjectPath activeprojCOP; - CIMObjectPath cop; - DataModel dm = null; - - SRMDebug.trace(SRMDebug.METHOD_CALL, op.toString()); - try { - dm = resourceMonitor.getDataModel(false); - Iterator i = dm.getProjectIterator(); - while (i.hasNext()) { - apm = (ActiveProjectModel) i.next(); - activeprojCOP = apm.getCIMObjectPath(SOLARIS_ACTIVEPROJECT); - procaggreCOP = dm.getProjprocs(apm.name).getCIMObjectPath( - SOLARIS_PROJECTPROCESSAGGREGATESTATISTICALINFORMATION); - cop = new CIMObjectPath(op.getObjectName(), - op.getNameSpace()); - cop.addKey(ELEMENT, new CIMValue(activeprojCOP)); - cop.addKey(STATS, new CIMValue(procaggreCOP)); - installedElements.add(cop); - } - dm = resourceMonitor.releaseDataModel(dm); - } catch (Exception e) { - dm = resourceMonitor.releaseDataModel(dm); - String msg = writeLog(LOGERROR, "SRM_1003"); - writeLog(LOGERROR, e); - msg += " (" + e.getClass().toString() + ")"; - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - CIMObjectPath[] copArray = new CIMObjectPath[installedElements.size()]; - installedElements.toArray(copArray); - SRMDebug.trace(SRMDebug.METHOD_RETV, "instanceName[0]: " - + copArray[0].toString()); - return copArray; - } - -} // end class Solaris_ActiveProjectProcessAggregateStatistics diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ActiveProjectProperties.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ActiveProjectProperties.java deleted file mode 100644 index 4b1552d937..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ActiveProjectProperties.java +++ /dev/null @@ -1,44 +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" - * - * Copyright (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * Solaris_ActiveProjectProperties.java - */ - -package com.sun.wbem.solarisprovider.srm; - -/** - * Defines property names of the Solaris_ActiveProjectProperties class and - * the corresponding keys in the RDS protocol - */ -public interface Solaris_ActiveProjectProperties { - /** The name of the project name property */ - static final String PROJECTNAME = "ProjectName"; - static final String PROJECTNAME_KEY = "prj_name"; - /** The name of the project ID property */ - static final String PROJECTID = "ProjectID"; - static final String PROJECTID_KEY = "prj_id"; -} diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ActiveUser.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ActiveUser.java deleted file mode 100644 index e480100f7e..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ActiveUser.java +++ /dev/null @@ -1,256 +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 (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * Solaris_ActiveUser.java - */ - - -package com.sun.wbem.solarisprovider.srm; - -import javax.wbem.cim.*; -import javax.wbem.client.*; -import javax.wbem.provider.*; -import javax.wbem.query.*; - -import com.sun.wbem.solarisprovider.common.ProviderUtility; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.Vector; - - -/** - * Provider of the Solaris_ActiveUser class. This class represents - * a ActiveUser that is actively running on an OperatingSystem. - * @author Sun Microsystems - */ -public class Solaris_ActiveUser extends SRMProvider - implements Authorizable, Solaris_ActiveUserProperties { - - /** - * The name of the provider implemented by this class. - */ - protected String providerName = SOLARIS_ACTIVEUSER; - - /** - * Get the name of the provider implemented by this class. - * @returns String provider name - */ - protected String getProviderName() { - return providerName; - } - - - /** - * Returns a specific CIMInstance. - * @param op - the name of the instance to be retrieved. This must include - * all of the keys and values for the instance. - * @param localOnly - if true, only the local properties of the class are - * returned, otherwise all properties are required - * @param includeQualifiers - if true, the qualifiers are returned as part - * of of the returned instancei, otherwise no qualifiers will be returned - * @param includeClassOrigin - if true, the class origin of each property - * will be returned - * @param String[] - if null, all properties are returned, otherwise only - * the properties specified will be returned. Any duplicate properties will - * be ignored. - * @param cc - the class reference - * - * @return CIMInstance the retrieved instance. - * @exception CIMException - the method getInstance throws a CIMException - * if the CIMObjectPath is incorrect or does not exist. - */ - public synchronized CIMInstance getInstance(CIMObjectPath op, - boolean localOnly, - boolean includeQualifiers, - boolean includeClassOrigin, - String[] propList, - CIMClass cc) - throws CIMException { - - String userID = null; - CIMProperty cp; - CIMInstance ci; - DataModel dm = null; - ActiveUserModel aum; - - SRMDebug.trace(SRMDebug.METHOD_CALL, op.toString()); - try { - Enumeration e = op.getKeys().elements(); - while (e.hasMoreElements()) { - cp = (CIMProperty) e.nextElement(); - if (cp.getName().equalsIgnoreCase(USERID)) { - userID = (String) (((CIMValue) (cp.getValue())).getValue()); - } - } - - dm = resourceMonitor.getDataModel(false); - if ((aum = dm.getUser(userID)) == null) { - resourceMonitor.releaseDataModel(dm); - throw notFoundEx; - } - ci = aum.getCIMInstance(cc); - dm = resourceMonitor.releaseDataModel(dm); - } catch (Exception e) { - dm = resourceMonitor.releaseDataModel(dm); - String msg = writeLog(LOGERROR, "SRM_1001"); - writeLog(LOGERROR, e); - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - SRMDebug.trace(SRMDebug.METHOD_RETV, ci.toString()); - return ci; - - } // end getInstance - - - /** - * Returns all instances of Solaris_ActiveUser. - * @param op - the object path specifies the class to be enumerated - * localOnly - if true, only the local properties of the class are returned, - * otherwise all properties are required - * @param includeQualifiers - if true, the qualifiers are returned as part - * of of the returned instancei, otherwise no qualifiers will be returned - * @param includeClassOrigin - if true, the class origin of each property - * will be returned - * @param String[] - if null, all properties are returned, otherwise only - * the properties specified will be - * returned. Any duplicate properties will be ignored. - * @param cc - the class reference - * @return An array of CIMInstance - * @exception CIMException - if the CIMObjectPath is incorrect or does not - * exist. - */ - public synchronized CIMInstance[] enumerateInstances(CIMObjectPath op, - boolean localOnly, - boolean includeQualifiers, - boolean includeClassOrigin, - String[] propList, - CIMClass cc) - throws CIMException { - DataModel dm = null; - CIMInstance ci; - - SRMDebug.trace(SRMDebug.METHOD_CALL, op.toString()); - try { - Vector userInstances = new Vector(); - dm = resourceMonitor.getDataModel(false); - Iterator i = dm.getUserIterator(); - while (i.hasNext()) { - ci = ((ActiveUserModel) i.next()).getCIMInstance(cc); - userInstances.addElement(ci); - } - dm = resourceMonitor.releaseDataModel(dm); - CIMInstance[] ciArray = new CIMInstance[userInstances.size()]; - userInstances.toArray(ciArray); - SRMDebug.trace(SRMDebug.METHOD_RETV, "instance[0]: " + - ciArray[0].toString()); - return ciArray; - } catch (Exception e) { - dm = resourceMonitor.releaseDataModel(dm); - String msg = writeLog(LOGERROR, "SRM_1002"); - msg += " (" + e.getClass().toString() + ")"; - writeLog(LOGERROR, e); - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - - } // end enumerateInstances - - - /** - * Returns the names of all Solaris_ActiveUser instances. - * - * @param op - the class name to enumerate the instances - * @param cc - the class reference passed to the provider - * @return an array of CIMObjectPath containing names of the enumerated - * instances. - * @exception CIMException - if the classname is null or does not exist. - */ - public synchronized CIMObjectPath[] enumerateInstanceNames(CIMObjectPath op, - CIMClass cc) - throws CIMException { - DataModel dm = null; - - SRMDebug.trace(SRMDebug.METHOD_CALL, op.toString()); - try { - ActiveUserModel aum; - Vector userInstances = new Vector(); - CIMObjectPath cop; - - dm = resourceMonitor.getDataModel(false); - Iterator i = dm.getUserIterator(); - while (i.hasNext()) { - aum = (ActiveUserModel) i.next(); - cop = new CIMObjectPath(op.getObjectName(), op.getNameSpace()); - cop.addKey(USERID, new CIMValue(aum.name)); - userInstances.addElement(cop); - } - dm = resourceMonitor.releaseDataModel(dm); - CIMObjectPath[] copArray = new CIMObjectPath[userInstances.size()]; - userInstances.toArray(copArray); - SRMDebug.trace(SRMDebug.METHOD_RETV, "instanceName[0]: " - + copArray[0].toString()); - return copArray; - } catch (Exception e) { - dm = resourceMonitor.releaseDataModel(dm); - String msg = writeLog(LOGERROR, "SRM_1003"); - writeLog(LOGERROR, e); - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - - } // end enumerateInstanceNames - - protected CIMValue getBulkData(Vector outParams) throws CIMException { - DataModel dm = null; - - try { - dm = resourceMonitor.getDataModel(false); - Iterator i = dm.getUserIterator(); - // Fill the array; each obj takes the bulk data for one user. - Vector vOutParam = new Vector(); - while (i.hasNext()) { - vOutParam.addElement(((ActiveUserModel) i.next()).toBulkData()); - } - // rem: we can only return CIMValues in our outParams - CIMDataType dtype = new CIMDataType(CIMDataType.STRING_ARRAY); - CIMValue outVal = new CIMValue(vOutParam, dtype); - outParams.addElement(outVal); - - dm = resourceMonitor.releaseDataModel(dm); - - } catch (Exception e) { - dm = resourceMonitor.releaseDataModel(dm); - String msg = writeLog(LOGERROR, "SRM_1002"); - writeLog(LOGERROR, e); - msg += " (" + e.getClass().toString() + ")"; - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - - CIMValue rv = new CIMValue(new Integer(0)); - return (rv); - } // end getBulkData - -} // end class Solaris_ActiveUser diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ActiveUserProcessAggregateStatistics.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ActiveUserProcessAggregateStatistics.java deleted file mode 100644 index 23d5a76b3a..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ActiveUserProcessAggregateStatistics.java +++ /dev/null @@ -1,245 +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 (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * Solaris_ActiveUserProcessAggregateStatistics.java - */ - - -package com.sun.wbem.solarisprovider.srm; - -import javax.wbem.cim.*; -import javax.wbem.provider.*; - -import java.util.Enumeration; -import java.util.Iterator; -import java.util.Vector; - - -/** - * Provider of the Solaris_ProjectProcessAggregateStatisticalInformation class. - * This class represents a link between an User active on a system and the - * aggregated resource usage of its Process(es). - * @author Sun Microsystems - */ -public class Solaris_ActiveUserProcessAggregateStatistics extends SRMProvider { - - /** - * The name of the provider implemented by this class - */ - protected String providerName = - SOLARIS_ACTIVEUSERPROCESSAGGREGATESTATISTICS; - - - /** - * Get the name of the provider implemented by this class. - * @returns String provider name - */ - protected String getProviderName() { - return providerName; - } - - - /** - * Returns a specific CIMInstance - * @param op - the name of the instance to be retrieved. This must include - * all of the keys and values for the instance. - * @param localOnly - if true, only the local properties of the class are - * returned, otherwise all properties are required - * @param includeQualifiers - if true, the qualifiers are returned as part - * of of the returned instancei, otherwise no qualifiers will be returned - * @param includeClassOrigin - if true, the class origin of each property - * will be returned - * @param String[] - if null, all properties are returned, otherwise only - * the properties specified will be returned. Any duplicate properties will - * be ignored. - * @param cc - the class reference - * - * @return CIMInstance the retrieved instance. - * @exception CIMException - the method getInstance throws a CIMException - * if the CIMObjectPath is incorrect or does not exist. - */ - public CIMInstance getInstance(CIMObjectPath op, - boolean localOnly, - boolean includeQualifiers, - boolean includeClassOrigin, - String[] propList, - CIMClass cc) - throws CIMException { - - - CIMObjectPath procaggreCOP = null; - CIMObjectPath activeusrCOP = null; - CIMInstance ci = null; - CIMProperty cp; - - SRMDebug.trace(SRMDebug.METHOD_CALL, op.toString()); - try { - Enumeration e = op.getKeys().elements(); - while (e.hasMoreElements()) { - cp = (CIMProperty)e.nextElement(); - if (cp.getName().equalsIgnoreCase(ELEMENT)) { - activeusrCOP = (CIMObjectPath)((CIMValue)(cp.getValue())). - getValue(); - } - if (cp.getName().equalsIgnoreCase(STATS)) { - procaggreCOP = (CIMObjectPath)((CIMValue)(cp.getValue())). - getValue(); - } - } - - ci = cc.newInstance(); - ci.setProperty(ELEMENT, new CIMValue(activeusrCOP)); - ci.setProperty(STATS, new CIMValue(procaggreCOP)); - - } catch (Exception e) { - String msg = writeLog(LOGERROR, "SRM_1001"); - writeLog(LOGERROR, e); - msg += " (" + e.getClass().toString() + ")"; - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - SRMDebug.trace(SRMDebug.METHOD_RETV, ci.toString()); - return ci; - - } // end getInstance - - - /** - * Enumerates all instances of Solaris_ActiveUserAggregateStatistics. - * @param op - the object path specifies the class to be enumerated - * localOnly - if true, only the local properties of the class are returned, - * otherwise all properties are required - * @param includeQualifiers - if true, the qualifiers are returned as part - * of of the returned instancei, otherwise no qualifiers will be returned - * @param includeClassOrigin - if true, the class origin of each property - * will be returned - * @param String[] - if null, all properties are returned, otherwise only - * the properties specified will be - * returned. Any duplicate properties will be ignored. - * @param cc - the class reference - * @return An array of CIMInstance - * @exception CIMException - if the CIMObjectPath is incorrect or does not - * exist. - */ - public CIMInstance[] enumerateInstances(CIMObjectPath op, - boolean localOnly, - boolean includeQualifiers, - boolean includeClassOrigin, - String[] propList, - CIMClass cc) - throws CIMException { - - Vector installedElements = new Vector(); - DataModel dm = null; - ActiveUserModel aum; - CIMObjectPath procaggreCOP; - CIMObjectPath activeusrCOP; - CIMInstance ci; - - SRMDebug.trace(SRMDebug.METHOD_CALL, op.toString()); - try { - dm = resourceMonitor.getDataModel(false); - Iterator i = dm.getUserIterator(); - while (i.hasNext()) { - aum = (ActiveUserModel) i.next(); - activeusrCOP = aum.getCIMObjectPath(SOLARIS_ACTIVEUSER); - procaggreCOP = dm.getUserprocs(aum.name).getCIMObjectPath( - SOLARIS_USERPROCESSAGGREGATESTATISTICALINFORMATION); - ci = cc.newInstance(); - ci.setProperty(ELEMENT, new CIMValue(activeusrCOP)); - ci.setProperty(STATS, new CIMValue(procaggreCOP)); - installedElements.addElement(ci); - } - dm = resourceMonitor.releaseDataModel(dm); - } catch (Exception e) { - dm = resourceMonitor.releaseDataModel(dm); - String msg = writeLog(LOGERROR, "SRM_1002"); - writeLog(LOGERROR, e); - msg += " (" + e.getClass().toString() + ")"; - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - CIMInstance[] ciArray = new CIMInstance[installedElements.size()]; - installedElements.toArray(ciArray); - SRMDebug.trace(SRMDebug.METHOD_RETV, "instance[0]: " - + ciArray[0].toString()); - return ciArray; - - } // end enumerateInstances - - - /** - * Returns all object paths - * - * @param op - the class name to enumerate the instances - * @param cc - the class reference passed to the provider - * @return an array of CIMObjectPath containing names of the enumerated - * instances. - * @exception CIMException - if the classname is null or does not exist. - */ - public CIMObjectPath[] enumerateInstanceNames(CIMObjectPath op, - CIMClass cc) - throws CIMException { - - Vector installedElements = new Vector(); - DataModel dm = null; - ActiveUserModel aum; - CIMObjectPath procaggreCOP; - CIMObjectPath activeusrCOP; - CIMObjectPath cop; - - SRMDebug.trace(SRMDebug.METHOD_CALL, op.toString()); - try { - dm = resourceMonitor.getDataModel(false); - Iterator i = dm.getUserIterator(); - while (i.hasNext()) { - aum = (ActiveUserModel) i.next(); - activeusrCOP = aum.getCIMObjectPath(SOLARIS_ACTIVEUSER); - procaggreCOP = dm.getUserprocs(aum.name).getCIMObjectPath( - SOLARIS_USERPROCESSAGGREGATESTATISTICALINFORMATION); - cop = new CIMObjectPath(op.getObjectName(), - op.getNameSpace()); - cop.addKey(ELEMENT, new CIMValue(activeusrCOP)); - cop.addKey(STATS, new CIMValue(procaggreCOP)); - installedElements.add(cop); - } - dm = resourceMonitor.releaseDataModel(dm); - } catch (Exception e) { - dm = resourceMonitor.releaseDataModel(dm); - String msg = writeLog(LOGERROR, "SRM_1003"); - writeLog(LOGERROR, e); - msg += " (" + e.getClass().toString() + ")"; - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - - CIMObjectPath[] copArray = new CIMObjectPath[installedElements.size()]; - installedElements.toArray(copArray); - SRMDebug.trace(SRMDebug.METHOD_RETV, "instanceName[0]: " - + copArray[0].toString()); - return copArray; - - } // end enumerateInstanceNames - -} // end class Solaris_ActiveUserProcessAggregateStatistics diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ActiveUserProperties.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ActiveUserProperties.java deleted file mode 100644 index 0702e061db..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ActiveUserProperties.java +++ /dev/null @@ -1,45 +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" - * - * Copyright (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * Solaris_ActiveUserProperties.java - */ - -package com.sun.wbem.solarisprovider.srm; - -/** - * Defines property names of the Solaris_ActiveUse class and - * the corresponding keys in the RDS protocol - */ - -public interface Solaris_ActiveUserProperties { - /** The name of the user name property */ - static final String USERNAME = "UserName"; - static final String USERNAME_KEY = "usr_name"; - /** The name of the user ID property */ - static final String USERID = "UserID"; - static final String USERID_KEY = "usr_id"; -} diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_Performance1.0.mof b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_Performance1.0.mof deleted file mode 100644 index 46dd900a04..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_Performance1.0.mof +++ /dev/null @@ -1,640 +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 - */ -/* - * Title: Resource Utilization and Performance Monitoring - * - * Description: Classes providing visibility to computing resource metrics. - * - * Date: %G% - * - * Version: %I% - * - * Copyright (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * ident "%Z%%M% %I% %E% SMI" - * - */ - - -#pragma Locale ("en_US") - -/* - * User and Project entities. - */ - -//================================================================== -// Solaris_ActiveUser -//================================================================== -[Provider("java:com.sun.wbem.solarisprovider.srm.Solaris_ActiveUser"), - Description( - "Represents a UserAccount that is actively " - "running on an OperatingSystem.") -] -class Solaris_ActiveUser: CIM_LogicalElement -{ - [Propagated("CIM_OperatingSystem.CSCreationClassName"), - Key, - Description ("The scoping ComputerSystem's CreationClassName."), - MaxLen (256) - ] - string CSCreationClassName; - - [Propagated("CIM_OperatingSystem.CSName"), - Key, - Description ("The scoping ComputerSystem's Name."), - MaxLen (256) - ] - string CSName; - - [Propagated("CIM_OperatingSystem.CreationClassName"), - Key, - Description ("The scoping OperatingSystem's CreationClassName."), - MaxLen (256) - ] - string OSCreationClassName; - - [Propagated("CIM_OperatingSystem.Name"), - Key, - Description ("The scoping OperatingSystem's Name."), - MaxLen (256) - ] - string OSName; - - [Key, - Description ( - "CreationClassName indicates the name of the class or the " - "subclass used in the creation of an instance. When used " - "with the other key properties of this class, this property " - "allows all instances of this class and its subclasses to " - "be uniquely identified."), - MaxLen (256) - ] - string CreationClassName; - - [Read, - Description("User Name"), - MaxLen (256) - ] - string UserName; - - [Description( - "Get properties for all instances of Solaris_ActiveUser" - " as an array of strings. Each string contains the values" - " of the UserID and UserName properties for a" - " single instance.") - ] - sint32 getBulkData([OUT] string data[]); - - [Key, - Read, - Description("User ID") - ] - sint32 UserID; - -}; - - -//================================================================== -// Solaris_ActiveProject -//================================================================== -[Provider("java:com.sun.wbem.solarisprovider.srm.Solaris_ActiveProject"), - Description("Represents a Project that is actively" - "running on an OperatingSystem.") -] -class Solaris_ActiveProject: CIM_LogicalElement -{ - [Propagated("CIM_OperatingSystem.CSCreationClassName"), - Key, - Description ("The scoping ComputerSystem's CreationClassName."), - MaxLen (256) - ] - string CSCreationClassName; - - [Propagated("CIM_OperatingSystem.CSName"), - Key, - Description ("The scoping ComputerSystem's Name."), - MaxLen (256) - ] - string CSName; - - [Propagated("CIM_OperatingSystem.CreationClassName"), - Key, - Description ("The scoping OperatingSystem's CreationClassName."), - MaxLen (256) - ] - string OSCreationClassName; - - [Propagated("CIM_OperatingSystem.Name"), - Key, - Description ("The scoping OperatingSystem's Name."), - MaxLen (256) - ] - string OSName; - - [Key, - Description ( - "CreationClassName indicates the name of the class or the " - "subclass used in the creation of an instance. When used " - "with the other key properties of this class, this property " - "allows all instances of this class and its subclasses to " - "be uniquely identified."), - MaxLen (256) - ] - string CreationClassName; - - [Key, - Read, - Description("Project Name"), - MaxLen (256) - ] - string ProjectName; - - [Read, - Description("Project ID") - ] - sint32 ProjectID; - - [Description( - "Get properties for all instances of Solaris_ActiveProject" - " as an array of strings. Each string contains the values" - " of the ProjectID and ProjectName properties for a" - " single instance.") - ] - sint32 getBulkData([OUT] string data[]); -}; - - -/* - * Statistical properties of Processes and Process Aggregates. - */ - -//================================================================== -// Solaris_ProcessStatisticalInformation -//================================================================== -[ -Description("Raw resource utilization measurements for a process.") -] -class Solaris_ProcessStatisticalInformation : CIM_SystemStatisticalInformation -{ - - // CPU state times - - [Read, - Description ( - "The cumulative number of seconds that this process " - "has spent in User mode over its lifetime."), - Units("Seconds") - ] - real64 UserModeTime; - - [Read, - Description ( - "The cumulative number of seconds that this process " - "has spent in System mode over its lifetime."), - Units("Seconds") - ] - real64 SystemModeTime; - - [Read, - Description ( - "The cumulative number of seconds that this process " - "has spent in System Traps over its lifetime."), - Units("Seconds") - ] - real64 SystemTrapTime; - - [Read, - Description ( - "The cumulative number of seconds that this process " - "has spent sleeping in Text Page Faults over its lifetime."), - Units("Seconds") - ] - real64 TextPageFaultSleepTime; - - [Read, - Description ( - "The cumulative number of seconds that this process " - "has spent sleeping in Data Page Faults over its lifetime."), - Units("Seconds") - ] - real64 DataPageFaultSleepTime; - - [Read, - Description ( - "The cumulative number of seconds that this process " - "has spent sleeping in System Page Faults over its lifetime."), - Units("Seconds") - ] - real64 SystemPageFaultSleepTime; - - [Read, - Description ( - "The cumulative number of seconds that this process " - "has spent sleeping on User Lock Waits over its lifetime."), - Units("Seconds") - ] - real64 UserLockWaitSleepTime; - - [Read, - Description ( - "The cumulative number of seconds that this process " - "has spent sleeping in all other ways over its lifetime."), - Units("Seconds") - ] - real64 OtherSleepTime; - - [Read, - Description ( - "The cumulative number of seconds that this process " - "has spent Waiting for CPU over its lifetime."), - Units("Seconds") - ] - real64 WaitCPUTime; - - [Read, - Description ( - "The cumulative number of seconds that this process " - "has spent Stopped over its lifetime."), - Units("Seconds") - ] - real64 StoppedTime; - - - // Event counts - - [Read, - Description ( - "The cumulative number of Minor Page Faults engendered by the " - "process over its lifetime.") - ] - uint64 MinorPageFaults; - - [Read, - Description ( - "The cumulative number of Major Page Faults engendered by the " - "process over its lifetime.") - ] - uint64 MajorPageFaults; - - - [Read, - Description ( - "The cumulative number of swap operations engendered by the " - "process over its lifetime.") - ] - uint64 SwapOperations; - - [Read, - Description ( - "The cumulative number of blocks Read by the process " - "over its lifetime.") - ] - uint64 BlocksRead; - - [Read, - Description ( - "The cumulative number of blocks Written by the process " - "over its lifetime.") - ] - uint64 BlocksWritten; - - [Read, - Description ( - "The cumulative number of Messages Received by the process " - "over its lifetime.") - ] - uint64 MessagesReceived; - - [Read, - Description ( - "The cumulative number of Messages Sent by the process " - "over its lifetime.") - ] - uint64 MessagesSent; - - [Read, - Description ( - "The cumulative number of Signals taken by the " - "process over its lifetime.") - ] - uint64 SignalsReceived; - - [Read, - Description ( - "The cumulative number of Voluntary Context Switches " - "made by the process over its lifetime.") - ] - uint64 VoluntaryContextSwitches; - - [Read, - Description ( - "The cumulative number of Involuntary Context Switches " - "made by the process over its lifetime.") - ] - uint64 InvoluntaryContextSwitches; - - [Read, - Description ( - "The cumulative number of system calls made by the " - "process over its lifetime.") - ] - uint64 SystemCallsMade; - - [Read, - Description ( - "The cumulative number of character I/O bytes " - "Read and Written by the process over its lifetime."), - Units ("Bytes") - ] - uint64 CharacterIOUsage; - - - // Memory usage statistics - - [Read, - Description ( - "The total number of KiloBytes of memory consumed by the " - "process heap at the time that it is sampled."), - Units ("KiloBytes") - ] - uint64 ProcessHeapSize; - - [Read, - Description( - "The size of the process virtual address space " - "in KiloBytes."), - Units ("KiloBytes") - ] - uint64 ProcessVMSize; - - [Read, - Description("The resident set size of the process in KiloBytes "), - Units ("KiloBytes") - ] - uint64 ProcessResidentSetSize; - - - // Composite statistics - - [Read, - Description("The percent CPU time used by the process.") - ] - real32 PercentCPUTime; - - [Read, - Description( - "The ratio of the process resident set size to " - "physical memory.") - ] - real32 PercentMemorySize; - - [Read, - Description( - "Time in User mode and System mode spent by the process," - "in milliseconds. If this information is not available," - "a value of 0 should be used."), - Units("MilliSeconds") - ] - real64 UserSystemModeTime; - - [Read, - Description( - "The number of threads active in the current Process. ") - ] - uint32 NumThreads; - - [Read, - Description ( - "The system clock time at which the sample was taken.") ] - uint64 Timestamp; - - [Override ("Name"), - Key, - Description ("Process ID of the owning process.") - ] - String Name; -}; - - -//================================================================== -// Solaris_UserProcessAggregateStatisticalInformation -//================================================================== -[Provider("java:com.sun.wbem.solarisprovider.srm.Solaris_UserProcessAggregateStatisticalInformation"), - Description( - "Accumulated resource utilization measurements for " - "an aggregation of processes sharing a common User. " - "The (inherited) ProcessStatisticalInformation properties " - "are populated by summing the underlying process' usage. ") -] -class Solaris_UserProcessAggregateStatisticalInformation : - Solaris_ProcessStatisticalInformation -{ - [Description("The number of processes measured in the aggregate.") ] - uint32 NumProcs; - - [Description( - "Get properties for all instances of" - " Solaris_UserProcessAggregateStatisticalInformation" - " as an array of strings. Each string contains the values" - " of a single instance's properties. The values are " - " separated by whitespace and appear in the same order " - " as they do in the MOF definition of the class.") - ] - sint32 getBulkData([OUT] string data[]); - - [Override ("Name"), - Key, - Description ( - "The unique User ID (in String form) of aggregate's owner.") - ] - String Name; -}; - - -//================================================================== -// Solaris_ProjectProcessAggregateStatisticalInformation -//================================================================== -[Provider("java:com.sun.wbem.solarisprovider.srm.Solaris_ProjectProcessAggregateStatisticalInformation"), - Description( - "Accumulated resource utilization measurements for " - "an aggregation of processes sharing a common Project. " - "The (inherited) ProcessStatisticalInformation properties " - "are populated by summing the underlying process' usage. ") -] -class Solaris_ProjectProcessAggregateStatisticalInformation : - Solaris_ProcessStatisticalInformation -{ - [Description("The number of processes measured in the aggregate.") ] - uint32 NumProcs; - - [Description( - "Get properties for all instances of" - " Solaris_ProjectProcessAggregateStatisticalInformation" - " as an array of strings. Each string contains the values" - " of a single instance's properties. The values are " - " separated by whitespace and appear in the same order " - " as they do in the MOF definition of the class.") - ] - sint32 getBulkData([OUT] string data[]); - - [Override ("Name"), - Key, - Description ( - "The unique Project name of the aggregate's owner.") - ] - String Name; -}; - - -/* - * Association between a Process and its statistics. - */ - -//================================================================== -// Solaris_ProcessStatistics -//================================================================== -[Association, - Provider("java:com.sun.wbem.solarisprovider.srm.Solaris_ProcessStatistics"), - Description("An association linking a Solaris_Process and its " - "Solaris_ProcessStatisticalInformation instance.") -] -class Solaris_ProcessStatistics : CIM_SystemStatistics -{ - [Override ("Element"), - Key, - Description ("The Process whose utilization is being monitored.") - ] - Solaris_Process REF Element; - - [Override ("Stats"), - Key, - Description ( - "The statistical information object that contains " - "utilization data for the associated Process.") - ] - Solaris_ProcessStatisticalInformation REF Stats; - -}; - - -/* - * Associations between Users/Projects and Processes/Process Aggregates. - */ -/* -//================================================================== -// Solaris_UserProcessStatistics -//================================================================== -[Association, - Aggregation, - Provider("java:com.sun.wbem.solarisprovider.srm.Solaris_UserProcessStatistics"), - Description("A link between a User active on a system and the " - "Statistics of all Processes running on its behalf.") -] -class Solaris_UserProcessStatistics: CIM_SystemStatistics -{ - [Override ("Element"), - Description ("The User active on a System") - ] - Solaris_ActiveUser REF Element; - - [Override ("Stats"), - Description ("The Process Statistics belonging to the User.") - ] - Solaris_ProcessStatisticalInformation REF Stats; -}; - - -//================================================================== -// Solaris_ProjectProcessStatistics -//================================================================== -[Association, - Aggregation, - Provider("java:com.sun.wbem.solarisprovider.srm.Solaris_ProjectProcessStatistics"), - Description("A link between a Project active on a system and the " - "Statistics of all Processes running on its behalf.") - -] -class Solaris_ProjectProcessStatistics: CIM_SystemStatistics -{ - [Override ("Element"), - Description ("The Project active on a System") - ] - Solaris_ActiveProject REF Element; - - [Override ("Stats"), - Description ("The Process Statistics belonging to the Project") - ] - Solaris_ProcessStatisticalInformation REF Stats ; -}; - -*/ - -//================================================================== -// Solaris_ActiveUserProcessAggregateStatistics -//================================================================== -[Association, - Provider("java:com.sun.wbem.solarisprovider.srm.Solaris_ActiveUserProcessAggregateStatistics"), - Description("A link between an User active on a system and the " - "aggregated resource usage of its Process(es).") -] -class Solaris_ActiveUserProcessAggregateStatistics: CIM_SystemStatistics -{ - [Override ("Element"), - Key, - Description ("The User active on a System.") - ] - Solaris_ActiveUser REF Element; - - [Override ("Stats"), - Key, - Description ("The Process Aggregate Statistics for the User.") - ] - Solaris_UserProcessAggregateStatisticalInformation REF Stats; -}; - - - -//================================================================== -// Solaris_ActiveProjectProcessAggregateStatistics -//================================================================== -[Association, - Provider("java:com.sun.wbem.solarisprovider.srm.Solaris_ActiveProjectProcessAggregateStatistics"), - Description("A link between a Project active on a system and the " - "aggregated resource usage of its Process(es).") -] -class Solaris_ActiveProjectProcessAggregateStatistics: CIM_SystemStatistics -{ - [Override ("Element"), - Key, - Description ("The Project active on a System.") - ] - Solaris_ActiveProject REF Element; - - [Override ("Stats"), - Key, - Description ("The Process Aggregate Statistics for the Project.") - ] - Solaris_ProjectProcessAggregateStatisticalInformation REF Stats; -}; - - diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ProcessStatisticalInformation.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ProcessStatisticalInformation.java deleted file mode 100644 index a8a0f174c5..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ProcessStatisticalInformation.java +++ /dev/null @@ -1,229 +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 (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * Solaris_ProcessStatisticalInformation.java - */ - - -package com.sun.wbem.solarisprovider.srm; - -import javax.wbem.cim.*; -import javax.wbem.client.*; -import javax.wbem.provider.*; -import javax.wbem.query.*; - -import java.util.Enumeration; -import java.util.Iterator; -import java.util.Vector; - - -/** - * Provider of the Solaris_ProcessStatisticalInformation class. - * This class provides raw resource utilization measurements for a process. - * @author Sun Microsystems - */ -public class Solaris_ProcessStatisticalInformation extends SRMProvider - implements Solaris_ProcessStatisticalInformationProperties { - - - /** - * The name of the provider implemented by this class - */ - protected String providerName = SOLARIS_PROCESSSTATISTICALINFORMATION; - - - /** - * Get the name of the provider implemented by this class. - * @returns String provider name - */ - protected String getProviderName() { - return providerName; - } - - - /** - * Returns an instance specified by the PID key. - * @param op - the name of the instance to be retrieved. This must include - * all of the keys and values for the instance. - * @param localOnly - if true, only the local properties of the class are - * returned, otherwise all properties are required - * @param includeQualifiers - if true, the qualifiers are returned as part - * of of the returned instancei, otherwise no qualifiers will be returned - * @param includeClassOrigin - if true, the class origin of each property - * will be returned - * @param String[] - if null, all properties are returned, otherwise only - * the properties specified will be returned. Any duplicate properties will - * be ignored. - * @param cc - the class reference - * - * @return CIMInstance the retrieved instance. - * @exception CIMException - the method getInstance throws a CIMException - * if the CIMObjectPath is incorrect or does not exist. - */ - public synchronized CIMInstance getInstance(CIMObjectPath op, - boolean localOnly, - boolean includeQualifiers, - boolean includeClassOrigin, - String[] propList, - CIMClass cc) - throws CIMException { - - String pid = null; - CIMInstance ci = null; - CIMProperty cp = null; - DataModel dm = null; - ProcessDataModel pdm; - - SRMDebug.trace(SRMDebug.METHOD_CALL, op.toString()); - try { - Enumeration e = op.getKeys().elements(); - while (e.hasMoreElements()) { - cp = (CIMProperty) e.nextElement(); - if (cp.getName().equalsIgnoreCase(NAME)) { - pid = (String)((CIMValue)(cp.getValue())).getValue(); - } - } - dm = resourceMonitor.getDataModel(false); - if ((pdm = dm.getProcess(Integer.parseInt(pid))) == null) { - resourceMonitor.releaseDataModel(dm); - throw notFoundEx; - } - ci = pdm.getCIMInstance(cc); - dm = resourceMonitor.releaseDataModel(dm); - } catch (Exception e) { - dm = resourceMonitor.releaseDataModel(dm); - String msg = writeLog(LOGERROR, "SRM_1001"); - writeLog(LOGERROR, e); - msg += " (" + e.getClass().toString() + ")"; - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - SRMDebug.trace(SRMDebug.METHOD_RETV, ci.toString()); - return ci; - - } // end getInstance - - - /** - * Returns all instances of Solaris_ProcessUtilizationInformation. - * @param op - the object path specifies the class to be enumerated - * localOnly - if true, only the local properties of the class are returned, - * otherwise all properties are required - * @param includeQualifiers - if true, the qualifiers are returned as part - * of of the returned instancei, otherwise no qualifiers will be returned - * @param includeClassOrigin - if true, the class origin of each property - * will be returned - * @param String[] - if null, all properties are returned, otherwise only - * the properties specified will be - * returned. Any duplicate properties will be ignored. - * @param cc - the class reference - * @return An array of CIMInstance - * @exception CIMException - if the CIMObjectPath is incorrect or does not - * exist. - */ - public synchronized CIMInstance[] enumerateInstances(CIMObjectPath op, - boolean localOnly, - boolean includeQualifiers, - boolean includeClassOrigin, - String[] propList, - CIMClass cc) - throws CIMException { - - DataModel dm = null; - - SRMDebug.trace(SRMDebug.METHOD_CALL, op.toString()); - try { - Vector procInstances = new Vector(); - CIMInstance ci; - dm = resourceMonitor.getDataModel(false); - Iterator i = dm.getProcessIterator(); - while (i.hasNext()) { - ci = ((ProcessDataModel) i.next()).getCIMInstance(cc); - procInstances.addElement(ci); - } - dm = resourceMonitor.releaseDataModel(dm); - CIMInstance[] ciArray = new CIMInstance[procInstances.size()]; - procInstances.toArray(ciArray); - SRMDebug.trace(SRMDebug.METHOD_RETV, "instance[0]: " + - ciArray[0].toString()); - return ciArray; - } catch (Exception e) { - dm = resourceMonitor.releaseDataModel(dm); - String msg = writeLog(LOGERROR, "SRM_1002"); - writeLog(LOGERROR, e); - msg += " (" + e.getClass().toString() + ")"; - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - - } // end enumerateInstances - - - /** - * Returns the names of all Solaris_ProcessUtilizationInformation instances. - * - * @param op - the class name to enumerate the instances - * @param cc - the class reference passed to the provider - * @return an array of CIMObjectPath containing names of the enumerated - * instances. - * @exception CIMException - if the classname is null or does not exist. - */ - public synchronized CIMObjectPath[] - enumerateInstanceNames(CIMObjectPath op, CIMClass cc) - throws CIMException { - - DataModel dm = null; - - SRMDebug.trace(SRMDebug.METHOD_CALL, op.toString()); - try { - ProcessDataModel pdm; - Vector procInstances = new Vector(); - int pid; - CIMObjectPath cop; - dm = resourceMonitor.getDataModel(false); - Iterator i = dm.getProcessIterator(); - while (i.hasNext()) { - pdm = (ProcessDataModel)i.next(); - cop = new CIMObjectPath(op.getObjectName(), op.getNameSpace()); - cop.addKey(NAME, new CIMValue(Long.toString(pdm.pid))); - procInstances.addElement(cop); - } - dm = resourceMonitor.releaseDataModel(dm); - CIMObjectPath[] copArray = new CIMObjectPath[procInstances.size()]; - procInstances.toArray(copArray); - SRMDebug.trace(SRMDebug.METHOD_RETV, "instanceName[0]: " - + copArray[0].toString()); - return copArray; - } catch (Exception e) { - dm = resourceMonitor.releaseDataModel(dm); - String msg = writeLog(LOGERROR, "SRM_1003"); - writeLog(LOGERROR, e); - msg += " (" + e.getClass().toString() + ")"; - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - - } // end enumerateInstanceNames - -} // end class Solaris_ProcessStatisticalInformation diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ProcessStatisticalInformationProperties.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ProcessStatisticalInformationProperties.java deleted file mode 100644 index 96683137a4..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ProcessStatisticalInformationProperties.java +++ /dev/null @@ -1,209 +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 (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * Solaris_ProcessStatisticalInformationProperties.java - */ - - -package com.sun.wbem.solarisprovider.srm; - -/** - * Defines property names of the Solaris_ProcessStatisticalInformation and - * the corresponding keys in the RDS protocol - * @author SMI - */ -public interface Solaris_ProcessStatisticalInformationProperties { - /** - * The cumulative number of nanoseconds that this process has spent in - * User mode over its lifetime. - */ - static final String USERMODETIME = "UserModeTime"; - static final String USERMODETIME_KEY = "id_usr"; - /** - * The cumulative number of nanoseconds that this process has spent in - * System mode over its lifetime. - */ - static final String SYSTEMMODETIME = "SystemModeTime"; - static final String SYSTEMMODETIME_KEY = "id_sys"; - /** - * The cumulative number of nanoseconds that this process has spent in - * System Traps over its lifetime. - */ - static final String SYSTEMTRAPTIME = "SystemTrapTime"; - static final String SYSTEMTRAPTIME_KEY = "id_ttime"; - /** - * The cumulative number of nanoseconds that this process has spent - * sleeping in Text Page Faults over its lifetime. - */ - static final String TEXTPAGEFAULTSLEEPTIME = "TextPageFaultSleepTime"; - static final String TEXTPAGEFAULTSLEEPTIME_KEY = "id_tpftime"; - /** - * The cumulative number of nanoseconds that this process has spent - * sleeping in Data Page Faults over its lifetime. - */ - static final String DATAPAGEFAULTSLEEPTIME = "DataPageFaultSleepTime"; - static final String DATAPAGEFAULTSLEEPTIME_KEY = "id_dpftime"; - /** - * The cumulative number of nanoseconds that this process has spent - * sleeping in System Page Faults over its lifetime. - */ - static final String SYSTEMPAGEFAULTSLEEPTIME = "SystemPageFaultSleepTime"; - static final String SYSTEMPAGEFAULTSLEEPTIME_KEY = "id_kpftime"; - /** - * The cumulative number of nanoseconds that this process has spent - * sleeping on User Lock Waits over its lifetime. - */ - static final String USERLOCKWAITSLEEPTIME = "UserLockWaitSleepTime"; - static final String USERLOCKWAITSLEEPTIME_KEY = "id_lck"; - /** - * The cumulative number of nanoseconds that this process has spent - * sleeping in all other ways over its lifetime. - */ - static final String OTHERSLEEPTIME = "OtherSleepTime"; - static final String OTHERSLEEPTIME_KEY = "id_slp"; - /** - * The cumulative number of nanoseconds that this process has spent - * Waiting for CPU over its lifetime. - */ - static final String WAITCPUTIME = "WaitCPUTime"; - static final String WAITCPUTIME_KEY = "id_lat"; - /** - * The cumulative number of nanoseconds that this process has spent - * Stopped over its lifetime. - */ - static final String STOPPEDTIME = "StoppedTime"; - static final String STOPPEDTIME_KEY = "id_stime"; - /** - * The cumulative number of Minor Page Faults engendered by the process - * over its lifetime - */ - static final String MINORPAGEFAULTS = "MinorPageFaults"; - static final String MINORPAGEFAULTS_KEY = "id_minf"; - /** - * The cumulative number of Major Page Faults engendered by the process - * over its lifetime. - */ - static final String MAJORPAGEFAULTS = "MajorPageFaults"; - static final String MAJORPAGEFAULTS_KEY = "id_majf"; - /** - * The cumulative number of swap operations engendered by the process - * over its lifetime. - */ - static final String SWAPOPERATIONS = "SwapOperations"; - static final String SWAPOPERATIONS_KEY = "id_nswap"; - /** - * The cumulative number of blocks Read by the process over its lifetime. - */ - static final String BLOCKSREAD = "BlocksRead"; - static final String BLOCKSREAD_KEY = "id_inblk"; - /** - * The cumulative number of blocks Written by the process over its lifetime. - */ - static final String BLOCKSWRITTEN = "BlocksWritten"; - static final String BLOCKSWRITTEN_KEY = "id_oublk"; - /** - * The cumulative number of Messages Sent by the process over its lifetime - */ - static final String MESSAGESSENT = "MessagesSent"; - static final String MESSAGESSENT_KEY = "id_msnd"; - /** - * The cumulative number of Messages Received by the process over - * its lifetime. - */ - static final String MESSAGESRECEIVED = "MessagesReceived"; - static final String MESSAGESRECEIVED_KEY = "id_mrcv"; - /** - * The cumulative number of Signals taken by the process over its lifetime. - */ - static final String SIGNALSRECEIVED = "SignalsReceived"; - static final String SIGNALSRECEIVED_KEY = "id_sigs"; - /** - * The cumulative number of Voluntary Context Switches made by the process - * over its lifetime. - */ - static final String VOLUNTARYCONTEXTSWITCHES = "VoluntaryContextSwitches"; - static final String VOLUNTARYCONTEXTSWITCHES_KEY = "id_vctx"; - /** - * The cumulative number of Involuntary Context Switches made by - * the process over its lifetime. - */ - static final String INVOLUNTARYCONTEXTSWITCHES = - "InvoluntaryContextSwitches"; - static final String INVOLUNTARYCONTEXTSWITCHES_KEY = - "id_ictx"; - /** - * The cumulative number of system calls made by the process over its - * lifetime. - */ - static final String SYSTEMCALLSMADE = "SystemCallsMade"; - static final String SYSTEMCALLSMADE_KEY = "id_scl"; - /** - * The cumulative number of character I/O bytes Read and Written - * by the process over its lifetime. - */ - static final String CHARACTERIOUSAGE = "CharacterIOUsage"; - static final String CHARACTERIOUSAGE_KEY = "id_ioch"; - /** - * The total number of KiloBytes of memory consumed by the process - * heap at the time that it is sampled. - */ - static final String PROCESSHEAPSIZE = "ProcessHeapSize"; - static final String PROCESSHEAPSIZE_KEY = "id_hpsize"; - /** - * The size of the process virtual address space in KiloBytes. - */ - static final String PROCESSVMSIZE = "ProcessVMSize"; - static final String PROCESSVMSIZE_KEY = "id_size"; - /** - * The resident set size of the process in KiloBytes - */ - static final String PROCESSRESIDENTSETSIZE = "ProcessResidentSetSize"; - static final String PROCESSRESIDENTSETSIZE_KEY = "id_rssize"; - /** - * The percent CPU time used by the process. - */ - static final String PERCENTCPUTIME = "PercentCPUTime"; - static final String PERCENTCPUTIME_KEY = "id_pctcpu"; - /** - * The ratio of the process resident set size to physical memory - */ - static final String PERCENTMEMORYSIZE = "PercentMemorySize"; - static final String PERCENTMEMORYSIZE_KEY = "id_pctmem"; - /** - * Time in User mode and System mode spent by the process in milliseconds. - * If this information is not available, a value of 0 should be used. - */ - static final String USERSYSTEMMODETIME = "UserSystemModeTime"; - static final String USERSYSTEMMODETIME_KEY = "id_time"; - /** - * The number of threads active in the current Process. - */ - static final String NUMTHREADS = "NumThreads"; - static final String NUMTHREADS_KEY = "id_nlwps"; - /** - * The system clock time at which the sample was taken. - */ - static final String TIMESTAMP = "Timestamp"; - static final String TIMESTAMP_KEY = "id_timestamp"; -} diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ProcessStatistics.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ProcessStatistics.java deleted file mode 100644 index 62c34b7479..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ProcessStatistics.java +++ /dev/null @@ -1,244 +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 2001-2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -package com.sun.wbem.solarisprovider.srm; - -import javax.wbem.cim.*; -import javax.wbem.client.*; -import javax.wbem.provider.*; - -import java.util.Enumeration; -import java.util.Iterator; -import java.util.Vector; - - -/** - * Provider of the Solaris_ProcessStatistics class. This class represents - * an association linking a Solaris_Process and its - * Solaris_ProcessStatisticalInformation instance a raw resource utilization - * measurements for a process. - * @author Sun Microsystems, Inc. - */ -public class Solaris_ProcessStatistics extends SRMProvider { - - /** - * The name of the provider implemented by this class - */ - String providerName = SOLARIS_PROCESSSTATISTICS; - - private DataModel dm; - - - /** - * Get the name of the provider implemented by this class. - * @returns String provider name - */ - protected String getProviderName() { - return providerName; - } - - - /** - * Returns a specific instance. - * @param op - the name of the instance to be retrieved. This must include - * all of the keys and values for the instance. - * @param localOnly - if true, only the local properties of the class are - * returned, otherwise all properties are required - * @param includeQualifiers - if true, the qualifiers are returned as part - * of of the returned instancei, otherwise no qualifiers will be returned - * @param includeClassOrigin - if true, the class origin of each property - * will be returned - * @param String[] - if null, all properties are returned, otherwise only - * the properties specified will be returned. Any duplicate properties will - * be ignored. - * @param cc - the class reference - * - * @return CIMInstance the retrieved instance. - * @exception CIMException - the method getInstance throws a CIMException - * if the CIMObjectPath is incorrect or does not exist. - */ - public synchronized CIMInstance getInstance(CIMObjectPath op, - boolean localOnly, - boolean includeQualifiers, - boolean includeClassOrigin, - String[] propList, - CIMClass cc) - throws CIMException { - - CIMObjectPath procstatCOP = null; - CIMObjectPath procCOP = null; - CIMInstance ci = null; - CIMProperty cp = null; - - SRMDebug.trace(SRMDebug.METHOD_CALL, op.toString()); - try { - Enumeration e = op.getKeys().elements(); - while (e.hasMoreElements()) { - cp = (CIMProperty) e.nextElement(); - if (cp.getName().equalsIgnoreCase(ELEMENT)) { - procCOP = (CIMObjectPath)((CIMValue)(cp.getValue())). - getValue(); - } - if (cp.getName().equalsIgnoreCase(STATS)) { - procstatCOP = (CIMObjectPath)((CIMValue)(cp.getValue())). - getValue(); - } - } - - ci = cc.newInstance(); - ci.setProperty(ELEMENT, new CIMValue(procCOP)); - ci.setProperty(STATS, new CIMValue(procstatCOP)); - - } catch (Exception e) { - String msg = writeLog(LOGERROR, "SRM_1001"); - writeLog(LOGERROR, e); - msg += " (" + e.getClass().toString() + ")"; - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - SRMDebug.trace(SRMDebug.METHOD_RETV, ci.toString()); - return ci; - - } // end getInstance - - - /** - * Returns all instances of Solaris_ProcessStatistics. - * @param op - the object path specifies the class to be enumerated - * localOnly - if true, only the local properties of the class are returned, - * otherwise all properties are required - * @param includeQualifiers - if true, the qualifiers are returned as part - * of of the returned instancei, otherwise no qualifiers will be returned - * @param includeClassOrigin - if true, the class origin of each property - * will be returned - * @param String[] - if null, all properties are returned, otherwise only - * the properties specified will be - * returned. Any duplicate properties will be ignored. - * @param cc - the class reference - * @return An array of CIMInstance - * @exception CIMException - if the CIMObjectPath is incorrect or does not - * exist. - */ - public synchronized CIMInstance[] enumerateInstances(CIMObjectPath op, - boolean localOnly, - boolean includeQualifiers, - boolean includeClassOrigin, - String[] propList, - CIMClass cc) - throws CIMException { - - Vector installedElements = new Vector(); - ProcessDataModel pdm; - CIMObjectPath procstatCOP; - CIMObjectPath procCOP; - CIMInstance ci; - DataModel dm = null; - - SRMDebug.trace(SRMDebug.METHOD_CALL, op.toString()); - try { - dm = resourceMonitor.getDataModel(false); - Iterator i = dm.getProcessIterator(); - while (i.hasNext()) { - pdm = (ProcessDataModel)i.next(); - procstatCOP = pdm.getCIMObjectPath( - SOLARIS_PROCESSSTATISTICALINFORMATION); - procCOP = pdm.getCIMObjectPathForProc(); - ci = cc.newInstance(); - ci.setProperty(ELEMENT, new CIMValue(procCOP)); - ci.setProperty(STATS, new CIMValue(procstatCOP)); - installedElements.addElement(ci); - } - dm = resourceMonitor.releaseDataModel(dm); - } catch (Exception e) { - dm = resourceMonitor.releaseDataModel(dm); - String msg = writeLog(LOGERROR, "SRM_1002"); - writeLog(LOGERROR, e); - msg += " (" + e.getClass().toString() + ")"; - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - - CIMInstance[] ciArray = new CIMInstance[installedElements.size()]; - installedElements.toArray(ciArray); - SRMDebug.trace(SRMDebug.METHOD_RETV, "instance[0]: " - + (String)(ciArray.length > 0 ? ciArray[0].toString() : "null")); - return ciArray; - - } // end enumerateInstances - - - /** - * Returns the names of all Solaris_ProcessUtilizationInformation instances. - * - * @param op - the class name to enumerate the instances - * @param cc - the class reference passed to the provider - * @return an array of CIMObjectPath containing names of the enumerated - * instances. - * @exception CIMException - if the classname is null or does not exist. - */ - public synchronized CIMObjectPath[] - enumerateInstanceNames(CIMObjectPath op, CIMClass cc) - throws CIMException { - - Vector installedElements = new Vector(); - ProcessDataModel pdm; - CIMObjectPath procstatCOP; - CIMObjectPath procCOP; - CIMObjectPath cop; - - SRMDebug.trace(SRMDebug.METHOD_CALL, op.toString()); - try { - dm = resourceMonitor.getDataModel(false); - Iterator i = dm.getProcessIterator(); - while (i.hasNext()) { - pdm = (ProcessDataModel) i.next(); - procstatCOP = pdm.getCIMObjectPath( - SOLARIS_PROCESSSTATISTICALINFORMATION); - procCOP = pdm.getCIMObjectPathForProc(); - cop = new CIMObjectPath(op.getObjectName(), - op.getNameSpace()); - cop.addKey(ELEMENT, new CIMValue(procCOP)); - cop.addKey(STATS, new CIMValue(procstatCOP)); - installedElements.add(cop); - } - dm = resourceMonitor.releaseDataModel(dm); - } catch (Exception e) { - dm = resourceMonitor.releaseDataModel(dm); - String msg = writeLog(LOGERROR, "SRM_1003"); - writeLog(LOGERROR, e); - msg += " (" + e.getClass().toString() + ")"; - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - - CIMObjectPath[] copArray = new CIMObjectPath[installedElements.size()]; - installedElements.toArray(copArray); - SRMDebug.trace(SRMDebug.METHOD_RETV, "instanceName[0]: " - + (String)(copArray.length > 0 ? copArray[0].toString() : "null")); - return copArray; - - } // end enumerateInstanceNames - -} // end class Solaris_ProcessStatistics diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ProjectProcessAggregateStatisticalInformation.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ProjectProcessAggregateStatisticalInformation.java deleted file mode 100644 index d0aebaa8db..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_ProjectProcessAggregateStatisticalInformation.java +++ /dev/null @@ -1,269 +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 (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * Solaris_ProjectProcessAggregateStatisticalInformation.java - */ - - -package com.sun.wbem.solarisprovider.srm; - -import javax.wbem.cim.*; -import javax.wbem.client.*; -import javax.wbem.provider.*; -import javax.wbem.query.*; - -import com.sun.wbem.solarisprovider.common.ProviderUtility; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.Vector; - - -/** - * Provider of the Solaris_ProjectProcessAggregateStatisticalInformation class. - * This class provides accumulated resource utilization measurements for - * an aggregation of processes sharing a common Project. The (inherited) - * ProcessStatisticalInformation properties are populated by summing the - * underlying process's usage. - * @author Sun Microsystems - */ -public class Solaris_ProjectProcessAggregateStatisticalInformation - extends SRMProvider - implements Authorizable, - Solaris_ProcessStatisticalInformationProperties { - - /** - * The name of the provider implemented by this class - */ - String providerName = - SOLARIS_PROJECTPROCESSAGGREGATESTATISTICALINFORMATION; - - /** - * Get the name of the provider implemented by this class. - * @returns String provider name - */ - protected String getProviderName() { - return providerName; - } - - - /** - * Returns an instance specified by the Name key. - * @param op - the name of the instance to be retrieved. This must include - * all of the keys and values for the instance. - * @param localOnly - if true, only the local properties of the class are - * returned, otherwise all properties are required - * @param includeQualifiers - if true, the qualifiers are returned as part - * of of the returned instancei, otherwise no qualifiers will be returned - * @param includeClassOrigin - if true, the class origin of each property - * will be returned - * @param String[] - if null, all properties are returned, otherwise only - * the properties specified will be returned. Any duplicate properties will - * be ignored. - * @param cc - the class reference - * - * @return CIMInstance the retrieved instance. - * @exception CIMException - the method getInstance throws a CIMException - * if the CIMObjectPath is incorrect or does not exist. - */ - public synchronized CIMInstance getInstance(CIMObjectPath op, - boolean localOnly, - boolean includeQualifiers, - boolean includeClassOrigin, - String[] propList, - CIMClass cc) - throws CIMException { - - String name = null; - CIMProperty cp; - CIMInstance ci = null; - DataModel dm = null; - ProcessAggregateDataModel padm; - - SRMDebug.trace(SRMDebug.METHOD_CALL, op.toString()); - try { - Enumeration e = op.getKeys().elements(); - while (e.hasMoreElements()) { - cp = (CIMProperty) e.nextElement(); - if (cp.getName().equalsIgnoreCase(NAME)) { - name = (String)((CIMValue)(cp.getValue())).getValue(); - } - } - dm = resourceMonitor.getDataModel(false); - if ((padm = dm.getProjprocs(name)) == null) { - dm = resourceMonitor.releaseDataModel(dm); - throw notFoundEx; - } - ci = padm.getCIMInstance(cc); - dm = resourceMonitor.releaseDataModel(dm); - } catch (Exception e) { - dm = resourceMonitor.releaseDataModel(dm); - String msg = writeLog(LOGERROR, "SRM_1001"); - writeLog(LOGERROR, e); - msg += " (" + e.getClass().toString() + ")"; - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - SRMDebug.trace(SRMDebug.METHOD_RETV, ci.toString()); - return ci; - - } // end getInstance - - - /** - * Returns all instances of - * Solaris_ProjectProcessAggregateUtilizationInformation. - * @param op - the object path specifies the class to be enumerated - * localOnly - if true, only the local properties of the class are returned, - * otherwise all properties are required - * @param includeQualifiers - if true, the qualifiers are returned as part - * of of the returned instancei, otherwise no qualifiers will be returned - * @param includeClassOrigin - if true, the class origin of each property - * will be returned - * @param String[] - if null, all properties are returned, otherwise only - * the properties specified will be - * returned. Any duplicate properties will be ignored. - * @param cc - the class reference - * @return An array of CIMInstance - * @exception CIMException - if the CIMObjectPath is incorrect or does not - * exist. - */ - public synchronized CIMInstance[] enumerateInstances(CIMObjectPath op, - boolean localOnly, - boolean includeQualifiers, - boolean includeClassOrigin, - String[] propList, - CIMClass cc) - throws CIMException { - DataModel dm = null; - - long t0 = System.currentTimeMillis(); - - SRMDebug.trace(SRMDebug.METHOD_CALL, op.toString()); - try { - Vector procAggrInstances = new Vector(); - CIMInstance ci; - dm = resourceMonitor.getDataModel(false); - Iterator i = dm.getProjprocsIterator(); - while (i.hasNext()) { - ci = ((ProcessAggregateDataModel) i.next()).getCIMInstance(cc); - procAggrInstances.addElement(ci); - } - dm = resourceMonitor.releaseDataModel(dm); - CIMInstance[] ciArray = new CIMInstance[procAggrInstances.size()]; - procAggrInstances.toArray(ciArray); - SRMDebug.trace(SRMDebug.METHOD_RETV, "instance[0]: " + - ciArray[0].toString()); - return ciArray; - } catch (Exception e) { - dm = resourceMonitor.releaseDataModel(dm); - String msg = writeLog(LOGERROR, "SRM_1002"); - writeLog(LOGERROR, e); - msg += " (" + e.getClass().toString() + ")"; - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - - } // end enumerateInstances - - - /** - * Returns the names of all Solaris_ProjectProcessUtilizationInformation - * instances. - * - * @param op - the class name to enumerate the instances - * @param cc - the class reference passed to the provider - * @return an array of CIMObjectPath containing names of the enumerated - * instances. - * @exception CIMException - if the classname is null or does not exist. - */ - public synchronized CIMObjectPath[] enumerateInstanceNames(CIMObjectPath op, - CIMClass cc) throws CIMException { - DataModel dm = null; - - SRMDebug.trace(SRMDebug.METHOD_CALL, op.toString()); - try { - ProcessAggregateDataModel padm; - Vector procAggrInstances = new Vector(); - int pid; - CIMObjectPath cop; - - dm = resourceMonitor.getDataModel(false); - Iterator i = dm.getProjprocsIterator(); - - while (i.hasNext()) { - padm = (ProcessAggregateDataModel) i.next(); - cop = new CIMObjectPath(op.getObjectName(), op.getNameSpace()); - cop.addKey(NAME, new CIMValue(padm.name)); - procAggrInstances.addElement(cop); - } - dm = resourceMonitor.releaseDataModel(dm); - CIMObjectPath[] copArray = - new CIMObjectPath[procAggrInstances.size()]; - procAggrInstances.toArray(copArray); - SRMDebug.trace(SRMDebug.METHOD_RETV, "instanceName[0]: " + - copArray[0].toString()); - return copArray; - } catch (Exception e) { - dm = resourceMonitor.releaseDataModel(dm); - String msg = writeLog(LOGERROR, "SRM_1003"); - writeLog(LOGERROR, e); - msg += " (" + e.getClass().toString() + ")"; - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - - } // end enumerateInstanceNames - - protected synchronized CIMValue getBulkData(Vector outParams) - throws CIMException { - DataModel dm = null; - - try { - dm = resourceMonitor.getDataModel(false); - Iterator i = dm.getProjprocsIterator(); - Vector vOutParam = new Vector(); - while (i.hasNext()) { - vOutParam.addElement(((ProcessAggregateDataModel) i.next()). - toBulkData()); - } - // rem: we can only return CIMValues in our outParams - CIMDataType dtype = new CIMDataType(CIMDataType.STRING_ARRAY); - CIMValue outVal = new CIMValue(vOutParam, dtype); - outParams.addElement(outVal); - dm = resourceMonitor.releaseDataModel(dm); - - } catch (Exception e) { - dm = resourceMonitor.releaseDataModel(dm); - String msg = writeLog(LOGERROR, "SRM_1002"); - writeLog(LOGERROR, e); - msg += " (" + e.getClass().toString() + ")"; - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - - CIMValue rv = new CIMValue(new Integer(0)); - return (rv); - } // end getBulkData - -} // end class Solaris_ProjectProcessAggregateStatisticalInformation diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_UserProcessAggregateStatisticalInformation.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_UserProcessAggregateStatisticalInformation.java deleted file mode 100644 index abf23b7371..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Solaris_UserProcessAggregateStatisticalInformation.java +++ /dev/null @@ -1,264 +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 (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * Solaris_UserProcessAggregateStatisticalInformation.java - */ - - -package com.sun.wbem.solarisprovider.srm; - -import javax.wbem.cim.*; -import javax.wbem.client.*; -import javax.wbem.provider.*; -import javax.wbem.query.*; - -import com.sun.wbem.solarisprovider.common.ProviderUtility; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.Vector; - - -/** - * Provider of the Solaris_UserProcessAggregateStatisticalInformation class. - * This class provides an accumulated resource utilization measurements for - * an aggregation of processes sharing a common User. The (inherited) - * ProcessStatisticalInformation properties are populated by summing the - * underlying process' usage. - * @author Sun Microsystems - */ -public class Solaris_UserProcessAggregateStatisticalInformation - extends SRMProvider - implements Authorizable, - Solaris_ProcessStatisticalInformationProperties { - - String providerName = - SOLARIS_USERPROCESSAGGREGATESTATISTICALINFORMATION; - - /** - * Get the name of the provider implemented by this class. - * @returns String provider name - */ - protected String getProviderName() { - return providerName; - } - - - /** - * Returns an instance specified by the Name key - * @param op - the name of the instance to be retrieved. This must include - * all of the keys and values for the instance. - * @param localOnly - if true, only the local properties of the class are - * returned, otherwise all properties are required - * @param includeQualifiers - if true, the qualifiers are returned as part - * of of the returned instancei, otherwise no qualifiers will be returned - * @param includeClassOrigin - if true, the class origin of each property - * will be returned - * @param String[] - if null, all properties are returned, otherwise only - * the properties specified will be returned. Any duplicate properties will - * be ignored. - * @param cc - the class reference - * - * @return CIMInstance the retrieved instance. - * @exception CIMException - the method getInstance throws a CIMException - * if the CIMObjectPath is incorrect or does not exist. - */ - public synchronized CIMInstance getInstance(CIMObjectPath op, - boolean localOnly, - boolean includeQualifiers, - boolean includeClassOrigin, - String[] propList, - CIMClass cc) - throws CIMException { - - String name = null; - CIMProperty cp = null; - CIMInstance ci = null; - DataModel dm = null; - ProcessAggregateDataModel padm; - - SRMDebug.trace(SRMDebug.METHOD_CALL, op.toString()); - try { - Enumeration e = op.getKeys().elements(); - while (e.hasMoreElements()) { - cp = (CIMProperty) e.nextElement(); - if (cp.getName().equalsIgnoreCase(NAME)) { - name = (String)((CIMValue)(cp.getValue())).getValue(); - } - } - - dm = resourceMonitor.getDataModel(false); - if ((padm = dm.getUserprocs(name)) == null) { - dm = resourceMonitor.releaseDataModel(dm); - throw notFoundEx; - } - ci = padm.getCIMInstance(cc); - dm = resourceMonitor.releaseDataModel(dm); - } catch (Exception e) { - dm = resourceMonitor.releaseDataModel(dm); - String msg = writeLog(LOGERROR, "SRM_1001"); - writeLog(LOGERROR, e); - msg += " (" + e.getClass().toString() + ")"; - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - SRMDebug.trace(SRMDebug.METHOD_RETV, ci.toString()); - return ci; - - } // end getInstance - - - /** - * Returns all instances of Solaris_ProcessUtilizationInformation - * @param op - the object path specifies the class to be enumerated - * localOnly - if true, only the local properties of the class are returned, - * otherwise all properties are required - * @param includeQualifiers - if true, the qualifiers are returned as part - * of of the returned instancei, otherwise no qualifiers will be returned - * @param includeClassOrigin - if true, the class origin of each property - * will be returned - * @param String[] - if null, all properties are returned, otherwise only - * the properties specified will be - * returned. Any duplicate properties will be ignored. - * @param cc - the class reference - * @return An array of CIMInstance - * @exception CIMException - if the CIMObjectPath is incorrect or does not - * exist. - */ - public synchronized CIMInstance[] enumerateInstances(CIMObjectPath op, - boolean localOnly, - boolean includeQualifiers, - boolean includeClassOrigin, - String[] propList, - CIMClass cc) - throws CIMException { - DataModel dm = null; - - SRMDebug.trace(SRMDebug.METHOD_CALL, op.toString()); - try { - Vector procAggrInstances = new Vector(); - CIMInstance ci; - - dm = resourceMonitor.getDataModel(false); - Iterator i = dm.getUserprocsIterator(); - while (i.hasNext()) { - ci = ((ProcessAggregateDataModel) i.next()).getCIMInstance(cc); - procAggrInstances.addElement(ci); - } - dm = resourceMonitor.releaseDataModel(dm); - CIMInstance[] ciArray = new CIMInstance[procAggrInstances.size()]; - procAggrInstances.toArray(ciArray); - SRMDebug.trace(SRMDebug.METHOD_RETV, "instance[0]: " + - ciArray[0].toString()); - return ciArray; - } catch (Exception e) { - dm = resourceMonitor.releaseDataModel(dm); - String msg = writeLog(LOGERROR, "SRM_1002"); - writeLog(LOGERROR, e); - msg += " (" + e.getClass().toString() + ")"; - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - } // end enumerateInstances - - - /** - * Returns the names of all Solaris_UserProcessUtilizationInformation - * instances. - * - * @param op - the class name to enumerate the instances - * @param cc - the class reference passed to the provider - * @return an array of CIMObjectPath containing names of the enumerated - * instances. - * @exception CIMException - if the classname is null or does not exist. - */ - public synchronized CIMObjectPath[] enumerateInstanceNames(CIMObjectPath op, - CIMClass cc) - throws CIMException { - DataModel dm = null; - - SRMDebug.trace(SRMDebug.METHOD_CALL, op.toString()); - try { - ProcessAggregateDataModel padm; - Vector procAggrInstances = new Vector(); - int pid; - CIMObjectPath cop; - - dm = resourceMonitor.getDataModel(false); - Iterator i = dm.getUserprocsIterator(); - while (i.hasNext()) { - padm = (ProcessAggregateDataModel) i.next(); - cop = new CIMObjectPath(op.getObjectName(), op.getNameSpace()); - cop.addKey(NAME, new CIMValue(padm.name)); - procAggrInstances.addElement(cop); - } - dm = resourceMonitor.releaseDataModel(dm); - CIMObjectPath[] copArray = - new CIMObjectPath[procAggrInstances.size()]; - procAggrInstances.toArray(copArray); - SRMDebug.trace(SRMDebug.METHOD_RETV, "instanceName[0]: " - + copArray[0].toString()); - return copArray; - } catch (Exception e) { - dm = resourceMonitor.releaseDataModel(dm); - String msg = writeLog(LOGERROR, "SRM_1003"); - writeLog(LOGERROR, e); - msg += " (" + e.getClass().toString() + ")"; - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - - } // end enumerateInstanceNames - - protected CIMValue getBulkData(Vector outParams) throws CIMException { - DataModel dm = null; - - try { - dm = resourceMonitor.getDataModel(false); - Iterator i = dm.getUserprocsIterator(); - // Fill the array; each obj takes the bulk data for one user. - Vector vOutParam = new Vector(); - while (i.hasNext()) { - vOutParam.addElement(((ProcessAggregateDataModel) i.next()). - toBulkData()); - } - // rem: we can only return CIMValues in our outParams - CIMDataType dtype = new CIMDataType(CIMDataType.STRING_ARRAY); - CIMValue outVal = new CIMValue(vOutParam, dtype); - outParams.addElement(outVal); - dm = resourceMonitor.releaseDataModel(dm); - - } catch (Exception e) { - dm = resourceMonitor.releaseDataModel(dm); - String msg = writeLog(LOGERROR, "SRM_1002"); - writeLog(LOGERROR, e); - msg += " (" + e.getClass().toString() + ")"; - SRMDebug.trace1(providerName, e); - throw new CIMException(CIMException.CIM_ERR_FAILED, msg); - } - - CIMValue rv = new CIMValue(new Integer(0)); - return (rv); - } // end getBulkData - -} // end class Solaris_UserProcessAggregateStatisticalInformation diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SystemDataModel.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SystemDataModel.java deleted file mode 100644 index 61eb90750d..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SystemDataModel.java +++ /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 (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * SystemDataModel.java - */ - - -package com.sun.wbem.solarisprovider.srm; - -import javax.wbem.cim.*; - -import java.util.*; - -/** - * The global system properties, osname and csname, are handled by this - * class. The data fields are defined as static in the superclass, since they - * should be accessible by all provider data models. - * @author Sun Microsystems, Inc. - */ -public class SystemDataModel extends SRMProviderDataModel - implements SRMProviderProperties { - - protected void setCIMInstance(boolean newInstance) { - return; - } - - protected void setOpPropertiesVector() { - return; - } - - protected void initKeyValTable() { - return; - } - - void setProperty(String key, String val) { - - PropertyAccessInterface ac; - - if (!key.equals(CSNAME_KEY)) { - csName = val; - } else if (!key.equals(OSNAME_KEY)) { - osName = val; - } - } - -} // end class SystemDataModel diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Util.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Util.java deleted file mode 100644 index 175d676ab1..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/Util.java +++ /dev/null @@ -1,184 +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 (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * Util.java - */ - -package com.sun.wbem.solarisprovider.srm; - -import javax.wbem.cim.*; - -import java.math.*; - -import java.util.PropertyResourceBundle; -import java.io.InputStream; - -/** - * Utility class - * @author Sun Microsystems - */ -class Util { - - public static String propertyUPDATETIME; - public static String propertyRDSTIMEOUT; - public static String propertyRDSINTERVAL; - public static String propertyRDSDATABASE; - public static String propertyKEEPALIVETIMEOUT; - public static String propertyMSACCT; - public static String propertyREADTIMEOUT; - public static String propertyRDSLOGFILE; - - - /** - * Converts a java long into CIM UnsignedInt64 object. - * @param l the long to be converted - * @returns a CIM UnsignedInt64 object - */ - public static UnsignedInt64 longToUI64(long l) { - byte a[] = new byte[9]; - - for (int i = 8; i > 0; i--, l >>= 8) { - a[i] = (byte)(l & 0x0ff); - } - a[0] = 0; - return new UnsignedInt64(a); - } - - /** - * Waits some milliseconds. - * - * @param ms time to wait in milliseconds - */ - public static void napms(int ms) { - try { - Thread.sleep(ms); - } catch (InterruptedException e) {} - } - - private static final String classNameForResourceBundle = - "com.sun.wbem.solarisprovider.srm.Util"; - private static final String nameForResourceBundle = - "perfprovider.properties"; - private static final String nameForDebugPropertyLevel = - "ProviderDEBUGLEVEL"; - private static final String nameForDebugPropertyDevice = - "ProviderDEBUGDEVICE"; - private static final String nameForUPDATETIME = - "ProviderUPDATETIME"; - private static final String nameForRDSTIMEOUT = - "ProviderRDSTIMEOUT"; - private static final String nameForRDSINTERVAL = - "ProviderRDSINTERVAL"; - private static final String nameForRDSDATABASE = - "ProviderRDSDATABASE"; - private static final String nameForKEEPALIVETIMEOUT = - "ProviderKEEPALIVETIMEOUT"; - private static final String nameForMSACCT = - "ProviderMSACCT"; - private static final String nameForREADTIMEOUT= - "ProviderREADTIMEOUT"; - private static final String nameForRDSLOGFILE= - "ProviderRDSLOGFILE"; - - // look for debug flag as a local resource - static { - try { - Class c = Class.forName(classNameForResourceBundle); - - InputStream is = c.getResourceAsStream(nameForResourceBundle); - - PropertyResourceBundle prb = new PropertyResourceBundle(is); - - try { - propertyUPDATETIME = prb.getString(nameForUPDATETIME); - } catch (java.util.MissingResourceException x) { - ; - } - - try { - propertyRDSTIMEOUT = prb.getString(nameForRDSTIMEOUT); - } catch (java.util.MissingResourceException x) { - ; - } - - try { - propertyRDSINTERVAL = prb.getString(nameForRDSINTERVAL); - } catch (java.util.MissingResourceException x) { - ; - } - - try { - propertyRDSDATABASE = prb.getString(nameForRDSDATABASE); - } catch (java.util.MissingResourceException x) { - ; - } - - try { - propertyKEEPALIVETIMEOUT = - prb.getString(nameForKEEPALIVETIMEOUT); - } catch (java.util.MissingResourceException x) { - ; - } - - try { - propertyMSACCT = prb.getString(nameForMSACCT); - } catch (java.util.MissingResourceException x) { - ; - } - - try { - propertyREADTIMEOUT = prb.getString(nameForREADTIMEOUT); - } catch (java.util.MissingResourceException x) { - ; - } - - try { - propertyRDSLOGFILE = prb.getString(nameForRDSLOGFILE); - } catch (java.util.MissingResourceException x) { - ; - } - String level = null; - String device = null; - - try { - level = prb.getString(nameForDebugPropertyLevel); - device = prb.getString(nameForDebugPropertyDevice); - } catch (java.util.MissingResourceException x) { - ; - } - - if ((device != null) && (device.equalsIgnoreCase("file"))) { - device = "perfprovider"; - } - SRMDebug.traceOpen(level, device); - SRMDebug.trace(SRMDebug.TRACE_ALL, - "Starting SRM provider trace level = " - + level + ", device = " + device); - - } catch (Exception x) { - ; - } - } - -} diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/perfprovider.properties b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/perfprovider.properties deleted file mode 100644 index 0eed2be129..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/perfprovider.properties +++ /dev/null @@ -1,106 +0,0 @@ -# -# ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# 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 -# - -# -# The ProviderDEBUGLEVEL controls server tracing. To turn on a tracing -# category, set the appropriate bit in the ProviderDEBUGLEVEL value to one: -# -# bits 7 6 5 4 3 2 1 0 -# ^ ^ ^ ^ ^ ^ ^ ^----- - provider method calls -# | | | | | | +------- - provider method return values -# | | | | | +--------- - rds command interface -# | | | | +----------- - rds data flow -# | | | | -# | | | +------------- - thread synchronization -# | | +--------------- - unused -# | +----------------- - unused -# +------------------- - unused -# -# Optionally add any of these characters after the hexadecimal number: -# t - include time stamp prefix -# m - include class and method name prefix -# p - include thread name prefix -# Example, "fftmp" gives all details with all prefaces -ProviderDEBUGLEVEL=0 - -# -# Set trace device to "stdout", "stderr", or "file". If file, -# trace file is written as /var/tmp/perfprovider_mmdd_hhmm -ProviderDEBUGDEVICE=stderr - -# -# The ProviderUPDATETIME property defines the time window in which -# a data request will be served from internal data cache instead of -# accessing rds, default time is 5 sec. -# -ProviderUPDATETIME=5000 - -# -# The ProviderRDSTIMEOUT property defines the timeout after which rds -# will exit if it hasn't received command from client, default time is 30 sec. -# -ProviderRDSTIMEOUT=30000 - -# -# The ProviderRDSINTERVAL property defines an interval in which rds -# will update its data structure, default time is 1 sec. -# -ProviderRDSINTERVAL=1000 - -# -# The ProviderRDSDATABASE property defines if and where rds will store -# the state of the internal statistic lists. Comment out this property -# if you want to have this feature disabled. -# -ProviderRDSDATABASE=/var/run/rds_db - -# -# The ProviderKEPPALIVETIMEOUT property defines how long the connection -# to rds should be kept open even when no client request has been -# received in this time, default time is 10 minutes. -ProviderKEEPALIVETIMEOUT=600000 - -# -# The ProviderMSACCT property, if set to true, enables the microstate -# accounting -ProviderMSACCT=true - -# -# The ProviderREADTIMEOUT property defines the number of milliseconds to -# wait for rds to respond to a command. This value may need to be -# increased for heavily loaded systems. -ProviderREADTIMEOUT=60000 - -# -# The ProviderRDSLOGFILE property defines if and where rds will write -# its log messages. If this property is not defined, the log messages -# will be directed to the 'stderr'. -# -ProviderRDSLOGFILE=/var/tmp/rds_log - - - diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/resources/Exceptions.properties b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/resources/Exceptions.properties deleted file mode 100644 index f9f2dc02d0..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/resources/Exceptions.properties +++ /dev/null @@ -1,28 +0,0 @@ -# -# ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# 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 -# - -# currently empty diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/resources/LogMessages.properties b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/resources/LogMessages.properties deleted file mode 100644 index 3bc19168f8..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/resources/LogMessages.properties +++ /dev/null @@ -1,41 +0,0 @@ -# -# ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# 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 -# - -SRM_0001=Performance provider debug - -SRM_1000=Provider initialization failed. -SRM_1001=GetInstance failed. -SRM_1002=EnumerateInstances failed. -SRM_1003=EnumerateInstanceNames failed. - -SRM_5000=GetInstance({0}) -SRM_5001=EnumerateInstances({0}) -SRM_5002=EnumerateInstanceNames({0}) -SRM_5003=ExecQuery({0}): `{1}' `{2}' - -SRM_10000=Resource monitor could not be opened. -SRM_10001=No such instance `{0}'. diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/rmon.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/rmon.java deleted file mode 100644 index 9e8282c2b5..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/rmon.java +++ /dev/null @@ -1,192 +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 (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * rmon.java - */ - - -package com.sun.wbem.solarisprovider.srm; - -import java.util.Iterator; - - -/** - * Simple CLI to test ResourceMonitor class. Prints the current user, projects - * and processor sets metrics on the stdout. - * @author Sun Microsystems, Inc. - */ -public class rmon { - - static String usage = -"rmon [-p -u [] | -j [] | -s [] -l [] -i [] -d]"; - - public static void main(String []args) { - - int pID = -1, uID = -1, jID = -1, sID = -1; - boolean pFlag = false, uFlag = false, jFlag = false, sFlag = false, - lFlag = false, selected = false, debF = false; - int loopCnt = 1, interval = 1000; - int argc; - - ProcessDataModel pui; - ActiveUserModel aum; - ActiveProjectModel apm; - ProcessAggregateDataModel padm; - ResourceMonitor resourceMonitor = null; - Object sync = new Object(); - - try { - if ((argc = args.length) > 0) { - for (int argix = 0; argix < argc; argix++) { - if (args[argix].startsWith("-u")) { - uFlag = true; selected = true; - if (((argix + 1) < argc) && - (!args[argix + 1].startsWith("-"))) { - uID = Integer.parseInt(args[++argix]); - } - } else if (args[argix].startsWith("-p")) { - pFlag = true; selected = true; - if (((argix + 1) < argc) && - (!args[argix + 1].startsWith("-"))) { - pID = Integer.parseInt(args[++argix]); - } - } else if (args[argix].startsWith("-j")) { - jFlag = true; selected = true; - if (((argix + 1) < argc) && - (!args[argix + 1].startsWith("-"))) { - jID = Integer.parseInt(args[++argix]); - } - } else if (args[argix].startsWith("-s")) { - sFlag = true; selected = true; - if (((argix + 1) < argc) && - (!args[argix + 1].startsWith("-"))) { - sID = Integer.parseInt(args[++argix]); - } - } else if (args[argix].startsWith("-l")) { - lFlag = true; - if (((argix + 1) < argc) && - (!args[argix + 1].startsWith("-"))) { - loopCnt = Integer.parseInt(args[++argix]); - } else { - loopCnt = 60; - } - } else if (args[argix].startsWith("-i")) { - lFlag = true; - if (((argix + 1) < argc) && - (!args[argix + 1].startsWith("-"))) { - interval = Integer.parseInt(args[++argix]); - } - } else if (args[argix].startsWith("-d")) { - debF = true; - } else { - System.err.println(usage); - return; - } - } - } - - resourceMonitor = ResourceMonitor.getHandle(); - resourceMonitor.openDataModel(10000, 1000, 5000); - int ret; - Iterator iterator; - DataModel dm = null; - - for (int l = 0; l < loopCnt; l++) { - System.out.println("\n------- Loop cnt = "+l+" -------------"); - if (!selected || pFlag) { - System.out.println("\n--------- PROCESSES ----------"); - dm = resourceMonitor.getDataModel(false); - iterator = dm.getProcessIterator(); - while (iterator.hasNext()) { - pui = (ProcessDataModel) iterator.next(); - if ((pID == -1) || ((ProcessDataModel)pui).pid == pID) - System.out.println(pui); - } - resourceMonitor.releaseDataModel(dm); - } - if (!selected || uFlag) { - System.out.println("\n--------- USERS ----------"); - dm = resourceMonitor.getDataModel(false); - iterator = dm.getProcessIterator(); - while (iterator.hasNext()) { - aum = (ActiveUserModel) iterator.next(); - System.out.println(aum); - } - resourceMonitor.releaseDataModel(dm); - } - if (!selected || uFlag) { - System.out.println("\n--------- USERS PROCS ----------"); - dm = resourceMonitor.getDataModel(false); - iterator = dm.getProcessIterator(); - while (iterator.hasNext()) { - padm = (ProcessAggregateDataModel) iterator.next(); - System.out.println(padm); - } - resourceMonitor.releaseDataModel(dm); - } - if (!selected || jFlag) { - System.out.println("\n--------- PROJECT ----------"); - dm = resourceMonitor.getDataModel(false); - iterator = dm.getProcessIterator(); - while (iterator.hasNext()) { - apm = (ActiveProjectModel) iterator.next(); - System.out.println(apm); - } - resourceMonitor.releaseDataModel(dm); - } - if (!selected || jFlag) { - System.out.println("\n--------- USERS PROCS ----------"); - dm = resourceMonitor.getDataModel(false); - iterator = dm.getProcessIterator(); - while (iterator.hasNext()) { - padm = (ProcessAggregateDataModel) iterator.next(); - System.out.println(padm); - } - resourceMonitor.releaseDataModel(dm); - } - napms(6000); - } - - } catch (Exception e) { - System.err.println(e); - System.err.println(usage); - resourceMonitor.closeDataModel(); - return; - } - resourceMonitor.closeDataModel(); - - } // end main - - /** - * Waits some milliseconds. - * - * @param ms time to wait in milliseconds - */ - public static void napms(int ms) { - try { - Thread.sleep(ms); - } catch (InterruptedException e) {} - } - -} // end class rmon diff --git a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/stats.java b/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/stats.java deleted file mode 100644 index 8cce6e341a..0000000000 --- a/usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/stats.java +++ /dev/null @@ -1,477 +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" - * - * Copyright (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - * - * stats.java - */ - -package com.sun.wbem.solarisprovider.srm; - -import java.util.*; -import java.net.InetAddress; -import javax.wbem.cim.*; -import javax.wbem.client.*; - -public class stats { - /* - * -u username - * -p project - * -h host - * -I id to auth - * -P passwd - */ - - CIMClient client = null; - String user = new String(""); - String project = new String(""); - String host = ""; - String id = new String(""); - String passwd = new String(""); - boolean showproject = false; - boolean listprops = false; - boolean checkonly = false; - int intervalms = 5000; - - String usage = new String( - "Usage: " + this.getClass().getName() + "\n" + - "\t" + "-u userid -p projectname\n" + - "\t" + "-r{aw} [property name] -d{elta} [property name]\n" + - "\t" + "-L{ist all property names}\n" + - "\t" + "-C{heck for existence}\n" + - "\t" + "-i [update interval (sec)]\n" + - "\t" + "-h host -I auth_user_id -P auth_user_passwd\n" + - "\n" + - "-I and -P are always required.\n" + - "At least one of -r or -d is required unless -L or -C are used.\n" + - "If -L is specifed, -r, -d, and -i are ignored.\n" + - "If -C is specified, one of -u or -p must be used.\n" + - "Default value for -i is " + - Integer.toString(intervalms / 1000) + " seconds.\n" + - "Default value for -h is \"localhost\"."); - - - void badarg(String s) { - System.err.println("Ignoring invalid argument \"" + s + "\""); - } - - - void parseargs(String args[]) { - int argc = args.length; - int i, l; - - for (i = 0; i < argc; i++) { - - if (args[i].startsWith("-u")) { - - // specific user to monitor - if ((l = args[i].length()) > 2) - user = args[i].substring(2, l); - else if ((i < argc - 1) && (!args[i + 1].startsWith("-"))) - user = args[++i]; - else - badarg(args[i]); - - } else if (args[i].startsWith("-p")) { - - // specific project to monitor - if ((l = args[i].length()) > 2) - project = args[i].substring(2, l); - else if ((i < argc - 1) && (!args[i + 1].startsWith("-"))) - project = args[++i]; - else - badarg(args[i]); - - } else if (args[i].startsWith("-h")) { - - // hostname - if ((l = args[i].length()) > 2) - host = args[i].substring(2, l); - else if ((i < argc - 1) && (!args[i + 1].startsWith("-"))) - host = args[++i]; - else - badarg(args[i]); - - } else if (args[i].startsWith("-i")) { - - // update interval - String s = Integer.toString(intervalms / 1000); - if ((l = args[i].length()) > 2) - s = args[i].substring(2, l); - else if ((i < argc - 1) && (!args[i + 1].startsWith("-"))) - s = args[++i]; - else - badarg(args[i]); - intervalms = Integer.valueOf(s).intValue() * 1000; - - } else if (args[i].startsWith("-I")) { - - // user authentication identity - if ((l = args[i].length()) > 2) - id = args[i].substring(2, l); - else if ((i < argc - 1) && (!args[i + 1].startsWith("-"))) { - id = args[++i]; - } - else - badarg(args[i]); - - } else if (args[i].startsWith("-P")) { - - // user authentication password - if ((l = args[i].length()) > 2) - passwd = args[i].substring(2, l); - else if ((i < argc - 1) && (!args[i + 1].startsWith("-"))) - passwd = args[++i]; - else - badarg(args[i]); - - } else if (args[i].startsWith("-r")) { - - // raw property to be monitored - String tmp = new String(""); - if ((l = args[i].length()) > 2) - tmp = args[i].substring(2, l); - else if ((i < argc - 1) && (!args[i + 1].startsWith("-"))) - tmp = args[++i]; - else { - badarg(args[i]); - continue; - } - props.addElement(tmp); - - } else if (args[i].startsWith("-d")) { - - // delta property to be monitored - String tmp = new String(""); - if ((l = args[i].length()) > 2) - tmp = args[i].substring(2, l); - else if ((i < argc - 1) && (!args[i + 1].startsWith("-"))) - tmp = args[++i]; - else { - badarg(args[i]); - continue; - } - props.addElement(tmp); - deltaprops.add(tmp); - - } else if (args[i].startsWith("-L")) { - - // list property names only - listprops = true; - - } else if (args[i].startsWith("-C")) { - - // check for existence only - checkonly = true; - - } else { - - // unknown arg - System.err.println(usage); - return; - - } - } - } - - Vector props = new Vector(); - HashSet deltaprops = new HashSet(); - - void printHeader(String s, Vector v) { - System.out.println((showproject ? "Project " : " User ") + s); - Enumeration e = v.elements(); - while (e.hasMoreElements()) - System.out.print((String) e.nextElement() + "\t"); - System.out.println(""); - } - - - // compute val1 - val2 - String delta(CIMValue val1, CIMValue val2) { - String rv = new String("empty"); - - if (val1 == null || val2 == null) - return new String("null"); - - Object a = val1.getValue(); - Object b = val2.getValue(); - - if (!(a instanceof Number) || !(b instanceof Number)) - rv = new String("NAN"); - else if (a instanceof UnsignedInt64 && b instanceof UnsignedInt64) { - long x = ((UnsignedInt64) a).longValue(); - long y = ((UnsignedInt64) b).longValue(); - long z = x - y; - rv = new String(Long.toString(z)); - } else if (a instanceof UnsignedInt32 && b instanceof UnsignedInt32) { - int x = ((UnsignedInt32) a).intValue(); - int y = ((UnsignedInt32) b).intValue(); - int z = x - y; - rv = new String(Integer.toString(z)); - } else if (a instanceof Float && b instanceof Float) { - float x = ((Float) a).floatValue(); - float y = ((Float) b).floatValue(); - float z = x - y; - rv = new String(Float.toString(z)); - } else - rv = new String("unknown"); - - return rv; - } - - - void checkOnly(String name) { - CIMInstance ci = null; - - String className = new String("Solaris_Active"); - className += (showproject ? "Project" : "User"); - - CIMObjectPath op = new CIMObjectPath(className); - - if (showproject) { - op.addKey("ProjectName", - new CIMValue(new String(name))); - op.addKey("CreationClassName", - new CIMValue("Solaris_ActiveProject")); - } else { - op.addKey("UserID", - new CIMValue(new Integer(name))); - op.addKey("CreationClassName", - new CIMValue("Solaris_ActiveUser")); - } - op.addKey("CSCreationClassName", - new CIMValue("Solaris_ComputerSystem")); - op.addKey("CSName", - new CIMValue(host)); - op.addKey("OSCreationClassName", - new CIMValue("Solaris_OperatingSystem")); - op.addKey("OSName", - new CIMValue("SunOS")); - - try { - ci = client.getInstance(op, false); - } catch (CIMException x) { - System.err.println(x); - Runtime.getRuntime().exit(-1); - } - - System.err.println("CI: " + ci); - - Runtime.getRuntime().exit(0); - } - - - void validateProps() { - // assume User and ProcessAggregate are the same... - String className = new String( - "Solaris_UserProcessAggregateStatisticalInformation"); - CIMObjectPath op = new CIMObjectPath(className); - CIMClass c = null; - - try { - c = client.getClass(op, false); - } catch (CIMException x) { - System.err.println(x); - Runtime.getRuntime().exit(-1); - } - - String propname = null; - Enumeration e = props.elements(); - while (e.hasMoreElements()) { - propname = (String) e.nextElement(); - if (c.getProperty(propname) == null) { - System.err.println( - "Unknown property `" + propname + "' -- try -L."); - Runtime.getRuntime().exit(-1); - } - } - } - - - void listProps() { - // assume User and ProcessAggregate are the same... - String className = new String( - "Solaris_UserProcessAggregateStatisticalInformation"); - - try { - CIMObjectPath op = new CIMObjectPath(className); - CIMClass c = client.getClass(op, false); - Vector v = c.getAllProperties(); - Enumeration e = v.elements(); - while (e.hasMoreElements()) { - CIMProperty p = (CIMProperty) e.nextElement(); - System.out.println("\t" + p.getName()); - } - } catch (Exception x) { - System.out.println(x); - } - } - - - public void _main(String args[]) { - String name = new String(""); - - // handle comd-line args - parseargs(args); - - // default to localhost - if (host.length() == 0) { - try { - host = new String(InetAddress.getLocalHost().getHostName()); - } catch (Exception x) { - System.err.println(x); - Runtime.getRuntime().exit(-1); - } - } - - // always need auth id - if (id.length() == 0 || passwd.length() == 0) { - System.err.println("Username (-I) and password (-P) are required."); - System.err.println(usage); - Runtime.getRuntime().exit(-1); - } - - // initialize client connection to CIMOM - try { - CIMNameSpace ns = new CIMNameSpace(host); - UserPrincipal principal = new UserPrincipal(id); - PasswordCredential credential = new PasswordCredential(passwd); - client = new CIMClient(ns, principal, credential); - // System.err.println("CLIENT: " + client); - } catch (CIMException x) { - System.err.println(x); - Runtime.getRuntime().exit(-1); - } - - // just list available properties? - if (listprops) { - listProps(); - Runtime.getRuntime().exit(0); - } - - // always need a user id or project name - if (user.length() == 0) { - if (project.length() == 0) { - System.err.println( - "User (-u) or project (-p) must be specified."); - System.err.println(usage); - Runtime.getRuntime().exit(-1); - } else { - name = project; - showproject = true; - } - } else - name = user; - - // just check for entity existence? - if (checkonly) { - checkOnly(name); - Runtime.getRuntime().exit(0); - } - - - // examine specified process aggregate - String className = new String("Solaris_"); - className += (showproject ? "Project" : "User"); - className += "ProcessAggregateStatisticalInformation"; - - // check that all specified props exist - validateProps(); - - printHeader(name, props); - - long timestamp = 0; - long lastTimestamp = 0; - - Hashtable oldVals = new Hashtable(); - Hashtable newVals = new Hashtable(); - String p; - - try { - - CIMObjectPath op = new CIMObjectPath(className); - op.addKey("Name", new CIMValue(name)); - // System.err.println("OP: " + op); - - while (true) { - CIMInstance ci = client.getInstance(op, false); - // System.err.println("CI: " + ci); - - CIMValue val = ci.getProperty("Timestamp").getValue(); - timestamp = ((UnsignedInt64) val.getValue()).longValue(); - newVals.put("Timestamp", val); - - if (timestamp > lastTimestamp) { - Enumeration e = props.elements(); - while (e.hasMoreElements()) { - p = (String) e.nextElement(); - val = ci.getProperty(p).getValue(); - newVals.put(p, val); - } - lastTimestamp = timestamp; - - e = props.elements(); - while (e.hasMoreElements()) { - p = (String) e.nextElement(); - String s = new String(); - CIMValue o = (CIMValue) oldVals.get(p); - CIMValue n = (CIMValue) newVals.get(p); - - { - String a = "x"; - String b = "x"; - if (o != null) - a = o.toString(); - if (n != null) - b = n.toString(); - // System.out.print(p + ": " + a + "/" + b + "\t"); - } - - if (deltaprops.contains(p)) { - s = delta(n, o); - oldVals.put(p, n); - } else { - s = n.toString(); - } - System.out.print(s + "\t"); - } - System.out.println(); - - } - Thread.sleep(intervalms); - } - - } catch (Exception x) { - x.printStackTrace(); - } - } - - - public static void main(String args[]) { - stats inst = new stats(); - inst._main(args); - - } -} diff --git a/usr/src/cmd/wbem/provider/tools/Makefile b/usr/src/cmd/wbem/provider/tools/Makefile deleted file mode 100644 index eb0f194b4c..0000000000 --- a/usr/src/cmd/wbem/provider/tools/Makefile +++ /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 -# -# -#ident "%Z%%M% %I% %E% SMI" -# -# cmd/wbem/provider/tools/Makefile -# -# Copyright (c) 2001 Sun Microsystems, Inc. -# All rights reserved. -# - -# include global definitions -include $(SRC)/cmd/wbem/Makefile.wbem - -SUBDIRS= rds - -all:= TARGET= all -install:= TARGET= install -clean:= TARGET= clean -clobber:= TARGET= clobber -lint:= TARGET= lint - -.KEEP_STATE: - -all install install_h clean clobber lint: $(SUBDIRS) - -$(SUBDIRS): FRC - cd $@; pwd; $(MAKE) $(TARGET) - -FRC: diff --git a/usr/src/cmd/wbem/provider/tools/rds/Makefile b/usr/src/cmd/wbem/provider/tools/rds/Makefile deleted file mode 100644 index 1c760d1949..0000000000 --- a/usr/src/cmd/wbem/provider/tools/rds/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 -# -# -#ident "%Z%%M% %I% %E% SMI" -# -# cmd/wbem/provider/tools/rds/Makefile -# -# Copyright (c) 2001 by Sun Microsystems, Inc. -# All rights reserved. -# - - -PROG = rds -OBJS = rds.o rdutil.o rdfile.o rdtable.o rdkstat.o rdimpl.o rdprot.o prtelement.o -POFILES = $(OBJS:.o=.po) -CLOBBERFILES = $(POFILE) $(POFILES) - -include $(SRC)/cmd/wbem/Makefile.cmd - -POFILE = prds.po - -.KEEP_STATE: - -SUBDIRS = $(MACH) -$(BUILD64)SUBDIRS += $(MACH64) - - -all := TARGET = all -install := TARGET = install -clean := TARGET = clean -clobber := TARGET = clobber -lint := TARGET = lint -test := TARGET = test - -all: $(WBEMTOOLDIRS) $(SUBDIRS) -clean: $(SUBDIRS) -clobber: $(SUBDIRS) -lint: $(SUBDIRS) -test: $(SUBDIRS) - -install: all $(SUBDIRS) - -$(RM) $(ROOTWBEMPROG) - -$(LN) $(ISAEXEC) $(ROOTWBEMPROG) - -$(SUBDIRS): FRC - @cd $@; pwd; $(MAKE) $(TARGET) - -$(POFILE): $(POFILES) - $(RM) $@ - $(CAT) $(POFILES) > $@ - -FRC: - -include $(SRC)/cmd/Makefile.targ - diff --git a/usr/src/cmd/wbem/provider/tools/rds/Makefile.com b/usr/src/cmd/wbem/provider/tools/rds/Makefile.com deleted file mode 100644 index 02a6e4dc6d..0000000000 --- a/usr/src/cmd/wbem/provider/tools/rds/Makefile.com +++ /dev/null @@ -1,68 +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. -# -# cmd/wbem/provider/tools/rds/Makefile.com -# - - -PROG = rds -OBJS = rds.o rdutil.o rdfile.o rdtable.o rdimpl.o rdprot.o rdlist.o prtelement.o -SRCS = $(OBJS:%.o=../%.c) - -include $(SRC)/cmd/wbem/Makefile.cmd - -CPPFLAGS += -D_REENTRANT -CFLAGS += $(CCVERBOSE) -CFLAGS64 += $(CCVERBOSE) -LDLIBS += -lproject -LINTFLAGS += -u -LINTFLAGS64 += -u - -# i.e. permission and group for /usr/bin-style executables -FILEMODE = 0555 - -.KEEP_STATE: - -.PARALLEL : $(OBJS) - -all: $(PROG) - -test: - echo WBEMPROG32 $(ROOTWBEMPROG32) - -clean: - $(RM) $(OBJS) - -$(PROG): $(OBJS) - $(LINK.c) -o $@ $(OBJS) $(LDLIBS) - $(POST_PROCESS) - -%.o: ../%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - -lint: - $(LINT.c) $(SRCS) $(LDLIBS) - -include $(SRC)/cmd/Makefile.targ diff --git a/usr/src/cmd/wbem/provider/tools/rds/amd64/Makefile b/usr/src/cmd/wbem/provider/tools/rds/amd64/Makefile deleted file mode 100644 index 12fd5317c1..0000000000 --- a/usr/src/cmd/wbem/provider/tools/rds/amd64/Makefile +++ /dev/null @@ -1,37 +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" -# - -.KEEP_STATE: - - -include ../Makefile.com -include $(SRC)/cmd/Makefile.cmd.64 - -install: all $(ROOTWBEMPROG64) - - diff --git a/usr/src/cmd/wbem/provider/tools/rds/i386/Makefile b/usr/src/cmd/wbem/provider/tools/rds/i386/Makefile deleted file mode 100644 index a61ceffb98..0000000000 --- a/usr/src/cmd/wbem/provider/tools/rds/i386/Makefile +++ /dev/null @@ -1,35 +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" -# -# cmd/wbem/provider/tools/rds/i386/Makefile -# -# Copyright (c) 2001 by Sun Microsystems, Inc. -# All rights reserved. -# - -.KEEP_STATE: - -include ../Makefile.com - -install: all $(ROOTWBEMPROG32) diff --git a/usr/src/cmd/wbem/provider/tools/rds/prtelement.c b/usr/src/cmd/wbem/provider/tools/rds/prtelement.c deleted file mode 100644 index a989d11851..0000000000 --- a/usr/src/cmd/wbem/provider/tools/rds/prtelement.c +++ /dev/null @@ -1,112 +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 (c) 2000-2001 by Sun Microsystems, Inc. - * All rights reserved. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include - -#include "rdimpl.h" - - -void -prtelement(FILE *fp, id_info_t *id) -{ - (void) fprintf(fp, "\n" - "processID = %d\n" - "userID = %d\n" - "taskID = %d\n" - "projectID = %d\n" - "setID = %d\n" - "UserModeTime = %f\n" - "SystemModeTime = %f\n" - "SystemTrapTime = %f\n" - "TextPageFaultSleepTime = %f\n" - "DataPageFaultSleepTime = %f\n" - "SystemPageFaultSleepTime = %f\n" - "UserLockWaitSleepTime = %f\n" - "OtherSleepTime = %f\n" - "WaitCPUTime = %f\n" - "StoppedTime = %f\n" - "MinorPageFaults = %" PRId64 "\n" - "MajorPageFaults = %" PRId64 "\n" - "SwapOperations = %" PRId64 "\n" - "BlocksRead = %" PRId64 "\n" - "BlocksWritten = %" PRId64 "\n" - "MessagesSent = %" PRId64 "\n" - "MessagesReceived = %" PRId64 "\n" - "SignalsReceived = %" PRId64 "\n" - "VoluntaryContextSwitches = %" PRId64 "\n" - "InvoluntaryContextSwitches = %" PRId64 "\n" - "SystemCallsMade = %" PRId64 "\n" - "CharacterIOUsage = %" PRId64 "\n" - "ProcessHeapSize = %" PRId64 "\n" - "ProcessVMSize = %" PRId64 "\n" - "ProcessResidentSetSize = %" PRId64 "\n" - "PercentCPUTime = %f\n" - "PercentMemorySize = %f\n" - "UserSystemModeTime = %" PRId64 "\n" - "NumThreads = %d\n" - "NumProcesses = %d\n" - "TIMESTAMP in us = %" PRId64 "\n" - "name = %s\n", - id->id_pid, - id->id_uid, - id->id_taskid, - id->id_projid, - id->id_psetid, - id->id_usr, - id->id_sys, - id->id_ttime, - id->id_tpftime, - id->id_dpftime, - id->id_kpftime, - id->id_lck, - id->id_slp, - id->id_lat, - id->id_stime, - id->id_minf, - id->id_majf, - id->id_nswap, - id->id_inblk, - id->id_oublk, - id->id_msnd, - id->id_mrcv, - id->id_sigs, - id->id_vctx, - id->id_ictx, - id->id_scl, - id->id_ioch, - id->id_hpsize, - id->id_size, - id->id_rssize, - id->id_pctcpu, - id->id_pctmem, - id->id_time, - id->id_nlwps, - id->id_nproc, - id->id_timestamp, - id->id_name); -} diff --git a/usr/src/cmd/wbem/provider/tools/rds/rdfile.c b/usr/src/cmd/wbem/provider/tools/rds/rdfile.c deleted file mode 100644 index fb2a4e3083..0000000000 --- a/usr/src/cmd/wbem/provider/tools/rds/rdfile.c +++ /dev/null @@ -1,226 +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 (c) 2000-2001 by Sun Microsystems, Inc. - * All rights reserved. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include -#include -#include -#include -#include -#include -#include - -#include "rdimpl.h" -#include "rdtable.h" -#include "rdutil.h" -#include "rdfile.h" - -#define FDS_TABLE_SIZE 1024 - -static fd_t *fd_tbl = NULL; -static int fd_max; -static int fd_cnt; -static int fd_cnt_cur; -static int fd_cnt_old; -static fds_t *fds_tbl[FDS_TABLE_SIZE]; - -void -fd_init(int n) -{ - fd_max = n; - fd_cnt = fd_cnt_cur = fd_cnt_old = 0; - fd_tbl = Zalloc(sizeof (fd_t) * n); - (void) memset(fds_tbl, 0, sizeof (fds_t *) * FDS_TABLE_SIZE); -} - -void -fd_exit() -{ - if (fd_tbl) - free(fd_tbl); -} - -void -fd_close(fd_t *fdp) -{ - if (fdp) { - if (fdp->fd_fd >= 0 && fdp->fd_name[0] != '\0') { - (void) close(fdp->fd_fd); - fd_cnt--; - } - - (void) memset(fdp, 0, sizeof (fd_t)); - fdp->fd_fd = -1; - } -} - -void -fd_closeall() -{ - fd_t *fdp = fd_tbl; - int i; - - for (i = 0; i < fd_max; i++) { - fd_close(fdp); - fdp++; - } -} - - -int -fd_count() -{ - fd_t *fdp = fd_tbl; - int count = 0; - int i; - - for (i = 0; i < fd_max; i++, fdp++) { - if (fdp->fd_name[0] != '\0') { - ++count; - } - } - return (count); -} - - -static void -fd_recycle() -{ - fd_t *fdp = fd_tbl; - int counter; - int i; - - counter = abs(fd_cnt_old - fd_cnt) + NUM_RESERVED_FD; - - for (i = 0; i < fd_max; i++, fdp++) { - - if (fdp->fd_fd == -1) - continue; /* skip recycled ones */ - - if (fdp->fd_name[0] != '\0') { /* file has name */ - (void) close(fdp->fd_fd); - fd_cnt--; - counter--; - fdp->fd_fd = -1; - } - - if (counter == 0) - break; - } -} - -fd_t * -fd_open(char *name, int flags, fd_t *fdp) -{ - fd_t *fdp_new; - int fd; - - if (fd_cnt > fd_max - NUM_RESERVED_FD) - fd_recycle(); - - if (fdp != NULL) { - if ((strcmp(fdp->fd_name, name) == 0) && (fdp->fd_fd >= 0)) { - fd_cnt_cur++; - return (fdp); - } - } - -again: fd = open(name, flags); - - if (fd == -1) { - if ((errno == EMFILE) || (errno == ENFILE)) { - fd_recycle(); - goto again; - } - fdp_new = NULL; - } else { - fdp_new = &fd_tbl[fd]; - fdp_new->fd_fd = fd; - fdp_new->fd_flags = flags; - (void) strcpy(fdp_new->fd_name, name); - fd_cnt++; - fd_cnt_cur++; - } - return (fdp_new); -} - -int -fd_getfd(fd_t *fdp) -{ - return (fdp->fd_fd); -} - -void -fd_update() -{ - fd_cnt_old = fd_cnt_cur; - fd_cnt_cur = 0; -} - -fds_t * -fds_get(pid_t pid) -{ - fds_t *fdsp; - int hash = pid % FDS_TABLE_SIZE; - - for (fdsp = fds_tbl[hash]; fdsp; fdsp = fdsp->fds_next) - if (fdsp->fds_pid == pid) /* searching for pid */ - return (fdsp); - - fdsp = Zalloc(sizeof (fds_t)); /* adding new if pid was not found */ - fdsp->fds_pid = pid; - fdsp->fds_next = fds_tbl[hash]; - fds_tbl[hash] = fdsp; - return (fdsp); -} - -void -fds_rm(pid_t pid) -{ - fds_t *fds; - fds_t *fds_prev = NULL; - int hash = pid % FDS_TABLE_SIZE; - - for (fds = fds_tbl[hash]; fds && fds->fds_pid != pid; - fds = fds->fds_next) /* finding pid */ - fds_prev = fds; - - if (fds) { /* if pid was found */ - - fd_close(fds->fds_psinfo); - fd_close(fds->fds_usage); - fd_close(fds->fds_lpsinfo); - fd_close(fds->fds_lusage); - - if (fds_prev) - fds_prev->fds_next = fds->fds_next; - else - fds_tbl[hash] = fds->fds_next; - - free(fds); - } -} diff --git a/usr/src/cmd/wbem/provider/tools/rds/rdfile.h b/usr/src/cmd/wbem/provider/tools/rds/rdfile.h deleted file mode 100644 index 2c025dc644..0000000000 --- a/usr/src/cmd/wbem/provider/tools/rds/rdfile.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 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _RDFILE_H -#define _RDFILE_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define MAX_PROCFS_PATH 40 -#define NUM_RESERVED_FD 10 - -typedef struct fd { - int fd_fd; - int fd_flags; - char fd_name[MAX_PROCFS_PATH]; -} fd_t; - -typedef struct fds { - pid_t fds_pid; - fd_t *fds_psinfo; - fd_t *fds_usage; - fd_t *fds_lpsinfo; - fd_t *fds_lusage; - struct fds *fds_next; -} fds_t; - -extern void fd_init(int); -extern void fd_exit(); -extern fd_t *fd_open(char *, int, fd_t *); -extern int fd_getfd(fd_t *); -extern void fd_close(fd_t *); -extern void fd_closeall(); -extern void fd_update(); -extern fds_t *fds_get(pid_t); -extern void fds_rm(pid_t); -extern int fd_count(); - -#ifdef __cplusplus -} -#endif - -#endif /* _RDFILE_H */ diff --git a/usr/src/cmd/wbem/provider/tools/rds/rdimpl.c b/usr/src/cmd/wbem/provider/tools/rds/rdimpl.c deleted file mode 100644 index eb98808864..0000000000 --- a/usr/src/cmd/wbem/provider/tools/rds/rdimpl.c +++ /dev/null @@ -1,747 +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 -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "rdimpl.h" -#include "rdutil.h" -#include "rdtable.h" -#include "rdfile.h" -#include "rdlist.h" - -/* global variables */ - -extern pthread_mutex_t listLock; - -list_t lwps; /* list of lwps/processes */ -list_t users; /* list of users */ -list_t projects; /* list of projects */ -list_t processes; /* list of processes */ - -sys_info_t sys_info; - -jmp_buf dm_jmpbuffer; -char errmsg[NL_TEXTMAX]; /* error message max 255 */ - -static float total_mem; /* total memory usage */ -static float total_cpu; /* total cpu usage */ -static char *nullstr = "null"; -static double loadavg[3]; -static DIR *procdir; - - -/* - * Add a LWP entry to the specifed list. - */ -lwp_info_t * -list_add_lwp(list_t *list, pid_t pid, id_t lwpid) -{ - lwp_info_t *lwp; - - if (list->l_head == NULL) { - list->l_head = list->l_tail = lwp = Zalloc(sizeof (lwp_info_t)); - } else { - lwp = Zalloc(sizeof (lwp_info_t)); - lwp->li_prev = list->l_tail; - ((lwp_info_t *)list->l_tail)->li_next = lwp; - list->l_tail = lwp; - } - lwp->li_lwpsinfo = Zalloc(sizeof (lwpsinfo_t)); - lwp->li_psinfo = Zalloc(sizeof (psinfo_t)); - lwp->li_psinfo->pr_pid = pid; - lwp->li_lwpsinfo->pr_lwpid = lwpid; - lwpid_add(lwp, pid, lwpid); - list->l_count++; - return (lwp); -} - - -/* - * Remove an LWP entry from the specified list. - */ -static void -list_remove_lwp(list_t *list, lwp_info_t *lwp) -{ - - if (lwp->li_prev) - lwp->li_prev->li_next = lwp->li_next; - else - list->l_head = lwp->li_next; /* removing the head */ - if (lwp->li_next) - lwp->li_next->li_prev = lwp->li_prev; - else - list->l_tail = lwp->li_prev; /* removing the tail */ - lwpid_del(lwp->li_psinfo->pr_pid, lwp->li_lwpsinfo->pr_lwpid); - if (lwpid_pidcheck(lwp->li_psinfo->pr_pid) == 0) - fds_rm(lwp->li_psinfo->pr_pid); - list->l_count--; - Free(lwp->li_lwpsinfo); - Free(lwp->li_psinfo); - Free(lwp); -} - - -/* - * Remove entry from the specified list. - */ -static void -list_remove_id(list_t *list, id_info_t *id) -{ - - if (id->id_prev) - id->id_prev->id_next = id->id_next; - else - list->l_head = id->id_next; /* removing the head */ - if (id->id_next) - id->id_next->id_prev = id->id_prev; - else - list->l_tail = id->id_prev; /* removing the tail */ - - list->l_count--; - /* anly free if doesn't point to static 'nullstr' def */ - if (id->id_name != nullstr) - Free(id->id_name); - Free(id); -} - - -/* - * Empty the specified list. - * If it's an LWP list, this will traverse /proc to - * restore microstate accounting to its original value. - */ -void -list_clear(list_t *list) -{ - if (list->l_type == LT_LWPS) { - lwp_info_t *lwp = list->l_tail; - lwp_info_t *lwp_tmp; - - fd_closeall(); - while (lwp) { - lwp_tmp = lwp; - lwp = lwp->li_prev; - list_remove_lwp(&lwps, lwp_tmp); - } - } else { - id_info_t *id = list->l_head; - id_info_t *nextid; - while (id) { - nextid = id->id_next; - /* anly free if doesn't point to static 'nullstr' def */ - if (id->id_name != nullstr) - Free(id->id_name); - Free(id); - id = nextid; - } - list->l_count = 0; - list->l_head = list->l_tail = NULL; - } -} - - -/* - * Calculate a process' statistics from its lwp statistics. - */ -static void -id_update(id_info_t *id, lwp_info_t *lwp, int l_type) { - char usrname[LOGNAME_MAX+1]; - char projname[PROJNAME_MAX+1]; - - /* - * When an id is processed first time in an update run its - * id_alive flag set to false. - * The next values are gauges, their old values from the previous - * calculation should be set to null. - * The names and timestamp must be set once. - */ - if (id->id_alive == B_FALSE) { - id->id_hpsize = 0; - id->id_size = 0; - id->id_rssize = 0; - id->id_pctmem = 0; - id->id_timestamp = 0; - id->id_time = 0; - id->id_pctcpu = 0; - id->id_nlwps = 0; - id->id_nproc = 0; - id->id_pid = (int)-1; - id->id_taskid = lwp->li_psinfo->pr_taskid; - id->id_projid = lwp->li_psinfo->pr_projid; - id->id_psetid = lwp->li_lwpsinfo->pr_bindpset; - id->id_uid = lwp->li_psinfo->pr_uid; - if (l_type == LT_USERS) { - getusrname(id->id_uid, usrname, LOGNAME_MAX+1); - id->id_name = Realloc(id->id_name, - strlen(usrname) + 1); - (void) strcpy(id->id_name, usrname); - } else if (l_type == LT_PROJECTS) { - getprojname(id->id_projid, projname, PROJNAME_MAX); - id->id_name = Realloc(id->id_name, - strlen(projname) + 1); - (void) strcpy(id->id_name, projname); - } else { - id->id_name = nullstr; - } - id->id_timestamp = get_timestamp(); - /* mark this id as changed in this update run */ - id->id_alive = B_TRUE; - } - - if (lwp->li_psinfo->pr_nlwp > 0) { - id->id_nlwps++; - } - - /* - * The next values are calculated only one time for each pid. - */ - if ((id->id_pid != lwp->li_psinfo->pr_pid) && - (lwp->rlwpid == lwp->li_lwpsinfo->pr_lwpid)) { - id->id_nproc++; - id->id_hpsize += (lwp->li_hpsize/1024); - id->id_size += lwp->li_psinfo->pr_size; - id->id_rssize += lwp->li_psinfo->pr_rssize; - id->id_pctmem += FRC2PCT(lwp->li_psinfo->pr_pctmem); - id->id_pid = lwp->li_psinfo->pr_pid; - if (l_type == LT_PROCESS) - total_mem += FRC2PCT(lwp->li_psinfo->pr_pctmem); - } - - id->id_pctcpu += FRC2PCT(lwp->li_lwpsinfo->pr_pctcpu); - if (l_type == LT_PROCESS) - total_cpu += FRC2PCT(lwp->li_lwpsinfo->pr_pctcpu); - id->id_time += TIME2SEC(lwp->li_lwpsinfo->pr_time); - id->id_usr += lwp->li_usr; - id->id_sys += lwp->li_sys; - id->id_ttime += lwp->li_ttime; - id->id_tpftime += lwp->li_tpftime; - id->id_dpftime += lwp->li_dpftime; - id->id_kpftime += lwp->li_kpftime; - id->id_lck += lwp->li_lck; - id->id_slp += lwp->li_slp; - id->id_lat += lwp->li_lat; - id->id_stime += lwp->li_stime; - id->id_minf += lwp->li_minf; - id->id_majf += lwp->li_majf; - id->id_nswap += lwp->li_nswap; - id->id_inblk += lwp->li_inblk; - id->id_oublk += lwp->li_oublk; - id->id_msnd += lwp->li_msnd; - id->id_mrcv += lwp->li_mrcv; - id->id_sigs += lwp->li_sigs; - id->id_vctx += lwp->li_vctx; - id->id_ictx += lwp->li_ictx; - id->id_scl += lwp->li_scl; - id->id_ioch += lwp->li_ioch; -} - -static void -list_update(list_t *list, lwp_info_t *lwp) -{ - id_info_t *id; - if (list->l_head == NULL) { /* first element */ - list->l_head = list->l_tail = id = Zalloc(sizeof (id_info_t)); - id_update(id, lwp, list->l_type); - list->l_count++; - return; - } - - for (id = list->l_head; id; id = id->id_next) { - if ((list->l_type == LT_PROCESS) && - (id->id_pid != lwp->li_psinfo->pr_pid)) - continue; - if ((list->l_type == LT_USERS) && - (id->id_uid != lwp->li_psinfo->pr_uid)) - continue; - if ((list->l_type == LT_PROJECTS) && - (id->id_projid != lwp->li_psinfo->pr_projid)) - continue; - id_update(id, lwp, list->l_type); - return; - } - - /* a new element */ - id = list->l_tail; - id->id_next = Zalloc(sizeof (id_info_t)); - id->id_next->id_prev = list->l_tail; - id->id_next->id_next = NULL; - list->l_tail = id->id_next; - id = list->l_tail; - id_update(id, lwp, list->l_type); - list->l_count++; -} - -/* - * This procedure removes all dead procs/user/.. from the specified list. - */ -static void -list_refresh_id(list_t *list) -{ - id_info_t *id, *id_next; - - if (!(list->l_type & LT_PROCESS) && !(list->l_type & LT_USERS) && - !(list->l_type & LT_TASKS) && !(list->l_type & LT_PROJECTS) && - !(list->l_type & LT_PSETS)) { - return; - } - id = list->l_head; - - while (id) { - if (id->id_alive == B_FALSE) { /* id is dead */ - id_next = id->id_next; - list_remove_id(list, id); - id = id_next; - } else { - - /* normalize total mem and cpu across all processes. */ - if (total_mem >= 100) - id->id_pctmem = (100 * id->id_pctmem) / - total_mem; - if (total_cpu >= 100) - id->id_pctcpu = (100 * id->id_pctcpu) / - total_cpu; - - id->id_alive = B_FALSE; - id = id->id_next; - } - } -} - -/* - * This procedure removes all dead lwps from the specified lwp list. - */ -static void -list_refresh(list_t *list) -{ - lwp_info_t *lwp, *lwp_next; - - if (!(list->l_type & LT_LWPS)) - return; - lwp = list->l_head; - - while (lwp) { - if (lwp->li_alive == B_FALSE) { /* lwp is dead */ - lwp_next = lwp->li_next; - list_remove_lwp(&lwps, lwp); - lwp = lwp_next; - } else { - lwp->li_alive = B_FALSE; - lwp = lwp->li_next; - } - } -} - - -/* - * Update a LWP entry according to the specified usage data. - */ -static void -lwp_update(lwp_info_t *lwp, struct prusage *usage_buf) -{ - lwp->li_usr = (double)(TIME2NSEC(usage_buf->pr_utime) - - TIME2NSEC(lwp->li_usage.pr_utime)) / NANOSEC; - lwp->li_sys = (double)(TIME2NSEC(usage_buf->pr_stime) - - TIME2NSEC(lwp->li_usage.pr_stime)) / NANOSEC; - lwp->li_ttime = (double)(TIME2NSEC(usage_buf->pr_ttime) - - TIME2NSEC(lwp->li_usage.pr_ttime)) / NANOSEC; - lwp->li_tpftime = (double)(TIME2NSEC(usage_buf->pr_tftime) - - TIME2NSEC(lwp->li_usage.pr_tftime)) / NANOSEC; - lwp->li_dpftime = (double)(TIME2NSEC(usage_buf->pr_dftime) - - TIME2NSEC(lwp->li_usage.pr_dftime)) / NANOSEC; - lwp->li_kpftime = (double)(TIME2NSEC(usage_buf->pr_kftime) - - TIME2NSEC(lwp->li_usage.pr_kftime)) / NANOSEC; - lwp->li_lck = (double)(TIME2NSEC(usage_buf->pr_ltime) - - TIME2NSEC(lwp->li_usage.pr_ltime)) / NANOSEC; - lwp->li_slp = (double)(TIME2NSEC(usage_buf->pr_slptime) - - TIME2NSEC(lwp->li_usage.pr_slptime)) / NANOSEC; - lwp->li_lat = (double)(TIME2NSEC(usage_buf->pr_wtime) - - TIME2NSEC(lwp->li_usage.pr_wtime)) / NANOSEC; - lwp->li_stime = (double)(TIME2NSEC(usage_buf->pr_stoptime) - - TIME2NSEC(lwp->li_usage.pr_stoptime)) / NANOSEC; - lwp->li_minf = usage_buf->pr_minf - lwp->li_usage.pr_minf; - lwp->li_majf = usage_buf->pr_majf - lwp->li_usage.pr_majf; - lwp->li_nswap = usage_buf->pr_nswap - lwp->li_usage.pr_nswap; - lwp->li_inblk = usage_buf->pr_inblk - lwp->li_usage.pr_inblk; - lwp->li_oublk = usage_buf->pr_oublk -lwp->li_usage.pr_oublk; - lwp->li_msnd = usage_buf->pr_msnd - lwp->li_usage.pr_msnd; - lwp->li_mrcv = usage_buf->pr_mrcv - lwp->li_usage.pr_mrcv; - lwp->li_sigs = usage_buf->pr_sigs - lwp->li_usage.pr_sigs; - lwp->li_vctx = usage_buf->pr_vctx - lwp->li_usage.pr_vctx; - lwp->li_ictx = usage_buf->pr_ictx - lwp->li_usage.pr_ictx; - lwp->li_scl = usage_buf->pr_sysc - lwp->li_usage.pr_sysc; - lwp->li_ioch = usage_buf->pr_ioch - lwp->li_usage.pr_ioch; - lwp->li_timestamp = TIME2NSEC(usage_buf->pr_tstamp); - (void) memcpy(&lwp->li_usage, usage_buf, sizeof (prusage_t)); -} - - -/* - * This is the meat of the /proc scanner. - * It will visit every single LWP in /proc. - */ -static void -collect_lwp_data() -{ - char *pidstr; - pid_t pid; - id_t lwpid; - size_t entsz; - long nlwps, nent, i; - char *buf, *ptr; - char pfile[MAX_PROCFS_PATH]; - - fds_t *fds; - lwp_info_t *lwp; - - dirent_t *direntp; - - prheader_t header_buf; - psinfo_t psinfo_buf; - prusage_t usage_buf; - lwpsinfo_t *lwpsinfo_buf; - prusage_t *lwpusage_buf; - - log_msg("->collect_lwp_data(): %d files open\n", fd_count()); - for (rewinddir(procdir); (direntp = readdir(procdir)); ) { - pidstr = direntp->d_name; - if (pidstr[0] == '.') /* skip "." and ".." */ - continue; - pid = atoi(pidstr); - if (pid == 0 || pid == 2 || pid == 3) - continue; /* skip sched, pageout and fsflush */ - - fds = fds_get(pid); /* get ptr to file descriptors */ - - /* - * Here we are going to read information about - * current process (pid) from /proc/pid/psinfo file. - * If process has more than one lwp, we also should - * read /proc/pid/lpsinfo for information about all lwps. - */ - (void) snprintf(pfile, MAX_PROCFS_PATH, - "/proc/%s/psinfo", pidstr); - if ((fds->fds_psinfo = fd_open(pfile, O_RDONLY, - fds->fds_psinfo)) == NULL) - continue; - if (pread(fd_getfd(fds->fds_psinfo), &psinfo_buf, - sizeof (struct psinfo), 0) != sizeof (struct psinfo)) { - fd_close(fds->fds_psinfo); - continue; - } - - fd_close(fds->fds_psinfo); - - nlwps = psinfo_buf.pr_nlwp + psinfo_buf.pr_nzomb; - if (nlwps > 1) { - (void) snprintf(pfile, MAX_PROCFS_PATH, - "/proc/%s/lpsinfo", pidstr); - if ((fds->fds_lpsinfo = fd_open(pfile, O_RDONLY, - fds->fds_lpsinfo)) == NULL) - continue; - entsz = sizeof (struct prheader); - if (pread(fd_getfd(fds->fds_lpsinfo), &header_buf, - entsz, 0) != entsz) { - fd_close(fds->fds_lpsinfo); - continue; - } - nent = header_buf.pr_nent; - entsz = header_buf.pr_entsize * nent; - ptr = buf = Malloc(entsz); - if (pread(fd_getfd(fds->fds_lpsinfo), buf, - entsz, sizeof (struct prheader)) != entsz) { - fd_close(fds->fds_lpsinfo); - Free(buf); - continue; - } - - fd_close(fds->fds_lpsinfo); - - for (i = 0; i < nent; - i++, ptr += header_buf.pr_entsize) { - /*LINTED ALIGNMENT*/ - lwpsinfo_buf = (lwpsinfo_t *)ptr; - lwpid = lwpsinfo_buf->pr_lwpid; - if ((lwp = lwpid_get(pid, lwpid)) == NULL) { - lwp = list_add_lwp(&lwps, pid, lwpid); - } - if (i == 0) - lwp->rlwpid = lwpid; - (void) memcpy(lwp->li_psinfo, &psinfo_buf, - sizeof (psinfo_t) - sizeof (lwpsinfo_t)); - lwp->li_alive = B_TRUE; - (void) memcpy(lwp->li_lwpsinfo, - lwpsinfo_buf, sizeof (lwpsinfo_t)); - } - Free(buf); - } else { - lwpid = psinfo_buf.pr_lwp.pr_lwpid; - if ((lwp = lwpid_get(pid, lwpid)) == NULL) { - lwp = list_add_lwp(&lwps, pid, lwpid); - } - lwp->rlwpid = lwpid; - (void) memcpy(lwp->li_psinfo, &psinfo_buf, - sizeof (psinfo_t) - sizeof (lwpsinfo_t)); - lwp->li_alive = B_TRUE; - (void) memcpy(lwp->li_lwpsinfo, - &psinfo_buf.pr_lwp, sizeof (lwpsinfo_t)); - lwp->li_lwpsinfo->pr_pctcpu = lwp->li_psinfo->pr_pctcpu; - } - - /* - * At this part of scandir we read additional information - * about processes from /proc/pid/usage file. - * Again, if process has more than one lwp, then we - * will get information about all its lwps from - * /proc/pid/lusage file. - */ - if (nlwps > 1) { - (void) snprintf(pfile, MAX_PROCFS_PATH, - "/proc/%s/lusage", pidstr); - if ((fds->fds_lusage = fd_open(pfile, O_RDONLY, - fds->fds_lusage)) == NULL) - continue; - entsz = sizeof (struct prheader); - if (pread(fd_getfd(fds->fds_lusage), &header_buf, - entsz, 0) != entsz) { - fd_close(fds->fds_lusage); - continue; - } - - nent = header_buf.pr_nent; - entsz = header_buf.pr_entsize * nent; - buf = Malloc(entsz); - if (pread(fd_getfd(fds->fds_lusage), buf, - entsz, sizeof (struct prheader)) != entsz) { - fd_close(fds->fds_lusage); - Free(buf); - continue; - } - - fd_close(fds->fds_lusage); - - for (i = 1, ptr = buf + header_buf.pr_entsize; i < nent; - i++, ptr += header_buf.pr_entsize) { - /*LINTED ALIGNMENT*/ - lwpusage_buf = (prusage_t *)ptr; - lwpid = lwpusage_buf->pr_lwpid; - if ((lwp = lwpid_get(pid, lwpid)) == NULL) - continue; - lwp_update(lwp, lwpusage_buf); - } - Free(buf); - } else { - (void) snprintf(pfile, MAX_PROCFS_PATH, - "/proc/%s/usage", pidstr); - if ((fds->fds_usage = fd_open(pfile, O_RDONLY, - fds->fds_usage)) == NULL) - continue; - entsz = sizeof (prusage_t); - if (pread(fd_getfd(fds->fds_usage), &usage_buf, - entsz, 0) != entsz) { - fd_close(fds->fds_usage); - continue; - } - - fd_close(fds->fds_usage); - - lwpid = psinfo_buf.pr_lwp.pr_lwpid; - if ((lwp = lwpid_get(pid, lwpid)) == NULL) - continue; - lwp_update(lwp, &usage_buf); - } - } - list_refresh(&lwps); - fd_update(); - log_msg("<-collect_lwp_data(): %d files open\n", fd_count()); -} - - -/* - * Create linked lists of users, projects and sets. - * - * Updates of the process, users and projects lists are done in - * a critical section so that the consumer of these lists will - * always get consistent data. - */ -static void -list_create() -{ - struct utsname utsn; - lwp_info_t *lwp; - hrtime_t t1, t2, t3; - double d; - int rv; - - lwp = lwps.l_head; - total_mem = 0; - total_cpu = 0; - log_msg("->list_create()\n"); - t1 = gethrtime(); - if ((rv = pthread_mutex_lock(&listLock)) == 0) { - t2 = gethrtime(); - d = (double)(t2 - t1) / 1000000000.0; - log_msg("Scanner process lock wait was %1.5f sec\n", d); - - while (lwp) { - list_update(&processes, lwp); - list_update(&users, lwp); - list_update(&projects, lwp); - lwp = lwp->li_next; - } - list_refresh_id(&processes); - list_refresh_id(&users); - list_refresh_id(&projects); - /* release the mutex */ - if ((rv = pthread_mutex_unlock(&listLock)) != 0) - log_msg("pthread_mutex_unlock failed with %d\n", rv); - - t3 = gethrtime(); - - d = (double)(t3 - t2) / 1000000000.0; - log_msg("Scanner process lock time was %1.5f sec\n", d); - - } else { - log_msg("pthread_mutex_lock failed with %d\n", rv); - } - - if (uname(&utsn) != -1) { - sys_info.name = - Realloc(sys_info.name, strlen(utsn.sysname) + 1); - (void) strcpy(sys_info.name, utsn.sysname); - sys_info.nodename = - Realloc(sys_info.nodename, strlen(utsn.nodename) + 1); - (void) strcpy(sys_info.nodename, utsn.nodename); - } else { - log_err("uname()\n"); - } - - log_msg("<-list_create()\n"); -} - - -static void -collect_data() { - - collect_lwp_data(); - if (getloadavg(loadavg, 3) == -1) - dmerror("cannot get load average\n"); -} - - -void -monitor_stop() -{ - /* store the list state */ - if (ltdb_file != NULL) - (void) list_store(ltdb_file); - list_clear(&lwps); - list_clear(&processes); - list_clear(&users); - list_clear(&projects); - fd_exit(); -} - - -/* - * Initialize the monitor. - * Creates list data structures. - * If a saved list data file exists it is loaded. - * The /proc directory is opened. - * No actual scanning of /proc is done. - * - * Returns 0 if OK or -1 on error (leaving errno unchanged) - */ -int -monitor_start() -{ - - if (setjmp(dm_jmpbuffer) == 0) { - lwpid_init(); - fd_init(Setrlimit()); - - list_alloc(&lwps, LS_LWPS); - list_alloc(&processes, LT_PROCESS); - list_alloc(&users, LS_USERS); - list_alloc(&projects, LS_PROJECTS); - - list_init(&lwps, LT_LWPS); - list_init(&processes, LT_PROCESS); - list_init(&users, LT_USERS); - list_init(&projects, LT_PROJECTS); - - sys_info.name = NULL; - sys_info.nodename = NULL; - - if ((procdir = opendir("/proc")) == NULL) - dmerror("cannot open /proc directory\n"); - - /* restore the lists state */ - if (ltdb_file != NULL) - (void) list_restore(ltdb_file); - - return (0); - } else { - return (-1); - } -} - - -/* - * Update the monitor data lists. - * return 0, or -1 on error and leave errno unchanged - */ -int -monitor_update() -{ - if (setjmp(dm_jmpbuffer) == 0) { - collect_data(); - list_create(); - return (0); - } else { - return (-1); - } -} diff --git a/usr/src/cmd/wbem/provider/tools/rds/rdimpl.h b/usr/src/cmd/wbem/provider/tools/rds/rdimpl.h deleted file mode 100644 index 2363562f8e..0000000000 --- a/usr/src/cmd/wbem/provider/tools/rds/rdimpl.h +++ /dev/null @@ -1,210 +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. - */ - -#ifndef _RDIMPL_H -#define _RDIMPL_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -extern int monitor_start(); -extern void monitor_stop(); -extern int monitor_update(); -extern void list_clear(); -extern char *ltdb_file; -extern int mo; /* option flag for microstate accounting */ - -/* - * FRC2PCT macro is used to convert 16-bit binary fractions in the range - * 0.0 to 1.0 with binary point to the right of the high order bit - * (i.e. 1.0 == 0x8000) to percentage value. - */ - -#define FRC2PCT(pp) (((float)(pp))/0x8000*100) - -#define TIME2NSEC(__t)\ -(hrtime_t)(((hrtime_t)__t.tv_sec * (hrtime_t)NANOSEC) + (hrtime_t)__t.tv_nsec) -#define TIME2SEC(__t)\ -(hrtime_t)(__t.tv_sec) - -/* - * Possible list types - */ -#define LT_LWPS 0x0001 -#define LT_USERS 0x0002 -#define LT_TASKS 0x0004 -#define LT_PROJECTS 0x0008 -#define LT_PSETS 0x0010 -#define LT_SYS 0x0020 -#define LT_PROCESS 0x0040 - -/* - * Default list sizes - */ -#define LS_LWPS 1024 -#define LS_PROCESSES 512 -#define LS_USERS 32 -#define LS_PROJECTS 16 -#define LS_PSETS 8 -#define LS_SYS 1 - -/* - * Linked list of per-process or per-lwp statistics - */ -typedef struct lwp_info { - psinfo_t *li_psinfo; /* data read from psinfo file */ - lwpsinfo_t *li_lwpsinfo; - prusage_t li_usage; /* data read from usage file */ - int li_alive; /* flag for alive lwps */ - int rlwpid; /* id of the representative lwp */ - - double li_usr; /* user level CPU time */ - double li_sys; /* system call CPU time */ - double li_ttime; /* SystemTrapTime */ - double li_tpftime; /* TextPageFaultSleepTime */ - double li_dpftime; /* DataPageFaultSleepTime */ - double li_kpftime; /* SystemPageFaultSleepTime */ - double li_lck; /* user lock wait sleep time */ - double li_slp; /* all other sleep time */ - double li_lat; /* wait-cpu (latency) time */ - double li_stime; /* StoppedTime */ - ulong_t li_minf; /* MinorPageFaults */ - ulong_t li_majf; /* MajorPageFaults */ - ulong_t li_nswap; /* SwapOperations */ - ulong_t li_inblk; /* BlocksRead */ - ulong_t li_oublk; /* BlocksWritten */ - ulong_t li_msnd; /* MessagesSent */ - ulong_t li_mrcv; /* MessagesReceived */ - ulong_t li_sigs; /* SignalsReceived */ - ulong_t li_vctx; /* VoluntaryContextSwitches */ - ulong_t li_ictx; /* InvoluntaryContextSwitches */ - ulong_t li_scl; /* SystemCallsMade */ - ulong_t li_ioch; /* CharacterIOUsage */ - ulong_t li_hpsize; /* process heap in byte */ - ulong_t li_timestamp; /* system clock time od this snapshot */ - struct lwp_info *li_next; /* pointer to next lwp */ - struct lwp_info *li_prev; /* pointer to previous lwp */ -} lwp_info_t; - -typedef struct { - char *nodename; - char *name; -} sys_info_t; - -typedef struct { - int id; - void *id_next; /* pointer to next entry */ - void *id_prev; /* pointer to previous entry */ -} info_head_t; - -/* - * Linked list of collective per-uid, per-set, or per-projid statistics - */ -typedef struct id_info { - - int id_alive; /* flag for alive id */ - uint_t id_pid; /* user process id */ - uint_t id_uid; /* user id */ - uint_t id_taskid; /* task id */ - uint_t id_projid; /* project id */ - uint_t id_psetid; /* processor set to which lwp is bound */ - - double id_usr; /* UserModeTime */ - double id_sys; /* SystemModeTime */ - double id_ttime; /* SystemTrapTime */ - double id_tpftime; /* TextPageFaultSleepTime */ - double id_dpftime; /* DataPageFaultSleepTime */ - double id_kpftime; /* SystemPageFaultSleepTime */ - double id_lck; /* UserLockWaitSleepTime */ - double id_slp; /* OtherSleepTime */ - double id_lat; /* WaitCPUTime */ - double id_stime; /* StoppedTime */ - int64_t id_minf; /* MinorPageFaults */ - int64_t id_majf; /* MajorPageFaults */ - int64_t id_nswap; /* SwapOperations */ - int64_t id_inblk; /* BlocksRead */ - int64_t id_oublk; /* BlocksWritten */ - int64_t id_msnd; /* MessagesSent */ - int64_t id_mrcv; /* MessagesReceived */ - int64_t id_sigs; /* SignalsReceived */ - int64_t id_vctx; /* VoluntaryContextSwitches */ - int64_t id_ictx; /* InvoluntaryContextSwitches */ - int64_t id_scl; /* SystemCallsMade */ - int64_t id_ioch; /* CharacterIOUsage */ - int64_t id_hpsize; /* ProcessHeapSize # pstatus */ - int64_t id_size; /* ProcessVMSize */ - int64_t id_rssize; /* ProcessResidentSetSize # psinfo */ - float id_pctcpu; /* PercentCPUTime # psinfo */ - float id_pctmem; /* PercentMemorySize # psinfo */ - int64_t id_time; /* UserSystemModeTime */ - uint_t id_nlwps; /* NumThreads # psinfo */ - uint_t id_nproc; /* number of processes */ - int64_t id_timestamp; - - char *id_name; - int64_t id_inpkg; /* net input packets */ - int64_t id_oupkg; /* net output packets */ - uint_t id_key; /* sort key value */ - struct id_info *id_next; /* pointer to next entry */ - struct id_info *id_prev; /* pointer to previous entry */ -} id_info_t; - -/* - * Per-list structure - */ -typedef struct list { - int l_type; /* list type */ - int l_count; /* number of entries in the list */ - void *l_head; /* pointer to the head of the list */ - void *l_tail; /* pointer to the tail of the list */ - int l_size; /* number of allocated pointers */ - int l_used; /* number of used pointers */ - void **l_ptrs; /* pointer to an array of pointers */ -} list_t; - -typedef struct swap_info { - size_t allocated; /* not free swap memory */ - size_t reserved; /* reserved but not allocated swap memory in KB */ - size_t available; /* available swap memory in KB */ - float pctswap; /* percentage of used swap */ -} swap_info_t; - -#ifdef __cplusplus -} -#endif - -#endif /* _RDIMPL_H */ diff --git a/usr/src/cmd/wbem/provider/tools/rds/rdlist.c b/usr/src/cmd/wbem/provider/tools/rds/rdlist.c deleted file mode 100644 index bdb876f863..0000000000 --- a/usr/src/cmd/wbem/provider/tools/rds/rdlist.c +++ /dev/null @@ -1,390 +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 2000-2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "rdlist.h" -#include "rdtable.h" - -static int list_read(int listt, int elemn); -static int lwp_write(list_t *list); -static int lwp_read(int lwpn); - -/* - * This procedure stores the current state of the lists (lwps, processes, - * users and project) into the file defined by 'file'. - * param file - the file name to be used - * return 0, or -1 on error and store the error message in - * the global buffer 'errmsg'. - */ -int -list_store(char *file) -{ - int storefd; - time_t tv; - char *tstr; - int ret = -1; - - if ((storefd = open(file, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR)) - == -1) { - format_err("can't open list db: %s\n", file); - (void) fprintf(stderr, errmsg); - return (-1); - } - log_msg("writing persistence file: %s\n", file); - - /* - * the next do {..} while (false); statement is a replacement - * of goto; - */ - do { - if (open_prot(storefd, "w") == -1) { - format_err("can't open list db: %s\n", file); - (void) fprintf(stderr, errmsg); - break; - } - (void) time(&tv); - tstr = ctime(&tv); - if (wr_string("# RDS data base file generated on: ") == -1) - break; - if (wr_string(tstr) == -1) - break; - if (wr_value(LTDB_VERSION_KEY, LTDB_VERSION) == -1) - break; - if (wr_value(LTDB_TIMESTAMP, tv) == -1) - break; - /* we will write 4 lists */ - if (wr_lshead(4) != 0) { - format_err("can't write into list db: %s\n", - "./listdb"); - break; - } - if (list_write(L_LWP, 0) == -1) - break; - if (list_write(L_PRC_SI, 0) == -1) - break; - if (list_write(L_USR_SI, 0) == -1) - break; - if (list_write(L_PRJ_SI, 0) == -1) - break; - ret = 0; - } while (ret); - - if (ret == 0) { - struct stat stat_buf; - (void) fstat(storefd, &stat_buf); - log_msg("wrote: %ld bytes\n", stat_buf.st_size); - } - - /* close_prot(); */ - (void) close(storefd); - - return (ret); -} - -/* - * This procedure restores the last state of the lists (lwps, processes, - * users and project) from the file defined by 'file'. - * param file - the file name to be used - * return 0, or -1 on error and store the error message in - * the global buffer 'errmsg'. - */ -int -list_restore(char *file) -{ - int storefd; - int listt, elemn, listn; - int64_t timestamp; - time_t tv; - int version; - int ret = -1; - - if ((storefd = open(file, O_RDONLY)) == -1) - return (ret); - log_msg("reading persistence file: %s\n", file); - - /* - * the next do {..} while (false); statement is a replacement - * of goto; - */ - do { - if (open_prot(storefd, "r") == -1) - break; - if (skip_line() == -1) - break; - if ((version = r_value(LTDB_VERSION_KEY)) == -1) - break; - if (version != LTDB_VERSION) { - (void) fprintf(stderr, - "wrong version %d of db file %s\n", - version, file); - break; - } - if ((timestamp = r_value(LTDB_TIMESTAMP)) == -1) - break; - /* check the file decay time is expired */ - (void) time(&tv); - if ((tv - timestamp) > LTDB_DECAYTIME) - break; - if ((listn = r_lshead()) == -1) - break; - while (listn-- > 0) { - if ((elemn = r_lhead(&listt)) == -1) - break; - if (list_read(listt, elemn) != 0) { - break; - } - } - ret = 0; - } while (ret); - - if (ret == 0) { - struct stat stat_buf; - (void) fstat(storefd, &stat_buf); - log_msg("read: %ld bytes\n", stat_buf.st_size); - } - - /* close_prot(); */ - (void) close(storefd); - (void) unlink(file); - return (ret); -} - -/* - * This procedure writes a list of type 'listt' according to the - * rds interface protocol. It uses the already opened and initialized - * protocol module (see file protocol.[c,h]). - * param listt - the type of the list, see rdimpl.h - * param Po - print option, if 1 the list will be also printed on stdout. - * return 0, or -1 on error and store the error message in - * the global buffer 'errmsg'. - */ -int -list_write(int listt, int Po) -{ - char idstr[P_MAXVAL]; - list_t *list; - id_info_t *id = NULL, *nextid; - - if (listt == L_LWP) { - return (lwp_write(&lwps)); - } else if (listt == L_SYSTEM) { - if (wr_lhead(listt, 1) != 0) { - format_err( - "RDS protocol error: cannot write list header"); - return (-1); - } - (void) snprintf(idstr, sizeof (idstr), "%s", sys_info.name); - if (wr_element(listt, (char *)(&sys_info), idstr) != 0) { - format_err( - "RDS protocol error: cannot write list header"); - return (-1); - } - - } else { - switch (listt) { - case L_PRC_SI : list = &processes; - break; - case L_AC_USR : - case L_USR_SI : list = &users; - break; - case L_AC_PRJ : - case L_PRJ_SI : list = &projects; - break; - } - id = list->l_head; - - if (wr_lhead(listt, list->l_count) != 0) { - format_err( - "RDS protocol error: cannot write list header"); - return (-1); - } - while (id != NULL) { - switch (listt) { - case L_PRC_SI : - (void) sprintf(idstr, "%d", id->id_pid); - break; - case L_AC_USR : - case L_USR_SI : - (void) sprintf(idstr, "%d", id->id_uid); - break; - case L_AC_PRJ : - case L_PRJ_SI : - (void) snprintf(idstr, sizeof (idstr), "%s", - id->id_name); - break; - } - if (wr_element(listt, (char *)id, idstr) != 0) { - format_err( - "RDS protocol error: cannot write list header"); - } - if (Po == 1) - prtelement(stderr, id); - nextid = id->id_next; - id = nextid; - } - } - return (0); -} - -/* - * This procedure prints out all list elements on stdout. The elements - * int the list must be of type id_info_t. - * param list - the list to be printed - */ -void -list_print(list_t *list, int xid) -{ - - id_info_t *id = list->l_head; - id_info_t *nextid; - - while (id) { - if (xid == -1) { - prtelement(stdout, id); - } else { - switch (list->l_type) { - case LT_PROCESS : if (xid == id->id_pid) - prtelement(stdout, id); - break; - case LT_USERS : if (xid == id->id_uid) - prtelement(stdout, id); - break; - case LT_PROJECTS : if (xid == id->id_projid) - prtelement(stdout, id); - break; - default: prtelement(stdout, id); - } - } - nextid = id->id_next; - id = nextid; - } - -} - -static int -list_read(int listt, int elemn) -{ - char idstr[P_MAXVAL]; - list_t *list; - id_info_t *id; - - if (listt == L_LWP) - return (lwp_read(elemn)); - - while (elemn-- > 0) { - switch (listt) { - case L_PRC_SI : list = &processes; - break; - case L_USR_SI : list = &users; - break; - case L_PRJ_SI : list = &projects; - break; - } - - if (list->l_head == NULL) { /* first element */ - list->l_head = list->l_tail = id = - Zalloc(sizeof (id_info_t)); - list->l_count++; - } else { - /* a new element */ - id = list->l_tail; - id->id_next = Zalloc(sizeof (id_info_t)); - id->id_next->id_prev = list->l_tail; - id->id_next->id_next = NULL; - list->l_tail = id->id_next; - id = list->l_tail; - list->l_count++; - } - if (r_element((char *)id, idstr) == -1) { - list_clear(list); - return (-1); - } - } - return (0); -} - -static int -lwp_write(list_t *list) -{ - lwpinfo_t lwpsi; - lwp_info_t *li = NULL, *nextli; - - li = list->l_head; - - if (wr_lhead(L_LWP, list->l_count) != 0) { - format_err( - "RDS protocol error: cannot write list header"); - err_exit(); - } - while (li != NULL) { - lwpsi.pr_pid = li->li_psinfo->pr_pid; - lwpsi.pr_lwpid = li->li_lwpsinfo->pr_lwpid; - - if (wr_element(L_LWP__I, (char *)&lwpsi, "lwpi") != 0) { - format_err( - "RDS protocol error: cannot write list header"); - } - if (wr_element(L_LWP__U, (char *)&(li->li_usage), "lwpu") - != 0) { - format_err( - "RDS protocol error: cannot write list header"); - } - if (wr_element(L_LWP, (char *)li, "lwp") != 0) { - format_err( - "RDS protocol error: cannot write list header"); - } - nextli = li->li_next; - li = nextli; - } - return (0); -} - -static int -lwp_read(int lwpn) -{ - lwp_info_t *lwp; - lwpinfo_t lwpsi; - - char idstr[P_MAXVAL]; - - while (lwpn-- > 0) { - if (r_element((char *)&lwpsi, idstr) == -1) { - return (-1); - } - lwp = list_add_lwp(&lwps, lwpsi.pr_pid, lwpsi.pr_lwpid); - lwp->li_psinfo->pr_pid = lwpsi.pr_pid; - lwp->li_lwpsinfo->pr_lwpid = lwpsi.pr_lwpid; - if (r_element((char *)&(lwp->li_usage), idstr) == -1) { - return (-1); - } - if (r_element((char *)lwp, idstr) == -1) { - return (-1); - } - - } - return (0); -} diff --git a/usr/src/cmd/wbem/provider/tools/rds/rdlist.h b/usr/src/cmd/wbem/provider/tools/rds/rdlist.h deleted file mode 100644 index c4fe251c36..0000000000 --- a/usr/src/cmd/wbem/provider/tools/rds/rdlist.h +++ /dev/null @@ -1,80 +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 (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - */ - -#ifndef _RDLIST_H -#define _RDLIST_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include -#include - -#include "rdimpl.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "rdimpl.h" -#include "rdprot.h" -#include "rdutil.h" - -#define LTDB_TIMESTAMP "TIMESTAMP" -#define LTDB_DECAYTIME 3600 -/* The current DB file version */ -#define LTDB_VERSION_KEY "VERSION" -#define LTDB_VERSION 100 - -#ifdef __cplusplus -extern "C" { -#endif - -extern void list_print(list_t *list, int xid); -extern int list_write(int listt, int Po); -extern int list_store(); -extern int list_restore(); - -extern list_t users; /* list of users */ -extern list_t projects; /* list of projects */ -extern list_t processes; /* list of processes */ -extern list_t lwps; -extern char errmsg[]; -extern void prtelement(FILE *fp, id_info_t *id); -extern lwp_info_t * - list_add_lwp(list_t *list, pid_t pid, id_t lwpid); -extern void err_exit(); -extern sys_info_t sys_info; - -#ifdef __cplusplus -} -#endif - -#endif /* _RDLIST_H */ diff --git a/usr/src/cmd/wbem/provider/tools/rds/rdprot.c b/usr/src/cmd/wbem/provider/tools/rds/rdprot.c deleted file mode 100644 index a52b99fc3b..0000000000 --- a/usr/src/cmd/wbem/provider/tools/rds/rdprot.c +++ /dev/null @@ -1,788 +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. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include -#include - -#include -#include "rdprot.h" -#include "rdutil.h" -/* - * This file works out the protocol layer of the bidirectional data interface - * between the rds and the client. In the server mode rds writes greetings and - * a protocol header to the output stream. - * pheader == { "@RDS-MAG@" PROTV } - * PROTV == { protocol version } - * Then it sends a prompt and waits for command from client. - * PROMPT == { "@RDS@>" } - * COMMAND == { "command" cmd } - * cmd == { "-pUuJjS" | "-p" | "-u" | "-U" | - * "-j" | "-J" | "-S" | "-i100" | "alive"| "exit" } - * The answer from rds is always a lists of data. The header of the answer data - * contains the number of lists in the package. Each list has a header and - * some elements, which have again a header and some fields of data: - * answer == { lshead, n * list } - * lshead == { number of lists } - * list == { lheader, n * element } - * lheader == { LISTT, ELEMN } - * LISTT == { type of the list } - * ELEMN == { number of elements in the list } - * element == { eheader, field } - * eheader == { ELMID, FILDN } - * ELMID == { element id, like pid, uid, project name } - * field == { KEY, VALUE } - * All protocol elements have a key and a value separated by one space. - * The value begins after the first space and ends with the new line character. - * Protocol keys are: "@RDS-MAG@", PROTV, LISTN, LISTT, ELEMN ELMID, FILDN, - * RDERR. The special key RDERR can occur in any line and indicates that an - * error condition occurred, where the VALUE is the error message. - */ - -static char line[P_MAXLEN]; -static char error[P_MAXLEN]; -static char value[P_MAXVAL]; -static char key[P_MAXKEY]; - -static char *nullstr = ""; -static FILE *wstream, *rstream; - -static int format_int64(int, char *, char *, int); -static int format_int32(int, char *, char *, int); -static int format_ulong(int, char *, char *, int); -static int format_float(int, char *, char *, int); -static int format_double(int, char *, char *, int); -static int format_string(int, char *, char *, int); -static int format_timestruc(int, char *, char *, int); - -/* - * The kv_pair_t represents an field in a c-sturcture. An filed - * is defined by a key 'field name', format function and an offset - * in this structure - */ - -/* - * Array of fields from id_info_t structure, that are sent/received - * in a process/user/project utilization list. - */ -static kv_pair_t id_stub[] = -{ -{ "id_pid", { format_int32, offsetof(id_info_t, id_pid) }}, -{ "id_uid", { format_int32, offsetof(id_info_t, id_uid) }}, -{ "id_projid", { format_int32, offsetof(id_info_t, id_projid) }}, -{ "id_usr", { format_double, offsetof(id_info_t, id_usr) }}, -{ "id_sys", { format_double, offsetof(id_info_t, id_sys) }}, -{ "id_ttime", { format_double, offsetof(id_info_t, id_ttime) }}, -{ "id_tpftime", { format_double, offsetof(id_info_t, id_tpftime) }}, -{ "id_dpftime", { format_double, offsetof(id_info_t, id_dpftime) }}, -{ "id_kpftime", { format_double, offsetof(id_info_t, id_kpftime) }}, -{ "id_lck", { format_double, offsetof(id_info_t, id_lck) }}, -{ "id_slp", { format_double, offsetof(id_info_t, id_slp) }}, -{ "id_lat", { format_double, offsetof(id_info_t, id_lat) }}, -{ "id_stime", { format_double, offsetof(id_info_t, id_stime) }}, -{ "id_minf", { format_int64, offsetof(id_info_t, id_minf) }}, -{ "id_majf", { format_int64, offsetof(id_info_t, id_majf) }}, -{ "id_nswap", { format_int64, offsetof(id_info_t, id_nswap) }}, -{ "id_inblk", { format_int64, offsetof(id_info_t, id_inblk) }}, -{ "id_oublk", { format_int64, offsetof(id_info_t, id_oublk) }}, -{ "id_msnd", { format_int64, offsetof(id_info_t, id_msnd) }}, -{ "id_mrcv", { format_int64, offsetof(id_info_t, id_mrcv) }}, -{ "id_sigs", { format_int64, offsetof(id_info_t, id_sigs) }}, -{ "id_vctx", { format_int64, offsetof(id_info_t, id_vctx) }}, -{ "id_ictx", { format_int64, offsetof(id_info_t, id_ictx) }}, -{ "id_scl", { format_int64, offsetof(id_info_t, id_scl) }}, -{ "id_ioch", { format_int64, offsetof(id_info_t, id_ioch) }}, -{ "id_hpsize", { format_int64, offsetof(id_info_t, id_hpsize) }}, -{ "id_size", { format_int64, offsetof(id_info_t, id_size) }}, -{ "id_rssize", { format_int64, offsetof(id_info_t, id_rssize) }}, -{ "id_pctcpu", { format_float, offsetof(id_info_t, id_pctcpu) }}, -{ "id_pctmem", { format_float, offsetof(id_info_t, id_pctmem) }}, -{ "id_time", { format_int64, offsetof(id_info_t, id_time) }}, -{ "id_nlwps", { format_int32, offsetof(id_info_t, id_nlwps) }}, -{ "id_timestamp", { format_int64, offsetof(id_info_t, id_timestamp) }}, -{ "id_nproc", { format_int32, offsetof(id_info_t, id_nproc) }}, -{ "id_inpkg", { format_int64, offsetof(id_info_t, id_inpkg) }}, -{ "id_oupkg", { format_int64, offsetof(id_info_t, id_oupkg) }}, -{ "id_name", { format_string, offsetof(id_info_t, id_name) }} -}; - -static kv_pair_t lwp_stub[] = -{ -{"li_usage", { format_ulong, offsetof(lwp_info_t, li_usr) }}, -{"li_usr", { format_ulong, offsetof(lwp_info_t, li_usr) }}, -{"li_sys", { format_ulong, offsetof(lwp_info_t, li_sys) }}, -{"li_ttime", { format_ulong, offsetof(lwp_info_t, li_ttime) }}, -{"li_tpftime", { format_ulong, offsetof(lwp_info_t, li_tpftime) }}, -{"li_dpftime", { format_ulong, offsetof(lwp_info_t, li_dpftime) }}, -{"li_kpftime", { format_ulong, offsetof(lwp_info_t, li_kpftime) }}, -{"li_lck", { format_ulong, offsetof(lwp_info_t, li_lck) }}, -{"li_slp", { format_ulong, offsetof(lwp_info_t, li_slp) }}, -{"li_lat", { format_ulong, offsetof(lwp_info_t, li_lat) }}, -{"li_stime", { format_ulong, offsetof(lwp_info_t, li_stime) }}, -{"li_minf", { format_ulong, offsetof(lwp_info_t, li_minf) }}, -{"li_majf", { format_ulong, offsetof(lwp_info_t, li_majf) }}, -{"li_nswap", { format_ulong, offsetof(lwp_info_t, li_nswap) }}, -{"li_inblk", { format_ulong, offsetof(lwp_info_t, li_inblk) }}, -{"li_oublk", { format_ulong, offsetof(lwp_info_t, li_oublk) }}, -{"li_msnd", { format_ulong, offsetof(lwp_info_t, li_msnd) }}, -{"li_mrcv", { format_ulong, offsetof(lwp_info_t, li_mrcv) }}, -{"li_sigs", { format_ulong, offsetof(lwp_info_t, li_sigs) }}, -{"li_vctx", { format_ulong, offsetof(lwp_info_t, li_vctx) }}, -{"li_ictx", { format_ulong, offsetof(lwp_info_t, li_ictx) }}, -{"li_scl", { format_ulong, offsetof(lwp_info_t, li_scl) }}, -{"li_ioch", { format_ulong, offsetof(lwp_info_t, li_ioch) }}, -{"li_hpsize", { format_ulong, offsetof(lwp_info_t, li_hpsize) }}, -{"li_timestamp", { format_ulong, offsetof(lwp_info_t, li_timestamp) }}, -}; - -static kv_pair_t lwpinfo_stub[] = -{ -{"lwpr_pid", { format_int32, offsetof(lwpinfo_t, pr_pid) }}, -{"lwpr_lwpid", { format_int32, offsetof(lwpinfo_t, pr_lwpid) }}, -}; - -static kv_pair_t prusage_stub[] = -{ -{"pr_tstamp", { format_timestruc, offsetof(prusage_t, pr_tstamp) }}, -{"pr_create", { format_timestruc, offsetof(prusage_t, pr_create) }}, -{"pr_term", { format_timestruc, offsetof(prusage_t, pr_term) }}, -{"pr_rtime", { format_timestruc, offsetof(prusage_t, pr_rtime) }}, -{"pr_utime", { format_timestruc, offsetof(prusage_t, pr_utime) }}, -{"pr_stime", { format_timestruc, offsetof(prusage_t, pr_stime) }}, -{"pr_ttime", { format_timestruc, offsetof(prusage_t, pr_ttime) }}, -{"pr_tftime", { format_timestruc, offsetof(prusage_t, pr_tftime) }}, -{"pr_dftime", { format_timestruc, offsetof(prusage_t, pr_dftime) }}, -{"pr_kftime", { format_timestruc, offsetof(prusage_t, pr_kftime) }}, -{"pr_ltime", { format_timestruc, offsetof(prusage_t, pr_ltime) }}, -{"pr_slptime", { format_timestruc, offsetof(prusage_t, pr_slptime) }}, -{"pr_wtime", { format_timestruc, offsetof(prusage_t, pr_wtime) }}, -{"pr_stoptime", { format_timestruc, offsetof(prusage_t, pr_stoptime) }}, -{"pr_minf", { format_ulong, offsetof(prusage_t, pr_minf) }}, -{"pr_majf", { format_ulong, offsetof(prusage_t, pr_majf) }}, -{"pr_nswap", { format_ulong, offsetof(prusage_t, pr_nswap) }}, -{"pr_inblk", { format_ulong, offsetof(prusage_t, pr_inblk) }}, -{"pr_oublk", { format_ulong, offsetof(prusage_t, pr_oublk) }}, -{"pr_msnd", { format_ulong, offsetof(prusage_t, pr_msnd) }}, -{"pr_mrcv", { format_ulong, offsetof(prusage_t, pr_mrcv) }}, -{"pr_sigs", { format_ulong, offsetof(prusage_t, pr_sigs) }}, -{"pr_vctx", { format_ulong, offsetof(prusage_t, pr_vctx) }}, -{"pr_ictx", { format_ulong, offsetof(prusage_t, pr_ictx) }}, -{"pr_sysc", { format_ulong, offsetof(prusage_t, pr_sysc) }}, -{"pr_ioch", { format_ulong, offsetof(prusage_t, pr_ioch) }}, -}; - -/* - * Array of fields in id_info_t structure, that are sent/received - * in an active user list. - */ -static kv_pair_t usr_stub[] = -{ -{ "usr_id", { format_int32, offsetof(id_info_t, id_uid) }}, -{ "usr_name", { format_string, offsetof(id_info_t, id_name) }} -}; - -/* - * Array of fields in id_info_t structure, that are sent/received - * in an active project list. - */ -static kv_pair_t prj_stub[] = -{ -{ "prj_id", { format_int32, offsetof(id_info_t, id_projid) }}, -{ "prj_name", { format_string, offsetof(id_info_t, id_name) }} -}; - -/* - * Array of fields in id_info_t structure, that are sent/received - * in a system list. - */ -static kv_pair_t sys_stub[] = -{ -{ "sys_nodename", { format_string, offsetof(sys_info_t, nodename) }}, -{ "sys_name", { format_string, offsetof(sys_info_t, name) }} -}; - -/* - * Array of fields in id_info_t structure, that are sent/received - * in command. - */ -static kv_pair_t cmd_stub[] = -{ -{ "command", { format_int32, offsetof(cmd_t, command) }} -}; - -#define stubsize(stub) ((sizeof (stub))/(sizeof (kv_pair_t))) - -/* - * Each list type has its own fields description, the list type is - * the index into this table: - * L_PRC_SI - processes statistical information - * L_USR_SI - useres statistical information - * L_PRJ_SI - projects statistical information - * L_AC_USR - active users - * L_AC_PRJ - active projects - * L_SYSTEM - system - */ -#define NOF_STUBS 10 -static stub_t stubs[NOF_STUBS + 1] = { -{ 0, NULL}, -{ stubsize(id_stub), id_stub}, -{ stubsize(id_stub), id_stub}, -{ stubsize(id_stub), id_stub}, -{ stubsize(usr_stub), usr_stub}, -{ stubsize(prj_stub), prj_stub}, -{ stubsize(sys_stub), sys_stub}, -{ stubsize(cmd_stub), cmd_stub}, -{ stubsize(lwp_stub), lwp_stub}, -{ stubsize(lwpinfo_stub), lwpinfo_stub}, -{ stubsize(prusage_stub), prusage_stub}, -}; - -/* - * read a protocol line, do some checks and extract its key - * and value part. - */ -static int -r_line() { - size_t len; - - if (fgets(line, P_MAXLEN, rstream) == NULL) { - format_err("can't read line"); - return (-1); - } - len = strlen(line); - if (len > P_MAXLEN) { - format_err("%s: \"%s\"", "wrong line length", line); - return (-1); - } - /* carriage return */ - if (len == 1) { - value[0] = line[0]; - return (0); - } - /* see P_MAXKEY and P_MAXVAL for string sizes */ - if (sscanf(line, "%19s %58s", key, value) != 2) { - format_err("%s: \"%s\"", "wrong line format", line); - return (-1); - } - if (strcmp(key, RDERR) == 0) { - (void) strcpy(error, line + strlen(RDERR) + 1); - return (-1); - } - return (0); -} - -#define STRUCT_TO_STR 1 -#define STR_TO_STRUCT 2 - -/* - * if STR_TO_STRUCT read a 64 bit value from string buffer, format it and - * write it into the structure. - * if STRUCT_TO_STR read a 64 bit value from structure and write it as - * a string into buffer. - */ -static int -format_int64(int set, char *buf, char *strct, int off) -{ - int64_t v; - - if (set == STR_TO_STRUCT) { - if (sscanf(buf, "%" SCNd64, &v) != 1) { - format_err("%s: \"%s\"", "wrong line format", line); - return (-1); - } - *(int64_t *)(void *)(strct + off) = v; - - } else { - v = *((int64_t *)(void *)(strct + off)); - (void) sprintf(buf, "%" PRId64, v); - - } - return (0); -} - -/* - * if STR_TO_STRUCT read a 32 bit value from string buffer, format it and - * write it into the structure. - * if STRUCT_TO_STR read a 32 bit value from structure and write it as - * a string into buffer. - */ -static int -format_int32(int set, char *buf, char *id, int off) -{ - int32_t v; - - if (set == STR_TO_STRUCT) { - if (sscanf(buf, "%d", &v) != 1) { - format_err("%s: \"%s\"", "wrong line format", line); - return (-1); - } - *(int32_t *)(void *)(id + off) = v; - - } else { - v = *((int32_t *)(void *)(id + off)); - (void) sprintf(buf, "%d", v); - - } - return (0); -} - -/* - */ -static int -format_ulong(int set, char *buf, char *id, int off) -{ - ulong_t v; - - if (set == STR_TO_STRUCT) { - if (sscanf(buf, "%lu", &v) != 1) { - format_err("%s: \"%s\"", "wrong line format", line); - return (-1); - } - *(ulong_t *)(void *)(id + off) = v; - - } else { - v = *((ulong_t *)(void *)(id + off)); - (void) sprintf(buf, "%ld", v); - - } - return (0); -} - -/* - * if STR_TO_STRUCT read a float value from string buffer, format it and - * write it into the structure. - * if STRUCT_TO_STR read a float value from structure and write it as - * a string into buffer. - */ -static int -format_float(int set, char *buf, char *id, int off) -{ - float v; - - if (set == STR_TO_STRUCT) { - if (sscanf(buf, "%f", &v) != 1) { - format_err("%s: \"%s\"", "wrong line format", line); - return (-1); - } - *(float *)(void *)(id + off) = v; - - } else { - v = *((float *)(void *)(id + off)); - (void) sprintf(buf, "%f", v); - - } - return (0); -} - -/* - * if STR_TO_STRUCT read a double value from string buffer, format it and - * write it into the structure. - * if STRUCT_TO_STR read a double value from structure and write it as - * a string into buffer. - */ -static int -format_double(int set, char *buf, char *id, int off) -{ - double v; - - if (set == STR_TO_STRUCT) { - if (sscanf(buf, "%lf", &v) != 1) { - format_err("wrong line format: \"%s\"", line); - return (-1); - } - *(double *)(void *)(id + off) = v; - - } else { - v = *((double *)(void *)(id + off)); - (void) sprintf(buf, "%f", v); - - } - return (0); -} - -/* - * if STR_TO_STRUCT read a string from string buffer, format it and - * write it into the structure. - * if STRUCT_TO_STR read a string from structure and write it as - * a string into buffer. - */ -static int -format_string(int set, char *buf, char *id, int off) -{ - char *v; - - if (set == STR_TO_STRUCT) { - if ((v = (char *)malloc(strlen(buf) + 1)) != 0) { - (void) strcpy(v, buf); - } else { - v = nullstr; - return (-1); - } - *(char **)(void *)(id + off) = v; - } else { - if ((*((char **)(void *)(id + off))) != NULL) { - (void) snprintf(buf, P_MAXVAL, "%s", - *((char **)(void *)(id + off))); - } - } - return (0); -} - -static int -format_timestruc(int set, char *buf, char *strct, int off) -{ - int64_t v1; - int64_t v2; - - if (set == STR_TO_STRUCT) { - if (sscanf(buf, "%" SCNd64 ",%" SCNd64, &v1, &v2) != 2) { - format_err("%s: \"%s\"", "wrong line format", line); - return (-1); - } - ((timestruc_t *)(void *)(strct + off))->tv_sec = v1; - ((timestruc_t *)(void *)(strct + off))->tv_nsec = v2; - - } else { - v1 = ((timestruc_t *)(void *)(strct + off))->tv_sec; - /* - * Since the times in prusage start with millisecond - * precision after the micro state accounting was enabled - * discard the nano/micro second fraction in the saved - * values otherwise we will get negative values in next run. - */ - v2 = ((((timestruc_t *)(void *)(strct + off))->tv_nsec) / - MICROSEC) * MICROSEC; - (void) sprintf(buf, "%" PRId64 ",%" PRId64, v1, v2); - - } - return (0); -} - -/* - * A hash table of keys == names and data == { formats and offsets }. - */ -static int -init_hashtab() { - ENTRY item; - int i, j, size = 0; - - for (i = 0; i < NOF_STUBS + 1; i++) { - size += stubs[i].size; - } - if (hcreate(size) == 0) { - format_err("can't create hash table"); - return (-1); - } - for (i = 0; i < NOF_STUBS + 1; i++) { - for (j = 0; j < stubs[i].size; j++) { - item.key = stubs[i].stub[j].key; - item.data = (void *) &(stubs[i].stub[j].info); - if (hsearch(item, ENTER) == NULL) { - format_err("can't insert into hash table"); - return (-1); - } - } - } - return (0); -} - -int -open_prot(int fd, char *rw) -{ - if (strcmp(rw, "r") == 0) { - if ((rstream = fdopen(fd, rw)) == NULL) { - format_err("can't open read stream"); - return (-1); - } - if (init_hashtab() != 0) { - format_err("can't initialize hashtab"); - return (-1); - } - } else if (strcmp(rw, "w") == 0) { - if ((wstream = fdopen(fd, rw)) == NULL) { - format_err("can't open write stream"); - return (-1); - } - } else { - format_err("open_prot(), wrong argument %s", rw); - return (-1); - } - return (0); -} - -void -close_prot() -{ - - (void) fclose(rstream); - (void) fclose(wstream); - hdestroy(); -} - -/* - * @RDS-MAG@ - * PROTV 100 - */ -int -wr_phead() -{ - (void) fprintf(wstream, "%s\n%s %d\n", - PROTM, PROTV, PROT_VERSION); - (void) fflush(wstream); - return (0); -} -/* - * @RDS@> [code] - */ -int -wr_prompt(char *code) { - - (void) fprintf(wstream, "%s%s\n", PROMPT, code); - (void) fflush(wstream); - return (0); -} - -int -wr_lshead(int n) -{ - (void) fprintf(wstream, "%s %d\n", LISTN, n); - (void) fflush(wstream); - return (0); -} - -/* - * LISTT [type] - * ELEMN [n] - */ -int -wr_lhead(int type, int n) -{ - (void) fprintf(wstream, "%s %d\n%s %d\n", LISTT, type, ELEMN, n); - (void) fflush(wstream); - return (0); -} -/* - * ELMID [elemid] - * FILDN [number of elements] - * e.g. - * id_usr 11050000000 - * id_sys 7850000000 - * id_ttime 0 - * id_tpftime 0 - * - * Write all fields defined by stub[stubidx]. The src is the source pointer. - * For each element read the key, grab the format function and the offset. - * Read and format the element from the source and write it out as a string. - */ -int -wr_element(int stubidx, char *src, char *elemid) -{ - int i; - - (void) fprintf(wstream, "%s %s\n%s %d\n", - ELMID, elemid, FILDN, stubs[stubidx].size); - for (i = 0; i < stubs[stubidx].size; i++) { - stubs[stubidx].stub[i].info.format(STRUCT_TO_STR, - value, src, stubs[stubidx].stub[i].info.off); - (void) fprintf(wstream, "%s %s\n", - stubs[stubidx].stub[i].key, value); - } - (void) fflush(wstream); - return (0); -} - -int -wr_string(char *str) -{ - - (void) fprintf(wstream, "%s", str); - (void) fflush(wstream); - return (0); -} - -int -wr_value(char *key, int64_t v) -{ - - (void) fprintf(wstream, "%s %" PRId64 "\n", key, v); - (void) fflush(wstream); - return (0); -} -/* - * RDERR [err] - */ -void -wr_error(char *err) -{ - size_t len = strlen(RDERR + 1); - if (strlen(err) > P_MAXLEN - len) { - *(err + P_MAXLEN - len - 4) = '.'; - *(err + P_MAXLEN - len - 3) = '.'; - *(err + P_MAXLEN - len - 2) = '.'; - *(err + P_MAXLEN - len - 1) = 0; - } - len = strlen(err) - 1; - if (strlen(err) == 0) { - return; - } - while (len-- > 0) { - if (*(err + len) == '\n') - *(err + len) = ' '; - } - - (void) fprintf(wstream, "%s %s\n", RDERR, err); - (void) fflush(wstream); -} - -/* - * read a protocol line, check the key and return the value associated - * with it. - */ -int64_t -r_value(char *check_key) { - int64_t v = -1; - - if ((r_line() == -1) || - (strcmp(check_key, key) != 0) || - (sscanf(value, "%" SCNd64, &v) != 1)) { - return (-1); - } - return (v); -} - -char * -r_cmd() -{ - - if (r_line() == -1) { - format_err("can't read command"); - return (NULL); - } - return (value); -} - -int -r_phead() -{ - int protv; - size_t len = strlen(PROTM); - size_t errorlen = strlen(RDERR); - int i = 0; - - while (i++ < MAX_RETRIES) { - if (fgets(line, P_MAXLEN, rstream) == NULL) { - format_err("can't read prot. head"); - return (-1); - } - len = strlen(line); - if (len > P_MAXLEN) - continue; - if (strcmp(line, PROTM) == 0) - break; - if (strncmp(line, RDERR, errorlen) == 0) { - (void) strcpy(error, line + strlen(RDERR) + 1); - return (-1); - } - } - if ((protv = r_value(PROTV)) == -1) { - format_err("can't read prot. version"); - return (-1); - } - if (protv != PROT_VERSION) { - format_err("unsupported prot. version"); - return (-1); - } - return (0); -} - -int -r_lshead() -{ - int ret; - - if ((ret = r_value(LISTN)) == -1) { - format_err("can't read number of lists"); - return (-1); - } - return (ret); -} - -int -r_lhead(int *type) -{ - - if ((*type = r_value(LISTT)) == -1) { - format_err("can't read list type"); - return (-1); - } - return (r_value(ELEMN)); -} - -int -r_element(char *src, char *elemid) -{ - int fn, i; - ENTRY item, *fitem; - - if (r_line() == -1) { - format_err("can't read element id"); - return (-1); - } else { - (void) strcpy(elemid, value); - } - if ((fn = r_value(FILDN)) == -1) { - format_err("can't read number of fields"); - return (-1); - } - for (i = 0; i < fn; i++) { - if (r_line() == -1) { - return (-1); - } else { - item.key = key; - if ((fitem = hsearch(item, FIND)) == NULL) { - format_err("%s: \"%s\" ", - "unknown key ", line); - return (-1); - } - ((info_t *)(void *)fitem->data)-> - format(STR_TO_STRUCT, value, src, - ((info_t *)(void *)fitem->data)->off); - } - } - return (0); -} - -int -skip_line() -{ - if (r_line() == -1) { - format_err("can't read element id"); - return (-1); - } else { - return (0); - } -} diff --git a/usr/src/cmd/wbem/provider/tools/rds/rdprot.h b/usr/src/cmd/wbem/provider/tools/rds/rdprot.h deleted file mode 100644 index 53e4f2fabf..0000000000 --- a/usr/src/cmd/wbem/provider/tools/rds/rdprot.h +++ /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 (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - */ - -#ifndef _RDPROT_H -#define _RDPROT_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include - -#include "rdimpl.h" - -#define offsetof(s, m) ((size_t)(&(((s *)0)->m))) - -/* some maximal values */ -#define P_MAXLEN 80 -#define P_MAXKEY 20 -#define P_MAXVAL 59 -#define MAX_RETRIES 20 - -/* Tags definitions */ - -#define PROTM "@RDS-MAG@" -#define RDERR "RDERR" -#define PROTV "PROTV" -#define LISTT "LISTT" -#define LISTN "LISTN" -#define ELEMN "ELEMN" -#define ELMID "ELMID" -#define FILDN "FILDN" -#define PROMPT "@RDS@>" -#define PROMPT_OK "" -#define PROMPT_WHAT " ?" -#define CRETURN "\n" - -#define PROT_VERSION 100 - -/* list types */ -#define L_PRC_SI 1 -#define L_USR_SI 2 -#define L_PRJ_SI 3 -#define L_AC_USR 4 -#define L_AC_PRJ 5 -#define L_SYSTEM 6 -#define L_LWP 8 -#define L_LWP__I 9 -#define L_LWP__U 10 - -#define CMD_EMPTY 0 -#define CMD_GETALL "-pUuJjS" -#define CMD_GETPL "-p" -#define CMD_GETUL "-u" -#define CMD_GETAUL "-U" -#define CMD_GETJL "-j" -#define CMD_GETAJL "-J" -#define CMD_GETASL "-S" -#define CMD_SETINTERVAL "-i100" -#define CMD_ALIVE "alive" -#define CMD_EXIT "exit" - -extern int open_prot(int fd, char *rw); -extern void close_prot(void); -extern void wr_error(char *err); -extern int wr_phead(void); -extern int wr_lshead(int n); -extern int wr_lhead(int type, int n); -extern int wr_element(int stubidx, char *src, char *elemid); -extern int wr_ctrl(int code); -extern int wr_prompt(char *code); -extern int wr_string(char *code); -extern int wr_value(char *key, int64_t v); -extern int skip_line(void); -extern int r_phead(void); -extern int r_lshead(); -extern int r_lhead(int *type); -extern int r_element(char *src, char *elemid); -extern int64_t r_value(char *key); -extern int r_ctrl(void); -extern char *r_cmd(void); - -extern char rderr[]; - -typedef struct { - int (* format)(int, char *, char *, int); - size_t off; -} info_t; - -typedef struct { - char *key; - info_t info; -} kv_pair_t; - -typedef struct { - int size; - kv_pair_t *stub; -} stub_t; - -typedef struct { - int32_t pr_pid; - int32_t pr_lwpid; - int32_t pr_pctcpu; - int64_t pr_time_tv_sec; - int64_t pr_time_tv_nsec; - int32_t pr_bindpset; -} lwpinfo_t; - -typedef struct { - int command; -} cmd_t; - -#ifdef __cplusplus -} -#endif - -#endif /* _RDPROT_H */ diff --git a/usr/src/cmd/wbem/provider/tools/rds/rds.c b/usr/src/cmd/wbem/provider/tools/rds/rds.c deleted file mode 100644 index e1a24b085f..0000000000 --- a/usr/src/cmd/wbem/provider/tools/rds/rds.c +++ /dev/null @@ -1,1021 +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 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "rdimpl.h" -#include "rdprot.h" -#include "rdutil.h" -#include "rdlist.h" -#include "rdfile.h" - -#define RDS_VERSION "RDS Version 1.0\n" -#define TIMEOUT_MSG "Timeout" -#define NOTREADY_RESPONSE "BUSY" - -#define DEFAULT_SCAN_INTERVAL 1000 /* milliseconds */ -#define MAXIMAL_SCAN_INTERVAL 30000 /* milliseconds */ -#define DEFAULT_CMD_TIMEOUT 2000 /* milliseconds */ - -extern list_t users; /* list of users */ -extern list_t projects; /* list of projects */ -extern list_t sys; /* list with one sys entry */ -extern list_t processes; /* list of processes */ -extern list_t lwps; /* list of lwps */ -extern char errmsg[]; /* global message buffer */ - -static char greeting[] = \ - "Resource Data Server\n" \ - "Copyright 2001 SMI.\n" \ - "Version 1.0\n"; - -/* ms timeout between successive cmds */ -static int timeout = DEFAULT_CMD_TIMEOUT; - -/* ms interval between successive scans */ -static int interval = DEFAULT_SCAN_INTERVAL; - -/* global signal flag */ -static int sigterm = 0; - -/* print all cmd data on stdout in server mode flag */ -static int Po = 0; - -/* count of scans performed in server mode */ -static long scans_done = 0; - -/* name of rds logging file */ -static char *log_file = NULL; - -/* enable microstate accounting flag */ -int mo = 0; - -/* name of stored data file */ -char *ltdb_file = NULL; - - -/* mutex lock for data lists */ -pthread_mutex_t listLock = PTHREAD_MUTEX_INITIALIZER; - -/* mutex lock for log */ -pthread_mutex_t logLock = PTHREAD_MUTEX_INITIALIZER; - -/* identifiers for the various threads */ -static pthread_t scanner = 0; -static pthread_t server = 0; -static pthread_t master = 0; - - -/* - * Clean up calling thread's state. - */ -static void -thread_cleanup() -{ - pthread_t this = pthread_self(); - - if (pthread_equal(this, server)) { - - /* shut down the command protocol */ - (void) fprintf(stderr, - "cleanup_state: server thread shutdown\n"); - log_msg("server thread shutdown init\n"); - wr_error(errmsg); - log_msg("server thread shutdown complete\n"); - - } else if (pthread_equal(this, scanner)) { - - /* shut down the scanner */ - (void) fprintf(stderr, - "cleanup_state: scanner thread shutdown\n"); - log_msg("scanner thread shutdown init\n"); - - log_msg("Waiting for server thread %d join from %d\n", - (int)server, (int)this); - - if (pthread_join(server, NULL) != 0) { - int e = errno; - - perror("server join (cleanup)"); - log_msg("server join (cleanup) failed with %d\n", e); - } - - log_msg("Server thread joined %d.\n", (int)this); - - monitor_stop(); - log_msg("scanner thread shutdown complete\n"); - - } else if (pthread_equal(this, master)) { - - (void) fprintf(stderr, - "cleanup_state: master thread shutdown\n"); - log_msg("master thread shutdown\n"); - - } else { - - (void) fprintf(stderr, - "cleanup_state: unknown thread id %d\n", (int)this); - log_msg("unknown thread %d shutdown\n", (int)this); - - } -} - - -/* - * Called by any of the threads, this should set state - * that the other threads will pick up so they will (eventually) - * shut themselves down cleanly, then call pthread_exit - * to properly shut down the calling thread. - * The calling thread will exit with its code set to 1. - */ -static void -generic_exit(char *msg, int status) -{ - char wb[256]; - - /* cannot be on the stack since thread terminates with pthread_exit */ - static int retcode = 0; - - retcode = status; - - /* worker-specific cleanup */ - thread_cleanup(); - - /* announce the calling thread's demise */ - (void) snprintf(wb, sizeof (wb) - 2, "(%d) %s", - (int)pthread_self(), msg); - log_msg(wb); - (void) fprintf(stderr, "%s", wb); - - /* everybody checks this periodically */ - sigterm = 1; - - log_msg("calling thread_exit() from %d\n", (int)pthread_self()); - - /* return status as the calling thread's exit code */ - pthread_exit(&retcode); - -} - - -/* - * Called by any of the threads, this should set state - * that the other threads will pick up so they will (eventually) - * shut themselves down cleanly, then call pthread_exit - * to properly shut down the calling thread. - * The calling thread will exit with its code set to 1. - */ -void -err_exit() -{ - generic_exit(errmsg, 1); -} - - -/* - * Called by any of the threads, this should set state - * that the other threads will pick up so they will (eventually) - * shut themselves down cleanly, then call pthread_exit - * to properly shut down the calling thread. - * The calling thread will exit with its code set to 0. - */ -static void -ok_exit() -{ - generic_exit("Normal exit.\n", 0); -} - - -static void -usage() -{ - (void) printf("rds [ options ]\n" \ - "-u\t\t- print stats for all users\n" \ - "-U\t\t- print stats for \n" \ - "-j\t\t- print stats for all projects\n" \ - "-J\t- print stats for \n" \ - "-p\t\t- print stats for all processes\n" \ - "-P \t- print stats for \n" \ - "-m\t\t- enable microstate accounting\n" \ - "-a\t\t- run in server mode\n" \ - "-t