libsharecore.c revision 6185db853e024a486ff8837e6784dd290d866112
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * CDDL HEADER START
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * The contents of this file are subject to the terms of the
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * Common Development and Distribution License (the "License").
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * You may not use this file except in compliance with the License.
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * See the License for the specific language governing permissions
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * and limitations under the License.
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * When distributing Covered Code, include this CDDL HEADER in each
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * If applicable, add the following below this CDDL HEADER, with the
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * fields enclosed by brackets "[]" replaced with your own identifying
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * information: Portions Copyright [yyyy] [name of copyright owner]
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * CDDL HEADER END
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * Use is subject to license terms.
c533a883a71cff9ff32df1c53c31201e1cbf371fhx#pragma ident "%Z%%M% %I% %E% SMI"
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * core library for common functions across all config store types
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * and file systems to be exported. This includes legacy dfstab/sharetab
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * parsing. Need to eliminate XML where possible.
c533a883a71cff9ff32df1c53c31201e1cbf371fhx "# Do not modify this file directly.\n",
c533a883a71cff9ff32df1c53c31201e1cbf371fhx "# Use the sharemgr(1m) command for all share management\n",
c533a883a71cff9ff32df1c53c31201e1cbf371fhx "# This file is reconstructed and only maintained for backward\n",
c533a883a71cff9ff32df1c53c31201e1cbf371fhx "# compatibility. Configuration lines could be lost.\n",
c533a883a71cff9ff32df1c53c31201e1cbf371fhx#define STRNCAT(x, y, z) (xmlChar *)strncat((char *)x, (char *)y, z)
c533a883a71cff9ff32df1c53c31201e1cbf371fhx/* will be much smaller, but this handles bad syntax in the file */
c533a883a71cff9ff32df1c53c31201e1cbf371fhx/* used internally only */
43439c96b8398c01c375889c79bed72d78fb4c39hxextern char *get_token(char *);
43439c96b8398c01c375889c79bed72d78fb4c39hx/* prototypes */
43439c96b8398c01c375889c79bed72d78fb4c39hxextern sa_share_t _sa_add_share(sa_group_t, char *, int, int *);
c533a883a71cff9ff32df1c53c31201e1cbf371fhxextern int set_node_share(void *, char *, char *);
c533a883a71cff9ff32df1c53c31201e1cbf371fhxextern void set_node_attr(void *, char *, char *);
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * alloc_sharelist()
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * allocator function to return an zfs_sharelist_t
c533a883a71cff9ff32df1c53c31201e1cbf371fhx item = (xfs_sharelist_t *)malloc(sizeof (xfs_sharelist_t));
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * fix_notice(list)
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * Look at the beginning of the current /etc/dfs/dfstab file and add
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * the do not modify notice if it doesn't exist.
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * getdfstab(dfs)
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * Returns an zfs_sharelist_t list of lines from the dfstab file
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * pointed to by the FILE pointer dfs. Each entry is parsed and the
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * original line is also preserved. Used in parsing and updating the
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * dfstab file.
c533a883a71cff9ff32df1c53c31201e1cbf371fhx char buff[_POSIX_ARG_MAX]; /* reasonable size given syntax of share */
c533a883a71cff9ff32df1c53c31201e1cbf371fhx static int line = 0;
c533a883a71cff9ff32df1c53c31201e1cbf371fhx /* if no path, then comment */
argc = 0;
optind++;
char *resource;
char *optgroup;
return (first);
static xfs_sharelist_t *
return (item);
return (NULL);
static xfs_sharelist_t *
return (list);
static xfs_sharelist_t *
return (list);
static xfs_sharelist_t *
char *groupname;
return (list);
static FILE *
char *buff;
int grsize;
return (dfstab);
int err;
char *path;
return (ret);
char *path;
char *persist;
return (ret);
return (ret);
int ret = 0;
return (ret);
if (todfstab)
char *tag;
char *value1;
char *value2;
char *tag;
char *value1;
char *value2;
return (ret);
int err;
int defined_group;
char *oldprops;
defined_group = 0;
err = 0;
char *line;
char *error;
char *cmd;
int len;
&err);
char *path;
parse_sharetab(void)
int err = 0;
char *groupname;
int legacy = 0;
return (legacy);
return (legacy);
int legacy = 0;
return (legacy);
char *name;
int result = 0;
return (result);
update_legacy_config(void)
return (ret);
int err;
if (err < 0) {
return (NULL);
if (hier &&
return (NULL);
char *name;
char *value;
return (newoptionset);
if (hier &&
char *type;
char *sectype;
return (options);
if (hier &&
return (NULL);
char *name;
char *value;
return (newsecurity);
* makes use of the original sharetab.c from fs.d/nfs/lib
char *value;
char *buff;
char *zfs;
int len = 0;
char *path;
int logging = 0;
return (ret);
int logging = 0;
#ifdef lint
return (ret);