statfs.c revision 9acbbeaf2a1ffe5c14b244867d427714fab43c5c
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <assert.h>
#include <errno.h>
#include <libintl.h>
#include <string.h>
#include <strings.h>
#include <sys/lx_debug.h>
#include <sys/lx_statfs.h>
/*
* these defines must exist before we include regexp.h, see regexp(5)
*/
#define RE_SIZE 1024
#define ERROR(c) return ((char *)c);
/*
* for regular expressions we're using regexp(5).
*
* we'd really prefer to use some other nicer regular expressions
* interfaces (like regcmp(3c), regcomp(3c), or re_comp(3c)) but we
* can't because all these other interfaces rely on the ability
* to allocate memory via libc malloc()/calloc() calls, which
* we can't really do here.
*
* we could optionally use regexpr(3gen) but we don't since the
* interfaces there are incredibly similar to the regexp(5)
* interfaces we're already using and we'd have the added
* requirement of linking against libgen.
*
* another option that was considered is fnmatch(3c) but the
* limited pattern expansion capability of this interface would
* force us to include more patterns to check against.
*/
#include <regexp.h>
static struct lx_ftype_path {
char *lfp_path;
int lfp_magic;
char *lfp_magic_str;
} ftype_path_list[] = {
LX_DEVPTS_SUPER_MAGIC, "LX_DEVPTS_SUPER_MAGIC" },
LX_DEVPTS_SUPER_MAGIC, "LX_DEVPTS_SUPER_MAGIC" },
LX_DEVPTS_SUPER_MAGIC, "LX_DEVPTS_SUPER_MAGIC" },
{ NULL, "",
0, NULL }
};
/*
* For lack of linux equivalents, we present lofs and zfs as being ufs.
*/
static struct lx_ftype_name {
const char *lfn_name;
int lfn_magic;
char *lfn_magic_str;
} ftype_name_list[] = {
};
int
{
int i;
char *rv;
continue;
lx_debug("lx_statfs_init compile(\"%s\") failed",
ftype_path_list[i].lfp_path);
return (1);
}
return (0);
}
static int
{
int i;
char userpath[MAXPATHLEN];
return (-errno);
continue;
/* got a match on the fs path */
lx_debug("\ttranslated f_type to 0x%x - %s",
return (ftype_path_list[i].lfp_magic);
}
}
/* got a match on the fs name */
lx_debug("\ttranslated f_type to 0x%x - %s",
return (ftype_name_list[i].lfn_magic);
}
}
/* we don't know what the fs type is so just set it to 0 */
return (0);
}
/*
* The Linux statfs() is similar to the Solaris statvfs() call, the main
* difference being the use of a numeric 'f_type' identifier instead of the
* 'f_basetype' string.
*/
static int
{
int type;
return (type);
return (0);
}
static int
{
int type;
return (type);
return (0);
}
int
{
int err;
return (-errno);
return (err);
return (-errno);
return (0);
}
int
{
int err;
return (-errno);
return (err);
return (-errno);
return (0);
}
/* ARGSUSED */
int
{
int err;
return (-errno);
return (err);
return (-errno);
return (0);
}
/* ARGSUSED */
int
{
int err;
return (-errno);
return (err);
return (-errno);
return (0);
}