/*
* 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 <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <ctype.h>
#include <string.h>
#include <strings.h>
#include <thread.h>
#include <synch.h>
#include "libfsmgt.h"
/*
* Private datastructures.
*/
typedef struct dfstab_entry {
char *path;
char *resource;
char *fstype;
char *options;
char *description;
/*
* Private functions
*/
static dfstab_entry_t *get_dfstab_ents(int *);
static void free_dfstab_list(dfstab_entry_t *);
static dfstab_entry_t *dfstab_line_to_dfstab_entry(char *, int *);
static char *create_share_cmd(dfstab_entry_t *, char *, int *);
dfstab_entry_t *, int *);
static void add_entry_to_dfstab(dfstab_entry_t *, int *);
static dfstab_entry_t *
{
*err = 0;
char *share_cmd;
(void) mutex_lock(&dfstab_lock);
while ((share_cmd =
if ((dfstablist =
NULL) {
} else {
}
} else {
break;
}
}
}
(void) mutex_unlock(&dfstab_lock);
} else {
}
return (headptr);
} /* get_dfstab_ents */
static void
{
char *share_cmd;
(void) mutex_lock(&dfstab_lock);
(void) mutex_unlock(&dfstab_lock);
} else {
}
} else {
}
} /* add_entry_to_dfstab */
static void
{
}
}
}
}
}
}
} /* free_dfstab_list */
static char *
{
return (NULL);
}
}
}
if (new_entry->description) {
}
}
return (ret_val);
} /* create_share_cmd */
/*
* dfstab_line_to_dfstab_entry - parses a line from dfstab and fills in
* the fields of a dfstab_entry_t structure
* Parameters:
* char *cmd - the share command or dfstab line to be parsed
* int *err - a pointer for returning any error codes encountered
*/
static dfstab_entry_t *
{
extern char *optarg;
extern int optind;
int c, argcount = 0;
char *temp_str;
c = 0;
optind = 1;
return (NULL);
}
}
argcount--;
sizeof (dfstab_entry_t));
if (dfstablist == NULL) {
return (NULL);
}
switch (c) {
case 'F':
/* file system type */
/* at most one -F */
return (NULL);
}
break;
case 'd': /* description */
/* at most one -d */
return (NULL);
}
break;
case 'o': /* fs specific options */
/* at most one - o */
return (NULL);
}
break;
case '?':
*err = 1;
break;
}
}
return (NULL);
}
(void) mutex_lock(&dfstab_lock);
(void) mutex_unlock(&dfstab_lock);
}
return (NULL);
}
return (dfstablist);
} /* dfstab_line_to_dfstab_entry */
static dfstab_entry_t *
int *err)
{
int line_found = 0;
char *share_cmd;
int count = 0;
(void) mutex_lock(&dfstab_lock);
if ((share_cmd =
line_found = 0;
break;
}
continue;
}
if ((temp_list =
NULL) {
break;
}
line_found = 1;
err)) {
line_found = 0;
break;
}
}
} else {
line_found = 0;
break;
}
}
}
int i;
for (i = 0; i < count; i++) {
}
(void) mutex_unlock(&dfstab_lock);
} else {
(void) mutex_unlock(&dfstab_lock);
}
} else {
(void) mutex_unlock(&dfstab_lock);
if (temp_dfstab != NULL) {
}
}
} else {
}
return (ret_val);
} /* change_dfstab_ent */
/*
* Public accessor functions.
*/
/*
* fs_add_DFStab_ent - adds an entry to dfstab and to the list of dfstab
* entries. Returns a pointer to the head of the dfstab entry list.
* Parameters:
* char *cmd - the same command to be added to dstab
* int *err - an error pointer for retruning any errors
*/
{
if (dfstab_ent == NULL) {
return (NULL);
}
if (*err != 0) {
return (NULL);
}
return (get_dfstab_ents(err));
}
/*
* set_DFStab_ent - adds an entry to dfstab and to the list of dfstab entries.
* returns a pointer to the head of the dfstab entry list.
*/
char *path,
char *fstype,
char *options,
char *description,
int *err)
{
sizeof (dfstab_entry_t));
return (NULL);
}
} else {
return (NULL);
}
} else {
/* change this to error handler */
DFSTYPES);
return (NULL);
}
(void) mutex_lock(&dfstab_lock);
(void) mutex_unlock(&dfstab_lock);
}
}
if (description != NULL) {
}
if (*err != 0) {
return (NULL);
}
return (get_dfstab_ents(err));
} /* set_DFStab_ent */
/*
* Accessor function for path element of dfstab entry.
*/
char *
{
return (NULL);
}
} /* get_DFStab_ent_Path */
/*
* Accessor function for fstype element of dfstab entry.
*/
char *
{
return (NULL);
}
}
/*
* Accessor function for options element of dfstab entry.
*/
char *
{
return (NULL);
}
}
/*
* Accessor function for description element of dfstab entry.
*/
char *
{
return (NULL);
}
return (entryptr->description);
}
/*
* Accessor function for resource element of dfstab entry.
*/
char *
{
return (NULL);
}
}
/*
* Calls get_dfstab_ents to create the list of dfstab
* entries and returns that list.
*/
{
return (list);
}
/*
* Retrives and returns the next entry in the list.
*/
{
return (NULL);
}
}
/*
* Retrives and returns a share command based on the dfstab entry passed in.
*/
char *
{
char *share_cmd;
if (dfstab_ent == NULL) {
return (NULL);
}
return (share_cmd);
} /* fs_get_Dfstab_share_cmd */
/*
* edit_DFStab_ent - changes an entry in dfstab.
*/
{
if ((old_dfstabent =
return (NULL);
}
if ((new_dfstabent =
return (NULL);
}
if ((ret_val =
return (NULL);
}
return (ret_val);
}
/*
* del_DFStab_ent - deletes an entry in dfstab.
*/
{
if ((del_dfstabent =
return (NULL);
}
if ((ret_val =
return (NULL);
}
return (ret_val);
}
/*
* del_All_DFStab_ents_with_Path - deletes all duplicate entries with
* the specified path.
*/
{
}
} else {
}
} else {
}
return (ret_val);
}
int
{
int count = 0;
*err = 0;
count = -1;
}
if (dfstablist != NULL) {
while (dfstablist != NULL) {
count++;
}
}
} else {
if (err != 0)
else
count = 0;
}
return (count);
}
void
{
}
/*
* used for debugging only
*/
void
{
printf(" description: %s",
printf(" options: %s",
printf(" shared path is: %s\n",
}
}