zprop_common.c revision 7991292307fd1c555120800d965c4c6c4b304f3f
/*
* 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"
/*
* Common routines used by zfs and zpool property management.
*/
#include <sys/zfs_ioctl.h>
#include <sys/zfs_znode.h>
#include "zfs_prop.h"
#include "zfs_deleg.h"
#if defined(_KERNEL)
#else
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#endif
static zprop_desc_t *
{
if (type == ZFS_TYPE_POOL)
return (zpool_prop_get_table());
else
return (zfs_prop_get_table());
}
static int
{
if (type == ZFS_TYPE_POOL)
return (ZPOOL_NUM_PROPS);
else
return (ZFS_NUM_PROPS);
}
void
{
}
void
const char *colname)
{
}
void
{
}
void
const zprop_index_t *idx_tbl)
{
}
void
{
}
/*
* A comparison function we can use to order indexes into property tables.
*/
static int
{
}
/*
* Iterate over all properties in the given property table, calling back
* into the specified function for each property. We will continue to
* iterate until we either reach the end or the callback function returns
* something other than ZPROP_CONT.
*/
int
{
#if defined(_KERNEL)
#else
return (ZPROP_CONT);
#endif
for (int j = 0; j < num_props; j++)
if (ordered) {
}
prop = ZPROP_CONT;
for (i = 0; i < num_props; i++) {
break;
}
}
#if defined(_KERNEL)
#else
#endif
return (prop);
}
static boolean_t
{
#ifndef _KERNEL
int c;
return (B_FALSE);
#endif
return (B_TRUE);
#ifndef _KERNEL
return (B_FALSE);
for (c = 0; c < len; c++)
break;
return (colname[c] == '\0');
#else
return (B_FALSE);
#endif
}
typedef struct name_to_prop_cb {
const char *propname;
static int
{
return (prop);
return (ZPROP_CONT);
}
int
{
int prop;
}
int
{
const zprop_index_t *idx_tbl;
int i;
return (-1);
return (-1);
return (0);
}
}
return (-1);
}
int
{
const zprop_index_t *idx_tbl;
int i;
return (-1);
return (-1);
return (0);
}
}
return (-1);
}
const char *
{
}
/*
* Returns TRUE if the property applies to any of the given dataset types.
*/
{
return (B_FALSE);
}
#ifndef _KERNEL
/*
* Determines the minimum width for the column, and indicates whether it's fixed
* or not. Only string columns are non-fixed.
*/
{
const zprop_index_t *idx;
int i;
/*
* Start with the width of the column name.
*/
/*
* For fixed-width values, make sure the width is large enough to hold
* any possible value.
*/
switch (pd->pd_proptype) {
case PROP_TYPE_NUMBER:
/*
* The maximum length of a human-readable number is 5 characters
* ("20.4M", for example).
*/
if (ret < 5)
ret = 5;
/*
* 'creation' is handled specially because it's a number
* internally, but displayed as a date string.
*/
if (prop == ZFS_PROP_CREATION)
break;
case PROP_TYPE_INDEX:
}
break;
case PROP_TYPE_STRING:
break;
}
return (ret);
}
#endif