udevdb.c revision bbbe503ec1a5623a5a8abd003f46fdd8c3581054
/*
* udevdb.c - udev database library
*
* Userspace devfs
*
* Copyright (C) 2003 Greg Kroah-Hartman <greg@kroah.com>
* Copyright (C) 2003 IBM Corp.
*
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#define _KLIBC_HAS_ARCH_SIG_ATOMIC_T
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stddef.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include "libsysfs/sysfs/libsysfs.h"
#include "udev.h"
#include "udev_lib.h"
#include "udev_version.h"
#include "logging.h"
#include "namedev.h"
#include "udevdb.h"
static TDB_CONTEXT *udevdb;
{
char keystr[SYSFS_PATH_MAX];
return -ENODEV;
}
{
return -ENODEV;
return -ENODEV;
return 0;
}
int udevdb_delete_dev(const char *path)
{
char keystr[SYSFS_PATH_MAX];
return -EINVAL;
}
/**
* udevdb_exit: closes database
*/
void udevdb_exit(void)
{
}
}
/**
* udevdb_init: initializes database
* @init_flag: UDEVDB_INTERNAL - database stays in memory
* UDEVDB_DEFAULT - database is written to a file
*/
int udevdb_init(int init_flag)
{
return -EINVAL;
if (init_flag == UDEVDB_INTERNAL)
dbg("unable to initialize in-memory database");
else
return -EACCES;
}
return 0;
}
/**
* udevdb_open_ro: open database for reading
*/
int udevdb_open_ro(void)
{
return -EACCES;
}
return 0;
}
{
}
/**
* udevdb_call_foreach: dumps whole database by passing record data to user function
* @user_record_handler: user function called for every record in the database
*/
{
int retval = 0;
if (user_record_handler == NULL) {
dbg("invalid user record handling function");
return -EINVAL;
}
if (retval < 0)
return -ENODEV;
else
return 0;
}
static char *find_path;
static const char *find_name;
static int find_found;
{
char *pos;
int len;
find_found = 1;
/* stop search */
return 1;
}
/* look for matching symlink*/
continue;
continue;
find_found = 1;
return 1;
}
return 0;
}
/**
* udevdb_get_dev_byname: search device with given name by traversing the whole database
*/
{
find_found = 0;
if (find_found == 1)
return 0;
else
return -1;
}