udev_start.c revision f22e9686fd4f8e602e8dc11a4b06765206f26edf
/*
*
* 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 <errno.h>
#include <ctype.h>
#include <dirent.h>
#include <unistd.h>
#include "libsysfs/sysfs/libsysfs.h"
#include "logging.h"
#include "udev_utils.h"
#include "list.h"
#include "udev.h"
#define MAX_PATH_SIZE 512
struct device {
char path[MAX_PATH_SIZE];
char subsys[MAX_PATH_SIZE];
};
/* 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;
}
/* 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 */
}
}
{
char filename[MAX_PATH_SIZE];
return 1;
return 0;
}
static void udev_scan_block(void)
{
char base[MAX_PATH_SIZE];
char dirname[MAX_PATH_SIZE];
continue;
else
continue;
char dirname2[MAX_PATH_SIZE];
continue;
}
}
}
}
}
static void udev_scan_class(void)
{
char base[MAX_PATH_SIZE];
char dirname[MAX_PATH_SIZE];
continue;
char dirname2[MAX_PATH_SIZE];
continue;
/* pass the net class as it is */
}
}
}
}
}
int udev_start(void)
{
/* set environment for callouts and dev.d/ */
return 0;
}