1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _LIBFSMGT_H 28*7c478bd9Sstevel@tonic-gate #define _LIBFSMGT_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 31*7c478bd9Sstevel@tonic-gate extern "C" { 32*7c478bd9Sstevel@tonic-gate #endif 33*7c478bd9Sstevel@tonic-gate 34*7c478bd9Sstevel@tonic-gate #include <stdio.h> 35*7c478bd9Sstevel@tonic-gate #include <sys/param.h> 36*7c478bd9Sstevel@tonic-gate #include <nfs/nfs_sec.h> 37*7c478bd9Sstevel@tonic-gate #include <sys/utsname.h> 38*7c478bd9Sstevel@tonic-gate 39*7c478bd9Sstevel@tonic-gate #define DFSTYPES "/etc/dfs/fstypes" /* dfs list */ 40*7c478bd9Sstevel@tonic-gate #define DFSTAB "/etc/dfs/dfstab" /* dfs list */ 41*7c478bd9Sstevel@tonic-gate #define BUFSIZE 65536 42*7c478bd9Sstevel@tonic-gate #define LINESZ 2048 43*7c478bd9Sstevel@tonic-gate 44*7c478bd9Sstevel@tonic-gate typedef void *fs_dfstab_entry_t; 45*7c478bd9Sstevel@tonic-gate 46*7c478bd9Sstevel@tonic-gate /* 47*7c478bd9Sstevel@tonic-gate * Public data type declarations 48*7c478bd9Sstevel@tonic-gate */ 49*7c478bd9Sstevel@tonic-gate 50*7c478bd9Sstevel@tonic-gate /* 51*7c478bd9Sstevel@tonic-gate * Represents a list of the /etc/vfstab entries 52*7c478bd9Sstevel@tonic-gate */ 53*7c478bd9Sstevel@tonic-gate typedef struct mount_default_list { 54*7c478bd9Sstevel@tonic-gate struct mount_default_list *next; 55*7c478bd9Sstevel@tonic-gate char *resource; 56*7c478bd9Sstevel@tonic-gate char *fsckdevice; 57*7c478bd9Sstevel@tonic-gate char *mountp; 58*7c478bd9Sstevel@tonic-gate char *fstype; 59*7c478bd9Sstevel@tonic-gate char *fsckpass; 60*7c478bd9Sstevel@tonic-gate char *mountatboot; 61*7c478bd9Sstevel@tonic-gate char *mntopts; 62*7c478bd9Sstevel@tonic-gate } fs_mntdefaults_t; 63*7c478bd9Sstevel@tonic-gate 64*7c478bd9Sstevel@tonic-gate /* 65*7c478bd9Sstevel@tonic-gate * Represents a list of /etc/mnttab entries 66*7c478bd9Sstevel@tonic-gate */ 67*7c478bd9Sstevel@tonic-gate typedef struct mount_list { 68*7c478bd9Sstevel@tonic-gate struct mount_list *next; 69*7c478bd9Sstevel@tonic-gate char *resource; 70*7c478bd9Sstevel@tonic-gate char *mountp; 71*7c478bd9Sstevel@tonic-gate char *fstype; 72*7c478bd9Sstevel@tonic-gate char *mntopts; 73*7c478bd9Sstevel@tonic-gate char *time; 74*7c478bd9Sstevel@tonic-gate uint_t major; 75*7c478bd9Sstevel@tonic-gate uint_t minor; 76*7c478bd9Sstevel@tonic-gate boolean_t overlayed; 77*7c478bd9Sstevel@tonic-gate } fs_mntlist_t; 78*7c478bd9Sstevel@tonic-gate 79*7c478bd9Sstevel@tonic-gate /* 80*7c478bd9Sstevel@tonic-gate * Represents a /etc/dfs/sharetab entry 81*7c478bd9Sstevel@tonic-gate */ 82*7c478bd9Sstevel@tonic-gate typedef struct share_list { 83*7c478bd9Sstevel@tonic-gate struct share_list *next; 84*7c478bd9Sstevel@tonic-gate char *path; 85*7c478bd9Sstevel@tonic-gate char *resource; 86*7c478bd9Sstevel@tonic-gate char *fstype; 87*7c478bd9Sstevel@tonic-gate char *options; 88*7c478bd9Sstevel@tonic-gate char *description; 89*7c478bd9Sstevel@tonic-gate } fs_sharelist_t; 90*7c478bd9Sstevel@tonic-gate 91*7c478bd9Sstevel@tonic-gate /* 92*7c478bd9Sstevel@tonic-gate * Represents a list of /etc/mnttab entries with associated 93*7c478bd9Sstevel@tonic-gate * information from kstat. 94*7c478bd9Sstevel@tonic-gate */ 95*7c478bd9Sstevel@tonic-gate typedef struct nfs_mntlist { 96*7c478bd9Sstevel@tonic-gate struct nfs_mntlist *next; 97*7c478bd9Sstevel@tonic-gate char nml_curpath[MAXPATHLEN]; /* current path on */ 98*7c478bd9Sstevel@tonic-gate /* server */ 99*7c478bd9Sstevel@tonic-gate char nml_curserver[SYS_NMLN]; /* current server */ 100*7c478bd9Sstevel@tonic-gate char **nml_failoverlist; /* The list of servers */ 101*7c478bd9Sstevel@tonic-gate /* and corresponding */ 102*7c478bd9Sstevel@tonic-gate /* paths for failover. */ 103*7c478bd9Sstevel@tonic-gate char *nml_fstype; /* filesystem type */ 104*7c478bd9Sstevel@tonic-gate char *nml_mntopts; /* mount options */ 105*7c478bd9Sstevel@tonic-gate char *nml_mountp; /* mount point */ 106*7c478bd9Sstevel@tonic-gate char *nml_resource; /* mnttab.mnt_special */ 107*7c478bd9Sstevel@tonic-gate char nml_proto[KNC_STRSIZE]; /* transfer protocol */ 108*7c478bd9Sstevel@tonic-gate char *nml_securitymode; /* security mode name */ 109*7c478bd9Sstevel@tonic-gate char *nml_time; /* time mounted */ 110*7c478bd9Sstevel@tonic-gate int nml_failovercount; /* number of failover servers */ 111*7c478bd9Sstevel@tonic-gate int nml_retrans; /* times to retry request */ 112*7c478bd9Sstevel@tonic-gate int nml_timeo; /* inital timeout in 10th sec */ 113*7c478bd9Sstevel@tonic-gate ulong_t nml_fsid; /* filesystem ID */ 114*7c478bd9Sstevel@tonic-gate uint_t nml_acdirmax; /* max time to hold cached dir attr */ 115*7c478bd9Sstevel@tonic-gate uint_t nml_acdirmin; /* min time to hold cached dir attr */ 116*7c478bd9Sstevel@tonic-gate uint_t nml_acregmax; /* max time to hold cached file attr */ 117*7c478bd9Sstevel@tonic-gate uint_t nml_acregmin; /* min time to hold cached file attr */ 118*7c478bd9Sstevel@tonic-gate uint32_t nml_curread; /* current read size */ 119*7c478bd9Sstevel@tonic-gate uint32_t nml_curwrite; /* current write size */ 120*7c478bd9Sstevel@tonic-gate uint32_t nml_vers; /* nfs version */ 121*7c478bd9Sstevel@tonic-gate boolean_t nml_directio; /* force direct IO */ 122*7c478bd9Sstevel@tonic-gate boolean_t nml_grpid; /* group id inherited from parent */ 123*7c478bd9Sstevel@tonic-gate boolean_t nml_hard; /* hard or soft mount */ 124*7c478bd9Sstevel@tonic-gate boolean_t nml_intr; /* Key board intrupts */ 125*7c478bd9Sstevel@tonic-gate boolean_t nml_noac; /* no ata and attribute caching */ 126*7c478bd9Sstevel@tonic-gate boolean_t nml_nocto; /* no close-to-open consistency */ 127*7c478bd9Sstevel@tonic-gate boolean_t nml_overlayed; /* Is filesystem overlayed */ 128*7c478bd9Sstevel@tonic-gate boolean_t nml_xattr; /* allow extended attributes */ 129*7c478bd9Sstevel@tonic-gate } nfs_mntlist_t; 130*7c478bd9Sstevel@tonic-gate 131*7c478bd9Sstevel@tonic-gate /* 132*7c478bd9Sstevel@tonic-gate * Command execution interface method declarations 133*7c478bd9Sstevel@tonic-gate */ 134*7c478bd9Sstevel@tonic-gate 135*7c478bd9Sstevel@tonic-gate /* 136*7c478bd9Sstevel@tonic-gate * Method: cmd_execute_command 137*7c478bd9Sstevel@tonic-gate * 138*7c478bd9Sstevel@tonic-gate * Description: Executes the command passed into the function as if it was 139*7c478bd9Sstevel@tonic-gate * the input to a shell and returns the separated stdout and stderr messages 140*7c478bd9Sstevel@tonic-gate * which can be accessed by the client via the returned file descriptors using 141*7c478bd9Sstevel@tonic-gate * the cmd_retrieve_string method or one of their own methods. 142*7c478bd9Sstevel@tonic-gate * 143*7c478bd9Sstevel@tonic-gate * Parameters: 144*7c478bd9Sstevel@tonic-gate * char * - The command to execute. Expected in the format of a shell command. 145*7c478bd9Sstevel@tonic-gate * int * - Upon return from the function, this is the file descriptor that can 146*7c478bd9Sstevel@tonic-gate * be used to access the output from the command to stdout. 147*7c478bd9Sstevel@tonic-gate * int * - Upon return from the function, this is the file descriptor that can 148*7c478bd9Sstevel@tonic-gate * be used to access the output from the command to stderr. 149*7c478bd9Sstevel@tonic-gate * 150*7c478bd9Sstevel@tonic-gate * Return: 151*7c478bd9Sstevel@tonic-gate * Returns 0 (zero). 152*7c478bd9Sstevel@tonic-gate * Supposed to be the integer representing the exit value of the command 153*7c478bd9Sstevel@tonic-gate * executed, but due to the way blocking on file descriptors works, it will 154*7c478bd9Sstevel@tonic-gate * only return a 0 (zero) value. The reason: The producer, in this case the 155*7c478bd9Sstevel@tonic-gate * command being executed, will block when a certain amount of data is written 156*7c478bd9Sstevel@tonic-gate * to the file descriptor and will not be able to write any more data until the 157*7c478bd9Sstevel@tonic-gate * consumer reads from the file descriptor so since we are not reading in the 158*7c478bd9Sstevel@tonic-gate * data from the file descriptors in this method and we are allowing the client 159*7c478bd9Sstevel@tonic-gate * do what they want with the data we can't wait until the command is finished 160*7c478bd9Sstevel@tonic-gate * executing to get the return value. 161*7c478bd9Sstevel@tonic-gate */ 162*7c478bd9Sstevel@tonic-gate int cmd_execute_command(char *cmd, int *output_filedes, int *error_filedes); 163*7c478bd9Sstevel@tonic-gate 164*7c478bd9Sstevel@tonic-gate /* 165*7c478bd9Sstevel@tonic-gate * Method: cmd_execute_command_and_retrieve_string 166*7c478bd9Sstevel@tonic-gate * 167*7c478bd9Sstevel@tonic-gate * Description: Executes the command passed into the function as if it was the 168*7c478bd9Sstevel@tonic-gate * input to a shell and returns the output to stderr and stdout as a string as 169*7c478bd9Sstevel@tonic-gate * it would appear in the shell (stdout and stderr are mixed). 170*7c478bd9Sstevel@tonic-gate * 171*7c478bd9Sstevel@tonic-gate * Parameters: 172*7c478bd9Sstevel@tonic-gate * char * - The command to execute. Expected in the format of a shell command. 173*7c478bd9Sstevel@tonic-gate * int * - Upon return from the function, this should be used to determine if an 174*7c478bd9Sstevel@tonic-gate * error occurred in the execution of the command and the retrieval of 175*7c478bd9Sstevel@tonic-gate * output data from the command. 176*7c478bd9Sstevel@tonic-gate * data from the command. 177*7c478bd9Sstevel@tonic-gate * 178*7c478bd9Sstevel@tonic-gate * Return: 179*7c478bd9Sstevel@tonic-gate * The output to stdout and stderr created by the execution of the passed in 180*7c478bd9Sstevel@tonic-gate * command. 181*7c478bd9Sstevel@tonic-gate */ 182*7c478bd9Sstevel@tonic-gate char *cmd_execute_command_and_retrieve_string(char *cmd, int *errp); 183*7c478bd9Sstevel@tonic-gate 184*7c478bd9Sstevel@tonic-gate /* 185*7c478bd9Sstevel@tonic-gate * Method: cmd_retrieve_string 186*7c478bd9Sstevel@tonic-gate * 187*7c478bd9Sstevel@tonic-gate * Description: Retrieves the data from the passed in file descriptor and 188*7c478bd9Sstevel@tonic-gate * returns it to the caller in the form of a string. 189*7c478bd9Sstevel@tonic-gate * 190*7c478bd9Sstevel@tonic-gate * Parameters: 191*7c478bd9Sstevel@tonic-gate * int - The file descriptor to be read from. 192*7c478bd9Sstevel@tonic-gate * int * - Upon return from the function, this should be the used to determine 193*7c478bd9Sstevel@tonic-gate * if an error occurred in the retrieval of the data from the file 194*7c478bd9Sstevel@tonic-gate * descriptor. 195*7c478bd9Sstevel@tonic-gate * A non-zero value represents the occurrence of an error. 196*7c478bd9Sstevel@tonic-gate * 197*7c478bd9Sstevel@tonic-gate * Return: 198*7c478bd9Sstevel@tonic-gate * The data from the file descriptor in the form of a string. 199*7c478bd9Sstevel@tonic-gate * NOTE: The caller must free the space allocated (with calloc) for the return 200*7c478bd9Sstevel@tonic-gate * value using free(). 201*7c478bd9Sstevel@tonic-gate */ 202*7c478bd9Sstevel@tonic-gate char *cmd_retrieve_string(int filedes, int *errp); 203*7c478bd9Sstevel@tonic-gate 204*7c478bd9Sstevel@tonic-gate /* 205*7c478bd9Sstevel@tonic-gate * File interface method declarations 206*7c478bd9Sstevel@tonic-gate */ 207*7c478bd9Sstevel@tonic-gate 208*7c478bd9Sstevel@tonic-gate /* 209*7c478bd9Sstevel@tonic-gate * NOTE: the caller of this function is responsible for freeing any 210*7c478bd9Sstevel@tonic-gate * memory allocated by calling fileutil_free_string_array() 211*7c478bd9Sstevel@tonic-gate * 212*7c478bd9Sstevel@tonic-gate * Method: fileutil_add_string_to_array 213*7c478bd9Sstevel@tonic-gate * 214*7c478bd9Sstevel@tonic-gate * Description: Adds one line to the file image string array 215*7c478bd9Sstevel@tonic-gate * 216*7c478bd9Sstevel@tonic-gate * Parameters: 217*7c478bd9Sstevel@tonic-gate * char ***string_array - pointer array of strings holding the lines 218*7c478bd9Sstevel@tonic-gate * for the new file 219*7c478bd9Sstevel@tonic-gate * char *line - the line to be added to the new file 220*7c478bd9Sstevel@tonic-gate * int *count - the number of elements in the string array 221*7c478bd9Sstevel@tonic-gate * int *err - error pointer for returning any errors encountered 222*7c478bd9Sstevel@tonic-gate * 223*7c478bd9Sstevel@tonic-gate * Return: 224*7c478bd9Sstevel@tonic-gate * B_TRUE on success, B_FALSE on failure. 225*7c478bd9Sstevel@tonic-gate * 226*7c478bd9Sstevel@tonic-gate * Note: 227*7c478bd9Sstevel@tonic-gate * On success string_array is set to the new array of strings. On failure 228*7c478bd9Sstevel@tonic-gate * string_array is unchanged. 229*7c478bd9Sstevel@tonic-gate */ 230*7c478bd9Sstevel@tonic-gate boolean_t fileutil_add_string_to_array(char ***, char *, int *, int *); 231*7c478bd9Sstevel@tonic-gate 232*7c478bd9Sstevel@tonic-gate /* 233*7c478bd9Sstevel@tonic-gate * Method: fileutil_free_string_array 234*7c478bd9Sstevel@tonic-gate * 235*7c478bd9Sstevel@tonic-gate * Description: Frees the space allocated to a string array. 236*7c478bd9Sstevel@tonic-gate * 237*7c478bd9Sstevel@tonic-gate * Parameters: 238*7c478bd9Sstevel@tonic-gate * char ** - is the array to be freed 239*7c478bd9Sstevel@tonic-gate * int - the number of elements in the array 240*7c478bd9Sstevel@tonic-gate */ 241*7c478bd9Sstevel@tonic-gate void fileutil_free_string_array(char **, int); 242*7c478bd9Sstevel@tonic-gate 243*7c478bd9Sstevel@tonic-gate /* 244*7c478bd9Sstevel@tonic-gate * Method: fileutil_get_cmd_from_string 245*7c478bd9Sstevel@tonic-gate * 246*7c478bd9Sstevel@tonic-gate * Description: Returns a string containing a line with all comments and 247*7c478bd9Sstevel@tonic-gate * trailing white space removed. 248*7c478bd9Sstevel@tonic-gate * 249*7c478bd9Sstevel@tonic-gate * Parameters: 250*7c478bd9Sstevel@tonic-gate * char *input_stringp - the line to remove all coments and trailing white 251*7c478bd9Sstevel@tonic-gate * space. 252*7c478bd9Sstevel@tonic-gate * 253*7c478bd9Sstevel@tonic-gate * Note: The memory allocated for the returned string must be freed by the 254*7c478bd9Sstevel@tonic-gate * caller of fileutil_get_cmd_from_string(). 255*7c478bd9Sstevel@tonic-gate */ 256*7c478bd9Sstevel@tonic-gate char *fileutil_get_cmd_from_string(char *input_stringp); 257*7c478bd9Sstevel@tonic-gate 258*7c478bd9Sstevel@tonic-gate /* 259*7c478bd9Sstevel@tonic-gate * Method: fileutil_get_first_column_data 260*7c478bd9Sstevel@tonic-gate * 261*7c478bd9Sstevel@tonic-gate * Description: Returns a string array which is filled with the data in the 262*7c478bd9Sstevel@tonic-gate * first column of the lines in a table formatted file. 263*7c478bd9Sstevel@tonic-gate * Examples of table formatted files include: /etc/netcofig, /etc/nfssec.conf 264*7c478bd9Sstevel@tonic-gate * 265*7c478bd9Sstevel@tonic-gate * Parameters: 266*7c478bd9Sstevel@tonic-gate * FILE* - The file pointer of the table formatted file to get data from. 267*7c478bd9Sstevel@tonic-gate * int* - will be filled with the number of elements in the array that is passed 268*7c478bd9Sstevel@tonic-gate * back. 269*7c478bd9Sstevel@tonic-gate * int* - error pointer. If an error occurs this will be non-zero upon return 270*7c478bd9Sstevel@tonic-gate * the function. 271*7c478bd9Sstevel@tonic-gate * 272*7c478bd9Sstevel@tonic-gate * Returns: 273*7c478bd9Sstevel@tonic-gate * Two-dimensional array of characters (string array). Each element in the 274*7c478bd9Sstevel@tonic-gate * array is the first column data of each row in the table. 275*7c478bd9Sstevel@tonic-gate */ 276*7c478bd9Sstevel@tonic-gate char **fileutil_get_first_column_data(FILE *, int *, int *); 277*7c478bd9Sstevel@tonic-gate 278*7c478bd9Sstevel@tonic-gate /* 279*7c478bd9Sstevel@tonic-gate * Method: fileutil_getfs 280*7c478bd9Sstevel@tonic-gate * 281*7c478bd9Sstevel@tonic-gate * Description: Convenience function for retrieving the default remote file 282*7c478bd9Sstevel@tonic-gate * system type from /etc/dfs/fstypes. 283*7c478bd9Sstevel@tonic-gate * 284*7c478bd9Sstevel@tonic-gate * Parameters: 285*7c478bd9Sstevel@tonic-gate * FILE * - The /etc/dfs/fstypes file pointer. 286*7c478bd9Sstevel@tonic-gate * 287*7c478bd9Sstevel@tonic-gate * Return: 288*7c478bd9Sstevel@tonic-gate * The default remote filesystem type. 289*7c478bd9Sstevel@tonic-gate */ 290*7c478bd9Sstevel@tonic-gate char *fileutil_getfs(FILE *); 291*7c478bd9Sstevel@tonic-gate 292*7c478bd9Sstevel@tonic-gate /* 293*7c478bd9Sstevel@tonic-gate * Method: fileutil_getline 294*7c478bd9Sstevel@tonic-gate * 295*7c478bd9Sstevel@tonic-gate * Description: Convenience function for retrieving the next line from a file. 296*7c478bd9Sstevel@tonic-gate * Commented lines are not returned and comments at the end of 297*7c478bd9Sstevel@tonic-gate * a line are removed. 298*7c478bd9Sstevel@tonic-gate * 299*7c478bd9Sstevel@tonic-gate * Parameters: 300*7c478bd9Sstevel@tonic-gate * FILE * - The file pointer to a file that has been opened for reading. 301*7c478bd9Sstevel@tonic-gate * char * - The line retrived from the file will be placed in this string. 302*7c478bd9Sstevel@tonic-gate * int * - error pointer - If an error occurs this will be non-zero upon 303*7c478bd9Sstevel@tonic-gate * return from the function. 304*7c478bd9Sstevel@tonic-gate * 305*7c478bd9Sstevel@tonic-gate * Return: 306*7c478bd9Sstevel@tonic-gate * If successfull the line retrieved from the file will be returned. 307*7c478bd9Sstevel@tonic-gate * Otherwise NULL be be returned. 308*7c478bd9Sstevel@tonic-gate */ 309*7c478bd9Sstevel@tonic-gate char *fileutil_getline(FILE *, char *, int); 310*7c478bd9Sstevel@tonic-gate 311*7c478bd9Sstevel@tonic-gate /* 312*7c478bd9Sstevel@tonic-gate * Mount defaults (/etc/vfstab) interface method declarations 313*7c478bd9Sstevel@tonic-gate */ 314*7c478bd9Sstevel@tonic-gate /* 315*7c478bd9Sstevel@tonic-gate * Method: fs_add_mount_default 316*7c478bd9Sstevel@tonic-gate * 317*7c478bd9Sstevel@tonic-gate * Description: Adds an entry to vfstab based on the fs_mntdefaults_t 318*7c478bd9Sstevel@tonic-gate * structure that is passed in. 319*7c478bd9Sstevel@tonic-gate * 320*7c478bd9Sstevel@tonic-gate * Parameters: 321*7c478bd9Sstevel@tonic-gate * fs_mntdefaults_t *newp - The structure containing the mount information 322*7c478bd9Sstevel@tonic-gate * to be placed in vfstab. 323*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 324*7c478bd9Sstevel@tonic-gate * return from the function. 325*7c478bd9Sstevel@tonic-gate * 326*7c478bd9Sstevel@tonic-gate * Return: 327*7c478bd9Sstevel@tonic-gate * If successful a pointer to a list containing all the present vfstab 328*7c478bd9Sstevel@tonic-gate * entries is returned. On failure NULL is returned. 329*7c478bd9Sstevel@tonic-gate */ 330*7c478bd9Sstevel@tonic-gate fs_mntdefaults_t *fs_add_mount_default(fs_mntdefaults_t *, int *); 331*7c478bd9Sstevel@tonic-gate 332*7c478bd9Sstevel@tonic-gate /* 333*7c478bd9Sstevel@tonic-gate * Method: fs_check_for_duplicate_DFStab_paths 334*7c478bd9Sstevel@tonic-gate * 335*7c478bd9Sstevel@tonic-gate * Description: Checks dfstab for duplicate paths and returns the number of 336*7c478bd9Sstevel@tonic-gate * times the path passed in was encountered. The functon is used to help make 337*7c478bd9Sstevel@tonic-gate * sure a path is only listed in dfstab once. 338*7c478bd9Sstevel@tonic-gate * 339*7c478bd9Sstevel@tonic-gate * Parameters: 340*7c478bd9Sstevel@tonic-gate * char *path - the path to check for 341*7c478bd9Sstevel@tonic-gate * int *err - error pointer - If an error occurs this will be non-zero upon 342*7c478bd9Sstevel@tonic-gate * return from the function. 343*7c478bd9Sstevel@tonic-gate * 344*7c478bd9Sstevel@tonic-gate * Return: 345*7c478bd9Sstevel@tonic-gate * The number of times the specified path is encountered in dfstab. 346*7c478bd9Sstevel@tonic-gate */ 347*7c478bd9Sstevel@tonic-gate int fs_check_for_duplicate_DFStab_paths(char *path, int *err); 348*7c478bd9Sstevel@tonic-gate 349*7c478bd9Sstevel@tonic-gate /* 350*7c478bd9Sstevel@tonic-gate * Method: fs_del_mount_default_ent 351*7c478bd9Sstevel@tonic-gate * 352*7c478bd9Sstevel@tonic-gate * Description: Deletes the specified vfstab entry from the vfstab file. 353*7c478bd9Sstevel@tonic-gate * 354*7c478bd9Sstevel@tonic-gate * Parameters: 355*7c478bd9Sstevel@tonic-gate * fs_mntdefaults_t *old_vfstab_ent - The mount information that corresponds 356*7c478bd9Sstevel@tonic-gate * to the vfstab entry to be deleted. 357*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 358*7c478bd9Sstevel@tonic-gate * return from the function. 359*7c478bd9Sstevel@tonic-gate * 360*7c478bd9Sstevel@tonic-gate * Return: 361*7c478bd9Sstevel@tonic-gate * If successful a pointer to a list containing all the changed vfstab 362*7c478bd9Sstevel@tonic-gate * entries is returned. On failure NULL is returned. 363*7c478bd9Sstevel@tonic-gate */ 364*7c478bd9Sstevel@tonic-gate fs_mntdefaults_t *fs_del_mount_default_ent(fs_mntdefaults_t *, int *); 365*7c478bd9Sstevel@tonic-gate 366*7c478bd9Sstevel@tonic-gate /* 367*7c478bd9Sstevel@tonic-gate * Method: fs_edit_mount_defaults 368*7c478bd9Sstevel@tonic-gate * 369*7c478bd9Sstevel@tonic-gate * Description: Edits the specified vfstab entry with the new mount 370*7c478bd9Sstevel@tonic-gate * information passed in. 371*7c478bd9Sstevel@tonic-gate * 372*7c478bd9Sstevel@tonic-gate * Parameters: 373*7c478bd9Sstevel@tonic-gate * fs_mntdefaults_t *old_vfstab_ent - The old vfstab entry that is to be edited. 374*7c478bd9Sstevel@tonic-gate * fs_mntdefaults_t *new_vfstab_ent - The new vfstab entry information. 375*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 376*7c478bd9Sstevel@tonic-gate * return from the function 377*7c478bd9Sstevel@tonic-gate * 378*7c478bd9Sstevel@tonic-gate * Return: 379*7c478bd9Sstevel@tonic-gate */ 380*7c478bd9Sstevel@tonic-gate fs_mntdefaults_t *fs_edit_mount_defaults(fs_mntdefaults_t *, 381*7c478bd9Sstevel@tonic-gate fs_mntdefaults_t *, int *); 382*7c478bd9Sstevel@tonic-gate 383*7c478bd9Sstevel@tonic-gate /* 384*7c478bd9Sstevel@tonic-gate * Method: fs_free_mntdefaults_list 385*7c478bd9Sstevel@tonic-gate * 386*7c478bd9Sstevel@tonic-gate * Description: Frees the memory used when a fs_mntdefaults_t structure 387*7c478bd9Sstevel@tonic-gate * is populated. 388*7c478bd9Sstevel@tonic-gate * 389*7c478bd9Sstevel@tonic-gate * Parameters: 390*7c478bd9Sstevel@tonic-gate * fs_mntdefaults_t *headp - The pointer to the first element in the list 391*7c478bd9Sstevel@tonic-gate * of mntdefault structures. 392*7c478bd9Sstevel@tonic-gate */ 393*7c478bd9Sstevel@tonic-gate void fs_free_mntdefaults_list(fs_mntdefaults_t *headp); 394*7c478bd9Sstevel@tonic-gate 395*7c478bd9Sstevel@tonic-gate 396*7c478bd9Sstevel@tonic-gate /* 397*7c478bd9Sstevel@tonic-gate * Method: fs_get_filtered_mount_defaults 398*7c478bd9Sstevel@tonic-gate * 399*7c478bd9Sstevel@tonic-gate * Description: Retrieves vfstab entries based in the fields in the 400*7c478bd9Sstevel@tonic-gate * fs_mntdefaults_t structure passed in. The fields that are not to 401*7c478bd9Sstevel@tonic-gate * be used in the filter will be set to NULL. 402*7c478bd9Sstevel@tonic-gate * 403*7c478bd9Sstevel@tonic-gate * Parameters: 404*7c478bd9Sstevel@tonic-gate * fs_mntdefaults_t *filter - The structure containing the fields to be 405*7c478bd9Sstevel@tonic-gate * used for the filter. 406*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 407*7c478bd9Sstevel@tonic-gate * return from the function 408*7c478bd9Sstevel@tonic-gate * 409*7c478bd9Sstevel@tonic-gate * Return: 410*7c478bd9Sstevel@tonic-gate * The list of all vfstab entries meeting the filter criteria are returned. 411*7c478bd9Sstevel@tonic-gate * On failure NULL is returned. 412*7c478bd9Sstevel@tonic-gate */ 413*7c478bd9Sstevel@tonic-gate fs_mntdefaults_t *fs_get_filtered_mount_defaults( 414*7c478bd9Sstevel@tonic-gate fs_mntdefaults_t *filter, int *errp); 415*7c478bd9Sstevel@tonic-gate 416*7c478bd9Sstevel@tonic-gate /* 417*7c478bd9Sstevel@tonic-gate * Method: fs_get_mount_defaults 418*7c478bd9Sstevel@tonic-gate * 419*7c478bd9Sstevel@tonic-gate * Description: Retrieves vfstab entries and returns a list of 420*7c478bd9Sstevel@tonic-gate * fs_mntdefaults_t structures. 421*7c478bd9Sstevel@tonic-gate * 422*7c478bd9Sstevel@tonic-gate * Parameters: 423*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 424*7c478bd9Sstevel@tonic-gate * return from the function 425*7c478bd9Sstevel@tonic-gate * 426*7c478bd9Sstevel@tonic-gate * Return: 427*7c478bd9Sstevel@tonic-gate * fs_mntdefaults_t * - Returns a list of all vfstab entries. 428*7c478bd9Sstevel@tonic-gate */ 429*7c478bd9Sstevel@tonic-gate fs_mntdefaults_t *fs_get_mount_defaults(int *errp); 430*7c478bd9Sstevel@tonic-gate 431*7c478bd9Sstevel@tonic-gate /* 432*7c478bd9Sstevel@tonic-gate * Mount (/etc/mnttab) interface method declarations 433*7c478bd9Sstevel@tonic-gate */ 434*7c478bd9Sstevel@tonic-gate /* 435*7c478bd9Sstevel@tonic-gate * Method: fs_free_mount_list 436*7c478bd9Sstevel@tonic-gate * 437*7c478bd9Sstevel@tonic-gate * Description: Frees the mount list created when retrieving mnttab entries. 438*7c478bd9Sstevel@tonic-gate * 439*7c478bd9Sstevel@tonic-gate * Parameters: 440*7c478bd9Sstevel@tonic-gate * fs_mntlist_t *headp - The mount list to be freed. 441*7c478bd9Sstevel@tonic-gate */ 442*7c478bd9Sstevel@tonic-gate void fs_free_mount_list(fs_mntlist_t *mnt_list); 443*7c478bd9Sstevel@tonic-gate 444*7c478bd9Sstevel@tonic-gate /* 445*7c478bd9Sstevel@tonic-gate * Method: fs_get_availablesize 446*7c478bd9Sstevel@tonic-gate * 447*7c478bd9Sstevel@tonic-gate * Description: Calculates the total size available on the filesystem. 448*7c478bd9Sstevel@tonic-gate * 449*7c478bd9Sstevel@tonic-gate * Parameters: 450*7c478bd9Sstevel@tonic-gate * char *mntpnt - The mount point to use for gathering the stat information 451*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 452*7c478bd9Sstevel@tonic-gate * return from the function 453*7c478bd9Sstevel@tonic-gate * 454*7c478bd9Sstevel@tonic-gate * Return: 455*7c478bd9Sstevel@tonic-gate * The total size available on the filesystem. 456*7c478bd9Sstevel@tonic-gate */ 457*7c478bd9Sstevel@tonic-gate unsigned long long fs_get_availablesize(char *mntpnt, int *errp); 458*7c478bd9Sstevel@tonic-gate 459*7c478bd9Sstevel@tonic-gate /* 460*7c478bd9Sstevel@tonic-gate * Method: fs_get_avail_for_nonsuperuser_size 461*7c478bd9Sstevel@tonic-gate * 462*7c478bd9Sstevel@tonic-gate * Description: Calculates the available space on the filesystem for 463*7c478bd9Sstevel@tonic-gate * nonsuperusers. 464*7c478bd9Sstevel@tonic-gate * 465*7c478bd9Sstevel@tonic-gate * Parameters: 466*7c478bd9Sstevel@tonic-gate * char *mntpnt - The mount point for the filesystem. 467*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 468*7c478bd9Sstevel@tonic-gate * return from the function 469*7c478bd9Sstevel@tonic-gate * 470*7c478bd9Sstevel@tonic-gate * Return: 471*7c478bd9Sstevel@tonic-gate * The available space for nonsuperusers. 472*7c478bd9Sstevel@tonic-gate * On failure NULL is returned. 473*7c478bd9Sstevel@tonic-gate */ 474*7c478bd9Sstevel@tonic-gate unsigned long long fs_get_avail_for_nonsuperuser_size(char *mntpnt, 475*7c478bd9Sstevel@tonic-gate int *errp); 476*7c478bd9Sstevel@tonic-gate 477*7c478bd9Sstevel@tonic-gate /* 478*7c478bd9Sstevel@tonic-gate * Method: fs_get_blocksize 479*7c478bd9Sstevel@tonic-gate * 480*7c478bd9Sstevel@tonic-gate * Description: Retrieves the preferred filesystem block size. 481*7c478bd9Sstevel@tonic-gate * 482*7c478bd9Sstevel@tonic-gate * Parameters: 483*7c478bd9Sstevel@tonic-gate * char *mntpnt - The mount point for the filesystem. 484*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 485*7c478bd9Sstevel@tonic-gate * return from the function 486*7c478bd9Sstevel@tonic-gate * 487*7c478bd9Sstevel@tonic-gate * Return: 488*7c478bd9Sstevel@tonic-gate * Returns the preferred filesystem block size. 489*7c478bd9Sstevel@tonic-gate * On failure NULL is returned. 490*7c478bd9Sstevel@tonic-gate */ 491*7c478bd9Sstevel@tonic-gate 492*7c478bd9Sstevel@tonic-gate unsigned long long fs_get_blocksize(char *mntpnt, int *errp); 493*7c478bd9Sstevel@tonic-gate 494*7c478bd9Sstevel@tonic-gate /* 495*7c478bd9Sstevel@tonic-gate * Method: fs_get_filtered_mount_list 496*7c478bd9Sstevel@tonic-gate * 497*7c478bd9Sstevel@tonic-gate * Description: Can be used to filter mounts only by the following mount 498*7c478bd9Sstevel@tonic-gate * attributes or a mixture of them: 499*7c478bd9Sstevel@tonic-gate * 1.) resource 500*7c478bd9Sstevel@tonic-gate * 2.) mount point 501*7c478bd9Sstevel@tonic-gate * 3.) mount option string 502*7c478bd9Sstevel@tonic-gate * 4.) time mounted 503*7c478bd9Sstevel@tonic-gate * 504*7c478bd9Sstevel@tonic-gate * Parameters: 505*7c478bd9Sstevel@tonic-gate * char *resource - The name of the resource to be mounted 506*7c478bd9Sstevel@tonic-gate * char *mountp - The pathname of the directory on which the filesystem 507*7c478bd9Sstevel@tonic-gate * is mounted 508*7c478bd9Sstevel@tonic-gate * char *mntopts - The mount options 509*7c478bd9Sstevel@tonic-gate * char *time - The time at which the filesystem was mounted 510*7c478bd9Sstevel@tonic-gate * boolean_t find_overlays - Flag used to turn on overlay checking 511*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 512*7c478bd9Sstevel@tonic-gate * return from the function 513*7c478bd9Sstevel@tonic-gate * 514*7c478bd9Sstevel@tonic-gate * Return: 515*7c478bd9Sstevel@tonic-gate * The list of all mnttab entries meeting the filter criteria are returned. 516*7c478bd9Sstevel@tonic-gate * On failure NULL is returned. 517*7c478bd9Sstevel@tonic-gate */ 518*7c478bd9Sstevel@tonic-gate fs_mntlist_t *fs_get_filtered_mount_list(char *resource, 519*7c478bd9Sstevel@tonic-gate char *mountp, char *fstype, char *mntopts, 520*7c478bd9Sstevel@tonic-gate char *time, boolean_t find_overlays, 521*7c478bd9Sstevel@tonic-gate int *errp); 522*7c478bd9Sstevel@tonic-gate 523*7c478bd9Sstevel@tonic-gate /* 524*7c478bd9Sstevel@tonic-gate * Method: fs_get_fragsize 525*7c478bd9Sstevel@tonic-gate * 526*7c478bd9Sstevel@tonic-gate * Description: Determines the fundamental filesystem block size. 527*7c478bd9Sstevel@tonic-gate * 528*7c478bd9Sstevel@tonic-gate * Parameters: 529*7c478bd9Sstevel@tonic-gate * char *mntpnt - The mount point for the filesystem. 530*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 531*7c478bd9Sstevel@tonic-gate * return from the function 532*7c478bd9Sstevel@tonic-gate * 533*7c478bd9Sstevel@tonic-gate * Return: 534*7c478bd9Sstevel@tonic-gate * Returns the fundamental filesystem block size. 535*7c478bd9Sstevel@tonic-gate * On failure NULL is returned. 536*7c478bd9Sstevel@tonic-gate */ 537*7c478bd9Sstevel@tonic-gate unsigned long fs_get_fragsize(char *mntpnt, int *errp); 538*7c478bd9Sstevel@tonic-gate 539*7c478bd9Sstevel@tonic-gate /* 540*7c478bd9Sstevel@tonic-gate * Method: fs_get_maxfilenamelen 541*7c478bd9Sstevel@tonic-gate * 542*7c478bd9Sstevel@tonic-gate * Description: Determines the maximum file name length for the filesystem. 543*7c478bd9Sstevel@tonic-gate * 544*7c478bd9Sstevel@tonic-gate * Parameters: 545*7c478bd9Sstevel@tonic-gate * char *mntpnt - The mount point for the filesystem. 546*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 547*7c478bd9Sstevel@tonic-gate * return from the function 548*7c478bd9Sstevel@tonic-gate * 549*7c478bd9Sstevel@tonic-gate * Return: 550*7c478bd9Sstevel@tonic-gate * Returns the maximum file name length for the specified filesystem. 551*7c478bd9Sstevel@tonic-gate * On failure NULL is returned. 552*7c478bd9Sstevel@tonic-gate */ 553*7c478bd9Sstevel@tonic-gate unsigned long fs_get_maxfilenamelen(char *mntpnt, int *errp); 554*7c478bd9Sstevel@tonic-gate 555*7c478bd9Sstevel@tonic-gate /* 556*7c478bd9Sstevel@tonic-gate * Method: fs_get_mounts_by_mntopt 557*7c478bd9Sstevel@tonic-gate * 558*7c478bd9Sstevel@tonic-gate * Description: Returns only mounts with the specified mount option set. 559*7c478bd9Sstevel@tonic-gate * 560*7c478bd9Sstevel@tonic-gate * Parameters: 561*7c478bd9Sstevel@tonic-gate * char *mntopt - The mount option used for filtering mounts 562*7c478bd9Sstevel@tonic-gate * boolean_t find_overlays - Flag used to turn on overlay checking 563*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 564*7c478bd9Sstevel@tonic-gate * return from the function 565*7c478bd9Sstevel@tonic-gate * 566*7c478bd9Sstevel@tonic-gate * Return: 567*7c478bd9Sstevel@tonic-gate * Returns the list of all mnttab entries with the matching mount option. 568*7c478bd9Sstevel@tonic-gate * On failure NULL is returned. 569*7c478bd9Sstevel@tonic-gate */ 570*7c478bd9Sstevel@tonic-gate fs_mntlist_t *fs_get_mounts_by_mntopt(char *mntopt, 571*7c478bd9Sstevel@tonic-gate boolean_t find_overlays, int *errp); 572*7c478bd9Sstevel@tonic-gate 573*7c478bd9Sstevel@tonic-gate /* 574*7c478bd9Sstevel@tonic-gate * Method: fs_get_mount_list 575*7c478bd9Sstevel@tonic-gate * 576*7c478bd9Sstevel@tonic-gate * Description: Returns a list of all mounts in mnttab 577*7c478bd9Sstevel@tonic-gate * 578*7c478bd9Sstevel@tonic-gate * Parameters: 579*7c478bd9Sstevel@tonic-gate * char *mntpnt - The mount point for the filesystem 580*7c478bd9Sstevel@tonic-gate * boolean_t find_overlays - Flag used to turn on overlay checking 581*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 582*7c478bd9Sstevel@tonic-gate * return from the function 583*7c478bd9Sstevel@tonic-gate * 584*7c478bd9Sstevel@tonic-gate * Return: 585*7c478bd9Sstevel@tonic-gate * Returns the list of all mounts and associated mount information for mounts 586*7c478bd9Sstevel@tonic-gate * listed in mnttab. On failure NULL is returned. 587*7c478bd9Sstevel@tonic-gate */ 588*7c478bd9Sstevel@tonic-gate fs_mntlist_t *fs_get_mount_list(boolean_t find_overlays, int *errp); 589*7c478bd9Sstevel@tonic-gate 590*7c478bd9Sstevel@tonic-gate /* 591*7c478bd9Sstevel@tonic-gate * Method: fs_get_totalsize 592*7c478bd9Sstevel@tonic-gate * 593*7c478bd9Sstevel@tonic-gate * Description: Determines the total size of the filesystem using the 594*7c478bd9Sstevel@tonic-gate * total number of blocks and the block size. 595*7c478bd9Sstevel@tonic-gate * 596*7c478bd9Sstevel@tonic-gate * Parameters: 597*7c478bd9Sstevel@tonic-gate * char *mntpnt - The mount point for the filesystem 598*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 599*7c478bd9Sstevel@tonic-gate * return from the function 600*7c478bd9Sstevel@tonic-gate * 601*7c478bd9Sstevel@tonic-gate * Return: 602*7c478bd9Sstevel@tonic-gate * Returns the total size of the filesystem. 603*7c478bd9Sstevel@tonic-gate * On failure NULL is returned. 604*7c478bd9Sstevel@tonic-gate */ 605*7c478bd9Sstevel@tonic-gate unsigned long long fs_get_totalsize(char *mntpnt, int *errp); 606*7c478bd9Sstevel@tonic-gate 607*7c478bd9Sstevel@tonic-gate /* 608*7c478bd9Sstevel@tonic-gate * Method: fs_get_usedsize 609*7c478bd9Sstevel@tonic-gate * 610*7c478bd9Sstevel@tonic-gate * Description: Calculates the size of the used portion of the filesystem. 611*7c478bd9Sstevel@tonic-gate * 612*7c478bd9Sstevel@tonic-gate * Parameters: 613*7c478bd9Sstevel@tonic-gate * char *mntpnt - The mount point for the filesystem 614*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 615*7c478bd9Sstevel@tonic-gate * return from the function 616*7c478bd9Sstevel@tonic-gate * 617*7c478bd9Sstevel@tonic-gate * Return: 618*7c478bd9Sstevel@tonic-gate * Returns the size of the the used portion of the filesystem. 619*7c478bd9Sstevel@tonic-gate * On failure NULL is returned. 620*7c478bd9Sstevel@tonic-gate */ 621*7c478bd9Sstevel@tonic-gate unsigned long long fs_get_usedsize(char *mntpnt, int *errp); 622*7c478bd9Sstevel@tonic-gate 623*7c478bd9Sstevel@tonic-gate /* 624*7c478bd9Sstevel@tonic-gate * Method: fs_is_readonly 625*7c478bd9Sstevel@tonic-gate * 626*7c478bd9Sstevel@tonic-gate * Description: Checks the filesystem flags to see if the filesystem is 627*7c478bd9Sstevel@tonic-gate * readonly. 628*7c478bd9Sstevel@tonic-gate * 629*7c478bd9Sstevel@tonic-gate * Parameters: 630*7c478bd9Sstevel@tonic-gate * char *mntpnt - The mount point for the filesystem 631*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 632*7c478bd9Sstevel@tonic-gate * return from the function 633*7c478bd9Sstevel@tonic-gate * 634*7c478bd9Sstevel@tonic-gate * Return: 635*7c478bd9Sstevel@tonic-gate * Returns B_TRUE if the readonly flag is set and B_FALSE if not. 636*7c478bd9Sstevel@tonic-gate * On error the error pointer is set to errno. 637*7c478bd9Sstevel@tonic-gate */ 638*7c478bd9Sstevel@tonic-gate boolean_t fs_is_readonly(char *mntpnt, int *errp); 639*7c478bd9Sstevel@tonic-gate 640*7c478bd9Sstevel@tonic-gate /* 641*7c478bd9Sstevel@tonic-gate * Method: fs_parse_optlist_for_option 642*7c478bd9Sstevel@tonic-gate * 643*7c478bd9Sstevel@tonic-gate * Description: 644*7c478bd9Sstevel@tonic-gate * This method will parse the given comma delimited option list (optlist) for 645*7c478bd9Sstevel@tonic-gate * the option passed into the function. If the option (opt) to search for 646*7c478bd9Sstevel@tonic-gate * is one that sets a value such as onerror=, the value to the right of the "=" 647*7c478bd9Sstevel@tonic-gate * character will be returned from the function. This function expects the 648*7c478bd9Sstevel@tonic-gate * opt parameter to have the "=" character appended when searching for options 649*7c478bd9Sstevel@tonic-gate * which set a value. 650*7c478bd9Sstevel@tonic-gate * 651*7c478bd9Sstevel@tonic-gate * Parameters: 652*7c478bd9Sstevel@tonic-gate * char *optlist - The option string to be parsed 653*7c478bd9Sstevel@tonic-gate * char *opt - The option to search for 654*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 655*7c478bd9Sstevel@tonic-gate * return from the function 656*7c478bd9Sstevel@tonic-gate * 657*7c478bd9Sstevel@tonic-gate * Return: 658*7c478bd9Sstevel@tonic-gate * Returns the option as found in the option list. 659*7c478bd9Sstevel@tonic-gate * If the option is not found NULL is returned. 660*7c478bd9Sstevel@tonic-gate * On error NULL is returned and the error pointer is set to errno. 661*7c478bd9Sstevel@tonic-gate */ 662*7c478bd9Sstevel@tonic-gate char *fs_parse_optlist_for_option(char *optlist, char *opt, 663*7c478bd9Sstevel@tonic-gate int *errp); 664*7c478bd9Sstevel@tonic-gate 665*7c478bd9Sstevel@tonic-gate /* 666*7c478bd9Sstevel@tonic-gate * Share (/etc/dfs/sharetab) interface method declarations 667*7c478bd9Sstevel@tonic-gate */ 668*7c478bd9Sstevel@tonic-gate /* 669*7c478bd9Sstevel@tonic-gate * Method: fs_free_share_list 670*7c478bd9Sstevel@tonic-gate * 671*7c478bd9Sstevel@tonic-gate * Description: Used to free populated fs_sharelist_t structures 672*7c478bd9Sstevel@tonic-gate * 673*7c478bd9Sstevel@tonic-gate * Parameters: 674*7c478bd9Sstevel@tonic-gate * fs_sharelist_t *headp - the pointer to the first element in the list. 675*7c478bd9Sstevel@tonic-gate */ 676*7c478bd9Sstevel@tonic-gate void fs_free_share_list(fs_sharelist_t *share_list); 677*7c478bd9Sstevel@tonic-gate 678*7c478bd9Sstevel@tonic-gate /* 679*7c478bd9Sstevel@tonic-gate * Method: fs_get_share_list 680*7c478bd9Sstevel@tonic-gate * 681*7c478bd9Sstevel@tonic-gate * Description: Gets a list of the shares on the system from /etc/dfs/sharetab 682*7c478bd9Sstevel@tonic-gate * 683*7c478bd9Sstevel@tonic-gate * Parameters: 684*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 685*7c478bd9Sstevel@tonic-gate * return from the function 686*7c478bd9Sstevel@tonic-gate * 687*7c478bd9Sstevel@tonic-gate * Return: 688*7c478bd9Sstevel@tonic-gate * Returns a list of fs_sharelist_t structures containing all of the shares 689*7c478bd9Sstevel@tonic-gate * from sharetab. 690*7c478bd9Sstevel@tonic-gate * On error NULL is returned and errp is set to errno. 691*7c478bd9Sstevel@tonic-gate */ 692*7c478bd9Sstevel@tonic-gate fs_sharelist_t *fs_get_share_list(int *errp); 693*7c478bd9Sstevel@tonic-gate 694*7c478bd9Sstevel@tonic-gate /* 695*7c478bd9Sstevel@tonic-gate * Method: fs_parse_opts_for_sec_modes 696*7c478bd9Sstevel@tonic-gate * 697*7c478bd9Sstevel@tonic-gate * Description: Parses the option string for security modes and returns 698*7c478bd9Sstevel@tonic-gate * an array of strings containing all modes. 699*7c478bd9Sstevel@tonic-gate * 700*7c478bd9Sstevel@tonic-gate * Parameters: 701*7c478bd9Sstevel@tonic-gate * char * - options string to be parsed. 702*7c478bd9Sstevel@tonic-gate * int * - count of the number of modes found. 703*7c478bd9Sstevel@tonic-gate * int * - error code. 704*7c478bd9Sstevel@tonic-gate * 705*7c478bd9Sstevel@tonic-gate * Return: 706*7c478bd9Sstevel@tonic-gate * Returns an array of string containing all security opts listed in the 707*7c478bd9Sstevel@tonic-gate * passed in option string. On error NULL is returned. 708*7c478bd9Sstevel@tonic-gate */ 709*7c478bd9Sstevel@tonic-gate char **fs_parse_opts_for_sec_modes(char *, int *, int *); 710*7c478bd9Sstevel@tonic-gate 711*7c478bd9Sstevel@tonic-gate /* 712*7c478bd9Sstevel@tonic-gate * Method: fs_create_array_from_accesslist 713*7c478bd9Sstevel@tonic-gate * 714*7c478bd9Sstevel@tonic-gate * Description: Takes the colon seperated access list parses the list 715*7c478bd9Sstevel@tonic-gate * into an array containing all the elements of the list. 716*7c478bd9Sstevel@tonic-gate * The array created is returned and count is set to the 717*7c478bd9Sstevel@tonic-gate * number of elements in the array. 718*7c478bd9Sstevel@tonic-gate * 719*7c478bd9Sstevel@tonic-gate * Parameters: 720*7c478bd9Sstevel@tonic-gate * char *access_list - The string containing the colon sperated access list. 721*7c478bd9Sstevel@tonic-gate * int *count - Will contain the number of elements in the array. 722*7c478bd9Sstevel@tonic-gate * int *err - any errors encountered. 723*7c478bd9Sstevel@tonic-gate */ 724*7c478bd9Sstevel@tonic-gate char **fs_create_array_from_accesslist(char *access_list, int *count, int *err); 725*7c478bd9Sstevel@tonic-gate 726*7c478bd9Sstevel@tonic-gate /* 727*7c478bd9Sstevel@tonic-gate * FS dfstab (/etc/dfs/dfstab) interface method declarations 728*7c478bd9Sstevel@tonic-gate */ 729*7c478bd9Sstevel@tonic-gate 730*7c478bd9Sstevel@tonic-gate /* 731*7c478bd9Sstevel@tonic-gate * Method: fs_add_DFStab_ent 732*7c478bd9Sstevel@tonic-gate * 733*7c478bd9Sstevel@tonic-gate * Description: Adds an entry to dfstab and to the list of dfstab 734*7c478bd9Sstevel@tonic-gate * entries. Returns a pointer to the head of the dfstab entry list. 735*7c478bd9Sstevel@tonic-gate * 736*7c478bd9Sstevel@tonic-gate * Parameters: 737*7c478bd9Sstevel@tonic-gate * char *cmd - the share command to be added to dfstab 738*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 739*7c478bd9Sstevel@tonic-gate * return from the function 740*7c478bd9Sstevel@tonic-gate * 741*7c478bd9Sstevel@tonic-gate * Return: 742*7c478bd9Sstevel@tonic-gate * Returns the pointer to the updated dfstab entry list. 743*7c478bd9Sstevel@tonic-gate */ 744*7c478bd9Sstevel@tonic-gate fs_dfstab_entry_t fs_add_DFStab_ent(char *, int *); 745*7c478bd9Sstevel@tonic-gate 746*7c478bd9Sstevel@tonic-gate /* 747*7c478bd9Sstevel@tonic-gate * Method: fs_del_DFStab_ent 748*7c478bd9Sstevel@tonic-gate * 749*7c478bd9Sstevel@tonic-gate * Description: Deletes an entry from dfstab and from the list of 750*7c478bd9Sstevel@tonic-gate * dfstab entries. 751*7c478bd9Sstevel@tonic-gate * 752*7c478bd9Sstevel@tonic-gate * Parameters: 753*7c478bd9Sstevel@tonic-gate * char *del_cmd - The share command to be removed 754*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 755*7c478bd9Sstevel@tonic-gate * return from the function 756*7c478bd9Sstevel@tonic-gate * 757*7c478bd9Sstevel@tonic-gate * Return: 758*7c478bd9Sstevel@tonic-gate * Returns the pointer to the updated dfstab entry list. 759*7c478bd9Sstevel@tonic-gate */ 760*7c478bd9Sstevel@tonic-gate fs_dfstab_entry_t fs_del_DFStab_ent(char *, int *); 761*7c478bd9Sstevel@tonic-gate 762*7c478bd9Sstevel@tonic-gate /* 763*7c478bd9Sstevel@tonic-gate * NOTE: the caller of this function is responsible for freeing any 764*7c478bd9Sstevel@tonic-gate * memory allocated by calling fs_free_DFStab_ents() 765*7c478bd9Sstevel@tonic-gate * 766*7c478bd9Sstevel@tonic-gate * Method: fs_edit_DFStab_ent 767*7c478bd9Sstevel@tonic-gate * 768*7c478bd9Sstevel@tonic-gate * Description: Changes the specified line in dfstab to match the second 769*7c478bd9Sstevel@tonic-gate * string passed in. 770*7c478bd9Sstevel@tonic-gate * 771*7c478bd9Sstevel@tonic-gate * Parameters: 772*7c478bd9Sstevel@tonic-gate * char *old_cmd - The share command that will be changed. 773*7c478bd9Sstevel@tonic-gate * char *new_cmd - The share command that will replace old_cmd. 774*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 775*7c478bd9Sstevel@tonic-gate * return from the function 776*7c478bd9Sstevel@tonic-gate * 777*7c478bd9Sstevel@tonic-gate * Return: 778*7c478bd9Sstevel@tonic-gate * Returns the pointer to the updated dfstab entry list. 779*7c478bd9Sstevel@tonic-gate */ 780*7c478bd9Sstevel@tonic-gate fs_dfstab_entry_t fs_edit_DFStab_ent(char *, char *, int *); 781*7c478bd9Sstevel@tonic-gate 782*7c478bd9Sstevel@tonic-gate /* 783*7c478bd9Sstevel@tonic-gate * Method: fs_free_DFStab_ents 784*7c478bd9Sstevel@tonic-gate * 785*7c478bd9Sstevel@tonic-gate * Description: Frees the dfstab entry list. 786*7c478bd9Sstevel@tonic-gate * 787*7c478bd9Sstevel@tonic-gate * Parameters: 788*7c478bd9Sstevel@tonic-gate * fs_dfstab_entry_t list - The pointer to the dfstab entry list. 789*7c478bd9Sstevel@tonic-gate */ 790*7c478bd9Sstevel@tonic-gate void fs_free_DFStab_ents(fs_dfstab_entry_t); 791*7c478bd9Sstevel@tonic-gate 792*7c478bd9Sstevel@tonic-gate /* 793*7c478bd9Sstevel@tonic-gate * NOTE: the caller of this function is responsible for freeing any 794*7c478bd9Sstevel@tonic-gate * memory allocated by calling fs_free_DFStab_ents() 795*7c478bd9Sstevel@tonic-gate * 796*7c478bd9Sstevel@tonic-gate * Method: fs_get_DFStab_ents 797*7c478bd9Sstevel@tonic-gate * 798*7c478bd9Sstevel@tonic-gate * Description: Retrieves the dfstab entry list. 799*7c478bd9Sstevel@tonic-gate * 800*7c478bd9Sstevel@tonic-gate * Parameters: 801*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 802*7c478bd9Sstevel@tonic-gate * return from the function 803*7c478bd9Sstevel@tonic-gate * 804*7c478bd9Sstevel@tonic-gate * Return: 805*7c478bd9Sstevel@tonic-gate * Returns the pointer to the dfstab entry list. 806*7c478bd9Sstevel@tonic-gate * If NULL is returned and errp is 0 then dfstab has no entries. If errp is 807*7c478bd9Sstevel@tonic-gate * not 0 there was an error and the value of errp is set to the errno 808*7c478bd9Sstevel@tonic-gate * value for that error. 809*7c478bd9Sstevel@tonic-gate */ 810*7c478bd9Sstevel@tonic-gate fs_dfstab_entry_t fs_get_DFStab_ents(int *err); 811*7c478bd9Sstevel@tonic-gate 812*7c478bd9Sstevel@tonic-gate /* 813*7c478bd9Sstevel@tonic-gate * NOTE: the caller of this function is responsible for freeing any 814*7c478bd9Sstevel@tonic-gate * memory allocated by calling fs_free_DFStab_ents() 815*7c478bd9Sstevel@tonic-gate * 816*7c478bd9Sstevel@tonic-gate * Method: fs_get_DFStab_ent_Desc 817*7c478bd9Sstevel@tonic-gate * 818*7c478bd9Sstevel@tonic-gate * Description: Retrieves the description information for the present 819*7c478bd9Sstevel@tonic-gate * dfstab entry. 820*7c478bd9Sstevel@tonic-gate * 821*7c478bd9Sstevel@tonic-gate * Parameters: 822*7c478bd9Sstevel@tonic-gate * fs_dfstab_entry_t entry - the dfstab entry to retrieve the description from. 823*7c478bd9Sstevel@tonic-gate * 824*7c478bd9Sstevel@tonic-gate * Return: 825*7c478bd9Sstevel@tonic-gate * The string containing the description for the dfstab entry. 826*7c478bd9Sstevel@tonic-gate * If the description is not set NULL is returned. 827*7c478bd9Sstevel@tonic-gate * 828*7c478bd9Sstevel@tonic-gate * Note: the description is an optional share option and a return value of 829*7c478bd9Sstevel@tonic-gate * NULL is not an error but indicates that the description was not set. 830*7c478bd9Sstevel@tonic-gate */ 831*7c478bd9Sstevel@tonic-gate char *fs_get_DFStab_ent_Desc(fs_dfstab_entry_t); 832*7c478bd9Sstevel@tonic-gate 833*7c478bd9Sstevel@tonic-gate /* 834*7c478bd9Sstevel@tonic-gate * Method: fs_get_DFStab_ent_Fstype 835*7c478bd9Sstevel@tonic-gate * 836*7c478bd9Sstevel@tonic-gate * Description: Retrieves the filesystem type information from the dfstab 837*7c478bd9Sstevel@tonic-gate * entry passed in. 838*7c478bd9Sstevel@tonic-gate * 839*7c478bd9Sstevel@tonic-gate * Parameters: 840*7c478bd9Sstevel@tonic-gate * fs_dfstab_entry_t entry - the dfstab entry to retrieve the fstype from. 841*7c478bd9Sstevel@tonic-gate * 842*7c478bd9Sstevel@tonic-gate * Return: 843*7c478bd9Sstevel@tonic-gate * The string containing the filesystem type. 844*7c478bd9Sstevel@tonic-gate * 845*7c478bd9Sstevel@tonic-gate * Note: if fstype is not set in the dfstab entry the default fstype is 846*7c478bd9Sstevel@tonic-gate * returned. 847*7c478bd9Sstevel@tonic-gate */ 848*7c478bd9Sstevel@tonic-gate char *fs_get_DFStab_ent_Fstype(fs_dfstab_entry_t); 849*7c478bd9Sstevel@tonic-gate 850*7c478bd9Sstevel@tonic-gate /* 851*7c478bd9Sstevel@tonic-gate * Method: fs_get_DFStab_ent_Next 852*7c478bd9Sstevel@tonic-gate * 853*7c478bd9Sstevel@tonic-gate * Description: Retrieves the next entry in the dfstab entry list. 854*7c478bd9Sstevel@tonic-gate * 855*7c478bd9Sstevel@tonic-gate * Parameters: 856*7c478bd9Sstevel@tonic-gate * fs_dfstab_entry_t entry - The dfstab entry pointer to get the next 857*7c478bd9Sstevel@tonic-gate * pointer from. 858*7c478bd9Sstevel@tonic-gate * 859*7c478bd9Sstevel@tonic-gate * Return: 860*7c478bd9Sstevel@tonic-gate * Returns the next dfstab entry. 861*7c478bd9Sstevel@tonic-gate * A return value of NULL indicates the end of the dfstab entry list. 862*7c478bd9Sstevel@tonic-gate */ 863*7c478bd9Sstevel@tonic-gate fs_dfstab_entry_t fs_get_DFStab_ent_Next(fs_dfstab_entry_t); 864*7c478bd9Sstevel@tonic-gate 865*7c478bd9Sstevel@tonic-gate /* 866*7c478bd9Sstevel@tonic-gate * Method: fs_get_DFStab_ent_Options 867*7c478bd9Sstevel@tonic-gate * 868*7c478bd9Sstevel@tonic-gate * Description: Retrieves the share options from the dfstab 869*7c478bd9Sstevel@tonic-gate * entry passed in. 870*7c478bd9Sstevel@tonic-gate * 871*7c478bd9Sstevel@tonic-gate * Parameters: 872*7c478bd9Sstevel@tonic-gate * fs_dfstab_entry_t entry - The dfstab entry to retrieve the share 873*7c478bd9Sstevel@tonic-gate * options from. 874*7c478bd9Sstevel@tonic-gate * 875*7c478bd9Sstevel@tonic-gate * Return: 876*7c478bd9Sstevel@tonic-gate * Returns the string containing the share options. 877*7c478bd9Sstevel@tonic-gate * A NULL value indicates that no options were specified in the dfstab entry. 878*7c478bd9Sstevel@tonic-gate */ 879*7c478bd9Sstevel@tonic-gate char *fs_get_DFStab_ent_Options(fs_dfstab_entry_t); 880*7c478bd9Sstevel@tonic-gate 881*7c478bd9Sstevel@tonic-gate /* 882*7c478bd9Sstevel@tonic-gate * Method: fs_get_DFStab_ent_Path 883*7c478bd9Sstevel@tonic-gate * 884*7c478bd9Sstevel@tonic-gate * Description: Retrieves the path information from the dfstab 885*7c478bd9Sstevel@tonic-gate * entry passed in. 886*7c478bd9Sstevel@tonic-gate * 887*7c478bd9Sstevel@tonic-gate * Parameters: 888*7c478bd9Sstevel@tonic-gate * fs_dfstab_entry_t entry - the dfstab entry to retrieve the path from. 889*7c478bd9Sstevel@tonic-gate * 890*7c478bd9Sstevel@tonic-gate * Return: 891*7c478bd9Sstevel@tonic-gate * Returns the string containing the path. 892*7c478bd9Sstevel@tonic-gate * A NULL value indecates that no path information is available for the 893*7c478bd9Sstevel@tonic-gate * dfstab entry. A NULL value here is an error and indicates an invalid 894*7c478bd9Sstevel@tonic-gate * dfstab entry. 895*7c478bd9Sstevel@tonic-gate */ 896*7c478bd9Sstevel@tonic-gate char *fs_get_DFStab_ent_Path(fs_dfstab_entry_t); 897*7c478bd9Sstevel@tonic-gate 898*7c478bd9Sstevel@tonic-gate /* 899*7c478bd9Sstevel@tonic-gate * Method: fs_get_DFStab_ent_Res 900*7c478bd9Sstevel@tonic-gate * 901*7c478bd9Sstevel@tonic-gate * Description: Retrieves the resource information from the dfstab entry 902*7c478bd9Sstevel@tonic-gate * passed in. 903*7c478bd9Sstevel@tonic-gate * 904*7c478bd9Sstevel@tonic-gate * Parameters: 905*7c478bd9Sstevel@tonic-gate * fs_dfstab_entry_t entry - the dfstab entry to retrieve the resource 906*7c478bd9Sstevel@tonic-gate * information from. 907*7c478bd9Sstevel@tonic-gate * 908*7c478bd9Sstevel@tonic-gate * Return: 909*7c478bd9Sstevel@tonic-gate * Returns the string containing the path. 910*7c478bd9Sstevel@tonic-gate * A NULL value indecates that no resource information is available for the 911*7c478bd9Sstevel@tonic-gate * dfstab entry. 912*7c478bd9Sstevel@tonic-gate */ 913*7c478bd9Sstevel@tonic-gate char *fs_get_DFStab_ent_Res(fs_dfstab_entry_t); 914*7c478bd9Sstevel@tonic-gate 915*7c478bd9Sstevel@tonic-gate /* 916*7c478bd9Sstevel@tonic-gate * Method: fs_get_Dfstab_share_cmd 917*7c478bd9Sstevel@tonic-gate * 918*7c478bd9Sstevel@tonic-gate * Description: Retrieves the share command that corresponds to the 919*7c478bd9Sstevel@tonic-gate * dfstab entry passed in. 920*7c478bd9Sstevel@tonic-gate * 921*7c478bd9Sstevel@tonic-gate * Parameters: 922*7c478bd9Sstevel@tonic-gate * fs_dfstab_entry_t entry - The dfstab entry that will be used to create 923*7c478bd9Sstevel@tonic-gate * a share command. 924*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 925*7c478bd9Sstevel@tonic-gate * return from the function 926*7c478bd9Sstevel@tonic-gate * 927*7c478bd9Sstevel@tonic-gate * Return: 928*7c478bd9Sstevel@tonic-gate * Returns the string containing the share command. 929*7c478bd9Sstevel@tonic-gate * A NULL value indicates an error occured and errp will be non zero. 930*7c478bd9Sstevel@tonic-gate */ 931*7c478bd9Sstevel@tonic-gate char *fs_get_Dfstab_share_cmd(fs_dfstab_entry_t, int *); 932*7c478bd9Sstevel@tonic-gate 933*7c478bd9Sstevel@tonic-gate /* 934*7c478bd9Sstevel@tonic-gate * NOTE: the caller of this function is responsible for freeing any 935*7c478bd9Sstevel@tonic-gate * memory allocated by calling fs_free_DFStab_ents() 936*7c478bd9Sstevel@tonic-gate * 937*7c478bd9Sstevel@tonic-gate * Method: fs_set_DFStab_ent 938*7c478bd9Sstevel@tonic-gate * 939*7c478bd9Sstevel@tonic-gate * Description: Used to add entries into dfstab 940*7c478bd9Sstevel@tonic-gate * 941*7c478bd9Sstevel@tonic-gate * Parameters: 942*7c478bd9Sstevel@tonic-gate * char *path - The path for the dfstab entry 943*7c478bd9Sstevel@tonic-gate * char *fstype - The filesystem type for the share 944*7c478bd9Sstevel@tonic-gate * char *options - The share options to be used for the dfstab entry 945*7c478bd9Sstevel@tonic-gate * char *description - The description for the share 946*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 947*7c478bd9Sstevel@tonic-gate * return from the function 948*7c478bd9Sstevel@tonic-gate * 949*7c478bd9Sstevel@tonic-gate * Return: 950*7c478bd9Sstevel@tonic-gate * Returns a pointer to the begining of the dfstab entry list 951*7c478bd9Sstevel@tonic-gate * Failure returns NULL 952*7c478bd9Sstevel@tonic-gate */ 953*7c478bd9Sstevel@tonic-gate fs_dfstab_entry_t fs_set_DFStab_ent(char *, char *, char *, char *, int *); 954*7c478bd9Sstevel@tonic-gate 955*7c478bd9Sstevel@tonic-gate /* 956*7c478bd9Sstevel@tonic-gate * NOTE: the caller of this function is responsible for freeing any 957*7c478bd9Sstevel@tonic-gate * memory allocated by calling fs_free_DFStab_ents() 958*7c478bd9Sstevel@tonic-gate * 959*7c478bd9Sstevel@tonic-gate * Method: fs_del_All_DFStab_ents_with_Path 960*7c478bd9Sstevel@tonic-gate * 961*7c478bd9Sstevel@tonic-gate * Description: Removes all dfstab entries with the specified path. 962*7c478bd9Sstevel@tonic-gate * 963*7c478bd9Sstevel@tonic-gate * Parameters: 964*7c478bd9Sstevel@tonic-gate * char *path - The path to checked for removal from dfstab. 965*7c478bd9Sstevel@tonic-gate * int *err - error pointer. 966*7c478bd9Sstevel@tonic-gate * 967*7c478bd9Sstevel@tonic-gate * Return: returns a pointer to the nfs list of dfstab entries. 968*7c478bd9Sstevel@tonic-gate */ 969*7c478bd9Sstevel@tonic-gate fs_dfstab_entry_t fs_del_All_DFStab_ents_with_Path(char *, int *); 970*7c478bd9Sstevel@tonic-gate 971*7c478bd9Sstevel@tonic-gate /* 972*7c478bd9Sstevel@tonic-gate * Debuging functions 973*7c478bd9Sstevel@tonic-gate */ 974*7c478bd9Sstevel@tonic-gate void fs_print_dfstab_entries(fs_dfstab_entry_t); 975*7c478bd9Sstevel@tonic-gate 976*7c478bd9Sstevel@tonic-gate /* 977*7c478bd9Sstevel@tonic-gate * NFS mount interface method declarations 978*7c478bd9Sstevel@tonic-gate */ 979*7c478bd9Sstevel@tonic-gate /* 980*7c478bd9Sstevel@tonic-gate * Method: nfs_free_mntinfo_list 981*7c478bd9Sstevel@tonic-gate * 982*7c478bd9Sstevel@tonic-gate * Description: Used to free the network id list, which is an array of strings. 983*7c478bd9Sstevel@tonic-gate * 984*7c478bd9Sstevel@tonic-gate * Parameters: 985*7c478bd9Sstevel@tonic-gate * nfs_mntlist_t *mountinfo_list - The list of mounts and associated mount 986*7c478bd9Sstevel@tonic-gate * information 987*7c478bd9Sstevel@tonic-gate * 988*7c478bd9Sstevel@tonic-gate */ 989*7c478bd9Sstevel@tonic-gate void nfs_free_mntinfo_list(nfs_mntlist_t *); 990*7c478bd9Sstevel@tonic-gate 991*7c478bd9Sstevel@tonic-gate /* 992*7c478bd9Sstevel@tonic-gate * NOTE: the caller of this function is responsible for freeing any 993*7c478bd9Sstevel@tonic-gate * memory allocated by calling nfs_free_mntinfo_list() 994*7c478bd9Sstevel@tonic-gate * 995*7c478bd9Sstevel@tonic-gate * Method: nfs_get_filtered_mount_list 996*7c478bd9Sstevel@tonic-gate * 997*7c478bd9Sstevel@tonic-gate * Description: Can be used to filter nfs mounts only by the following mount 998*7c478bd9Sstevel@tonic-gate * attributes or a mixture of them: 999*7c478bd9Sstevel@tonic-gate * 1.) resource 1000*7c478bd9Sstevel@tonic-gate * 2.) mount point 1001*7c478bd9Sstevel@tonic-gate * 3.) mount option string 1002*7c478bd9Sstevel@tonic-gate * 4.) time mounted 1003*7c478bd9Sstevel@tonic-gate * 1004*7c478bd9Sstevel@tonic-gate * NULL must be passed into the options that are not being used in the filter. 1005*7c478bd9Sstevel@tonic-gate * 1006*7c478bd9Sstevel@tonic-gate * Parameters: 1007*7c478bd9Sstevel@tonic-gate * char *resource - The name of the resource to be mounted 1008*7c478bd9Sstevel@tonic-gate * char *mountp - The pathname of the directory on which the filesystem 1009*7c478bd9Sstevel@tonic-gate * is mounted 1010*7c478bd9Sstevel@tonic-gate * char *mntopts - The mount options 1011*7c478bd9Sstevel@tonic-gate * char *time - The time at which the filesystem was mounted 1012*7c478bd9Sstevel@tonic-gate * boolean_t find_overlays - Flag used to turn on overlay checking 1013*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 1014*7c478bd9Sstevel@tonic-gate * return from the function 1015*7c478bd9Sstevel@tonic-gate * 1016*7c478bd9Sstevel@tonic-gate * Return: 1017*7c478bd9Sstevel@tonic-gate * nfs_mntlist_t * - Returns a list of nfs mounts based on the 1018*7c478bd9Sstevel@tonic-gate * parameters passed in. 1019*7c478bd9Sstevel@tonic-gate */ 1020*7c478bd9Sstevel@tonic-gate nfs_mntlist_t *nfs_get_filtered_mount_list(char *resource, char *mountp, 1021*7c478bd9Sstevel@tonic-gate char *mntopts, char *time, boolean_t find_overlays, 1022*7c478bd9Sstevel@tonic-gate int *errp); 1023*7c478bd9Sstevel@tonic-gate 1024*7c478bd9Sstevel@tonic-gate /* 1025*7c478bd9Sstevel@tonic-gate * NOTE: the caller of this function is responsible for freeing any 1026*7c478bd9Sstevel@tonic-gate * memory allocated by calling nfs_free_mntinfo_list() 1027*7c478bd9Sstevel@tonic-gate * 1028*7c478bd9Sstevel@tonic-gate * Method: nfs_get_mounts_by_mntopt 1029*7c478bd9Sstevel@tonic-gate * 1030*7c478bd9Sstevel@tonic-gate * Description: Can be used to filter mounts by the mount options attribute. 1031*7c478bd9Sstevel@tonic-gate * 1032*7c478bd9Sstevel@tonic-gate * Parameters: 1033*7c478bd9Sstevel@tonic-gate * char *mntopts - The mount options 1034*7c478bd9Sstevel@tonic-gate * boolean_t find_overlays - Flag used to turn on overlay checking 1035*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 1036*7c478bd9Sstevel@tonic-gate * return from the function 1037*7c478bd9Sstevel@tonic-gate * 1038*7c478bd9Sstevel@tonic-gate * Return: 1039*7c478bd9Sstevel@tonic-gate * nfs_mntlist_t * - Returns a list of nfs mounts based on the 1040*7c478bd9Sstevel@tonic-gate * parameters passed in. 1041*7c478bd9Sstevel@tonic-gate */ 1042*7c478bd9Sstevel@tonic-gate nfs_mntlist_t *nfs_get_mounts_by_mntopt(char *mntopt, boolean_t find_overlays, 1043*7c478bd9Sstevel@tonic-gate int *errp); 1044*7c478bd9Sstevel@tonic-gate 1045*7c478bd9Sstevel@tonic-gate /* 1046*7c478bd9Sstevel@tonic-gate * NOTE: the caller of this function is responsible for freeing any 1047*7c478bd9Sstevel@tonic-gate * memory allocated by calling nfs_free_mntinfo_list() 1048*7c478bd9Sstevel@tonic-gate * 1049*7c478bd9Sstevel@tonic-gate * Method: nfs_get_mount_list 1050*7c478bd9Sstevel@tonic-gate * 1051*7c478bd9Sstevel@tonic-gate * Description: Used to gather all NFS mounts and there associated 1052*7c478bd9Sstevel@tonic-gate * mount information. 1053*7c478bd9Sstevel@tonic-gate * 1054*7c478bd9Sstevel@tonic-gate * Parameters: 1055*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 1056*7c478bd9Sstevel@tonic-gate * return from the function 1057*7c478bd9Sstevel@tonic-gate * 1058*7c478bd9Sstevel@tonic-gate * Return: 1059*7c478bd9Sstevel@tonic-gate * nfs_mntlist_t * - Returns a list of all nfs mounts. 1060*7c478bd9Sstevel@tonic-gate */ 1061*7c478bd9Sstevel@tonic-gate nfs_mntlist_t *nfs_get_mount_list(int *); 1062*7c478bd9Sstevel@tonic-gate 1063*7c478bd9Sstevel@tonic-gate /* 1064*7c478bd9Sstevel@tonic-gate * Netconfig (/etc/netconfig) interface method declarations 1065*7c478bd9Sstevel@tonic-gate */ 1066*7c478bd9Sstevel@tonic-gate /* 1067*7c478bd9Sstevel@tonic-gate * Method: netcfg_free_networkid_list 1068*7c478bd9Sstevel@tonic-gate * 1069*7c478bd9Sstevel@tonic-gate * Description: Used to free the network id list, which is an array of strings. 1070*7c478bd9Sstevel@tonic-gate * 1071*7c478bd9Sstevel@tonic-gate * Parameters: 1072*7c478bd9Sstevel@tonic-gate * char **netlist - The array of strings containing the network id list 1073*7c478bd9Sstevel@tonic-gate * int num_elements - The number of elements in the network id list 1074*7c478bd9Sstevel@tonic-gate * 1075*7c478bd9Sstevel@tonic-gate */ 1076*7c478bd9Sstevel@tonic-gate void netcfg_free_networkid_list(char **netlist, int num_elements); 1077*7c478bd9Sstevel@tonic-gate 1078*7c478bd9Sstevel@tonic-gate /* 1079*7c478bd9Sstevel@tonic-gate * NOTE: the caller of this function is responsible for freeing any 1080*7c478bd9Sstevel@tonic-gate * memory allocated by calling netcfg_free_networkid_list() 1081*7c478bd9Sstevel@tonic-gate * 1082*7c478bd9Sstevel@tonic-gate * Method: netcfg_get_networkid_list 1083*7c478bd9Sstevel@tonic-gate * 1084*7c478bd9Sstevel@tonic-gate * Description: Used to create the network id list. 1085*7c478bd9Sstevel@tonic-gate * 1086*7c478bd9Sstevel@tonic-gate * Parameters: 1087*7c478bd9Sstevel@tonic-gate * int *num_elements - The number of elements in the network id list. 1088*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 1089*7c478bd9Sstevel@tonic-gate * return from the function 1090*7c478bd9Sstevel@tonic-gate * 1091*7c478bd9Sstevel@tonic-gate * Return: 1092*7c478bd9Sstevel@tonic-gate * char ** - Returns the netowk id list. 1093*7c478bd9Sstevel@tonic-gate */ 1094*7c478bd9Sstevel@tonic-gate char **netcfg_get_networkid_list(int *num_elements, int *errp); 1095*7c478bd9Sstevel@tonic-gate 1096*7c478bd9Sstevel@tonic-gate /* 1097*7c478bd9Sstevel@tonic-gate * nfssec (/etc/nfssec.conf) interface method declarations 1098*7c478bd9Sstevel@tonic-gate */ 1099*7c478bd9Sstevel@tonic-gate /* 1100*7c478bd9Sstevel@tonic-gate * Method: nfssec_free_secmode_list 1101*7c478bd9Sstevel@tonic-gate * 1102*7c478bd9Sstevel@tonic-gate * Description: Used to free the NFS security mode list. 1103*7c478bd9Sstevel@tonic-gate * 1104*7c478bd9Sstevel@tonic-gate * Parameters: 1105*7c478bd9Sstevel@tonic-gate * char **seclist - The array of strings containing the security mode list 1106*7c478bd9Sstevel@tonic-gate * int num_elements - The number of elements in the list 1107*7c478bd9Sstevel@tonic-gate * 1108*7c478bd9Sstevel@tonic-gate */ 1109*7c478bd9Sstevel@tonic-gate void nfssec_free_secmode_list(char **seclist, int num_elements); 1110*7c478bd9Sstevel@tonic-gate 1111*7c478bd9Sstevel@tonic-gate /* 1112*7c478bd9Sstevel@tonic-gate * Method: nfssec_get_default_secmode 1113*7c478bd9Sstevel@tonic-gate * 1114*7c478bd9Sstevel@tonic-gate * Description: Used to retrieve the default security mode 1115*7c478bd9Sstevel@tonic-gate * 1116*7c478bd9Sstevel@tonic-gate * Parameters: 1117*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 1118*7c478bd9Sstevel@tonic-gate * return from the function 1119*7c478bd9Sstevel@tonic-gate * 1120*7c478bd9Sstevel@tonic-gate * Return: 1121*7c478bd9Sstevel@tonic-gate * char * - Returns the name of the default security mode 1122*7c478bd9Sstevel@tonic-gate */ 1123*7c478bd9Sstevel@tonic-gate char *nfssec_get_default_secmode(int *errp); 1124*7c478bd9Sstevel@tonic-gate 1125*7c478bd9Sstevel@tonic-gate /* 1126*7c478bd9Sstevel@tonic-gate * NOTE: the caller of this function is responsible for freeing any 1127*7c478bd9Sstevel@tonic-gate * memory allocated by calling nfssec_free_secmode_list() 1128*7c478bd9Sstevel@tonic-gate * 1129*7c478bd9Sstevel@tonic-gate * Method: nfssec_get_nfs_secmode_list 1130*7c478bd9Sstevel@tonic-gate * 1131*7c478bd9Sstevel@tonic-gate * Description: Used to create the NFS security mode list. 1132*7c478bd9Sstevel@tonic-gate * 1133*7c478bd9Sstevel@tonic-gate * Parameters: 1134*7c478bd9Sstevel@tonic-gate * int *num_elements - The number of elements in the security mode list 1135*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 1136*7c478bd9Sstevel@tonic-gate * return from the function 1137*7c478bd9Sstevel@tonic-gate * 1138*7c478bd9Sstevel@tonic-gate * Return: 1139*7c478bd9Sstevel@tonic-gate * char ** - Returns the NFS security mode list 1140*7c478bd9Sstevel@tonic-gate * 1141*7c478bd9Sstevel@tonic-gate */ 1142*7c478bd9Sstevel@tonic-gate char **nfssec_get_nfs_secmode_list(int *num_elements, int *errp); 1143*7c478bd9Sstevel@tonic-gate 1144*7c478bd9Sstevel@tonic-gate /* 1145*7c478bd9Sstevel@tonic-gate * System information interface method declarations 1146*7c478bd9Sstevel@tonic-gate */ 1147*7c478bd9Sstevel@tonic-gate /* 1148*7c478bd9Sstevel@tonic-gate * Method: sys_get_hostname 1149*7c478bd9Sstevel@tonic-gate * 1150*7c478bd9Sstevel@tonic-gate * Description: Used to retrieve the name of the host 1151*7c478bd9Sstevel@tonic-gate * 1152*7c478bd9Sstevel@tonic-gate * Parameters: 1153*7c478bd9Sstevel@tonic-gate * int *errp - error pointer - If an error occurs this will be non-zero upon 1154*7c478bd9Sstevel@tonic-gate * return from the function 1155*7c478bd9Sstevel@tonic-gate * 1156*7c478bd9Sstevel@tonic-gate * Return: 1157*7c478bd9Sstevel@tonic-gate * char * - Returns the name of the host system 1158*7c478bd9Sstevel@tonic-gate */ 1159*7c478bd9Sstevel@tonic-gate char *sys_get_hostname(int *errp); 1160*7c478bd9Sstevel@tonic-gate 1161*7c478bd9Sstevel@tonic-gate 1162*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1163*7c478bd9Sstevel@tonic-gate } 1164*7c478bd9Sstevel@tonic-gate #endif 1165*7c478bd9Sstevel@tonic-gate 1166*7c478bd9Sstevel@tonic-gate #endif /* _LIBFSMGT_H */ 1167