udev_device_event.c revision aa8734ffcb8a895fc8d66ff383cbcf8f4b78f562
/*
* Copyright (C) 2004-2008 Kay Sievers <kay.sievers@vrfy.org>
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* 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, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <ctype.h>
#include <string.h>
#include "udev.h"
#include "udev_rules.h"
{
struct udev_event *event;
return NULL;
return event;
}
{
}
{
int klog;
FILE *f;
if (klog < 0)
return;
if (f == NULL) {
return;
}
fprintf(f, "<6>udev: renamed network interface %s to %s\n",
fclose(f);
}
{
int sk;
int err;
return 0;
if (sk < 0) {
return -1;
}
if (err == 0)
else {
int loop;
/* see if the destination interface name already exists */
goto exit;
}
/* free our own name, another process may wait for us */
if (err != 0) {
goto exit;
}
/* wait 30 seconds for our target to become available */
while (loop--) {
if (err == 0) {
break;
}
break;
}
}
}
exit:
return err;
}
{
int err = 0;
}
/* add device node */
(strcmp(udev_device_get_action(dev), "add") == 0 || strcmp(udev_device_get_action(dev), "change") == 0)) {
char filename[UTIL_PATH_SIZE];
struct udev_device *dev_old;
if (event->ignore_device) {
goto exit;
}
goto exit;
}
/* set device node name */
/* read current database entry; cleanup, if it is known device */
}
if (err != 0)
goto exit;
goto exit;
}
/* add netif */
if (strcmp(udev_device_get_subsystem(dev), "net") == 0 && strcmp(udev_device_get_action(dev), "add") == 0) {
if (event->ignore_device) {
goto exit;
}
goto exit;
}
/* look if we want to change the name of the netif */
char syspath[UTIL_PATH_SIZE];
char *pos;
if (err != 0)
goto exit;
/* remember old name */
/* now change the devpath, because the kernel device name has changed */
}
}
goto exit;
}
/* remove device node */
if (major(udev_device_get_devnum(dev)) != 0 && strcmp(udev_device_get_action(dev), "remove") == 0) {
/* import database entry and delete it */
char devnode[UTIL_PATH_SIZE];
}
if (event->ignore_device) {
goto exit;
}
if (udev_device_get_ignore_remove(dev)) {
goto exit;
}
goto exit;
}
/* default devices */
if (event->ignore_device)
exit:
return err;
}