Lines 70-81
static char *first_list[] = {
Link Here
|
70 |
LIST_HEAD(device_first_list); |
70 |
LIST_HEAD(device_first_list); |
71 |
LIST_HEAD(device_default_list); |
71 |
LIST_HEAD(device_default_list); |
72 |
LIST_HEAD(device_last_list); |
72 |
LIST_HEAD(device_last_list); |
|
|
73 |
LIST_HEAD(path_skip_list); |
73 |
|
74 |
|
74 |
static int device_list_insert(const char *path) |
75 |
static int device_list_insert(const char *path) |
75 |
{ |
76 |
{ |
76 |
struct list_head *device_list = &device_default_list; |
77 |
struct list_head *device_list = &device_default_list; |
77 |
const char *devpath = &path[strlen(sysfs_path)]; |
78 |
const char *devpath = &path[strlen(sysfs_path)]; |
78 |
int i; |
79 |
int i; |
|
|
80 |
struct name_entry *loop_path; |
81 |
int devpath_length = strlen(devpath); |
82 |
|
83 |
list_for_each_entry(loop_path, &path_skip_list, node) { |
84 |
int skip_arg_length = strlen(loop_path->name); |
85 |
if (devpath_length >= skip_arg_length |
86 |
&& strncmp(devpath, loop_path->name, skip_arg_length) == 0 |
87 |
&& (*(devpath+skip_arg_length) == '\0' |
88 |
|| *(devpath+skip_arg_length) == '/')) { |
89 |
dbg("skip '%s'" , path); |
90 |
return 0; |
91 |
} |
92 |
} |
79 |
|
93 |
|
80 |
for (i = 0; first_list[i] != NULL; i++) { |
94 |
for (i = 0; first_list[i] != NULL; i++) { |
81 |
if (strncmp(devpath, first_list[i], strlen(first_list[i])) == 0) { |
95 |
if (strncmp(devpath, first_list[i], strlen(first_list[i])) == 0) { |
Lines 321-326
static void udev_scan_class(void)
Link Here
|
321 |
int main(int argc, char *argv[], char *envp[]) |
335 |
int main(int argc, char *argv[], char *envp[]) |
322 |
{ |
336 |
{ |
323 |
int i; |
337 |
int i; |
|
|
338 |
char* skip_param; |
324 |
|
339 |
|
325 |
logging_init("udevtrigger"); |
340 |
logging_init("udevtrigger"); |
326 |
udev_config_init(); |
341 |
udev_config_init(); |
Lines 335-342
int main(int argc, char *argv[], char *e
Link Here
|
335 |
verbose = 1; |
350 |
verbose = 1; |
336 |
else if (strcmp(arg, "--dry-run") == 0 || strcmp(arg, "-n") == 0) |
351 |
else if (strcmp(arg, "--dry-run") == 0 || strcmp(arg, "-n") == 0) |
337 |
dry_run = 1; |
352 |
dry_run = 1; |
338 |
else { |
353 |
else if ((strncmp(arg, "--skip=", 7) == 0 && (skip_param = strdup(arg+7))) |
339 |
fprintf(stderr, "Usage: udevtrigger [--verbose] [--dry-run]\n"); |
354 |
|| (strcmp(arg, "-s") == 0 && (++i < argc) && (skip_param = strdup(argv[i])))) { |
|
|
355 |
while(strlen(skip_param)) { |
356 |
char* comma = strchr(skip_param,','); |
357 |
int skip_param_length; |
358 |
if (comma != NULL) |
359 |
*comma = '\0'; |
360 |
if (!(skip_param_length = strlen(skip_param))) |
361 |
continue; |
362 |
dbg("%s will be ignored",skip_param); |
363 |
if (*(skip_param+skip_param_length-1) == '/') |
364 |
*(skip_param+skip_param_length-1) = '\0'; |
365 |
name_list_add(&path_skip_list, skip_param, 0); |
366 |
skip_param += skip_param_length+1; |
367 |
} |
368 |
} else { |
369 |
fprintf(stderr, "Usage: udevtrigger [--verbose] [--dry-run] [--skip=/some/path[,...]]\n"); |
340 |
goto exit; |
370 |
goto exit; |
341 |
} |
371 |
} |
342 |
} |
372 |
} |