/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <unistd.h>
#include <libintl.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <syslog.h>
#include <alloca.h>
#include <zone.h>
#include <signal.h>
#include <strings.h>
#include "fslib.h"
/* LINTLIBRARY */
/*
* Reads all of the entries from the in-kernel mnttab, and returns the
* linked list of the entries.
*/
fsgetmntlist(void)
{
return (NULL);
}
return (mntl);
}
struct extmnttab *
{
goto alloc_failed;
/*
* Allocate an extra byte for the mountpoint
* name in case a space needs to be added.
*/
goto alloc_failed;
goto alloc_failed;
goto alloc_failed;
goto alloc_failed;
goto alloc_failed;
return (new);
return (NULL);
}
/*
* Free a single mnttab structure
*/
void
{
if (mnt) {
if (mnt->mnt_special)
if (mnt->mnt_mountp)
if (mnt->mnt_fstype)
if (mnt->mnt_mntopts)
}
}
void
{
while (mntl) {
}
}
/*
* Read the mnttab file and return it as a list of mnttab structs.
* Returns NULL if there was a memory failure.
*/
{
int ret;
!= -1) {
if (ret != 0) /* bad entry */
continue;
goto alloc_failed;
else
mp->mntl_flags = 0;
goto alloc_failed;
}
return (mhead);
return (NULL);
}
/*
* Return the last entry that matches mntin's special
* Helps to be robust here, so we check for NULL pointers.
*/
{
/*
* match if and only if both are equal.
*/
mntin->mnt_mountp) == 0) &&
mntin->mnt_special) == 0))
} else if (mntin->mnt_mountp) {
mntin->mnt_mountp) == 0)
} else if (mntin->mnt_special) {
mntin->mnt_special) == 0)
}
}
return (delete);
}
/*
* Returns the mountlevel of the pathname in cp. As examples,
* / => 1, /bin => 2, /bin/ => 2, ////bin////ls => 3, sdf => 0, etc...
*/
int
{
int mlevel;
char *cp1;
return (0); /* this should never happen */
mlevel++;
return (mlevel);
}
/*
* Returns non-zero if string s is a member of the strings in ps.
*/
int
{
const char *cp;
while (cp) {
return (1);
ps++;
}
return (0);
}
static char *empty_opt_vector[] = {
};
/*
* Compare the mount options that were requested by the caller to
* the options actually supported by the file system. If any requested
* options are not supported, print a warning message.
*
* WARNING: this function modifies the string pointed to by
* the requested_opts argument.
*
* Arguments:
* requested_opts - the string containing the requested options.
* actual_opts - the string returned by mount(2), which lists the
* options actually supported. It is normal for this
* string to contain more options than the requested options.
* (The actual options may contain the default options, which
* may not have been included in the requested options.)
* special - device being mounted (only used in error messages).
* mountp - mount point (only used in error messages).
*/
void
{
int found;
if (requested_opts == NULL)
return;
while (*requested_opts != '\0') {
&option_ptr);
/*
* Truncate any "=<value>" string from the end of
* the option.
*/
*equalptr = '\0';
if (*option_ptr == '\0')
continue;
/*
* Whilst we don't need this option to perform a lofi
* mount, let's not be mendacious enough to complain
* about it.
*/
continue;
/*
* Search for the requested option in the list of options
* actually supported.
*/
found = 0;
/*
* Need to use a copy of actual_opts because getsubopt
* is destructive and we need to scan the actual_opts
* string more than once.
*
* We also need to reset actual_opt_hold to the
* beginning of the buffer because getsubopt changes
* actual_opt_hold (the pointer).
*/
if (actual_opts != NULL)
else
*actual_opt_hold = '\0';
while (*actual_opt_hold != '\0') {
&actopt);
/* Truncate the "=<value>", if any. */
*equalptr = '\0';
found = 1;
break;
}
}
if (found == 0) {
/*
* That we're ignoring the option is always
* truthful; the old message that the option
* was unknown is often not correct.
*/
"mount: %s on %s - WARNING ignoring option "
}
}
}
/*
* FUNCTION: fsgetmaxphys(int *, int *)
*
* INPUT: int *maxphys - a pointer to an integer that will hold
* the value for the system maxphys value.
* int *error - 0 means completed successfully
* otherwise this indicates the errno value.
*
* RETURNS: int - 0 if maxphys not found
* - 1 if maxphys is found
*/
int
int gotit = 0;
*error = 0;
/*
* For some reason cannot open root as read only. Need a valid file
* descriptor to call the ufs private ioctl. If this open failes,
* just assume we cannot get maxphys in this case.
*/
if (fp == -1) {
return (gotit);
}
return (gotit);
}
gotit = 1;
return (gotit);
}
/*
* The below is limited support for zone-aware commands.
*/
struct zone_summary {
};
struct zone_summary *
fs_get_zone_summaries(void)
{
uint_t i, j;
for (;;) {
perror("unable to retrieve list of zones");
return (NULL);
}
if (numzones <= oldnumzones)
break;
perror("malloc failed");
return (NULL);
}
}
perror("malloc failed");
return (NULL);
}
for (i = 0, j = 0; i < numzones; i++) {
continue;
if (len < 0) {
/*
* Zone must have gone away. Skip.
*/
continue;
}
/*
* Adding a trailing '/' to the zone's rootpath allows us to
* use strncmp() to see if a given path resides within that
* zone.
*
*/
j++;
}
return (summaries);
}
static zoneid_t
{
uint_t i;
summaries[i].rootpathlen) == 0)
}
/*
* (-1) is the special token we return to the caller if the mount
* wasn't found in any other mounts on the system. This means it's
* only visible to our zone.
*
* Odd choice of constant, I know, but it beats calling getzoneid() a
* million times.
*/
return (-1);
}
{
}
/*
* List of standard options.
*/
static const char *stdopts[] = {
};
static int
{
int i;
for (i = 0; i < NSTDOPT; i++) {
return (i);
}
return (-1);
}
/*
* INPUT: filesystem option not recognized by the fs specific option
* parsing code.
* OUTPUT: True if and only if the option is one of the standard VFS
* layer options.
*/
{
}