/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
*/
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <strings.h>
#include "libfsmgt.h"
/*
* Private variables
*/
/*
* Private method declarations
*/
char *mountp);
/*
* Public methods
*/
void
}
} /* fs_free_mount_list */
unsigned long long
unsigned long long availablesize;
*errp = 0;
/*
* Set errp to invalid parameter - EINVAL
*/
return (0);
}
} else {
return (0);
} /* if (statvfs64(mntpnt, &stvfs) != -1) */
return (availablesize);
} /* fs_get_availablesize */
unsigned long long
unsigned long long avail_for_nonsu_size;
*errp = 0;
/*
* Set errp to invalid parameter - EINVAL
*/
return (0);
}
} else {
return (0);
} /* if (statvfs64(mntpnt, &stvfs) != -1) */
return (avail_for_nonsu_size);
} /* fs_get_avail_for_nonsuperuser_size(char *mntpnt, int *errp) */
unsigned long long
unsigned long long blocksize;
*errp = 0;
/*
* Set errp to invalid parameter - EINVAL
*/
return (0);
}
} else {
return (0);
} /* if (statvfs64(mntpnt, &stvfs) != -1) */
return (blocksize);
} /* fs_get_blocksize */
*errp = 0;
if (search_entry == NULL) {
/*
* Out of memory
*/
return (NULL);
}
/* Add to list to be returned */
/*
* Out of memory
*/
return (NULL);
}
} else {
}
}
if (find_overlays == B_TRUE)
} else {
} /* if ((fp = fopen(MNTTAB, "r")) != NULL) */
return (headp);
} /* fs_get_filtered_mount_list */
unsigned long
unsigned long fragsize;
*errp = 0;
/*
* Set errp to invalid parameter - EINVAL
*/
return (0);
}
} else {
return (0);
} /* (statvfs64(mntpnt, &stvfs) != -1) */
return (fragsize);
} /* fs_get_fragsize(char *mntpnt, int *errp) */
unsigned long
long int returned_val;
unsigned long maxfilenamelen;
*errp = 0;
/*
* Set errp to invalid parameter - EINVAL
*/
return (0);
}
if (returned_val != -1) {
maxfilenamelen = (unsigned long)returned_val;
} else {
return (0);
}
return (maxfilenamelen);
} /* fs_get_maxfilenamelen */
*errp = 0;
return (NULL);
char *opt_found;
/*
* Add to list to be returned
*/
/*
* Out of memory
*/
return (NULL);
}
} else {
}
} /* if (char != NULL) */
}
if (find_overlays == B_TRUE)
} else {
} /* if ((fp = fopen(MNTTAB, "r")) != NULL) */
return (headp);
} /* fs_get_mounts_by_mntpnt */
*errp = 0;
/*
* getextmntent() Is used here so that we can use mnt_major
* and mnt_minor to get the fsid. The fsid is used when
* getting mount information from kstat.
*/
sizeof (struct extmnttab)) == 0) {
/*
* Out of memory
*/
return (NULL);
}
} else {
}
} /* while (getmntent(fp, &mnttab_entry) == 0) */
if (find_overlays)
} else {
} /* if ((fp = fopen(MNTTAB, "r")) != NULL) */
/*
* Caller must free the mount list
*/
return (headp);
} /* fs_get_mount_list */
*errp = 0;
/*
* Set errp to invalid parameter - EINVAL
*/
return (B_FALSE);
}
} else {
return (B_FALSE);
}
return (readonly);
} /* fs_is_readonly */
/*
* This method will parse the given comma delimited option list (optlist) for
* the option passed into the function. If the option (opt) to search for
* is one that sets a value such as onerror=, the value to the right of the "="
* character will be returned from the function. This function expects the
* opt parameter to have the "=" character appended when searching for options
* which set a value.
*
* If the option is found in the given optlist, the function will return the
* option as found in the option list.
* If the option is not found in the given optlist, the function will return
* NULL.
* If an error occurs, the function will return NULL and the errp will
* reflect the error that has occurred.
*
* NOTE: The caller must free the space allocated for the return value by using
* free().
*/
char *
char *token;
char *return_value;
char *optlist_copy;
*errp = 0;
if (optlist_copy == NULL) {
return (NULL);
}
/*
* Check to see if we have found the option.
*/
return (NULL);
return (return_value);
}
/*
* If token is NULL then then we are at the end of the list
* and we can return NULL because the option was never found in
* the option list.
*/
return (NULL);
} else if ((return_value =
return (return_value);
}
}
return (NULL);
}
unsigned long long
unsigned long long totalsize;
*errp = 0;
/*
* Set errp to invalid parameter - EINVAL
*/
return (0);
}
} else {
return (0);
} /* if (statvfs64(mntpnt, &stvfs) != -1) */
return (totalsize);
} /* fs_get_totalsize */
unsigned long long
unsigned long long usedsize;
*errp = 0;
/*
* Set errp to invalid parameter - EINVAL
*/
return (0);
}
} else {
return (0);
} /* if (statvfs64(mntpnt, &stvfs) != -1) */
return (usedsize);
} /* fs_get_usedsize */
/*
* Private methods
*/
static fs_mntlist_t *
(size_t)sizeof (fs_mntlist_t));
/*
* Out of memory
*/
return (NULL);
}
/*
* Out of memory
*/
return (NULL);
}
/*
* Out of memory
*/
return (NULL);
}
/*
* Out of memory
*/
return (NULL);
}
/*
* Out of memory
*/
return (NULL);
}
/*
* Out of memory
*/
return (NULL);
}
return (newp);
} /* create_mntlist_entry */
static fs_mntlist_t *
(size_t)sizeof (fs_mntlist_t));
/*
* Out of memory
*/
return (NULL);
}
/*
* Out of memory
*/
return (NULL);
}
/*
* Out of memory
*/
return (NULL);
}
/*
* Out of memory
*/
return (NULL);
}
/*
* Out of memory
*/
return (NULL);
}
/*
* Out of memory
*/
return (NULL);
}
return (newp);
} /* create_extmntlist_entry */
static struct mnttab *
char *time) {
if (search_entry == NULL) {
/*
* Out of memory
*/
return (NULL);
}
/*
* Out of memory
*/
return (NULL);
}
}
/*
* Out of memory
*/
return (NULL);
}
}
/*
* Out of memory
*/
return (NULL);
}
}
/*
* Out of memory
*/
return (NULL);
}
}
/*
* Out of memory
*/
return (NULL);
}
}
return (search_entry);
} /* create_mnttab_filter */
/*
* instances of overlayed file systems. We do this with the following
* assumptions:
*
* 1.) Entries in mnttab are ordered in the way that the most recent
* filed:
* 2.) Mnttab entries that are returned from all mnttab library
* functions such as getmntent, getextmntent, and getmntany in the order
* 3.) All automounted NFS file systems will have an autofs entry and
* entries can be ignored.
* 4.) The device id (dev=) uniquely identifies a mounted file system
* on a host.
*
* Algorithm explanation:
* ----------------------
* For each mnt_list entry
* where the mnt_list entry mount is and look for matching mount points,
* but ignore all "autofs" entries
* If a two entries are found with the same mount point mark the mnt_list
* entry as being overlayed.
*/
static void
*errp = 0;
if (filtered_list == B_TRUE) {
/*
* Get the complete mount list
*/
if (mnt_list_to_compare == NULL) {
/*
* If complete_mnt_list is NULL there are two
* possibilites:
* 2.) An error was encountered. errp will reflect
* the error.
*/
return;
}
} else {
}
char *dev_id;
"dev=", errp);
return;
}
char *tmp_dev_id;
if (tmp_dev_id == NULL) {
return;
}
/*
* Start searching for an
* overlay here.
*/
}
}
} /* while (tmp != NULL && exit == B_FALSE) */
} /* if (!(strcmp(mnt_list->fstype, "autofs") == 0)) */
} /* while (mnt_list != NULL) */
if (filtered_list == B_TRUE)
} /* find_overlayed_filesystems */
static void
} /* free_mnttab_entry */
char *
char *found_equalsign;
char *return_val;
*errp = 0;
/*
* If found_equalsign is NULL then we did not find an equal sign
* in the option we are to be looking for.
*/
if (found_equalsign == NULL) {
/*
* We have found the option so return with success.
*/
if (return_val == NULL) {
return (NULL);
}
} else {
return_val = NULL;
}
} else {
int counter = 0;
char *opt_found;
char *value;
return_val = NULL;
} else {
(size_t)sizeof (char));
/*
* Out of memory
*/
return (NULL);
}
}
/*
* Add the null terminating character.
*/
return_val = value;
}
} /* else */
return (return_val);
} /* is_option */
/*
* The first entry in the complete_mnt_list is the same mounted
* file system as the one we are trying to determine whether it is
* overlayed or not. There is no need to compare these mounts.
*/
} else {
}
}
}
return (ret_val);
} /* is_overlayed */