From 6b842bb2559116a949c6a569ac39f5c56ebc1be1 Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Wed, 27 Feb 2013 14:22:01 +0800 Subject: ui: pb_kexec_data -> pb_boot_data find ui/ -type f | xargs sed -i -e s/pb_kexec_data/pb_boot_data/g \ -e 's/\/bd/g' Signed-off-by: Jeremy Kerr --- ui/common/ui-system.c | 18 ++++++++-------- ui/common/ui-system.h | 6 +++--- ui/ncurses/generic-main.c | 2 +- ui/ncurses/nc-boot-editor.c | 38 ++++++++++++++++----------------- ui/ncurses/nc-boot-editor.h | 6 +++--- ui/ncurses/nc-cui.c | 52 ++++++++++++++++++++++----------------------- ui/ncurses/nc-cui.h | 2 +- ui/ncurses/ps3-main.c | 16 +++++++------- ui/twin/main-generic.c | 2 +- ui/twin/pbt-client.c | 12 +++++------ 10 files changed, 77 insertions(+), 77 deletions(-) diff --git a/ui/common/ui-system.c b/ui/common/ui-system.c index b4ae8f8..a828e2e 100644 --- a/ui/common/ui-system.c +++ b/ui/common/ui-system.c @@ -145,7 +145,7 @@ static int kexec_reboot(int dry_run) * pb_run_kexec - Run kexec with the supplied boot options. */ -int pb_run_kexec(const struct pb_kexec_data *kd, int dry_run) +int pb_run_kexec(const struct pb_boot_data *bd, int dry_run) { int result; char *l_image = NULL; @@ -153,20 +153,20 @@ int pb_run_kexec(const struct pb_kexec_data *kd, int dry_run) unsigned int clean_image = 0; unsigned int clean_initrd = 0; - pb_log("%s: image: '%s'\n", __func__, kd->image); - pb_log("%s: initrd: '%s'\n", __func__, kd->initrd); - pb_log("%s: args: '%s'\n", __func__, kd->args); + pb_log("%s: image: '%s'\n", __func__, bd->image); + pb_log("%s: initrd: '%s'\n", __func__, bd->initrd); + pb_log("%s: args: '%s'\n", __func__, bd->args); result = -1; - if (kd->image) { - l_image = pb_load_file(NULL, kd->image, &clean_image); + if (bd->image) { + l_image = pb_load_file(NULL, bd->image, &clean_image); if (!l_image) goto no_load; } - if (kd->initrd) { - l_initrd = pb_load_file(NULL, kd->initrd, &clean_initrd); + if (bd->initrd) { + l_initrd = pb_load_file(NULL, bd->initrd, &clean_initrd); if (!l_initrd) goto no_load; } @@ -174,7 +174,7 @@ int pb_run_kexec(const struct pb_kexec_data *kd, int dry_run) if (!l_image && !l_initrd) goto no_load; - result = kexec_load(l_image, l_initrd, kd->args, dry_run); + result = kexec_load(l_image, l_initrd, bd->args, dry_run); no_load: if (clean_image) diff --git a/ui/common/ui-system.h b/ui/common/ui-system.h index b75c4d1..82f630e 100644 --- a/ui/common/ui-system.h +++ b/ui/common/ui-system.h @@ -27,13 +27,13 @@ #include -struct pb_kexec_data { +struct pb_boot_data { char *image; char *initrd; char *args; }; -int pb_run_kexec(const struct pb_kexec_data *kd, int dry_run); +int pb_run_kexec(const struct pb_boot_data *bd, int dry_run); int pb_start_daemon(void); unsigned int pb_elf_hash(const char *str); @@ -47,7 +47,7 @@ static inline uint32_t pb_opt_hash(const struct device *dev, struct pb_opt_data { const char *name; - struct pb_kexec_data *kd; + struct pb_boot_data *bd; /* optional data */ const struct device *dev; diff --git a/ui/ncurses/generic-main.c b/ui/ncurses/generic-main.c index dfeb1ba..983ba47 100644 --- a/ui/ncurses/generic-main.c +++ b/ui/ncurses/generic-main.c @@ -153,7 +153,7 @@ static int pb_kexec_cb(struct cui *cui, struct cui_opt_data *cod) assert(pb->cui->current == &pb->cui->main->scr); - return pb_run_kexec(cod->kd, pb->cui->dry_run); + return pb_run_kexec(cod->bd, pb->cui->dry_run); } /** diff --git a/ui/ncurses/nc-boot-editor.c b/ui/ncurses/nc-boot-editor.c index a9256ff..38d29f8 100644 --- a/ui/ncurses/nc-boot-editor.c +++ b/ui/ncurses/nc-boot-editor.c @@ -167,27 +167,27 @@ static char *boot_editor_chomp(char *s) return start; } -static struct pb_kexec_data *boot_editor_prepare_data( +static struct pb_boot_data *boot_editor_prepare_data( struct boot_editor *boot_editor) { - struct pb_kexec_data *kd; + struct pb_boot_data *bd; char *s; - kd = talloc(boot_editor, struct pb_kexec_data); + bd = talloc(boot_editor, struct pb_boot_data); - if (!kd) + if (!bd) return NULL; s = boot_editor_chomp(field_buffer(boot_editor->fields[0], 0)); - kd->image = *s ? talloc_strdup(kd, s) : NULL; + bd->image = *s ? talloc_strdup(bd, s) : NULL; s = boot_editor_chomp(field_buffer(boot_editor->fields[1], 0)); - kd->initrd = *s ? talloc_strdup(kd, s) : NULL; + bd->initrd = *s ? talloc_strdup(bd, s) : NULL; s = boot_editor_chomp(field_buffer(boot_editor->fields[2], 0)); - kd->args = *s ? talloc_strdup(kd, s) : NULL; + bd->args = *s ? talloc_strdup(bd, s) : NULL; - return kd; + return bd; } /** @@ -199,7 +199,7 @@ static struct pb_kexec_data *boot_editor_prepare_data( static void boot_editor_process_key(struct nc_scr *scr) { struct boot_editor *boot_editor = boot_editor_from_scr(scr); - struct pb_kexec_data *kd; + struct pb_boot_data *bd; while (1) { int c = getch(); @@ -223,9 +223,9 @@ static void boot_editor_process_key(struct nc_scr *scr) case '\n': case '\r': form_driver(boot_editor->ncf, REQ_VALIDATION); - kd = boot_editor_prepare_data(boot_editor); + bd = boot_editor_prepare_data(boot_editor); boot_editor->on_exit(boot_editor, - boot_editor_update, kd); + boot_editor_update, bd); nc_flush_keys(); return; @@ -315,16 +315,16 @@ static FIELD *boot_editor_setup_label(unsigned int y, unsigned int x, char *str) } struct boot_editor *boot_editor_init(void *ui_ctx, - const struct pb_kexec_data *kd, + const struct pb_boot_data *bd, void (*on_exit)(struct boot_editor *, enum boot_editor_result, - struct pb_kexec_data *)) + struct pb_boot_data *)) { struct boot_editor *boot_editor; - pb_log("%s: image: '%s'\n", __func__, kd->image); - pb_log("%s: initrd: '%s'\n", __func__, kd->initrd); - pb_log("%s: args: '%s'\n", __func__, kd->args); + pb_log("%s: image: '%s'\n", __func__, bd->image); + pb_log("%s: initrd: '%s'\n", __func__, bd->initrd); + pb_log("%s: args: '%s'\n", __func__, bd->args); assert(on_exit); @@ -348,9 +348,9 @@ struct boot_editor *boot_editor_init(void *ui_ctx, boot_editor->fields = talloc_array(boot_editor, FIELD *, 7); - boot_editor->fields[0] = boot_editor_setup_field(0, 9, kd->image); - boot_editor->fields[1] = boot_editor_setup_field(1, 9, kd->initrd); - boot_editor->fields[2] = boot_editor_setup_field(2, 9, kd->args); + boot_editor->fields[0] = boot_editor_setup_field(0, 9, bd->image); + boot_editor->fields[1] = boot_editor_setup_field(1, 9, bd->initrd); + boot_editor->fields[2] = boot_editor_setup_field(2, 9, bd->args); boot_editor->fields[3] = boot_editor_setup_label(0, 1, "image:"); boot_editor->fields[4] = boot_editor_setup_label(1, 1, "initrd:"); boot_editor->fields[5] = boot_editor_setup_label(2, 1, "args:"); diff --git a/ui/ncurses/nc-boot-editor.h b/ui/ncurses/nc-boot-editor.h index 650c316..bdcc560 100644 --- a/ui/ncurses/nc-boot-editor.h +++ b/ui/ncurses/nc-boot-editor.h @@ -59,13 +59,13 @@ struct boot_editor { enum boot_editor_attr_cursor attr_cursor; void (*on_exit)(struct boot_editor *boot_editor, enum boot_editor_result result, - struct pb_kexec_data *kd); + struct pb_boot_data *bd); }; struct boot_editor *boot_editor_init(void *ui_ctx, - const struct pb_kexec_data *kd, + const struct pb_boot_data *bd, void (*on_exit)(struct boot_editor *, enum boot_editor_result, - struct pb_kexec_data *)); + struct pb_boot_data *)); #endif diff --git a/ui/ncurses/nc-cui.c b/ui/ncurses/nc-cui.c index 51c1472..f47e324 100644 --- a/ui/ncurses/nc-cui.c +++ b/ui/ncurses/nc-cui.c @@ -70,19 +70,19 @@ static char *cui_make_item_name(struct pmenu_item *i, struct cui_opt_data *cod) char *name; assert(cod->name); - assert(cod->kd); + assert(cod->bd); name = talloc_asprintf(i, "%s:", cod->name); - if (cod->kd->image) - name = talloc_asprintf_append(name, " %s", cod->kd->image); + if (cod->bd->image) + name = talloc_asprintf_append(name, " %s", cod->bd->image); - if (cod->kd->initrd) + if (cod->bd->initrd) name = talloc_asprintf_append(name, " initrd=%s", - cod->kd->initrd); + cod->bd->initrd); - if (cod->kd->args) - name = talloc_asprintf_append(name, " %s", cod->kd->args); + if (cod->bd->args) + name = talloc_asprintf_append(name, " %s", cod->bd->args); DBGS("@%s@\n", name); return name; @@ -154,8 +154,8 @@ static int cui_run_kexec(struct pmenu_item *item) sleep(cui->dry_run ? 1 : 60); } - pb_log("%s: failed: %s\n", __func__, cod->kd->image); - nc_scr_status_printf(cui->current, "Failed: kexec %s", cod->kd->image); + pb_log("%s: failed: %s\n", __func__, cod->bd->image); + nc_scr_status_printf(cui->current, "Failed: kexec %s", cod->bd->image); return 0; } @@ -165,7 +165,7 @@ static int cui_run_kexec(struct pmenu_item *item) */ static void cui_boot_editor_on_exit(struct boot_editor *boot_editor, enum boot_editor_result boot_editor_result, - struct pb_kexec_data *kd) + struct pb_boot_data *bd) { struct cui *cui = cui_from_arg(boot_editor->scr.ui_ctx); @@ -174,11 +174,11 @@ static void cui_boot_editor_on_exit(struct boot_editor *boot_editor, enum boot_e struct cui_opt_data *cod = cod_from_item(i); char *name; - assert(kd); + assert(bd); - talloc_steal(i, kd); - talloc_free(cod->kd); - cod->kd = kd; + talloc_steal(i, bd); + talloc_free(cod->bd); + cod->bd = bd; name = cui_make_item_name(i, cod); pmenu_item_replace(i, name); @@ -187,9 +187,9 @@ static void cui_boot_editor_on_exit(struct boot_editor *boot_editor, enum boot_e set_current_item(cui->main->ncm, i->nci); pb_log("%s: updating opt '%s'\n", __func__, cod->name); - pb_log(" image '%s'\n", cod->kd->image); - pb_log(" initrd '%s'\n", cod->kd->initrd); - pb_log(" args '%s'\n", cod->kd->args); + pb_log(" image '%s'\n", cod->bd->image); + pb_log(" initrd '%s'\n", cod->bd->initrd); + pb_log(" args '%s'\n", cod->bd->args); } cui_set_current(cui, &cui->main->scr); @@ -203,7 +203,7 @@ int cui_boot_editor_run(struct pmenu_item *item) struct cui_opt_data *cod = cod_from_item(item); struct boot_editor *boot_editor; - boot_editor = boot_editor_init(cui, cod->kd, cui_boot_editor_on_exit); + boot_editor = boot_editor_init(cui, cod->bd, cui_boot_editor_on_exit); cui_set_current(cui, &boot_editor->scr); return 0; @@ -345,7 +345,7 @@ void cui_on_open(struct pmenu *menu) i->data = cod = talloc_zero(i, struct cui_opt_data); cod->name = talloc_asprintf(i, "User item %u:", insert_pt); - cod->kd = talloc_zero(i, struct pb_kexec_data); + cod->bd = talloc_zero(i, struct pb_boot_data); pmenu_item_setup(menu, i, insert_pt, talloc_strdup(i, cod->name)); @@ -414,11 +414,11 @@ static int cui_device_add(struct device *dev, void *arg) cod->opt = opt; cod->opt_hash = pb_opt_hash(dev, opt); cod->name = opt->name; - cod->kd = talloc(i, struct pb_kexec_data); + cod->bd = talloc(i, struct pb_boot_data); - cod->kd->image = talloc_strdup(cod->kd, opt->boot_image_file); - cod->kd->initrd = talloc_strdup(cod->kd, opt->initrd_file); - cod->kd->args = talloc_strdup(cod->kd, opt->boot_args); + cod->bd->image = talloc_strdup(cod->bd, opt->boot_image_file); + cod->bd->initrd = talloc_strdup(cod->bd, opt->initrd_file); + cod->bd->args = talloc_strdup(cod->bd, opt->boot_args); name = cui_make_item_name(i, cod); pmenu_item_setup(cui->main, i, insert_pt, name); @@ -426,9 +426,9 @@ static int cui_device_add(struct device *dev, void *arg) insert_pt++; pb_log("%s: adding opt '%s'\n", __func__, cod->name); - pb_log(" image '%s'\n", cod->kd->image); - pb_log(" initrd '%s'\n", cod->kd->initrd); - pb_log(" args '%s'\n", cod->kd->args); + pb_log(" image '%s'\n", cod->bd->image); + pb_log(" initrd '%s'\n", cod->bd->initrd); + pb_log(" args '%s'\n", cod->bd->args); /* If this is the default_item select it and start timer. */ diff --git a/ui/ncurses/nc-cui.h b/ui/ncurses/nc-cui.h index 4470ef4..3bdbcfc 100644 --- a/ui/ncurses/nc-cui.h +++ b/ui/ncurses/nc-cui.h @@ -28,7 +28,7 @@ struct cui_opt_data { const char *name; - struct pb_kexec_data *kd; + struct pb_boot_data *bd; /* optional data */ const struct device *dev; diff --git a/ui/ncurses/ps3-main.c b/ui/ncurses/ps3-main.c index 26d2591..8744145 100644 --- a/ui/ncurses/ps3-main.c +++ b/ui/ncurses/ps3-main.c @@ -294,24 +294,24 @@ static int ps3_kexec_cb(struct cui *cui, struct cui_opt_data *cod) /* Add a default kernel video mode. */ - if (!cod->kd->args) { + if (!cod->bd->args) { altered_args = 1; orig_args = NULL; - cod->kd->args = talloc_asprintf(NULL, "video=ps3fb:mode:%u", + cod->bd->args = talloc_asprintf(NULL, "video=ps3fb:mode:%u", (unsigned int)ps3->values.video_mode); - } else if (!strstr(cod->kd->args, "video=")) { + } else if (!strstr(cod->bd->args, "video=")) { altered_args = 1; - orig_args = cod->kd->args; - cod->kd->args = talloc_asprintf(NULL, "%s video=ps3fb:mode:%u", + orig_args = cod->bd->args; + cod->bd->args = talloc_asprintf(NULL, "%s video=ps3fb:mode:%u", orig_args, (unsigned int)ps3->values.video_mode); } else altered_args = 0; - result = pb_run_kexec(cod->kd, ps3->cui->dry_run); + result = pb_run_kexec(cod->bd, ps3->cui->dry_run); if (altered_args) { - talloc_free(cod->kd->args); - cod->kd->args = orig_args; + talloc_free(cod->bd->args); + cod->bd->args = orig_args; } return result; diff --git a/ui/twin/main-generic.c b/ui/twin/main-generic.c index 8ed46b7..28a96e4 100644 --- a/ui/twin/main-generic.c +++ b/ui/twin/main-generic.c @@ -207,7 +207,7 @@ static int kexec_cb(struct pbt_client *client, struct pb_opt_data *opt_data) pb_log("%s: %s\n", __func__, opt_data->name); - result = pb_run_kexec(opt_data->kd, client->dry_run); + result = pb_run_kexec(opt_data->bd, client->dry_run); return result; } diff --git a/ui/twin/pbt-client.c b/ui/twin/pbt-client.c index 8eba0a2..39facf5 100644 --- a/ui/twin/pbt-client.c +++ b/ui/twin/pbt-client.c @@ -69,10 +69,10 @@ static int pbt_client_run_kexec(struct pbt_item *item) sleep(item->pbt_client->dry_run ? 1 : 60); } - pb_log("%s: failed: %s\n", __func__, opt_data->kd->image); + pb_log("%s: failed: %s\n", __func__, opt_data->bd->image); pbt_frame_status_printf(&item->pbt_client->frame, "Failed: kexec %s", - opt_data->kd->image); + opt_data->bd->image); return 0; } @@ -145,12 +145,12 @@ static int pbt_device_add(struct device *dev, struct pbt_client *client) i->data = opt_data = talloc(i, struct pb_opt_data); opt_data->name = opt->name; - opt_data->kd = talloc(i, struct pb_kexec_data); - opt_data->kd->image = talloc_strdup(opt_data->kd, + opt_data->bd = talloc(i, struct pb_boot_data); + opt_data->bd->image = talloc_strdup(opt_data->bd, opt->boot_image_file); - opt_data->kd->initrd = talloc_strdup(opt_data->kd, + opt_data->bd->initrd = talloc_strdup(opt_data->bd, opt->initrd_file); - opt_data->kd->args = talloc_strdup(opt_data->kd, + opt_data->bd->args = talloc_strdup(opt_data->bd, opt->boot_args); opt_data->dev = dev; opt_data->opt = opt; -- cgit v1.2.1