static int param_set_kgdboc_var(const char *kmessage, struct kernel_param *kp) { int len = strlen(kmessage); if (len >= MAX_CONFIG_LEN) { printk(KERN_ERR "kgdboc: config string too long\n"); return -ENOSPC; } /* Only copy in the string if the init function has not run yet */ if (configured < 0) { strcpy(config, kmessage); return 0; } if (kgdb_connected) { printk(KERN_ERR "kgdboc: Cannot reconfigure while KGDB is connected.\n"); return -EBUSY; } strcpy(config, kmessage); /* Chop out \n char as a result of echo */ if (config[len - 1] == '\n') config[len - 1] = '\0'; if (configured == 1) cleanup_kgdboc(); /* Go and configure with the new params. */ return configure_kgdboc(); }
static int param_set_kgdboc_var(const char *kmessage, struct kernel_param *kp) { int len = strlen(kmessage); if (len >= MAX_CONFIG_LEN) { printk(KERN_ERR "kgdboc: config string too long\n"); return -ENOSPC; } /* */ if (configured < 0) { strcpy(config, kmessage); return 0; } if (kgdb_connected) { printk(KERN_ERR "kgdboc: Cannot reconfigure while KGDB is connected.\n"); return -EBUSY; } strcpy(config, kmessage); /* */ if (config[len - 1] == '\n') config[len - 1] = '\0'; if (configured == 1) cleanup_kgdboc(); /* */ return configure_kgdboc(); }
static int configure_kgdboc(void) { struct tty_driver *p; int tty_line = 0; int err; char *cptr = config; struct console *cons; err = kgdboc_option_setup(config); if (err || !strlen(config) || isspace(config[0])) goto noconfig; err = -ENODEV; kgdboc_io_ops.is_console = 0; kgdb_tty_driver = NULL; kgdboc_use_kms = 0; if (strncmp(cptr, "kms,", 4) == 0) { cptr += 4; kgdboc_use_kms = 1; } if (kgdboc_register_kbd(&cptr)) goto do_register; p = tty_find_polling_driver(cptr, &tty_line); if (!p) goto noconfig; cons = console_drivers; while (cons) { int idx; if (cons->device && cons->device(cons, &idx) == p && idx == tty_line) { kgdboc_io_ops.is_console = 1; break; } cons = cons->next; } kgdb_tty_driver = p; kgdb_tty_line = tty_line; do_register: err = kgdb_register_io_module(&kgdboc_io_ops); if (err) goto noconfig; configured = 1; return 0; noconfig: config[0] = 0; configured = 0; cleanup_kgdboc(); return err; }