ndmpd_prop.c revision 1e05b03fa76ee89d509f0c461b36cb865f1e6794
/*
*/
/*
* BSD 3 Clause License
*
* Copyright (c) 2007, The Storage Networking Industry Association.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* distribution.
*
* - Neither the name of The Storage Networking Industry Association (SNIA)
* nor the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* NDMP configuration management
*/
#include <stdio.h>
#include <stdlib.h>
#include <synch.h>
#include <syslog.h>
#include <strings.h>
#include <ndmpd_prop.h>
#include <libndmp.h>
#include "ndmpd.h"
typedef struct ndmpd_cfg_param {
char *sc_name;
char *sc_defval;
char *sc_value;
/*
* IMPORTANT: any changes to the order of this table's entries
* need to be reflected in the enum ndmpd_cfg_id_t.
*/
{
};
/*
* Loads all the NDMP configuration parameters and sets up the
* config table.
*/
int
ndmpd_load_prop(void)
{
char *value;
continue;
}
/*
* enval == 0 could mean two things, either the
* config param is not defined, or it has been
* removed. If the variable has already been defined
* and now enval is 0, it should be removed, otherwise
* we don't need to do anything in this case.
*/
return (-1);
}
}
}
return (0);
}
/*
* ndmpd_config_update
*
* Updates the specified config param with the given value.
* This function is called both on (re)load and set.
*/
static int
{
char *curval;
int rc = 0;
int len;
if (value) {
} else {
}
if (curval) {
} else {
rc = -1;
}
}
return (rc);
}
/*
* Returns value of the specified config param.
* The return value is a string pointer to the locally
* allocated memory if the config param is defined
* otherwise it would be NULL.
*/
char *
{
char *env_val;
if (id < NDMP_MAXALL) {
return (env_val);
}
return (0);
}
/*
* Similar to ndmpd_get_prop except it will return dflt value
* if env is not set.
*/
char *
{
char *env;
return (env);
} else {
return (dflt);
}
}
/*
* Returns 1 is config is set to "yes", otherwise 0.
*/
int
{
char *val;
if (val) {
return (1);
}
return (0);
}