]> git.ozlabs.org Git - petitboot/commitdiff
ui: pb_kexec_data -> pb_boot_data
authorJeremy Kerr <jk@ozlabs.org>
Wed, 27 Feb 2013 06:22:01 +0000 (14:22 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Mon, 15 Apr 2013 06:54:21 +0000 (14:54 +0800)
find ui/ -type f |
xargs sed -i -e s/pb_kexec_data/pb_boot_data/g \
-e 's/\<kd\>/bd/g'

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
ui/common/ui-system.c
ui/common/ui-system.h
ui/ncurses/generic-main.c
ui/ncurses/nc-boot-editor.c
ui/ncurses/nc-boot-editor.h
ui/ncurses/nc-cui.c
ui/ncurses/nc-cui.h
ui/ncurses/ps3-main.c
ui/twin/main-generic.c
ui/twin/pbt-client.c

index b4ae8f8c101fd0cf1ea3b66dfe513656eb1e2691..a828e2ee3b92a3b881ea5d3b5e04bf38f8523d29 100644 (file)
@@ -145,7 +145,7 @@ static int kexec_reboot(int dry_run)
  * pb_run_kexec - Run kexec with the supplied boot options.
  */
 
  * 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;
 {
        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;
 
        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;
 
 
        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 (!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;
        }
                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;
 
        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)
 
 no_load:
        if (clean_image)
index b75c4d1bfecbe45ff766354a912af37714479305..82f630ea62397a6503bcbefe12bbfc83af02057d 100644 (file)
 
 #include <signal.h>
 
 
 #include <signal.h>
 
-struct pb_kexec_data {
+struct pb_boot_data {
        char *image;
        char *initrd;
        char *args;
 };
 
        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);
 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_opt_data {
        const char *name;
-       struct pb_kexec_data *kd;
+       struct pb_boot_data *bd;
 
        /* optional data */
        const struct device *dev;
 
        /* optional data */
        const struct device *dev;
index dfeb1ba6217a331dd3ce181d1b49282ea781e0b7..983ba474917ab629a47b2c36b61398c31125452c 100644 (file)
@@ -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);
 
 
        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);
 }
 
 /**
 }
 
 /**
index a9256ff59c5f03f5e87610ba16955cbd0f30d4f5..38d29f826d5556b6ad03b6734f94b6751f1dac9c 100644 (file)
@@ -167,27 +167,27 @@ static char *boot_editor_chomp(char *s)
        return start;
 }
 
        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 boot_editor *boot_editor)
 {
-       struct pb_kexec_data *kd;
+       struct pb_boot_data *bd;
        char *s;
 
        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));
                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));
 
        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));
 
        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);
 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();
 
        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);
                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->on_exit(boot_editor,
-                                       boot_editor_update, kd);
+                                       boot_editor_update, bd);
                        nc_flush_keys();
                        return;
 
                        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,
 }
 
 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,
                void (*on_exit)(struct boot_editor *,
                                enum boot_editor_result,
-                               struct pb_kexec_data *))
+                               struct pb_boot_data *))
 {
        struct boot_editor *boot_editor;
 
 {
        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);
 
 
        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 = 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:");
        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:");
index 650c316b6960e90c918f7678d68d6861e759368d..bdcc5609736c2e9944e365171d10e3a906b5b017 100644 (file)
@@ -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,
        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,
 };
 
 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,
                void (*on_exit)(struct boot_editor *,
                                enum boot_editor_result,
-                               struct pb_kexec_data *));
+                               struct pb_boot_data *));
 
 #endif
 
 #endif
index 51c14720dd760b1effc0bdca1600824eba095611..f47e3243de0aa12a48e432ab68507639f2f23cd7 100644 (file)
@@ -70,19 +70,19 @@ static char *cui_make_item_name(struct pmenu_item *i, struct cui_opt_data *cod)
        char *name;
 
        assert(cod->name);
        char *name;
 
        assert(cod->name);
-       assert(cod->kd);
+       assert(cod->bd);
 
        name = talloc_asprintf(i, "%s:", cod->name);
 
 
        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",
                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;
 
        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);
        }
 
                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;
 }
 
        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,
  */
 
 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);
 
 {
        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;
 
                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);
 
                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);
                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);
        }
 
        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;
 
        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;
        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);
        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));
 
 
        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->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);
 
                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);
                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. */
 
 
                /* If this is the default_item select it and start timer. */
 
index 4470ef44badee98fb9050d90db4d82b4ff316962..3bdbcfca2eaf8e4423aa6ec218d3f336d1f19398 100644 (file)
@@ -28,7 +28,7 @@
 
 struct cui_opt_data {
        const char *name;
 
 struct cui_opt_data {
        const char *name;
-       struct pb_kexec_data *kd;
+       struct pb_boot_data *bd;
 
        /* optional data */
        const struct device *dev;
 
        /* optional data */
        const struct device *dev;
index 26d2591d467f7112fa63b7f351dde76f8d4224ba..87441456ad9ee9e25486d8ea21a43f3fdfc6628f 100644 (file)
@@ -294,24 +294,24 @@ static int ps3_kexec_cb(struct cui *cui, struct cui_opt_data *cod)
 
        /* Add a default kernel video mode. */
 
 
        /* Add a default kernel video mode. */
 
-       if (!cod->kd->args) {
+       if (!cod->bd->args) {
                altered_args = 1;
                orig_args = NULL;
                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);
                        (unsigned int)ps3->values.video_mode);
-       } else if (!strstr(cod->kd->args, "video=")) {
+       } else if (!strstr(cod->bd->args, "video=")) {
                altered_args = 1;
                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;
 
                        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) {
 
        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;
        }
 
        return result;
index 8ed46b72c41d113a120de88847e770321606cc95..28a96e461f1223b1db244578c25790b37844591e 100644 (file)
@@ -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);
 
 
        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;
 }
 
        return result;
 }
index 8eba0a23209246d8edb7b505c223d23ff6814d69..39facf5fe73094b16dc8759086c43708daa2b6f3 100644 (file)
@@ -69,10 +69,10 @@ static int pbt_client_run_kexec(struct pbt_item *item)
                sleep(item->pbt_client->dry_run ? 1 : 60);
        }
 
                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",
 
        pbt_frame_status_printf(&item->pbt_client->frame, "Failed: kexec %s",
-               opt_data->kd->image);
+               opt_data->bd->image);
 
        return 0;
 }
 
        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;
 
                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->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->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;
                        opt->boot_args);
                opt_data->dev = dev;
                opt_data->opt = opt;