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