mountprov_methods.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "mountprov_methods.h"
#include "nfsprov_methods.h"
#include "util.h"
#include "libfsmgt.h"
#include "nfs_providers_msgstrings.h"
#include "nfs_provider_names.h"
#include <errno.h>
#define SHOWEXPORTS "/usr/sbin/showmount -e "
/*
* Private methods
*/
static char **create_export_array(char *exportList_in_string_form,
int *num_elements, int *errp);
/*
* Public methods
*/
/*
* Method: delete_vfstab_entry
*
* 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
* 2.) string mount point
*
* Returns:
* - CCIMProperty * - A value telling the success or failure of the method.
*/
char *resource;
char *mountPoint;
int err = 0;
return ((CCIMProperty *)NULL);
}
/*
* The inParams are expected to contain two elements in this order:
* 1.) string resource
* 2.) string mountPoint
*/
return ((CCIMProperty *)NULL);
}
return ((CCIMProperty *)NULL);
}
if (vfstabEnts == NULL) {
return ((CCIMProperty *)NULL);
}
} /* 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.
*/
char *showExportsCommand;
char *cmd_return;
char *host;
int commandLen;
int err = 0;
return ((CCIMProperty *)NULL);
}
/*
* The inParams are expected to contain one element being:
* 1.) string host
*/
return ((CCIMProperty *)NULL);
}
if (showExportsCommand == NULL) {
return ((CCIMProperty *)NULL);
}
host);
&err);
if (err != 0) {
if (cmd_return != NULL) {
} else {
}
return ((CCIMProperty *)NULL);
}
if (cmd_return != NULL) {
char **export_array;
int num_elements = 0;
&err);
if (export_array == NULL) {
if (err != 0) {
&err);
}
return ((CCIMProperty *)NULL);
}
NULL);
}
} /* 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 **
int *errp) {
char *endOfLine = "\n";
char *export;
char *listCopy;
char **export_array = NULL;
int i = 0;
*num_elements = 0;
return (NULL);
}
/*
* Ignore the first line. It is a header that is always printed out
* when using showmounts -e.
*/
/*
* Count the number of elements to be in the array.
*/
*num_elements = 0;
}
if (export_array == NULL) {
*num_elements = 0;
return (NULL);
}
*num_elements = 0;
return (NULL);
}
for (i = 0; i < *num_elements; i++) {
if (export_array[i] == NULL) {
*num_elements);
*num_elements = 0;
return (NULL);
}
}
}
return (export_array);
} /* create_export_array */