summaryrefslogtreecommitdiff
path: root/udevruler.c
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2004-03-31 23:12:57 -0800
committerGreg KH <gregkh@suse.de>2005-04-26 21:35:13 -0700
commitbbbe503ec1a5623a5a8abd003f46fdd8c3581054 (patch)
tree96d4b8b9c48c22578234454feceb4ba1a44c9dc5 /udevruler.c
parente5a2989efbae81f40b60885a8f92ea1f87df7ea9 (diff)
[PATCH] netdev - udevdb+dev.d changes
Here is a patch to change the netdev handling in the database and for the dev.d/ calls. I applies on top of the udevd.patch, cause klibc has no sysinfo(). o netdev's are also put into our database now. I want this for the udevruler gui to get a list of all handled devices. All devices in the db are stamped with the system uptime value at the creation time. 'udevinfo -d' prints it. o the DEVPATH value is the key for udevdb, but if we rename a netdev, the name is replaced in the kernel, so we add the changed name to the db to match with the remove event. NOTE: The dev.d/ scripts still get the original name from the hotplug call. Should we replace DEVPATH with the new name too? o We now only add a device to the db, if we have successfully created the main node or successfully renamed a netdev. This is the main part of the patch, cause I needed to clean the retval passing trough all the functions used for node creation. o DEVNODE sounds a bit ugly for netdev's so I exported DEVNAME too. Can we change the name? o I've added a UDEV_NO_DEVD to possibly skip the script execution and used it in udev-test.pl. udevstart is the same horror now, if you have scripts with logging statements in dev.d/ it takes minutes to finish, can we skip the scripts here too? o The get_device_type() function is changed to be more strict, cause 'udevinfo -a -p /block/' gets a class device for it and tries to print the major/minor values. o bugfix, the RESULT value has now a working newline removal and a test for this case.
Diffstat (limited to 'udevruler.c')
-rw-r--r--udevruler.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/udevruler.c b/udevruler.c
index af2cf7bb81..a13bd625a8 100644
--- a/udevruler.c
+++ b/udevruler.c
@@ -77,7 +77,7 @@ struct device {
char devpath[DEVPATH_SIZE];
int config_line;
char config_file[NAME_SIZE];
- time_t config_time;
+ long config_uptime;
int added;
};
@@ -106,7 +106,7 @@ static int add_record(char *path, struct udevice *udev)
strfieldcpy(dev->devpath, path);
dev->config_line = udev->config_line;
strfieldcpy(dev->config_file, udev->config_file);
- dev->config_time = udev->config_time;
+ dev->config_uptime = udev->config_uptime;
dev->added = 0;
/* sort in lexical order */
@@ -308,7 +308,7 @@ int main(int argc, char *argv[]) {
char roottext[81];
char path[NAME_SIZE];
struct device *dev;
- time_t time_last;
+ long time_last;
int count_last;
newtInit();
@@ -332,13 +332,13 @@ int main(int argc, char *argv[]) {
/* look for last discovered device */
time_last = 0;
list_for_each_entry(dev, &device_list, list)
- if (dev->config_time > time_last)
- time_last = dev->config_time;
+ if (dev->config_uptime > time_last)
+ time_last = dev->config_uptime;
/* skip if more than 16 recent devices */
count_last = 0;
list_for_each_entry(dev, &device_list, list) {
- if (dev->config_time < time_last - 10)
+ if (dev->config_uptime < time_last - 10)
continue;
count_last++;
}
@@ -347,7 +347,7 @@ int main(int argc, char *argv[]) {
if (count_last < 16) {
newtListboxAppendEntry(lbox, "--- last dicovered ---", NULL);
list_for_each_entry(dev, &device_list, list) {
- if (dev->config_time < time_last - 10)
+ if (dev->config_uptime < time_last - 10)
continue;
dbg("%s %i", dev->name, dev->config_line);