diff options
author | Eric Andersen <andersen@codepoet.org> | 2003-12-19 11:07:59 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2003-12-19 11:07:59 +0000 |
commit | f18bd8931d64dcaea6c9c41eb911fff37a38c29f (patch) | |
tree | 4653c390376fcf1de9296a8feaf9b25fd2ccc546 /miscutils/devfsd.c | |
parent | 1a773a656e8625c09553b2673b4d62bba1ffc242 (diff) | |
download | busybox-w32-f18bd8931d64dcaea6c9c41eb911fff37a38c29f.tar.gz busybox-w32-f18bd8931d64dcaea6c9c41eb911fff37a38c29f.tar.bz2 busybox-w32-f18bd8931d64dcaea6c9c41eb911fff37a38c29f.zip |
Tito writes:
Hi to all,
here is a new patch for bb's devfsd. The news are:
1) Size reduction for the basic setup with no options compiled in from :
text data bss dec hex filename
10591 392 543 11526 2d06 devfsd.o
rw-r--r-- 1 root root 18536 Dec 18 21:52 devfsd.o
to:
text data bss dec hex filename
9303 392 543 10238 27fe devfsd.o
rw-r--r-- 1 root root 16528 Dec 18 22:02 devfsd.o
With this setup you should not expect much output from devfsd
( just at start or with -v) and if some error occurs it only exits 1.
To have more output enable: " Increases logging (and size)" (+1568 b).
2) The option "Adds function names to program output" was removed from config menu
and now to enable debug output you can use bb's standard option:
"Build BusyBox with Debugging symbols".
Be careful as with this option enabled a lot of data are outputted to /dev/log and/or to stderr.
3) A new option: "Enables the -fg and -np option" was added to config menu (+128 b).
BTW: option "Adds support for MODLOAD keyword in devsfd.conf" adds 268 b.
4) The following keywords in devsfd.conf are supported:
"CLEAR_CONFIG", "INCLUDE", "OPTIONAL_INCLUDE", "RESTORE",
"PERMISSIONS", "EXECUTE", "COPY", "IGNORE", "MKOLDCOMPAT",
"MKNEWCOMPAT","RMOLDCOMPAT", "RMNEWCOMPAT".
But only if they are written UPPERCASE!!!!!!!!
5)Help text in usage.h was modified.
6)Something that I have forgotten..........
I've tested this for the last week on my box and it seems to work as expected.
Thanks in advance and please apply.
Ciao,
Tito
Diffstat (limited to 'miscutils/devfsd.c')
-rw-r--r-- | miscutils/devfsd.c | 783 |
1 files changed, 450 insertions, 333 deletions
diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c index 9f998e723..aa7a826b7 100644 --- a/miscutils/devfsd.c +++ b/miscutils/devfsd.c | |||
@@ -93,7 +93,7 @@ | |||
93 | #define DEVFSDIOC_GET_PROTO_REV _IOR(DEVFSD_IOCTL_BASE, 0, int) | 93 | #define DEVFSDIOC_GET_PROTO_REV _IOR(DEVFSD_IOCTL_BASE, 0, int) |
94 | #define DEVFSDIOC_SET_EVENT_MASK _IOW(DEVFSD_IOCTL_BASE, 2, int) | 94 | #define DEVFSDIOC_SET_EVENT_MASK _IOW(DEVFSD_IOCTL_BASE, 2, int) |
95 | #define DEVFSDIOC_RELEASE_EVENT_QUEUE _IOW(DEVFSD_IOCTL_BASE, 3, int) | 95 | #define DEVFSDIOC_RELEASE_EVENT_QUEUE _IOW(DEVFSD_IOCTL_BASE, 3, int) |
96 | #define DEVFSDIOC_SET_DEBUG_MASK _IOW(DEVFSD_IOCTL_BASE, 4, int) | 96 | #define DEVFSDIOC_SET_CONFIG_DEBUG_MASK _IOW(DEVFSD_IOCTL_BASE, 4, int) |
97 | #define DEVFSD_NOTIFY_REGISTERED 0 | 97 | #define DEVFSD_NOTIFY_REGISTERED 0 |
98 | #define DEVFSD_NOTIFY_UNREGISTERED 1 | 98 | #define DEVFSD_NOTIFY_UNREGISTERED 1 |
99 | #define DEVFSD_NOTIFY_ASYNC_OPEN 2 | 99 | #define DEVFSD_NOTIFY_ASYNC_OPEN 2 |
@@ -102,8 +102,9 @@ | |||
102 | #define DEVFSD_NOTIFY_CHANGE 5 | 102 | #define DEVFSD_NOTIFY_CHANGE 5 |
103 | #define DEVFSD_NOTIFY_CREATE 6 | 103 | #define DEVFSD_NOTIFY_CREATE 6 |
104 | #define DEVFSD_NOTIFY_DELETE 7 | 104 | #define DEVFSD_NOTIFY_DELETE 7 |
105 | #define DEVFS_PATHLEN 1024 /* Never change this otherwise the | 105 | #define DEVFS_PATHLEN 1024 |
106 | binary interface will change */ | 106 | /* Never change this otherwise the binary interface will change */ |
107 | |||
107 | struct devfsd_notify_struct | 108 | struct devfsd_notify_struct |
108 | { /* Use native C types to ensure same types in kernel and user space */ | 109 | { /* Use native C types to ensure same types in kernel and user space */ |
109 | unsigned int type; /* DEVFSD_NOTIFY_* value */ | 110 | unsigned int type; /* DEVFSD_NOTIFY_* value */ |
@@ -118,18 +119,12 @@ struct devfsd_notify_struct | |||
118 | char devname[DEVFS_PATHLEN]; /* This will be '\0' terminated */ | 119 | char devname[DEVFS_PATHLEN]; /* This will be '\0' terminated */ |
119 | }; | 120 | }; |
120 | 121 | ||
121 | |||
122 | |||
123 | /* These are now in Config.in */ | ||
124 | /* define this if you want to have more output on stderr and syslog at the same time */ | ||
125 | /*#define CONFIG_DEVFSD_VERBOSE*/ | ||
126 | /* define this if you want to have the function names in output */ | ||
127 | /*#define CONFIG_DEVFSD_DEBUG*/ | ||
128 | |||
129 | #define BUFFER_SIZE 16384 | 122 | #define BUFFER_SIZE 16384 |
130 | #define DEVFSD_VERSION "1.3.25" | 123 | #define DEVFSD_VERSION "1.3.25" |
131 | #define CONFIG_FILE "/etc/devfsd.conf" | 124 | #define CONFIG_FILE "/etc/devfsd.conf" |
132 | #define MODPROBE "/sbin/modprobe" | 125 | #define MODPROBE "/sbin/modprobe" |
126 | #define MODPROBE_SWITCH_1 "-k" | ||
127 | #define MODPROBE_SWITCH_2 "-C" | ||
133 | #define CONFIG_MODULES_DEVFS "/etc/modules.devfs" | 128 | #define CONFIG_MODULES_DEVFS "/etc/modules.devfs" |
134 | #define MAX_ARGS (6 + 1) | 129 | #define MAX_ARGS (6 + 1) |
135 | #define MAX_SUBEXPR 10 | 130 | #define MAX_SUBEXPR 10 |
@@ -221,7 +216,7 @@ static void service(struct stat statbuf, char *path); | |||
221 | static int st_expr_expand(char *, unsigned, const char *, const char *(*) (const char *, void *), void *); | 216 | static int st_expr_expand(char *, unsigned, const char *, const char *(*) (const char *, void *), void *); |
222 | static const char *get_old_name(const char *, unsigned, char *, unsigned, unsigned); | 217 | static const char *get_old_name(const char *, unsigned, char *, unsigned, unsigned); |
223 | static int mksymlink (const char *oldpath, const char *newpath); | 218 | static int mksymlink (const char *oldpath, const char *newpath); |
224 | static void read_config_file (const char *path, int optional, unsigned long *event_mask); | 219 | static void read_config_file (char *path, int optional, unsigned long *event_mask); |
225 | static void process_config_line (const char *, unsigned long *); | 220 | static void process_config_line (const char *, unsigned long *); |
226 | static int do_servicing (int, unsigned long); | 221 | static int do_servicing (int, unsigned long); |
227 | static void service_name (const struct devfsd_notify_struct *); | 222 | static void service_name (const struct devfsd_notify_struct *); |
@@ -251,11 +246,15 @@ static char get_old_ide_name (unsigned , unsigned); | |||
251 | static char *write_old_sd_name (char *, unsigned, unsigned, char *); | 246 | static char *write_old_sd_name (char *, unsigned, unsigned, char *); |
252 | 247 | ||
253 | /* busybox functions */ | 248 | /* busybox functions */ |
249 | #ifdef CONFIG_DEVFSD_VERBOSE | ||
254 | static void msg_logger(int die, int pri, const char * fmt, ... ); | 250 | static void msg_logger(int die, int pri, const char * fmt, ... ); |
251 | #endif | ||
255 | static void do_ioctl(int die, int fd, int request, unsigned long event_mask_flag); | 252 | static void do_ioctl(int die, int fd, int request, unsigned long event_mask_flag); |
256 | static void fork_and_execute(int die, char *arg0, char **arg ); | 253 | static void fork_and_execute(int die, char *arg0, char **arg ); |
257 | static int get_uid_gid ( int, const char *); | 254 | static int get_uid_gid ( int, const char *); |
258 | static void safe_memcpy( char * dest, const char * src, int len); | 255 | static void safe_memcpy( char * dest, const char * src, int len); |
256 | static unsigned int scan_dev_name_common(const char *d, unsigned int n, int addendum, char *ptr); | ||
257 | static unsigned int scan_dev_name(const char *d, unsigned int n, char *ptr); | ||
259 | 258 | ||
260 | /* Structs and vars */ | 259 | /* Structs and vars */ |
261 | static struct config_entry_struct *first_config = NULL; | 260 | static struct config_entry_struct *first_config = NULL; |
@@ -297,13 +296,14 @@ static struct event_type | |||
297 | 296 | ||
298 | extern void xregcomp(regex_t * preg, const char *regex, int cflags); | 297 | extern void xregcomp(regex_t * preg, const char *regex, int cflags); |
299 | 298 | ||
300 | const char * const bb_msg_bad_config = "bad %s config file: %s\n"; | ||
301 | const char * const bb_msg_proto_rev = "protocol revision"; | 299 | const char * const bb_msg_proto_rev = "protocol revision"; |
302 | #ifdef CONFIG_DEVFSD_VERBOSE | 300 | #ifdef CONFIG_DEVFSD_VERBOSE |
301 | const char * const bb_msg_bad_config = "bad %s config file: %s\n"; | ||
303 | const char * const bb_msg_small_buffer = "buffer too small\n"; | 302 | const char * const bb_msg_small_buffer = "buffer too small\n"; |
304 | const char * const bb_msg_variable_not_found= "variable: %s not found\n"; | 303 | const char * const bb_msg_variable_not_found = "variable: %s not found\n"; |
305 | #endif | 304 | #endif |
306 | 305 | ||
306 | #ifdef CONFIG_DEVFSD_VERBOSE | ||
307 | static void msg_logger(int die, int pri, const char * fmt, ... ) | 307 | static void msg_logger(int die, int pri, const char * fmt, ... ) |
308 | { | 308 | { |
309 | va_list ap; | 309 | va_list ap; |
@@ -315,7 +315,7 @@ static void msg_logger(int die, int pri, const char * fmt, ... ) | |||
315 | vsyslog( pri , fmt , ap); | 315 | vsyslog( pri , fmt , ap); |
316 | closelog(); | 316 | closelog(); |
317 | } | 317 | } |
318 | #ifndef CONFIG_DEVFSD_VERBOSE | 318 | #ifndef CONFIG_DEBUG |
319 | else | 319 | else |
320 | #endif | 320 | #endif |
321 | bb_verror_msg(fmt, ap); | 321 | bb_verror_msg(fmt, ap); |
@@ -323,12 +323,17 @@ static void msg_logger(int die, int pri, const char * fmt, ... ) | |||
323 | if(die==DIE) | 323 | if(die==DIE) |
324 | exit(EXIT_FAILURE); | 324 | exit(EXIT_FAILURE); |
325 | } | 325 | } |
326 | 326 | #endif | |
327 | 327 | ||
328 | static void do_ioctl(int die, int fd, int request, unsigned long event_mask_flag) | 328 | static void do_ioctl(int die, int fd, int request, unsigned long event_mask_flag) |
329 | { | 329 | { |
330 | if (ioctl (fd, request, event_mask_flag) != 0) | 330 | #ifdef CONFIG_DEVFSD_VERBOSE |
331 | if (ioctl (fd, request, event_mask_flag) == -1) | ||
331 | msg_logger(die, LOG_ERR, "ioctl(): %m\n"); | 332 | msg_logger(die, LOG_ERR, "ioctl(): %m\n"); |
333 | #else | ||
334 | if (ioctl (fd, request, event_mask_flag) == -1) | ||
335 | exit(EXIT_FAILURE); | ||
336 | #endif | ||
332 | } | 337 | } |
333 | 338 | ||
334 | static void fork_and_execute(int die, char *arg0, char **arg ) | 339 | static void fork_and_execute(int die, char *arg0, char **arg ) |
@@ -340,7 +345,12 @@ static void fork_and_execute(int die, char *arg0, char **arg ) | |||
340 | break; | 345 | break; |
341 | case -1: | 346 | case -1: |
342 | /* Parent: Error : die or return */ | 347 | /* Parent: Error : die or return */ |
348 | #ifdef CONFIG_DEVFSD_VERBOSE | ||
343 | msg_logger(die, LOG_ERR,(char *) bb_msg_memory_exhausted); | 349 | msg_logger(die, LOG_ERR,(char *) bb_msg_memory_exhausted); |
350 | #else | ||
351 | if(die == DIE) | ||
352 | exit(EXIT_FAILURE); | ||
353 | #endif | ||
344 | return; | 354 | return; |
345 | default: | 355 | default: |
346 | /* Parent : ok : return or exit */ | 356 | /* Parent : ok : return or exit */ |
@@ -355,7 +365,11 @@ static void fork_and_execute(int die, char *arg0, char **arg ) | |||
355 | if(arg0 != NULL ) | 365 | if(arg0 != NULL ) |
356 | { | 366 | { |
357 | execvp (arg0, arg); | 367 | execvp (arg0, arg); |
368 | #ifdef CONFIG_DEVFSD_VERBOSE | ||
358 | msg_logger(DIE, LOG_ERR, "execvp(): %s: %m\n", arg0); | 369 | msg_logger(DIE, LOG_ERR, "execvp(): %s: %m\n", arg0); |
370 | #else | ||
371 | exit(EXIT_FAILURE); | ||
372 | #endif | ||
359 | } | 373 | } |
360 | } | 374 | } |
361 | 375 | ||
@@ -365,13 +379,60 @@ static void safe_memcpy( char *dest, const char *src, int len) | |||
365 | dest[len] = '\0'; | 379 | dest[len] = '\0'; |
366 | } | 380 | } |
367 | 381 | ||
382 | static unsigned int scan_dev_name_common(const char *d, unsigned int n, int addendum, char *ptr) | ||
383 | { | ||
384 | if( d[n - 4]=='d' && d[n - 3]=='i' && d[n - 2]=='s' && d[n - 1]=='c') | ||
385 | return (2 + addendum); | ||
386 | else if( d[n - 2]=='c' && d[n - 1]=='d') | ||
387 | return (3 + addendum); | ||
388 | else if(ptr[0]=='p' && ptr[1]=='a' && ptr[2]=='r' && ptr[3]=='t') | ||
389 | return (4 + addendum); | ||
390 | else if( ptr[n - 2]=='m' && ptr[n - 1]=='t') | ||
391 | return (5 + addendum); | ||
392 | else | ||
393 | return 0; | ||
394 | } | ||
395 | |||
396 | static unsigned int scan_dev_name(const char *d, unsigned int n, char *ptr) | ||
397 | { | ||
398 | if(d[0]=='s' && d[1]=='c' && d[2]=='s' && d[3]=='i' && d[4]=='/') | ||
399 | { | ||
400 | if( d[n - 7]=='g' && d[n - 6]=='e' && d[n - 5]=='n' && | ||
401 | d[n - 4]=='e' && d[n - 3]=='r' && d[n - 2]=='i' && | ||
402 | d[n - 1]=='c' ) | ||
403 | return 1; | ||
404 | return scan_dev_name_common(d, n, 0, ptr); | ||
405 | } | ||
406 | else if(d[0]=='i' && d[1]=='d' && d[2]=='e' && d[3]=='/' && | ||
407 | d[4]=='h' && d[5]=='o' && d[6]=='s' && d[7]=='t') | ||
408 | { | ||
409 | return scan_dev_name_common(d, n, 4, ptr); | ||
410 | } | ||
411 | else if(d[0]=='s' && d[1]=='b' && d[2]=='p' && d[3]=='/') | ||
412 | { | ||
413 | return 10; | ||
414 | } | ||
415 | else if(d[0]=='v' && d[1]=='c' && d[2]=='c' && d[3]=='/') | ||
416 | { | ||
417 | return 11; | ||
418 | } | ||
419 | else if(d[0]=='p' && d[1]=='t' && d[2]=='y' && d[3]=='/') | ||
420 | { | ||
421 | return 12; | ||
422 | } | ||
423 | return 0; | ||
424 | } | ||
425 | |||
368 | /* Public functions follow */ | 426 | /* Public functions follow */ |
369 | 427 | ||
370 | int devfsd_main (int argc, char **argv) | 428 | int devfsd_main (int argc, char **argv) |
371 | { | 429 | { |
372 | int print_version = FALSE; | 430 | int print_version = FALSE; |
431 | #ifdef CONFIG_DEVFSD_FG_NP | ||
373 | int do_daemon = TRUE; | 432 | int do_daemon = TRUE; |
374 | int no_polling = FALSE; | 433 | int no_polling = FALSE; |
434 | #endif | ||
435 | int do_scan; | ||
375 | int fd, proto_rev, count; | 436 | int fd, proto_rev, count; |
376 | unsigned long event_mask = 0; | 437 | unsigned long event_mask = 0; |
377 | struct sigaction new_action; | 438 | struct sigaction new_action; |
@@ -382,25 +443,42 @@ int devfsd_main (int argc, char **argv) | |||
382 | 443 | ||
383 | for (count = 2; count < argc; ++count) | 444 | for (count = 2; count < argc; ++count) |
384 | { | 445 | { |
385 | if (strcmp (argv[count], "-v") == 0) | 446 | if(argv[count][0] == '-') |
386 | print_version = TRUE; | 447 | { |
387 | else if (strcmp (argv[count], "-fg") == 0) | 448 | if(argv[count][1]=='v' && !argv[count][2]) /* -v */ |
388 | do_daemon = FALSE; | 449 | print_version = TRUE; |
389 | else if (strcmp (argv[count], "-np") == 0) | 450 | #ifdef CONFIG_DEVFSD_FG_NP |
390 | no_polling = TRUE; | 451 | else if(argv[count][1]=='f' && argv[count][2]=='g' && !argv[count][3]) /* -fg */ |
391 | else | 452 | do_daemon = FALSE; |
392 | bb_show_usage(); | 453 | else if(argv[count][1]=='n' && argv[count][2]=='p' && !argv[count][3]) /* -np */ |
454 | no_polling = TRUE; | ||
455 | #endif | ||
456 | else | ||
457 | bb_show_usage(); | ||
458 | } | ||
393 | } | 459 | } |
394 | 460 | ||
461 | /* strip last / from mount point, so we don't need to check for it later */ | ||
462 | while( argv[1][1]!='\0' && argv[1][strlen(argv[1])-1] == '/' ) | ||
463 | argv[1][strlen(argv[1]) -1] = '\0'; | ||
464 | |||
395 | mount_point = argv[1]; | 465 | mount_point = argv[1]; |
396 | 466 | ||
397 | if (chdir (mount_point) != 0) | 467 | if (chdir (mount_point) != 0) |
468 | #ifdef CONFIG_DEVFSD_VERBOSE | ||
398 | bb_error_msg_and_die( " %s: %m", mount_point); | 469 | bb_error_msg_and_die( " %s: %m", mount_point); |
470 | #else | ||
471 | exit(EXIT_FAILURE); | ||
472 | #endif | ||
399 | 473 | ||
400 | fd = bb_xopen (".devfsd", O_RDONLY); | 474 | fd = bb_xopen (".devfsd", O_RDONLY); |
401 | 475 | ||
402 | if (fcntl (fd, F_SETFD, FD_CLOEXEC) != 0) | 476 | if (fcntl (fd, F_SETFD, FD_CLOEXEC) != 0) |
477 | #ifdef CONFIG_DEVFSD_VERBOSE | ||
403 | bb_error_msg( "FD_CLOEXEC"); | 478 | bb_error_msg( "FD_CLOEXEC"); |
479 | #else | ||
480 | exit(EXIT_FAILURE); | ||
481 | #endif | ||
404 | 482 | ||
405 | do_ioctl(DIE, fd, DEVFSDIOC_GET_PROTO_REV,(int )&proto_rev); | 483 | do_ioctl(DIE, fd, DEVFSDIOC_GET_PROTO_REV,(int )&proto_rev); |
406 | 484 | ||
@@ -428,7 +506,11 @@ int devfsd_main (int argc, char **argv) | |||
428 | /* Set up SIGHUP and SIGUSR1 handlers */ | 506 | /* Set up SIGHUP and SIGUSR1 handlers */ |
429 | new_action.sa_handler = signal_handler; | 507 | new_action.sa_handler = signal_handler; |
430 | if (sigaction (SIGHUP, &new_action, NULL) != 0 || sigaction (SIGUSR1, &new_action, NULL) != 0 ) | 508 | if (sigaction (SIGHUP, &new_action, NULL) != 0 || sigaction (SIGUSR1, &new_action, NULL) != 0 ) |
509 | #ifdef CONFIG_DEVFSD_VERBOSE | ||
431 | bb_error_msg_and_die( "sigaction()"); | 510 | bb_error_msg_and_die( "sigaction()"); |
511 | #else | ||
512 | exit(EXIT_FAILURE); | ||
513 | #endif | ||
432 | 514 | ||
433 | bb_printf("%s v%s started for %s\n",bb_applet_name, DEVFSD_VERSION, mount_point); | 515 | bb_printf("%s v%s started for %s\n",bb_applet_name, DEVFSD_VERSION, mount_point); |
434 | 516 | ||
@@ -437,21 +519,25 @@ int devfsd_main (int argc, char **argv) | |||
437 | read_config_file (CONFIG_FILE, FALSE, &event_mask); | 519 | read_config_file (CONFIG_FILE, FALSE, &event_mask); |
438 | /* Do the scan before forking, so that boot scripts see the finished product */ | 520 | /* Do the scan before forking, so that boot scripts see the finished product */ |
439 | dir_operation(SERVICE,mount_point,0,NULL); | 521 | dir_operation(SERVICE,mount_point,0,NULL); |
522 | #ifdef CONFIG_DEVFSD_FG_NP | ||
440 | if (no_polling) | 523 | if (no_polling) |
441 | exit (0); | 524 | exit (0); |
442 | if (do_daemon) | 525 | if (do_daemon) |
443 | { | 526 | { |
527 | #endif | ||
444 | /* Release so that the child can grab it */ | 528 | /* Release so that the child can grab it */ |
445 | do_ioctl(DIE, fd, DEVFSDIOC_RELEASE_EVENT_QUEUE, 0); | 529 | do_ioctl(DIE, fd, DEVFSDIOC_RELEASE_EVENT_QUEUE, 0); |
446 | fork_and_execute(DIE, NULL, NULL); | 530 | fork_and_execute(DIE, NULL, NULL); |
447 | setsid (); /* Prevent hangups and become pgrp leader */ | 531 | setsid (); /* Prevent hangups and become pgrp leader */ |
532 | #ifdef CONFIG_DEVFSD_FG_NP | ||
448 | } | 533 | } |
449 | else | 534 | else |
450 | setpgid (0, 0); /* Become process group leader */ | 535 | setpgid (0, 0); /* Become process group leader */ |
536 | #endif | ||
451 | 537 | ||
452 | while (TRUE) | 538 | while (TRUE) |
453 | { | 539 | { |
454 | int do_scan = do_servicing (fd, event_mask); | 540 | do_scan = do_servicing (fd, event_mask); |
455 | 541 | ||
456 | free_config (); | 542 | free_config (); |
457 | read_config_file (CONFIG_FILE, FALSE, &event_mask); | 543 | read_config_file (CONFIG_FILE, FALSE, &event_mask); |
@@ -463,7 +549,7 @@ int devfsd_main (int argc, char **argv) | |||
463 | 549 | ||
464 | /* Private functions follow */ | 550 | /* Private functions follow */ |
465 | 551 | ||
466 | static void read_config_file (const char *path, int optional, unsigned long *event_mask) | 552 | static void read_config_file (char *path, int optional, unsigned long *event_mask) |
467 | /* [SUMMARY] Read a configuration database. | 553 | /* [SUMMARY] Read a configuration database. |
468 | <path> The path to read the database from. If this is a directory, all | 554 | <path> The path to read the database from. If this is a directory, all |
469 | entries in that directory will be read (except hidden entries). | 555 | entries in that directory will be read (except hidden entries). |
@@ -477,14 +563,18 @@ static void read_config_file (const char *path, int optional, unsigned long *eve | |||
477 | char buf[STRING_LENGTH]; | 563 | char buf[STRING_LENGTH]; |
478 | char *line=NULL; | 564 | char *line=NULL; |
479 | 565 | ||
480 | #ifdef CONFIG_DEVFSD_DEBUG | 566 | #ifdef CONFIG_DEBUG |
481 | msg_logger( NO_DIE, LOG_INFO, "read_config_file()\n"); | 567 | msg_logger( NO_DIE, LOG_INFO, "read_config_file(): %s\n", path); |
482 | #endif | 568 | #endif |
483 | if (stat (path, &statbuf) != 0 || statbuf.st_size == 0 ) | 569 | if (stat (path, &statbuf) != 0 || statbuf.st_size == 0 ) |
484 | goto read_config_file_err; | 570 | goto read_config_file_err; |
485 | 571 | ||
486 | if ( S_ISDIR (statbuf.st_mode) ) | 572 | if ( S_ISDIR (statbuf.st_mode) ) |
487 | { | 573 | { |
574 | /* strip last / from dirname so we don't need to check for it later */ | ||
575 | while( path && path[1]!='\0' && path[strlen(path)-1] == '/') | ||
576 | path[strlen(path) -1] = '\0'; | ||
577 | |||
488 | dir_operation(READ_CONFIG, path, 0, event_mask); | 578 | dir_operation(READ_CONFIG, path, 0, event_mask); |
489 | return; | 579 | return; |
490 | } | 580 | } |
@@ -513,6 +603,9 @@ static void read_config_file (const char *path, int optional, unsigned long *eve | |||
513 | read_config_file_err: | 603 | read_config_file_err: |
514 | #ifdef CONFIG_DEVFSD_VERBOSE | 604 | #ifdef CONFIG_DEVFSD_VERBOSE |
515 | msg_logger(((optional == 0 ) && (errno == ENOENT))? DIE : NO_DIE, LOG_ERR, "read config file: %s: %m\n", path); | 605 | msg_logger(((optional == 0 ) && (errno == ENOENT))? DIE : NO_DIE, LOG_ERR, "read config file: %s: %m\n", path); |
606 | #else | ||
607 | if(optional == 0 && errno == ENOENT) | ||
608 | exit(EXIT_FAILURE); | ||
516 | #endif | 609 | #endif |
517 | return; | 610 | return; |
518 | } /* End Function read_config_file */ | 611 | } /* End Function read_config_file */ |
@@ -532,7 +625,14 @@ static void process_config_line (const char *line, unsigned long *event_mask) | |||
532 | char * msg=""; | 625 | char * msg=""; |
533 | char *ptr; | 626 | char *ptr; |
534 | 627 | ||
535 | #ifdef CONFIG_DEVFSD_DEBUG | 628 | /* !!!! Only Uppercase Keywords in devsfd.conf */ |
629 | const char *options[] = { "CLEAR_CONFIG", "INCLUDE", "OPTIONAL_INCLUDE", "RESTORE", | ||
630 | "PERMISSIONS", "MODLOAD", "EXECUTE", "COPY", "IGNORE", | ||
631 | "MKOLDCOMPAT", "MKNEWCOMPAT","RMOLDCOMPAT", "RMNEWCOMPAT", 0 }; | ||
632 | |||
633 | short int i; | ||
634 | |||
635 | #ifdef CONFIG_DEBUG | ||
536 | msg_logger( NO_DIE, LOG_INFO, "process_config_line()\n"); | 636 | msg_logger( NO_DIE, LOG_INFO, "process_config_line()\n"); |
537 | #endif | 637 | #endif |
538 | 638 | ||
@@ -540,26 +640,32 @@ static void process_config_line (const char *line, unsigned long *event_mask) | |||
540 | num_args = sscanf (line, "%s %s %s %s %s %s %s %s %s %s", | 640 | num_args = sscanf (line, "%s %s %s %s %s %s %s %s %s %s", |
541 | when, name, what, | 641 | when, name, what, |
542 | p[0], p[1], p[2], p[3], p[4], p[5], p[6]); | 642 | p[0], p[1], p[2], p[3], p[4], p[5], p[6]); |
543 | if (strcasecmp (when, "CLEAR_CONFIG") == 0) | 643 | |
644 | i = compare_string_array(options, when ); | ||
645 | |||
646 | /*"CLEAR_CONFIG"*/ | ||
647 | if( i == 0) | ||
544 | { | 648 | { |
545 | free_config (); | 649 | free_config (); |
546 | *event_mask = 0; | 650 | *event_mask = 0; |
547 | return; | 651 | return; |
548 | } | 652 | } |
549 | if (num_args < 2) | 653 | |
654 | if ( num_args < 2) | ||
550 | goto process_config_line_err; | 655 | goto process_config_line_err; |
551 | 656 | ||
552 | if ( (strcasecmp (when, "INCLUDE") == 0) || | 657 | /* "INCLUDE" & "OPTIONAL_INCLUDE" */ |
553 | (strcasecmp (when, "OPTIONAL_INCLUDE") == 0) ) | 658 | if( i == 1 || i == 2 ) |
554 | { | 659 | { |
555 | st_expr_expand (name, STRING_LENGTH, name, get_variable, NULL ); | 660 | st_expr_expand (name, STRING_LENGTH, name, get_variable, NULL ); |
556 | #ifdef CONFIG_DEVFSD_VERBOSE | 661 | #ifdef CONFIG_DEBUG |
557 | msg_logger( NO_DIE, LOG_INFO, "%sinclude: %s\n",(toupper (when[0]) == 'I') ? "": "optional_", name); | 662 | msg_logger( NO_DIE, LOG_INFO, "%sinclude: %s\n",(toupper (when[0]) == 'I') ? "": "optional_", name); |
558 | #endif | 663 | #endif |
559 | read_config_file (name, (toupper (when[0]) == 'I') ? FALSE : TRUE, event_mask); | 664 | read_config_file (name, (toupper (when[0]) == 'I') ? FALSE : TRUE, event_mask); |
560 | return; | 665 | return; |
561 | } | 666 | } |
562 | if (strcasecmp (when, "RESTORE") == 0) | 667 | /* "RESTORE" */ |
668 | if( i == 3) | ||
563 | { | 669 | { |
564 | dir_operation(RESTORE,name, strlen (name),NULL); | 670 | dir_operation(RESTORE,name, strlen (name),NULL); |
565 | return; | 671 | return; |
@@ -583,65 +689,72 @@ static void process_config_line (const char *line, unsigned long *event_mask) | |||
583 | goto process_config_line_err; | 689 | goto process_config_line_err; |
584 | } | 690 | } |
585 | 691 | ||
586 | if (strcasecmp (what, "PERMISSIONS") == 0) | 692 | i = compare_string_array(options, what ); |
693 | |||
694 | switch(i) | ||
587 | { | 695 | { |
588 | new->action.what = AC_PERMISSIONS; | 696 | case 4: /* "PERMISSIONS" */ |
589 | /* Get user and group */ | 697 | new->action.what = AC_PERMISSIONS; |
590 | if ( ( ptr = strchr (p[0], '.') ) == NULL ) | 698 | /* Get user and group */ |
591 | { | 699 | if ( ( ptr = strchr (p[0], '.') ) == NULL ) |
592 | msg="UID.GID"; | 700 | { |
593 | goto process_config_line_err; /*"missing '.' in UID.GID */ | 701 | msg="UID.GID"; |
594 | } | 702 | goto process_config_line_err; /*"missing '.' in UID.GID */ |
703 | } | ||
595 | 704 | ||
596 | *ptr++ = '\0'; | 705 | *ptr++ = '\0'; |
597 | new->u.permissions.uid = get_uid_gid (UID, p[0]); | 706 | new->u.permissions.uid = get_uid_gid (UID, p[0]); |
598 | new->u.permissions.gid = get_uid_gid (GID, ptr); | 707 | new->u.permissions.gid = get_uid_gid (GID, ptr); |
599 | /* Get mode */ | 708 | /* Get mode */ |
600 | new->u.permissions.mode = get_mode (p[1]); | 709 | new->u.permissions.mode = get_mode (p[1]); |
601 | } | 710 | break; |
602 | #ifdef CONFIG_DEVFSD_MODLOAD | 711 | #ifdef CONFIG_DEVFSD_MODLOAD |
603 | else if (strcasecmp (what, "MODLOAD") == 0) | 712 | case 5: /* MODLOAD */ |
604 | /*This action will pass "/dev/$devname" (i.e. "/dev/" prefixed to | 713 | /*This action will pass "/dev/$devname" (i.e. "/dev/" prefixed to |
605 | the device name) to the module loading facility. In addition, | 714 | the device name) to the module loading facility. In addition, |
606 | the /etc/modules.devfs configuration file is used.*/ | 715 | the /etc/modules.devfs configuration file is used.*/ |
607 | 716 | new->action.what = AC_MODLOAD; | |
608 | new->action.what = AC_MODLOAD; | 717 | break; |
609 | #endif | 718 | #endif |
610 | else if (strcasecmp (what, "EXECUTE") == 0) | 719 | case 6: /* EXECUTE */ |
611 | { | 720 | new->action.what = AC_EXECUTE; |
612 | new->action.what = AC_EXECUTE; | 721 | num_args -= 3; |
613 | num_args -= 3; | ||
614 | 722 | ||
615 | for (count = 0; count < num_args; ++count) | 723 | for (count = 0; count < num_args; ++count) |
616 | new->u.execute.argv[count] = bb_xstrdup (p[count]); | 724 | new->u.execute.argv[count] = bb_xstrdup (p[count]); |
617 | |||
618 | new->u.execute.argv[num_args] = NULL; | ||
619 | } | ||
620 | else if (strcasecmp (what, "COPY") == 0) | ||
621 | { | ||
622 | new->action.what = AC_COPY; | ||
623 | num_args -= 3; | ||
624 | if (num_args != 2) | ||
625 | goto process_config_line_err; /* missing path and function in line */ | ||
626 | 725 | ||
627 | new->u.copy.source = bb_xstrdup (p[0]); | 726 | new->u.execute.argv[num_args] = NULL; |
628 | new->u.copy.destination = bb_xstrdup (p[1]); | 727 | break; |
629 | } | 728 | case 7: /* COPY */ |
630 | else if (strcasecmp (what, "IGNORE") == 0) | 729 | new->action.what = AC_COPY; |
631 | new->action.what = AC_IGNORE; | 730 | num_args -= 3; |
632 | else if (strcasecmp (what, "MKOLDCOMPAT") == 0) | 731 | if (num_args != 2) |
633 | new->action.what = AC_MKOLDCOMPAT; | 732 | goto process_config_line_err; /* missing path and function in line */ |
634 | else if (strcasecmp (what, "MKNEWCOMPAT") == 0) | 733 | |
635 | new->action.what = AC_MKNEWCOMPAT; | 734 | new->u.copy.source = bb_xstrdup (p[0]); |
636 | else if (strcasecmp (what, "RMOLDCOMPAT") == 0) | 735 | new->u.copy.destination = bb_xstrdup (p[1]); |
637 | new->action.what = AC_RMOLDCOMPAT; | 736 | break; |
638 | else if (strcasecmp (what, "RMNEWCOMPAT") == 0) | 737 | case 8: /* IGNORE */ |
639 | new->action.what = AC_RMNEWCOMPAT; | 738 | /* FALLTROUGH */ |
640 | else | 739 | case 9: /* MKOLDCOMPAT */ |
641 | { | 740 | /* FALLTROUGH */ |
642 | msg ="WHAT in"; | 741 | case 10: /* MKNEWCOMPAT */ |
643 | goto process_config_line_err; | 742 | /* FALLTROUGH */ |
644 | } | 743 | case 11:/* RMOLDCOMPAT */ |
744 | /* FALLTROUGH */ | ||
745 | case 12: /* RMNEWCOMPAT */ | ||
746 | /* AC_IGNORE 6 | ||
747 | AC_MKOLDCOMPAT 7 | ||
748 | AC_MKNEWCOMPAT 8 | ||
749 | AC_RMOLDCOMPAT 9 | ||
750 | AC_RMNEWCOMPAT 10*/ | ||
751 | new->action.what = i - 2; | ||
752 | break; | ||
753 | default: | ||
754 | msg ="WHAT in"; | ||
755 | goto process_config_line_err; | ||
756 | /*esac*/ | ||
757 | } /* switch (i) */ | ||
645 | 758 | ||
646 | xregcomp( &new->preg, name, REG_EXTENDED); | 759 | xregcomp( &new->preg, name, REG_EXTENDED); |
647 | 760 | ||
@@ -654,7 +767,11 @@ static void process_config_line (const char *line, unsigned long *event_mask) | |||
654 | last_config = new; | 767 | last_config = new; |
655 | return; | 768 | return; |
656 | process_config_line_err: | 769 | process_config_line_err: |
770 | #ifdef CONFIG_DEVFSD_VERBOSE | ||
657 | msg_logger( DIE, LOG_ERR, bb_msg_bad_config, msg , line); | 771 | msg_logger( DIE, LOG_ERR, bb_msg_bad_config, msg , line); |
772 | #else | ||
773 | exit(EXIT_FAILURE); | ||
774 | #endif | ||
658 | } /* End Function process_config_line */ | 775 | } /* End Function process_config_line */ |
659 | 776 | ||
660 | static int do_servicing (int fd, unsigned long event_mask) | 777 | static int do_servicing (int fd, unsigned long event_mask) |
@@ -668,7 +785,7 @@ static int do_servicing (int fd, unsigned long event_mask) | |||
668 | struct devfsd_notify_struct info; | 785 | struct devfsd_notify_struct info; |
669 | unsigned long tmp_event_mask; | 786 | unsigned long tmp_event_mask; |
670 | 787 | ||
671 | #ifdef CONFIG_DEVFSD_DEBUG | 788 | #ifdef CONFIG_DEBUG |
672 | msg_logger( NO_DIE, LOG_INFO, "do_servicing()\n"); | 789 | msg_logger( NO_DIE, LOG_INFO, "do_servicing()\n"); |
673 | #endif | 790 | #endif |
674 | /* Tell devfs what events we care about */ | 791 | /* Tell devfs what events we care about */ |
@@ -698,7 +815,7 @@ static int do_servicing (int fd, unsigned long event_mask) | |||
698 | msg_logger( NO_DIE, LOG_ERR, "read error on control file: %m\n"); | 815 | msg_logger( NO_DIE, LOG_ERR, "read error on control file: %m\n"); |
699 | #endif | 816 | #endif |
700 | /* This is to shut up a compiler warning */ | 817 | /* This is to shut up a compiler warning */ |
701 | exit(1); | 818 | exit(EXIT_FAILURE); |
702 | } /* End Function do_servicing */ | 819 | } /* End Function do_servicing */ |
703 | 820 | ||
704 | static void service_name (const struct devfsd_notify_struct *info) | 821 | static void service_name (const struct devfsd_notify_struct *info) |
@@ -711,18 +828,19 @@ static void service_name (const struct devfsd_notify_struct *info) | |||
711 | regmatch_t mbuf[MAX_SUBEXPR]; | 828 | regmatch_t mbuf[MAX_SUBEXPR]; |
712 | struct config_entry_struct *entry; | 829 | struct config_entry_struct *entry; |
713 | 830 | ||
714 | #ifdef CONFIG_DEVFSD_DEBUG | 831 | #ifdef CONFIG_DEBUG |
715 | msg_logger( NO_DIE, LOG_INFO, "service_name()\n"); | 832 | msg_logger( NO_DIE, LOG_INFO, "service_name()\n"); |
716 | #endif | ||
717 | #ifdef CONFIG_DEVFSD_VERBOSE | ||
718 | if (info->overrun_count > 0) | 833 | if (info->overrun_count > 0) |
719 | msg_logger( NO_DIE, LOG_ERR, "lost %u events\n", info->overrun_count); | 834 | msg_logger( NO_DIE, LOG_ERR, "lost %u events\n", info->overrun_count); |
720 | #endif | 835 | #endif |
721 | 836 | ||
722 | /* Discard lookups on "/dev/log" and "/dev/initctl" */ | 837 | /* Discard lookups on "/dev/log" and "/dev/initctl" */ |
723 | if (info->type == DEVFSD_NOTIFY_LOOKUP && | 838 | if( info->type == DEVFSD_NOTIFY_LOOKUP && |
724 | (( (strcmp (info->devname, "log") == 0) || | 839 | ((info->devname[0]=='l' && info->devname[1]=='o' && |
725 | (strcmp (info->devname, "initctl") == 0)))) | 840 | info->devname[2]=='g' && !info->devname[3]) && |
841 | ( info->devname[0]=='i' && info->devname[1]=='n' && | ||
842 | info->devname[2]=='i' && info->devname[3]=='c' && | ||
843 | info->devname[4]=='t' && info->devname[5]=='l' && !info->devname[6]))) | ||
726 | return; | 844 | return; |
727 | for (entry = first_config; entry != NULL; entry = entry->next) | 845 | for (entry = first_config; entry != NULL; entry = entry->next) |
728 | { | 846 | { |
@@ -731,51 +849,40 @@ static void service_name (const struct devfsd_notify_struct *info) | |||
731 | continue; | 849 | continue; |
732 | for (n = 0; (n < MAX_SUBEXPR) && (mbuf[n].rm_so != -1); ++n) | 850 | for (n = 0; (n < MAX_SUBEXPR) && (mbuf[n].rm_so != -1); ++n) |
733 | /* VOID */; | 851 | /* VOID */; |
852 | #ifdef CONFIG_DEBUG | ||
853 | msg_logger( NO_DIE, LOG_INFO, "service_name(): action.what %d\n", entry->action.what); | ||
854 | #endif | ||
734 | switch (entry->action.what) | 855 | switch (entry->action.what) |
735 | { | 856 | { |
736 | case AC_PERMISSIONS: | 857 | case AC_PERMISSIONS: |
737 | #ifdef CONFIG_DEVFSD_DEBUG | ||
738 | msg_logger( NO_DIE, LOG_INFO, "AC_PERMISSIONS\n"); | ||
739 | #endif | ||
740 | action_permissions (info, entry); | 858 | action_permissions (info, entry); |
741 | break; | 859 | break; |
742 | #ifdef CONFIG_DEVFSD_MODLOAD | 860 | #ifdef CONFIG_DEVFSD_MODLOAD |
743 | case AC_MODLOAD: | 861 | case AC_MODLOAD: |
744 | #ifdef CONFIG_DEVFSD_DEBUG | ||
745 | msg_logger( NO_DIE, LOG_INFO, "AC_MODLOAD\n"); | ||
746 | #endif | ||
747 | action_modload (info, entry); | 862 | action_modload (info, entry); |
748 | break; | 863 | break; |
749 | #endif | 864 | #endif |
750 | case AC_EXECUTE: | 865 | case AC_EXECUTE: |
751 | #ifdef CONFIG_DEVFSD_DEBUG | ||
752 | msg_logger( NO_DIE, LOG_INFO, "AC_EXECUTE\n"); | ||
753 | #endif | ||
754 | action_execute (info, entry, mbuf, n); | 866 | action_execute (info, entry, mbuf, n); |
755 | break; | 867 | break; |
756 | case AC_COPY: | 868 | case AC_COPY: |
757 | #ifdef CONFIG_DEVFSD_DEBUG | ||
758 | msg_logger( NO_DIE, LOG_INFO, "AC_COPY\n"); | ||
759 | #endif | ||
760 | action_copy (info, entry, mbuf, n); | 869 | action_copy (info, entry, mbuf, n); |
761 | break; | 870 | break; |
762 | case AC_IGNORE: | 871 | case AC_IGNORE: |
763 | #ifdef CONFIG_DEVFSD_DEBUG | ||
764 | msg_logger( NO_DIE, LOG_INFO, "AC_IGNORE\n"); | ||
765 | #endif | ||
766 | return; | 872 | return; |
767 | /*break;*/ | 873 | /*break;*/ |
768 | case AC_MKOLDCOMPAT: | 874 | case AC_MKOLDCOMPAT: |
769 | case AC_MKNEWCOMPAT: | 875 | case AC_MKNEWCOMPAT: |
770 | case AC_RMOLDCOMPAT: | 876 | case AC_RMOLDCOMPAT: |
771 | case AC_RMNEWCOMPAT: | 877 | case AC_RMNEWCOMPAT: |
772 | #ifdef CONFIG_DEVFSD_DEBUG | ||
773 | msg_logger( NO_DIE, LOG_INFO, "AC_COMPAT\n"); | ||
774 | #endif | ||
775 | action_compat (info, entry->action.what); | 878 | action_compat (info, entry->action.what); |
776 | break; | 879 | break; |
777 | default: | 880 | default: |
881 | #ifdef CONFIG_DEVFSD_VERBOSE | ||
778 | msg_logger( DIE, LOG_ERR, "Unknown action\n"); | 882 | msg_logger( DIE, LOG_ERR, "Unknown action\n"); |
883 | #else | ||
884 | exit(EXIT_FAILURE); | ||
885 | #endif | ||
779 | /*break;*/ | 886 | /*break;*/ |
780 | } | 887 | } |
781 | } | 888 | } |
@@ -791,7 +898,7 @@ static void action_permissions (const struct devfsd_notify_struct *info, | |||
791 | { | 898 | { |
792 | struct stat statbuf; | 899 | struct stat statbuf; |
793 | 900 | ||
794 | #ifdef CONFIG_DEVFSD_DEBUG | 901 | #ifdef CONFIG_DEBUG |
795 | msg_logger( NO_DIE, LOG_INFO, "action_permission()\n"); | 902 | msg_logger( NO_DIE, LOG_INFO, "action_permission()\n"); |
796 | #endif | 903 | #endif |
797 | 904 | ||
@@ -820,15 +927,16 @@ static void action_modload (const struct devfsd_notify_struct *info, | |||
820 | char device[STRING_LENGTH]; | 927 | char device[STRING_LENGTH]; |
821 | 928 | ||
822 | argv[0] = MODPROBE; | 929 | argv[0] = MODPROBE; |
823 | argv[1] = "-k"; | 930 | argv[1] = MODPROBE_SWITCH_1; /* "-k" */ |
824 | argv[2] = "-C"; | 931 | argv[2] = MODPROBE_SWITCH_2; /* "-C" */ |
825 | argv[3] = CONFIG_MODULES_DEVFS; | 932 | argv[3] = CONFIG_MODULES_DEVFS; |
826 | argv[4] = device; | 933 | argv[4] = device; |
827 | argv[5] = NULL; | 934 | argv[5] = NULL; |
828 | #ifdef CONFIG_DEVFSD_DEBUG | 935 | |
829 | msg_logger( NO_DIE, LOG_INFO, "action_modload()\n"); | ||
830 | #endif | ||
831 | snprintf (device, sizeof (device), "/dev/%s", info->devname); | 936 | snprintf (device, sizeof (device), "/dev/%s", info->devname); |
937 | #ifdef CONFIG_DEBUG | ||
938 | msg_logger( NO_DIE, LOG_INFO, "action_modload():%s %s %s %s %s\n",argv[0],argv[1],argv[2],argv[3],argv[4]); | ||
939 | #endif | ||
832 | fork_and_execute(DIE, argv[0], argv); | 940 | fork_and_execute(DIE, argv[0], argv); |
833 | } /* End Function action_modload */ | 941 | } /* End Function action_modload */ |
834 | #endif | 942 | #endif |
@@ -850,11 +958,9 @@ static void action_execute (const struct devfsd_notify_struct *info, | |||
850 | char *argv[MAX_ARGS + 1]; | 958 | char *argv[MAX_ARGS + 1]; |
851 | char largv[MAX_ARGS + 1][STRING_LENGTH]; | 959 | char largv[MAX_ARGS + 1][STRING_LENGTH]; |
852 | 960 | ||
853 | #ifdef CONFIG_DEVFSD_DEBUG | 961 | #ifdef CONFIG_DEBUG |
854 | int i; | 962 | int i; |
855 | char buff[1024]; | 963 | char buff[512]; |
856 | |||
857 | msg_logger( NO_DIE, LOG_INFO, "action_execute()\n"); | ||
858 | #endif | 964 | #endif |
859 | 965 | ||
860 | gv_info.info = info; | 966 | gv_info.info = info; |
@@ -870,12 +976,12 @@ static void action_execute (const struct devfsd_notify_struct *info, | |||
870 | } | 976 | } |
871 | argv[count] = NULL; | 977 | argv[count] = NULL; |
872 | 978 | ||
873 | #ifdef CONFIG_DEVFSD_DEBUG | 979 | #ifdef CONFIG_DEBUG |
874 | buff[0]='\0'; | 980 | buff[0]='\0'; |
875 | for(i=0;argv[i]!=NULL;i++) /* argv[i] < MAX_ARGS + 1 */ | 981 | for(i=0;argv[i]!=NULL;i++) /* argv[i] < MAX_ARGS + 1 */ |
876 | { | 982 | { |
877 | strcat(buff," "); | 983 | strcat(buff," "); |
878 | if( (strlen(buff)+ 1 + strlen(argv[i])) >= 1024) | 984 | if( (strlen(buff)+ 1 + strlen(argv[i])) >= 512) |
879 | break; | 985 | break; |
880 | strcat(buff,argv[i]); | 986 | strcat(buff,argv[i]); |
881 | } | 987 | } |
@@ -905,7 +1011,7 @@ static void action_copy (const struct devfsd_notify_struct *info, | |||
905 | char source[STRING_LENGTH], destination[STRING_LENGTH]; | 1011 | char source[STRING_LENGTH], destination[STRING_LENGTH]; |
906 | dest_stat.st_mode = 0; | 1012 | dest_stat.st_mode = 0; |
907 | 1013 | ||
908 | #ifdef CONFIG_DEVFSD_DEBUG | 1014 | #ifdef CONFIG_DEBUG |
909 | msg_logger( NO_DIE, LOG_INFO, "action_copy()\n"); | 1015 | msg_logger( NO_DIE, LOG_INFO, "action_copy()\n"); |
910 | #endif | 1016 | #endif |
911 | 1017 | ||
@@ -913,8 +1019,8 @@ static void action_copy (const struct devfsd_notify_struct *info, | |||
913 | return; | 1019 | return; |
914 | gv_info.info = info; | 1020 | gv_info.info = info; |
915 | gv_info.devname = info->devname; | 1021 | gv_info.devname = info->devname; |
916 | snprintf (gv_info.devpath, sizeof (gv_info.devpath), "%s/%s", mount_point, info->devname); | ||
917 | 1022 | ||
1023 | snprintf (gv_info.devpath, sizeof (gv_info.devpath), "%s/%s", mount_point, info->devname); | ||
918 | expand_expression (source, STRING_LENGTH, entry->u.copy.source, | 1024 | expand_expression (source, STRING_LENGTH, entry->u.copy.source, |
919 | get_variable, &gv_info, gv_info.devname, | 1025 | get_variable, &gv_info, gv_info.devname, |
920 | regexpr, numexpr); | 1026 | regexpr, numexpr); |
@@ -931,8 +1037,8 @@ static void action_copy (const struct devfsd_notify_struct *info, | |||
931 | new_mode |= S_ISVTX; | 1037 | new_mode |= S_ISVTX; |
932 | else if ( (info->type == DEVFSD_NOTIFY_CHANGE) && (dest_stat.st_mode & S_ISVTX) ) | 1038 | else if ( (info->type == DEVFSD_NOTIFY_CHANGE) && (dest_stat.st_mode & S_ISVTX) ) |
933 | new_mode |= S_ISVTX; | 1039 | new_mode |= S_ISVTX; |
934 | #ifdef CONFIG_DEVFSD_VERBOSE | 1040 | #ifdef CONFIG_DEBUG |
935 | if ( !copy_inode (destination, &dest_stat, new_mode, source, &source_stat) ) | 1041 | if ( !copy_inode (destination, &dest_stat, new_mode, source, &source_stat) && (errno != EEXIST)) |
936 | msg_logger( NO_DIE, LOG_ERR, "copy_inode(): %s to %s: %m\n", source, destination); | 1042 | msg_logger( NO_DIE, LOG_ERR, "copy_inode(): %s to %s: %m\n", source, destination); |
937 | #else | 1043 | #else |
938 | copy_inode (destination, &dest_stat, new_mode, source, &source_stat); | 1044 | copy_inode (destination, &dest_stat, new_mode, source, &source_stat); |
@@ -940,8 +1046,7 @@ static void action_copy (const struct devfsd_notify_struct *info, | |||
940 | return; | 1046 | return; |
941 | } /* End Function action_copy */ | 1047 | } /* End Function action_copy */ |
942 | 1048 | ||
943 | static void action_compat (const struct devfsd_notify_struct *info, | 1049 | static void action_compat (const struct devfsd_notify_struct *info, unsigned int action) |
944 | unsigned int action) | ||
945 | /* [SUMMARY] Process a compatibility request. | 1050 | /* [SUMMARY] Process a compatibility request. |
946 | <info> The devfs change. | 1051 | <info> The devfs change. |
947 | <action> The action to take. | 1052 | <action> The action to take. |
@@ -950,12 +1055,23 @@ static void action_compat (const struct devfsd_notify_struct *info, | |||
950 | { | 1055 | { |
951 | const char *compat_name = NULL; | 1056 | const char *compat_name = NULL; |
952 | const char *dest_name = info->devname; | 1057 | const char *dest_name = info->devname; |
953 | char *ptr; | 1058 | char *ptr=NULL; |
954 | char compat_buf[STRING_LENGTH], dest_buf[STRING_LENGTH]; | 1059 | char compat_buf[STRING_LENGTH], dest_buf[STRING_LENGTH]; |
955 | 1060 | int mode, host, bus, target, lun; | |
956 | #ifdef CONFIG_DEVFSD_DEBUG | 1061 | unsigned int i; |
957 | msg_logger( NO_DIE, LOG_INFO, "action_compat()\n"); | 1062 | char rewind_; |
958 | #endif | 1063 | /* 1 to 5 "scsi/" , 6 to 9 "ide/host" */ |
1064 | const char *fmt[] = { NULL , | ||
1065 | "sg/c%db%dt%du%d", /* scsi/generic */ | ||
1066 | "sd/c%db%dt%du%d", /* scsi/disc */ | ||
1067 | "sr/c%db%dt%du%d", /* scsi/cd */ | ||
1068 | "sd/c%db%dt%du%dp%d", /* scsi/part */ | ||
1069 | "st/c%db%dt%du%dm%d%c", /* scsi/mt */ | ||
1070 | "ide/hd/c%db%dt%du%d", /* ide/host/disc */ | ||
1071 | "ide/cd/c%db%dt%du%d", /* ide/host/cd */ | ||
1072 | "ide/hd/c%db%dt%du%dp%d", /* ide/host/part */ | ||
1073 | "ide/mt/c%db%dt%du%d%s", /* ide/host/mt */ | ||
1074 | NULL }; | ||
959 | 1075 | ||
960 | /* First construct compatibility name */ | 1076 | /* First construct compatibility name */ |
961 | switch (action) | 1077 | switch (action) |
@@ -966,80 +1082,58 @@ static void action_compat (const struct devfsd_notify_struct *info, | |||
966 | break; | 1082 | break; |
967 | case AC_MKNEWCOMPAT: | 1083 | case AC_MKNEWCOMPAT: |
968 | case AC_RMNEWCOMPAT: | 1084 | case AC_RMNEWCOMPAT: |
969 | if (strncmp (info->devname, "scsi/", 5) == 0) | 1085 | ptr = strrchr (info->devname, '/') + 1; |
970 | { | 1086 | i=scan_dev_name(info->devname, info->namelen, ptr); |
971 | int mode, host, bus, target, lun; | ||
972 | 1087 | ||
973 | sscanf (info->devname + 5, "host%d/bus%d/target%d/lun%d/", | 1088 | #ifdef CONFIG_DEBUG |
974 | &host, &bus, &target, &lun); | 1089 | msg_logger( NO_DIE, LOG_INFO, "action_compat(): scan_dev_name() returned %d\n", i); |
975 | compat_name = compat_buf; | 1090 | #endif |
976 | snprintf (dest_buf, sizeof (dest_buf), "../%s", info->devname); | 1091 | |
1092 | /* nothing found */ | ||
1093 | if(i==0 || i > 9) | ||
1094 | return; | ||
1095 | |||
1096 | sscanf (info->devname +((i<6)?5:4), "host%d/bus%d/target%d/lun%d/", &host, &bus, &target, &lun); | ||
1097 | snprintf (dest_buf, sizeof (dest_buf), "../%s", info->devname + ((i>5)?4:0)); | ||
977 | dest_name = dest_buf; | 1098 | dest_name = dest_buf; |
978 | if (strncmp (ptr = (strrchr (info->devname, '/') + 1), "mt", 2)== 0) | 1099 | compat_name = compat_buf; |
979 | { | ||
980 | char rewind_ = info->devname[info->namelen - 1]; | ||
981 | 1100 | ||
1101 | |||
1102 | /* 1 == scsi/generic 2 == scsi/disc 3 == scsi/cd 6 == ide/host/disc 7 == ide/host/cd */ | ||
1103 | if( i == 1 || i == 2 || i == 3 || i == 6 || i ==7 ) | ||
1104 | sprintf ( compat_buf, fmt[i], host, bus, target, lun); | ||
1105 | |||
1106 | /* 4 == scsi/part 8 == ide/host/part */ | ||
1107 | if( i == 4 || i == 8) | ||
1108 | sprintf ( compat_buf, fmt[i], host, bus, target, lun, atoi (ptr + 4) ); | ||
1109 | |||
1110 | /* 5 == scsi/mt */ | ||
1111 | if( i == 5) | ||
1112 | { | ||
1113 | rewind_ = info->devname[info->namelen - 1]; | ||
982 | if (rewind_ != 'n') | 1114 | if (rewind_ != 'n') |
983 | rewind_ = '\0'; | 1115 | rewind_ = '\0'; |
984 | 1116 | mode=0; | |
985 | switch (ptr[2]) | 1117 | if(ptr[2] == 'l' /*108*/ || ptr[2] == 'm'/*109*/) |
986 | { | 1118 | mode = ptr[2] - 107; /* 1 or 2 */ |
987 | default: | 1119 | if(ptr[2] == 'a') |
988 | mode = 0; | 1120 | mode = 3; |
989 | break; | 1121 | sprintf (compat_buf, fmt [i], host, bus, target, lun, mode, rewind_); |
990 | case 'l': | ||
991 | mode = 1; | ||
992 | break; | ||
993 | case 'm': | ||
994 | mode = 2; | ||
995 | break; | ||
996 | case 'a': | ||
997 | mode = 3; | ||
998 | break; | ||
999 | } | ||
1000 | sprintf (compat_buf, "st/c%db%dt%du%dm%d%c", host, bus, target, lun, mode, rewind_); | ||
1001 | } | 1122 | } |
1002 | else if (strcmp (info->devname + info->namelen - 7,"generic") == 0) | ||
1003 | sprintf (compat_buf, "sg/c%db%dt%du%d", | ||
1004 | host, bus, target, lun); | ||
1005 | else if (strcmp (info->devname + info->namelen - 2, "cd") == 0) | ||
1006 | sprintf (compat_buf, "sr/c%db%dt%du%d", | ||
1007 | host, bus, target, lun); | ||
1008 | else if (strcmp (info->devname + info->namelen - 4, "disc") == 0) | ||
1009 | sprintf (compat_buf, "sd/c%db%dt%du%d", | ||
1010 | host, bus, target, lun); | ||
1011 | else if (strncmp (ptr = (strrchr (info->devname, '/') + 1), "part", 4) == 0) | ||
1012 | sprintf ( compat_buf, "sd/c%db%dt%du%dp%d", | ||
1013 | host, bus, target, lun, atoi (ptr + 4) ); | ||
1014 | else compat_name = NULL; | ||
1015 | } | ||
1016 | else if (strncmp (info->devname, "ide/host", 8) == 0) | ||
1017 | { | ||
1018 | int host, bus, target, lun; | ||
1019 | 1123 | ||
1020 | sscanf (info->devname + 4, "host%d/bus%d/target%d/lun%d/", | 1124 | /* 9 == ide/host/mt */ |
1021 | &host, &bus, &target, &lun); | 1125 | if( i == 9 ) |
1022 | compat_name = compat_buf; | 1126 | snprintf (compat_buf, sizeof (compat_buf), fmt[i], host, bus, target, lun, ptr + 2); |
1023 | snprintf (dest_buf, sizeof (dest_buf), "../%s", info->devname + 4); | 1127 | /* esac */ |
1024 | dest_name = dest_buf; | 1128 | } /* switch(action) */ |
1025 | if (strcmp (info->devname + info->namelen - 4, "disc") == 0) | 1129 | |
1026 | sprintf (compat_buf, "ide/hd/c%db%dt%du%d", | 1130 | if(compat_name == NULL ) |
1027 | host, bus, target, lun); | ||
1028 | else if (strncmp (ptr = (strrchr (info->devname, '/') + 1), "part", 4) == 0) | ||
1029 | sprintf ( compat_buf, "ide/hd/c%db%dt%du%dp%d", | ||
1030 | host, bus, target, lun, atoi (ptr + 4) ); | ||
1031 | else if (strcmp (info->devname + info->namelen - 2, "cd") == 0) | ||
1032 | sprintf (compat_buf, "ide/cd/c%db%dt%du%d", | ||
1033 | host, bus, target,lun); | ||
1034 | else if (strncmp (ptr = (strrchr (info->devname, '/') + 1), "mt", 2) == 0) | ||
1035 | snprintf (compat_buf, sizeof (compat_buf), "ide/mt/c%db%dt%du%d%s", | ||
1036 | host, bus, target, lun, ptr + 2); | ||
1037 | else compat_name = NULL; | ||
1038 | } | ||
1039 | break; | ||
1040 | } | ||
1041 | if (compat_name == NULL) | ||
1042 | return; | 1131 | return; |
1132 | |||
1133 | #ifdef CONFIG_DEBUG | ||
1134 | msg_logger( NO_DIE, LOG_INFO, "action_compat(): %s\n", compat_name); | ||
1135 | #endif | ||
1136 | |||
1043 | /* Now decide what to do with it */ | 1137 | /* Now decide what to do with it */ |
1044 | switch (action) | 1138 | switch (action) |
1045 | { | 1139 | { |
@@ -1049,14 +1143,15 @@ static void action_compat (const struct devfsd_notify_struct *info, | |||
1049 | break; | 1143 | break; |
1050 | case AC_RMOLDCOMPAT: | 1144 | case AC_RMOLDCOMPAT: |
1051 | case AC_RMNEWCOMPAT: | 1145 | case AC_RMNEWCOMPAT: |
1052 | #ifdef CONFIG_DEVFSD_VERBOSE | 1146 | #ifdef CONFIG_DEBUG |
1053 | if (unlink (compat_name) != 0) | 1147 | if (unlink (compat_name) != 0) |
1054 | msg_logger( NO_DIE, LOG_ERR, "unlink(): %s: %m\n", compat_name); | 1148 | msg_logger( NO_DIE, LOG_ERR, "unlink(): %s: %m\n", compat_name); |
1055 | #else | 1149 | #else |
1056 | unlink (compat_name); | 1150 | unlink (compat_name); |
1057 | #endif | 1151 | #endif |
1058 | break; | 1152 | break; |
1059 | } | 1153 | /*esac*/ |
1154 | } /* switch(action) */ | ||
1060 | } /* End Function action_compat */ | 1155 | } /* End Function action_compat */ |
1061 | 1156 | ||
1062 | static void restore(char *spath, struct stat source_stat, int rootlen) | 1157 | static void restore(char *spath, struct stat source_stat, int rootlen) |
@@ -1064,7 +1159,7 @@ static void restore(char *spath, struct stat source_stat, int rootlen) | |||
1064 | char dpath[STRING_LENGTH]; | 1159 | char dpath[STRING_LENGTH]; |
1065 | struct stat dest_stat; | 1160 | struct stat dest_stat; |
1066 | 1161 | ||
1067 | #ifdef CONFIG_DEVFSD_DEBUG | 1162 | #ifdef CONFIG_DEBUG |
1068 | msg_logger( NO_DIE, LOG_INFO, "restore()\n"); | 1163 | msg_logger( NO_DIE, LOG_INFO, "restore()\n"); |
1069 | #endif | 1164 | #endif |
1070 | 1165 | ||
@@ -1092,8 +1187,13 @@ static int copy_inode (const char *destpath, const struct stat *dest_stat, | |||
1092 | [RETURNS] TRUE on success, else FALSE. | 1187 | [RETURNS] TRUE on success, else FALSE. |
1093 | */ | 1188 | */ |
1094 | { | 1189 | { |
1190 | int source_len, dest_len; | ||
1191 | char source_link[STRING_LENGTH], dest_link[STRING_LENGTH]; | ||
1192 | int fd, val; | ||
1193 | struct sockaddr_un un_addr; | ||
1194 | char symlink_val[STRING_LENGTH]; | ||
1095 | 1195 | ||
1096 | #ifdef CONFIG_DEVFSD_DEBUG | 1196 | #ifdef CONFIG_DEBUG |
1097 | msg_logger( NO_DIE, LOG_INFO, "copy_inode()\n"); | 1197 | msg_logger( NO_DIE, LOG_INFO, "copy_inode()\n"); |
1098 | #endif | 1198 | #endif |
1099 | 1199 | ||
@@ -1102,10 +1202,6 @@ static int copy_inode (const char *destpath, const struct stat *dest_stat, | |||
1102 | /* Same type */ | 1202 | /* Same type */ |
1103 | if ( S_ISLNK (source_stat->st_mode) ) | 1203 | if ( S_ISLNK (source_stat->st_mode) ) |
1104 | { | 1204 | { |
1105 | int source_len, dest_len; | ||
1106 | char source_link[STRING_LENGTH], dest_link[STRING_LENGTH]; | ||
1107 | |||
1108 | |||
1109 | if (( source_len = readlink (sourcepath, source_link, STRING_LENGTH - 1) ) < 0 || | 1205 | if (( source_len = readlink (sourcepath, source_link, STRING_LENGTH - 1) ) < 0 || |
1110 | ( dest_len = readlink (destpath , dest_link , STRING_LENGTH - 1) ) < 0 ) | 1206 | ( dest_len = readlink (destpath , dest_link , STRING_LENGTH - 1) ) < 0 ) |
1111 | return (FALSE); | 1207 | return (FALSE); |
@@ -1126,10 +1222,6 @@ static int copy_inode (const char *destpath, const struct stat *dest_stat, | |||
1126 | unlink (destpath); | 1222 | unlink (destpath); |
1127 | switch (source_stat->st_mode & S_IFMT) | 1223 | switch (source_stat->st_mode & S_IFMT) |
1128 | { | 1224 | { |
1129 | int fd, val; | ||
1130 | struct sockaddr_un un_addr; | ||
1131 | char symlink_val[STRING_LENGTH]; | ||
1132 | |||
1133 | case S_IFSOCK: | 1225 | case S_IFSOCK: |
1134 | if ( ( fd = socket (AF_UNIX, SOCK_STREAM, 0) ) < 0 ) | 1226 | if ( ( fd = socket (AF_UNIX, SOCK_STREAM, 0) ) < 0 ) |
1135 | break; | 1227 | break; |
@@ -1179,7 +1271,7 @@ static void free_config () | |||
1179 | struct config_entry_struct *c_entry; | 1271 | struct config_entry_struct *c_entry; |
1180 | void *next; | 1272 | void *next; |
1181 | 1273 | ||
1182 | #ifdef CONFIG_DEVFSD_DEBUG | 1274 | #ifdef CONFIG_DEBUG |
1183 | msg_logger( NO_DIE, LOG_INFO, "free_config()\n"); | 1275 | msg_logger( NO_DIE, LOG_INFO, "free_config()\n"); |
1184 | #endif | 1276 | #endif |
1185 | 1277 | ||
@@ -1213,9 +1305,11 @@ static int get_uid_gid (int flag, const char *string) | |||
1213 | { | 1305 | { |
1214 | struct passwd *pw_ent; | 1306 | struct passwd *pw_ent; |
1215 | struct group *grp_ent; | 1307 | struct group *grp_ent; |
1308 | #ifdef CONFIG_DEVFSD_VERBOSE | ||
1216 | char * msg="user"; | 1309 | char * msg="user"; |
1310 | #endif | ||
1217 | 1311 | ||
1218 | #ifdef CONFIG_DEVFSD_DEBUG | 1312 | #ifdef CONFIG_DEBUG |
1219 | msg_logger( NO_DIE, LOG_INFO, "get_uid_gid()\n"); | 1313 | msg_logger( NO_DIE, LOG_INFO, "get_uid_gid()\n"); |
1220 | 1314 | ||
1221 | 1315 | ||
@@ -1231,10 +1325,12 @@ static int get_uid_gid (int flag, const char *string) | |||
1231 | 1325 | ||
1232 | if ( flag == GID && ( grp_ent = getgrnam (string) ) != NULL ) | 1326 | if ( flag == GID && ( grp_ent = getgrnam (string) ) != NULL ) |
1233 | return (grp_ent->gr_gid); | 1327 | return (grp_ent->gr_gid); |
1328 | #ifdef CONFIG_DEVFSD_VERBOSE | ||
1234 | else | 1329 | else |
1235 | msg="group"; | 1330 | msg="group"; |
1236 | 1331 | ||
1237 | msg_logger( NO_DIE, LOG_ERR,"unknown %s: %s, defaulting to %cID=0\n", msg, string, msg[0] - 32); | 1332 | msg_logger( NO_DIE, LOG_ERR,"unknown %s: %s, defaulting to %cID=0\n", msg, string, msg[0] - 32); |
1333 | #endif | ||
1238 | return (0); | 1334 | return (0); |
1239 | }/* End Function get_uid_gid */ | 1335 | }/* End Function get_uid_gid */ |
1240 | 1336 | ||
@@ -1246,14 +1342,18 @@ static mode_t get_mode (const char *string) | |||
1246 | { | 1342 | { |
1247 | mode_t mode; | 1343 | mode_t mode; |
1248 | int i; | 1344 | int i; |
1249 | #ifdef CONFIG_DEVFSD_DEBUG | 1345 | #ifdef CONFIG_DEBUG |
1250 | msg_logger( NO_DIE, LOG_INFO, "get_mode()\n"); | 1346 | msg_logger( NO_DIE, LOG_INFO, "get_mode()\n"); |
1251 | #endif | 1347 | #endif |
1252 | 1348 | ||
1253 | if ( isdigit (string[0]) ) | 1349 | if ( isdigit (string[0]) ) |
1254 | return strtoul (string, NULL, 8); | 1350 | return strtoul (string, NULL, 8); |
1255 | if (strlen (string) != 9) | 1351 | if (strlen (string) != 9) |
1352 | #ifdef CONFIG_DEVFSD_VERBOSE | ||
1256 | msg_logger( DIE, LOG_ERR, "bad mode: %s\n", string); | 1353 | msg_logger( DIE, LOG_ERR, "bad mode: %s\n", string); |
1354 | #else | ||
1355 | exit(EXIT_FAILURE); | ||
1356 | #endif | ||
1257 | mode = 0; | 1357 | mode = 0; |
1258 | i= S_IRUSR; | 1358 | i= S_IRUSR; |
1259 | while(i>0) | 1359 | while(i>0) |
@@ -1268,7 +1368,7 @@ static mode_t get_mode (const char *string) | |||
1268 | 1368 | ||
1269 | static void signal_handler (int sig) | 1369 | static void signal_handler (int sig) |
1270 | { | 1370 | { |
1271 | #ifdef CONFIG_DEVFSD_DEBUG | 1371 | #ifdef CONFIG_DEBUG |
1272 | msg_logger( NO_DIE, LOG_INFO, "signal_handler()\n"); | 1372 | msg_logger( NO_DIE, LOG_INFO, "signal_handler()\n"); |
1273 | #endif | 1373 | #endif |
1274 | 1374 | ||
@@ -1284,48 +1384,53 @@ static const char *get_variable (const char *variable, void *info) | |||
1284 | { | 1384 | { |
1285 | struct get_variable_info *gv_info = info; | 1385 | struct get_variable_info *gv_info = info; |
1286 | static char hostname[STRING_LENGTH], sbuf[STRING_LENGTH]; | 1386 | static char hostname[STRING_LENGTH], sbuf[STRING_LENGTH]; |
1287 | 1387 | const char *field_names[] = { "hostname", "mntpt", "devpath", "devname", | |
1288 | #ifdef CONFIG_DEVFSD_DEBUG | 1388 | "uid", "gid", "mode", hostname, mount_point, |
1389 | gv_info->devpath, gv_info->devname, 0 }; | ||
1390 | short int i; | ||
1391 | #ifdef CONFIG_DEBUG | ||
1289 | msg_logger( NO_DIE, LOG_INFO, "get_variable()\n"); | 1392 | msg_logger( NO_DIE, LOG_INFO, "get_variable()\n"); |
1290 | #endif | 1393 | #endif |
1291 | 1394 | ||
1292 | if (gethostname (hostname, STRING_LENGTH - 1) != 0) | 1395 | if (gethostname (hostname, STRING_LENGTH - 1) != 0) |
1396 | #ifdef CONFIG_DEVFSD_VERBOSE | ||
1293 | msg_logger( DIE, LOG_ERR, "gethostname(): %m\n"); | 1397 | msg_logger( DIE, LOG_ERR, "gethostname(): %m\n"); |
1398 | #else | ||
1399 | exit(EXIT_FAILURE); | ||
1400 | #endif | ||
1294 | /* Here on error we should do exit(RV_SYS_ERROR), instead we do exit(EXIT_FAILURE) */ | 1401 | /* Here on error we should do exit(RV_SYS_ERROR), instead we do exit(EXIT_FAILURE) */ |
1295 | hostname[STRING_LENGTH - 1] = '\0'; | 1402 | hostname[STRING_LENGTH - 1] = '\0'; |
1296 | if (strcmp (variable, "hostname") == 0) | 1403 | |
1297 | return (hostname); | 1404 | /* compare_string_array returns i>=0 */ |
1298 | if (strcmp (variable, "mntpnt") == 0) | 1405 | i=compare_string_array(field_names, variable); |
1299 | return (mount_point); | 1406 | |
1300 | if (gv_info == NULL) | 1407 | if ( i > 6 && (i > 1 && gv_info == NULL)) |
1301 | return (NULL); | 1408 | return (NULL); |
1302 | if (strcmp (variable, "devpath") == 0) | 1409 | if( i >= 0 || i <= 3) |
1303 | return (gv_info->devpath); | ||
1304 | if (strcmp (variable, "devname") == 0) | ||
1305 | return (gv_info->devname); | ||
1306 | if (strcmp (variable, "mode") == 0) | ||
1307 | { | 1410 | { |
1308 | sprintf (sbuf, "%o", gv_info->info->mode); | 1411 | #ifdef CONFIG_DEBUG |
1309 | return (sbuf); | 1412 | msg_logger( NO_DIE, LOG_INFO, "get_variable(): i=%d %s\n",i ,field_names[i+7]); |
1413 | #endif | ||
1414 | return(field_names[i+7]); | ||
1310 | } | 1415 | } |
1311 | if (strcmp (variable, "uid") == 0) | 1416 | |
1312 | { | 1417 | if(i == 4 ) |
1313 | sprintf (sbuf, "%u", gv_info->info->uid); | 1418 | sprintf (sbuf, "%u", gv_info->info->uid); |
1314 | return (sbuf); | 1419 | else if(i == 5) |
1315 | } | ||
1316 | if (strcmp (variable, "gid") == 0) | ||
1317 | { | ||
1318 | sprintf (sbuf, "%u", gv_info->info->gid); | 1420 | sprintf (sbuf, "%u", gv_info->info->gid); |
1319 | return (sbuf); | 1421 | else if(i == 6) |
1320 | } | 1422 | sprintf (sbuf, "%o", gv_info->info->mode); |
1321 | return (NULL); | 1423 | #ifdef CONFIG_DEBUG |
1424 | msg_logger( NO_DIE, LOG_INFO, "get_variable(): %s\n", sbuf); | ||
1425 | #endif | ||
1426 | return (sbuf); | ||
1322 | } /* End Function get_variable */ | 1427 | } /* End Function get_variable */ |
1323 | 1428 | ||
1324 | static void service(struct stat statbuf, char *path) | 1429 | static void service(struct stat statbuf, char *path) |
1325 | { | 1430 | { |
1326 | struct devfsd_notify_struct info; | 1431 | struct devfsd_notify_struct info; |
1327 | 1432 | ||
1328 | #ifdef CONFIG_DEVFSD_DEBUG | 1433 | #ifdef CONFIG_DEBUG |
1329 | msg_logger( NO_DIE, LOG_INFO, "service()\n"); | 1434 | msg_logger( NO_DIE, LOG_INFO, "service()\n"); |
1330 | #endif | 1435 | #endif |
1331 | 1436 | ||
@@ -1358,26 +1463,31 @@ static void dir_operation(int type, const char * dir_name, int var, unsigned lon | |||
1358 | char path[STRING_LENGTH]; | 1463 | char path[STRING_LENGTH]; |
1359 | 1464 | ||
1360 | 1465 | ||
1361 | #ifdef CONFIG_DEVFSD_DEBUG | 1466 | #ifdef CONFIG_DEBUG |
1362 | msg_logger( NO_DIE, LOG_INFO, "dir_operation()\n"); | 1467 | msg_logger( NO_DIE, LOG_INFO, "dir_operation()\n"); |
1363 | #endif | 1468 | #endif |
1364 | 1469 | ||
1365 | if((dp = opendir( dir_name))==NULL) | 1470 | if((dp = opendir( dir_name))==NULL) |
1366 | { | 1471 | { |
1472 | #ifdef CONFIG_DEBUG | ||
1367 | msg_logger( NO_DIE, LOG_ERR, "opendir(): %s: %m\n", dir_name); | 1473 | msg_logger( NO_DIE, LOG_ERR, "opendir(): %s: %m\n", dir_name); |
1474 | #endif | ||
1368 | return; | 1475 | return; |
1369 | } | 1476 | } |
1370 | 1477 | ||
1371 | while ( (de = readdir (dp) ) != NULL ) | 1478 | while ( (de = readdir (dp) ) != NULL ) |
1372 | { | 1479 | { |
1373 | 1480 | ||
1374 | if ( (strcmp (de->d_name, ".") == 0) || (strcmp (de->d_name, "..") == 0) ) | 1481 | if(de->d_name && *de->d_name == '.' && (!de->d_name[1] || (de->d_name[1] == '.' && !de->d_name[2]))) |
1375 | continue; | 1482 | continue; |
1376 | snprintf (path, sizeof (path), "%s%s%s", dir_name,(last_char_is(dir_name,'/')==NULL)?"/":"", de->d_name); | 1483 | snprintf (path, sizeof (path), "%s/%s", dir_name, de->d_name); |
1484 | #ifdef CONFIG_DEBUG | ||
1485 | msg_logger( NO_DIE, LOG_ERR, "dir_operation(): %s\n", path); | ||
1486 | #endif | ||
1377 | 1487 | ||
1378 | if (lstat (path, &statbuf) != 0) | 1488 | if (lstat (path, &statbuf) != 0) |
1379 | { | 1489 | { |
1380 | #ifdef CONFIG_DEVFSD_VERBOSE | 1490 | #ifdef CONFIG_DEBUG |
1381 | msg_logger( NO_DIE, LOG_ERR, "%s: %m\n", path); | 1491 | msg_logger( NO_DIE, LOG_ERR, "%s: %m\n", path); |
1382 | #endif | 1492 | #endif |
1383 | continue; | 1493 | continue; |
@@ -1405,7 +1515,7 @@ static int mksymlink (const char *oldpath, const char *newpath) | |||
1405 | [RETURNS] 0 on success, else -1. | 1515 | [RETURNS] 0 on success, else -1. |
1406 | */ | 1516 | */ |
1407 | { | 1517 | { |
1408 | #ifdef CONFIG_DEVFSD_DEBUG | 1518 | #ifdef CONFIG_DEBUG |
1409 | msg_logger( NO_DIE, LOG_INFO, "mksymlink()\n", newpath); | 1519 | msg_logger( NO_DIE, LOG_INFO, "mksymlink()\n", newpath); |
1410 | #endif | 1520 | #endif |
1411 | 1521 | ||
@@ -1415,11 +1525,13 @@ static int mksymlink (const char *oldpath, const char *newpath) | |||
1415 | 1525 | ||
1416 | if (symlink (oldpath, newpath) != 0) | 1526 | if (symlink (oldpath, newpath) != 0) |
1417 | { | 1527 | { |
1418 | #ifdef CONFIG_DEVFSD_VERBOSE | ||
1419 | msg_logger( NO_DIE, LOG_ERR, "symlink(): %s to %s: %m\n", oldpath, newpath); | ||
1420 | #endif | ||
1421 | if (errno != EEXIST) | 1528 | if (errno != EEXIST) |
1529 | { | ||
1530 | #ifdef CONFIG_DEBUG | ||
1531 | msg_logger( NO_DIE, LOG_ERR, "mksymlink(): %s to %s: %m\n", oldpath, newpath); | ||
1532 | #endif | ||
1422 | return (-1); | 1533 | return (-1); |
1534 | } | ||
1423 | } | 1535 | } |
1424 | return (0); | 1536 | return (0); |
1425 | } /* End Function mksymlink */ | 1537 | } /* End Function mksymlink */ |
@@ -1431,12 +1543,12 @@ static int make_dir_tree (const char *path) | |||
1431 | [RETURNS] TRUE on success, else FALSE. | 1543 | [RETURNS] TRUE on success, else FALSE. |
1432 | */ | 1544 | */ |
1433 | { | 1545 | { |
1434 | #ifdef CONFIG_DEVFSD_DEBUG | 1546 | #ifdef CONFIG_DEBUG |
1435 | msg_logger( NO_DIE, LOG_INFO, "make_dir_tree()\n"); | 1547 | msg_logger( NO_DIE, LOG_INFO, "make_dir_tree()\n"); |
1436 | #endif | 1548 | #endif |
1437 | if (bb_make_directory( dirname((char *)path), S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH ,FILEUTILS_RECUR )==-1) | 1549 | if (bb_make_directory( dirname((char *)path), S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH ,FILEUTILS_RECUR )==-1) |
1438 | { | 1550 | { |
1439 | #ifdef CONFIG_DEVFSD_VERBOSE | 1551 | #ifdef CONFIG_DEBUG |
1440 | msg_logger( NO_DIE, LOG_ERR, "make_dir_tree(): %s: %m\n", path); | 1552 | msg_logger( NO_DIE, LOG_ERR, "make_dir_tree(): %s: %m\n", path); |
1441 | #endif | 1553 | #endif |
1442 | return (FALSE); | 1554 | return (FALSE); |
@@ -1467,7 +1579,7 @@ static int expand_expression(char *output, unsigned int outsize, | |||
1467 | { | 1579 | { |
1468 | char temp[STRING_LENGTH]; | 1580 | char temp[STRING_LENGTH]; |
1469 | 1581 | ||
1470 | #ifdef CONFIG_DEVFSD_DEBUG | 1582 | #ifdef CONFIG_DEBUG |
1471 | msg_logger( NO_DIE, LOG_INFO, "expand_expression()\n"); | 1583 | msg_logger( NO_DIE, LOG_INFO, "expand_expression()\n"); |
1472 | #endif | 1584 | #endif |
1473 | 1585 | ||
@@ -1498,7 +1610,7 @@ static void expand_regexp (char *output, size_t outsize, const char *input, | |||
1498 | const char last_exp = '0' - 1 + numex; | 1610 | const char last_exp = '0' - 1 + numex; |
1499 | int c = -1; | 1611 | int c = -1; |
1500 | 1612 | ||
1501 | #ifdef CONFIG_DEVFSD_DEBUG | 1613 | #ifdef CONFIG_DEBUG |
1502 | msg_logger( NO_DIE, LOG_INFO, "expand_regexp()\n"); | 1614 | msg_logger( NO_DIE, LOG_INFO, "expand_regexp()\n"); |
1503 | #endif | 1615 | #endif |
1504 | 1616 | ||
@@ -1597,14 +1709,35 @@ const char *get_old_name (const char *devname, unsigned int namelen, | |||
1597 | const char *compat_name = NULL; | 1709 | const char *compat_name = NULL; |
1598 | char *ptr; | 1710 | char *ptr; |
1599 | struct translate_struct *trans; | 1711 | struct translate_struct *trans; |
1600 | 1712 | unsigned int i; | |
1601 | #ifdef CONFIG_DEVFSD_DEBUG | 1713 | char mode; |
1714 | int indexx; | ||
1715 | const char *pty1; | ||
1716 | const char *pty2; | ||
1717 | size_t len; | ||
1718 | /* 1 to 5 "scsi/" , 6 to 9 "ide/host", 10 sbp/, 11 vcc/, 12 pty/ */ | ||
1719 | const char *fmt[] = { NULL , | ||
1720 | "sg%u", /* scsi/generic */ | ||
1721 | NULL, /* scsi/disc */ | ||
1722 | "sr%u", /* scsi/cd */ | ||
1723 | NULL, /* scsi/part */ | ||
1724 | "nst%u%c", /* scsi/mt */ | ||
1725 | "hd%c" , /* ide/host/disc */ | ||
1726 | "hd%c" , /* ide/host/cd */ | ||
1727 | "hd%c%s", /* ide/host/part */ | ||
1728 | "%sht%d", /* ide/host/mt */ | ||
1729 | "sbpcd%u", /* sbp/ */ | ||
1730 | "vcs%s", /* vcc/ */ | ||
1731 | "%cty%c%c", /* pty/ */ | ||
1732 | NULL }; | ||
1733 | |||
1734 | #ifdef CONFIG_DEBUG | ||
1602 | msg_logger( NO_DIE, LOG_INFO, "get_old_name()\n"); | 1735 | msg_logger( NO_DIE, LOG_INFO, "get_old_name()\n"); |
1603 | #endif | 1736 | #endif |
1604 | 1737 | ||
1605 | for (trans = translate_table; trans->match != NULL; ++trans) | 1738 | for (trans = translate_table; trans->match != NULL; ++trans) |
1606 | { | 1739 | { |
1607 | size_t len = strlen (trans->match); | 1740 | len = strlen (trans->match); |
1608 | 1741 | ||
1609 | if (strncmp (devname, trans->match, len) == 0) | 1742 | if (strncmp (devname, trans->match, len) == 0) |
1610 | { | 1743 | { |
@@ -1614,80 +1747,64 @@ const char *get_old_name (const char *devname, unsigned int namelen, | |||
1614 | return (buffer); | 1747 | return (buffer); |
1615 | } | 1748 | } |
1616 | } | 1749 | } |
1617 | if (strncmp (devname, "sbp/", 4) == 0) | 1750 | |
1618 | { | 1751 | ptr = (strrchr (devname, '/') + 1); |
1619 | sprintf (buffer, "sbpcd%u", minor); | 1752 | i = scan_dev_name(devname, namelen, ptr); |
1753 | |||
1754 | if( i > 0 && i < 13) | ||
1620 | compat_name = buffer; | 1755 | compat_name = buffer; |
1756 | else | ||
1757 | return NULL; | ||
1758 | |||
1759 | #ifdef CONFIG_DEBUG | ||
1760 | msg_logger( NO_DIE, LOG_INFO, "get_old_name(): scan_dev_name() returned %d\n", i); | ||
1761 | #endif | ||
1762 | |||
1763 | /* 1 == scsi/generic, 3 == scsi/cd, 10 == sbp/ */ | ||
1764 | if( i == 1 || i == 3 || i == 10 ) | ||
1765 | sprintf (buffer, fmt[i], minor); | ||
1766 | |||
1767 | /* 2 ==scsi/disc, 4 == scsi/part */ | ||
1768 | if( i == 2 || i == 4) | ||
1769 | compat_name = write_old_sd_name (buffer, major, minor,((i == 2)?"":(ptr + 4))); | ||
1770 | |||
1771 | /* 5 == scsi/mt */ | ||
1772 | if( i == 5) | ||
1773 | { | ||
1774 | mode = ptr[2]; | ||
1775 | if (mode == 'n') | ||
1776 | mode = '\0'; | ||
1777 | sprintf (buffer, fmt[i], minor & 0x1f, mode); | ||
1778 | if (devname[namelen - 1] != 'n') | ||
1779 | ++compat_name; | ||
1621 | } | 1780 | } |
1622 | else if (strncmp (devname, "scsi/", 5) == 0) | 1781 | /* 6 == ide/host/disc, 7 == ide/host/cd, 8 == ide/host/part */ |
1623 | { /* All SCSI devices */ | 1782 | if( i == 6 || i == 7 || i == 8 ) |
1624 | if (strcmp (devname + namelen - 7, "generic") == 0) | 1783 | sprintf (buffer, fmt[i] , get_old_ide_name (major, minor), ptr + 4); /* last arg should be ignored for i == 6 or i== 7 */ |
1625 | { | 1784 | |
1626 | sprintf (buffer, "sg%u", minor); | 1785 | /* 9 == ide/host/mt */ |
1627 | compat_name = buffer; | 1786 | if( i == 9 ) |
1628 | } | 1787 | sprintf (buffer, fmt[i], ptr + 2, minor & 0x7f); |
1629 | else if (strncmp (ptr = (strrchr (devname, '/') + 1), "mt", 2) == 0) | 1788 | |
1630 | { | 1789 | /* 11 == vcc/ */ |
1631 | char mode = ptr[2]; | 1790 | if( i == 11 ) |
1632 | |||
1633 | if (mode == 'n') | ||
1634 | mode = '\0'; | ||
1635 | sprintf (buffer, "nst%u%c", minor & 0x1f, mode); | ||
1636 | compat_name = buffer; | ||
1637 | if (devname[namelen - 1] != 'n') | ||
1638 | ++compat_name; | ||
1639 | } | ||
1640 | else if (strcmp (devname + namelen - 2, "cd") == 0) | ||
1641 | { | ||
1642 | sprintf (buffer, "sr%u", minor); | ||
1643 | compat_name = buffer; | ||
1644 | } | ||
1645 | else if (strcmp (devname + namelen - 4, "disc") == 0) | ||
1646 | compat_name = write_old_sd_name (buffer, major, minor, ""); | ||
1647 | else if (strncmp (ptr = (strrchr (devname, '/') + 1), "part", 4) == 0) | ||
1648 | compat_name = write_old_sd_name (buffer, major, minor, ptr + 4); | ||
1649 | return (compat_name); | ||
1650 | } | ||
1651 | else if (strncmp (devname, "ide/host", 8) == 0) | ||
1652 | { /* All IDE devices */ | ||
1653 | if (strncmp (ptr = (strrchr (devname, '/') + 1), "mt", 2) == 0) | ||
1654 | { | ||
1655 | sprintf (buffer, "%sht%d", ptr + 2, minor & 0x7f); | ||
1656 | compat_name = buffer; | ||
1657 | } | ||
1658 | else if (strcmp (devname + namelen - 4, "disc") == 0) | ||
1659 | { | ||
1660 | sprintf ( buffer, "hd%c", get_old_ide_name (major, minor) ); | ||
1661 | compat_name = buffer; | ||
1662 | } | ||
1663 | else if (strncmp (ptr = (strrchr (devname, '/') + 1), "part", 4) == 0) | ||
1664 | { | ||
1665 | sprintf (buffer, "hd%c%s", get_old_ide_name (major, minor), ptr + 4); | ||
1666 | compat_name = buffer; | ||
1667 | } | ||
1668 | else if (strcmp (devname + namelen - 2, "cd") == 0) | ||
1669 | { | ||
1670 | sprintf ( buffer, "hd%c", get_old_ide_name (major, minor) ); | ||
1671 | compat_name = buffer; | ||
1672 | } | ||
1673 | return (compat_name); | ||
1674 | } | ||
1675 | else if (strncmp (devname, "vcc/", 4) == 0) | ||
1676 | { | 1791 | { |
1677 | sprintf (buffer, "vcs%s", devname + 4); | 1792 | sprintf (buffer, fmt[i], devname + 4); |
1678 | if (buffer[3] == '0') | 1793 | if (buffer[3] == '0') |
1679 | buffer[3] = '\0'; | 1794 | buffer[3] = '\0'; |
1680 | compat_name = buffer; | ||
1681 | } | 1795 | } |
1682 | else if (strncmp (devname, "pty/", 4) == 0) | 1796 | /* 12 == pty/ */ |
1797 | if( i == 12 ) | ||
1683 | { | 1798 | { |
1684 | int indexx = atoi (devname + 5); | 1799 | pty1 = "pqrstuvwxyzabcde"; |
1685 | const char *pty1 = "pqrstuvwxyzabcde"; | 1800 | pty2 = "0123456789abcdef"; |
1686 | const char *pty2 = "0123456789abcdef"; | 1801 | indexx = atoi (devname + 5); |
1687 | 1802 | sprintf (buffer, fmt[i], (devname[4] == 'm') ? 'p' : 't', pty1[indexx >> 4], pty2[indexx & 0x0f]); | |
1688 | sprintf (buffer, "%cty%c%c", (devname[4] == 'm') ? 'p' : 't', pty1[indexx >> 4], pty2[indexx & 0x0f]); | ||
1689 | compat_name = buffer; | ||
1690 | } | 1803 | } |
1804 | #ifdef CONFIG_DEBUG | ||
1805 | if(compat_name!=NULL) | ||
1806 | msg_logger( NO_DIE, LOG_INFO, "get_old_name(): compat_name %s\n", compat_name); | ||
1807 | #endif | ||
1691 | return (compat_name); | 1808 | return (compat_name); |
1692 | } /* End Function get_old_name */ | 1809 | } /* End Function get_old_name */ |
1693 | 1810 | ||
@@ -1702,7 +1819,7 @@ static char get_old_ide_name (unsigned int major, unsigned int minor) | |||
1702 | char c='a'; /* 97 */ | 1819 | char c='a'; /* 97 */ |
1703 | int i=IDE0_MAJOR; | 1820 | int i=IDE0_MAJOR; |
1704 | 1821 | ||
1705 | #ifdef CONFIG_DEVFSD_DEBUG | 1822 | #ifdef CONFIG_DEBUG |
1706 | msg_logger( NO_DIE, LOG_INFO, "get_old_ide_name()\n"); | 1823 | msg_logger( NO_DIE, LOG_INFO, "get_old_ide_name()\n"); |
1707 | #endif | 1824 | #endif |
1708 | 1825 | ||
@@ -1741,7 +1858,7 @@ static char *write_old_sd_name (char *buffer, | |||
1741 | { | 1858 | { |
1742 | unsigned int disc_index; | 1859 | unsigned int disc_index; |
1743 | 1860 | ||
1744 | #ifdef CONFIG_DEVFSD_DEBUG | 1861 | #ifdef CONFIG_DEBUG |
1745 | msg_logger( NO_DIE, LOG_INFO, "write_old_sd_name()\n"); | 1862 | msg_logger( NO_DIE, LOG_INFO, "write_old_sd_name()\n"); |
1746 | #endif | 1863 | #endif |
1747 | 1864 | ||
@@ -1790,7 +1907,7 @@ int st_expr_expand (char *output, unsigned int length, const char *input, | |||
1790 | struct passwd *pwent; | 1907 | struct passwd *pwent; |
1791 | char buffer[BUFFER_SIZE], tmp[STRING_LENGTH]; | 1908 | char buffer[BUFFER_SIZE], tmp[STRING_LENGTH]; |
1792 | 1909 | ||
1793 | #ifdef CONFIG_DEVFSD_DEBUG | 1910 | #ifdef CONFIG_DEBUG |
1794 | msg_logger( NO_DIE, LOG_INFO, "st_expr_expand()\n"); | 1911 | msg_logger( NO_DIE, LOG_INFO, "st_expr_expand()\n"); |
1795 | #endif | 1912 | #endif |
1796 | 1913 | ||
@@ -1837,7 +1954,7 @@ int st_expr_expand (char *output, unsigned int length, const char *input, | |||
1837 | if ( ( pwent = getpwnam (tmp) ) == NULL ) | 1954 | if ( ( pwent = getpwnam (tmp) ) == NULL ) |
1838 | { | 1955 | { |
1839 | #ifdef CONFIG_DEVFSD_VERBOSE | 1956 | #ifdef CONFIG_DEVFSD_VERBOSE |
1840 | msg_logger( NO_DIE, LOG_INFO, "getpwnam(): %s\n", tmp); | 1957 | msg_logger( NO_DIE, LOG_INFO, "no pwent for: %s\n", tmp); |
1841 | #endif | 1958 | #endif |
1842 | return (FALSE); | 1959 | return (FALSE); |
1843 | } | 1960 | } |
@@ -1897,7 +2014,7 @@ static const char *expand_variable (char *buffer, unsigned int length, | |||
1897 | const char *env, *ptr; | 2014 | const char *env, *ptr; |
1898 | char tmp[STRING_LENGTH]; | 2015 | char tmp[STRING_LENGTH]; |
1899 | 2016 | ||
1900 | #ifdef CONFIG_DEVFSD_DEBUG | 2017 | #ifdef CONFIG_DEBUG |
1901 | msg_logger( NO_DIE, LOG_INFO, "expand_variable()\n"); | 2018 | msg_logger( NO_DIE, LOG_INFO, "expand_variable()\n"); |
1902 | #endif | 2019 | #endif |
1903 | 2020 | ||
@@ -2049,7 +2166,7 @@ static const char *get_variable_v2 (const char *variable, | |||
2049 | { | 2166 | { |
2050 | const char *value; | 2167 | const char *value; |
2051 | 2168 | ||
2052 | #ifdef CONFIG_DEVFSD_DEBUG | 2169 | #ifdef CONFIG_DEBUG |
2053 | msg_logger( NO_DIE, LOG_INFO, "get_variable_v2()\n"); | 2170 | msg_logger( NO_DIE, LOG_INFO, "get_variable_v2()\n"); |
2054 | #endif | 2171 | #endif |
2055 | 2172 | ||