udevadm-test.c revision 17fcfb5972977b6a3aedca6ad2aa8d1fbfbc761d
/*
* Copyright (C) 2003-2004 Greg Kroah-Hartman <greg@kroah.com>
* 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 <string.h>
#include <stdio.h>
#include <stddef.h>
#include <unistd.h>
#include <errno.h>
#include <ctype.h>
#include <fcntl.h>
#include <signal.h>
#include <syslog.h>
#include <getopt.h>
#include "udev.h"
#include "udev_rules.h"
{
char path[UTIL_PATH_SIZE];
int fd;
char *key;
char *next;
int rc = -1;
/* read uevent file */
if (fd < 0)
goto out;
if (size < 0)
goto out;
/* import keys into environment */
while (key[0] != '\0') {
goto out;
next[0] = '\0';
}
rc = 0;
out:
return rc;
}
{
int force = 0;
const char *action = "add";
struct sysfs_device *dev;
struct udev_rules rules = {};
int retval;
int rc = 0;
{}
};
/* export log priority to executed programs */
if (udev_get_log_priority(udev) > 0) {
char priority[32];
}
while (1) {
int option;
if (option == -1)
break;
switch (option) {
case 'a':
break;
case 's':
break;
case 'f':
force = 1;
break;
case 'h':
printf("Usage: udevadm test OPTIONS <devpath>\n"
" --action=<string> set action string\n"
" --subsystem=<string> set subsystem string\n"
" --help print this help text\n\n");
exit(0);
default:
exit(1);
}
}
rc = 1;
goto exit;
}
printf("This program is for debugging only, it does not run any program,\n"
"specified by a RUN key. It may show incorrect results, because\n"
"some values may be different, or not available at a simulation run.\n"
"\n");
/* remove /sys if given */
rc = 2;
goto exit;
}
rc = 3;
goto exit;
}
/* override built-in sysfs device */
/* simulate node creation with test flag */
if (!force)
info(udev, "looking at device '%s' from subsystem '%s'\n", udevice->dev->devpath, udevice->dev->subsystem);
if (udevice->event_timeout >= 0)
struct name_entry *name_loop;
char program[UTIL_PATH_SIZE];
}
}
exit:
return rc;
}