vold_db.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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 (c) 1992 by Sun Microsystems, Inc.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdlib.h>
#include <errno.h>
#include <dlfcn.h>
#include "vold.h"
#include "db.h"
#define DB_ALLOC_CHUNK 10
static struct dbops *default_dbops;
static int ndbs = 0;
static int nallocdbs = 0;
/*
* Called from the database to add a new dbop into the list.
* The first valid database seen is the "default" database.
*/
void
{
int i, na;
/*
* return if we've already seen this guy.
*/
for (i = 0; i < ndbs; i++)
return;
if (dbsw == 0) {
sizeof (struct dbops *));
} else {
sizeof (struct dbops *));
for (i = 0; i < na; i++)
}
}
if (default_dbops == NULL)
default_dbops = dop;
}
/*
* Look through all the databases to see if there are any
* new things in the "dvn" directory.
*/
void
{
int i;
extern char *vold_config;
if (default_dbops == NULL) {
/*NOTREACHED*/
}
/*
* node_startupdate and node_endupdate will remember what was
* added, and remove extra stuff that wasn't found in the
* database.
*/
for (i = 0; i < ndbs; i++)
}
/*
* Ask the databases to setup root for us.
*/
void
db_root()
{
int i;
for (i = 0; i < ndbs; i++) {
return;
}
}
/*
* somebody lied about having core directories...
*/
node_setup();
}
}
/*
* Sync changes made to the object up with the database.
*/
{
}
}
/*
* Add a new object to the database. If uniq == TRUE,
* don't return an error for a name conflict, just fix
* it.
*/
{
}
}
/*
* Remove an object from the database.
*/
{
if (node_tmpobj(obj)) {
return (TRUE);
}
}
}
/*
* Look through the databases to see if we have this
* label anywhere.
*/
vol_t *
{
vol_t *v;
int i;
for (i = 0; i < ndbs; i++) {
if (v) {
return (v);
}
}
}
/*
* Look through the databases to see if anyone is using this key.
*/
{
int i;
for (i = 0; i < ndbs; i++) {
continue;
}
return (TRUE);
}
}
return (FALSE);
}
/*
* return how many databases are configured
*/
int
db_configured_cnt(void)
{
return (ndbs);
}