udevstart.c revision 821d0ec803a72841f173739f5b713fe847edab75
/*
*
* Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
*
* Quick and dirty way to populate a /dev with udev if your system
* does not have access to a shell. Based originally on a patch to udev
* from Harald Hoyer <harald@redhat.com>
*
* 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.
*
*/
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <ctype.h>
#include <dirent.h>
#include <signal.h>
#include "libsysfs/sysfs/libsysfs.h"
#include "udev_libc_wrapper.h"
#include "udev.h"
#include "udev_version.h"
#include "logging.h"
#include "udev_rules.h"
#include "udev_utils.h"
#include "list.h"
#ifdef USE_LOG
{
if (priority > udev_log_priority)
return;
}
#endif
struct device {
};
/* sort files in lexical order */
{
struct device *loop_device;
struct device *new_device;
break;
}
}
if (new_device == NULL) {
dbg("error malloc");
return -ENOMEM;
}
return 0;
}
/* list of devices that we should run last due to any one of a number of reasons */
static char *last_list[] = {
NULL,
};
/* list of devices that we should run first due to any one of a number of reasons */
static char *first_list[] = {
NULL,
};
{
struct sysfs_class_device *class_dev;
const char *devpath;
/* set environment for callouts and dev.d/ */
dbg ("sysfs_open_class_device_path failed");
return -ENODEV;
}
struct name_entry *name_loop;
dbg("executing run list");
}
/* run dev.d/ scripts if we created a node or changed a netif name */
}
return 0;
}
{
struct device *loop_device;
struct device *tmp_device;
int i;
/* handle the "first" type devices first */
for (i = 0; first_list[i] != NULL; i++) {
break;
}
}
}
/* handle the devices we are allowed to, excluding the "last" type devices */
int found = 0;
found = 1;
break;
}
}
if (found)
continue;
}
/* handle the rest of the devices left over, if any */
}
}
{
return 1;
return 0;
}
static void udev_scan_block(void)
{
continue;
else
continue;
/* look for partitions */
continue;
}
}
}
}
}
static void udev_scan_class(void)
{
continue;
continue;
/* pass the net class as it is */
}
}
}
}
}
{
switch (signum) {
case SIGALRM:
exit(1);
case SIGINT:
case SIGTERM:
}
}
{
logging_init("udev");
/* disable all logging if not explicitely requested */
udev_log_priority = 0;
/* set signal handlers */
/* trigger timeout to prevent hanging processes */
/* set environment for executed programs */
return 0;
}