示例#1
0
/*
 * used for debugging only
 */
void
fs_print_dfstab_entries(void *list)
{
	while (list != NULL) {

		if (fs_get_DFStab_ent_Fstype(list) != NULL)
			printf("fstype: %s", fs_get_DFStab_ent_Fstype(list));
		if (fs_get_DFStab_ent_Desc(list) != NULL)
			printf(" description: %s",
			    fs_get_DFStab_ent_Desc(list));
		if (fs_get_DFStab_ent_Options(list) != NULL)
			printf(" options: %s",
			    fs_get_DFStab_ent_Options(list));
		if (fs_get_DFStab_ent_Path(list) != NULL)
			printf(" shared path is: %s\n",
			    fs_get_DFStab_ent_Path(list));
		list = (void *)fs_get_DFStab_ent_Next(list);
	}

}
示例#2
0
/*
 * 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 */