gfio: start of per-job option edit
authorJens Axboe <axboe@kernel.dk>
Sat, 24 Mar 2012 07:56:50 +0000 (08:56 +0100)
committerJens Axboe <axboe@kernel.dk>
Sat, 24 Mar 2012 07:56:50 +0000 (08:56 +0100)
Currently we don't properly handle job files with multiple
job entries in them, each one just overwrites the last.
Start tracking all of them.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
gclient.c
gfio.c
gfio.h
goptions.c
goptions.h

index c4be17241f273835247c0c1dc0bb41259f672da5..31dbb68fcc509e4c046bea7e05d3309257a60732 100644 (file)
--- a/gclient.c
+++ b/gclient.c
@@ -550,18 +550,29 @@ static void gfio_quit_op(struct fio_client *client, struct fio_net_cmd *cmd)
        gdk_threads_leave();
 }
 
+static struct thread_options *gfio_client_add_job(struct gfio_client *gc,
+                       struct thread_options_pack *top)
+{
+       struct gfio_client_options *gco;
+
+       gco = calloc(1, sizeof(*gco));
+       convert_thread_options_to_cpu(&gco->o, top);
+       flist_add_tail(&gco->list, &gc->o_list);
+       return &gco->o;
+}
+
 static void gfio_add_job_op(struct fio_client *client, struct fio_net_cmd *cmd)
 {
        struct cmd_add_job_pdu *p = (struct cmd_add_job_pdu *) cmd->payload;
        struct gfio_client *gc = client->client_data;
-       struct thread_options *o = &gc->o;
        struct gui_entry *ge = gc->ge;
+       struct thread_options *o;
        char *c1, *c2, *c3, *c4;
        char tmp[80];
 
        p->thread_number = le32_to_cpu(p->thread_number);
        p->groupid = le32_to_cpu(p->groupid);
-       convert_thread_options_to_cpu(o, &p->top);
+       o = gfio_client_add_job(gc, &p->top);
 
        gdk_threads_enter();
 
diff --git a/gfio.c b/gfio.c
index 6f313ed08490f6c314ce2fab91973191c209e2f7..d200ade05168c6ae83d50f92757b1945ee07e660 100644 (file)
--- a/gfio.c
+++ b/gfio.c
@@ -616,14 +616,22 @@ static void gfio_set_client(struct gfio_client *gc, struct fio_client *client)
 
 static void gfio_client_added(struct gui_entry *ge, struct fio_client *client)
 {
+       struct gfio_client_options *gco;
        struct gfio_client *gc;
 
-       gc = malloc(sizeof(*gc));
-       memset(gc, 0, sizeof(*gc));
-       options_default_fill(&gc->o);
+       gc = calloc(1, sizeof(*gc));
+       INIT_FLIST_HEAD(&gc->o_list);
        gc->ge = ge;
        ge->client = gc;
        gfio_set_client(gc, client);
+
+       /*
+        * Just add a default set of options, need to consider how best
+        * to handle this
+        */
+       gco = calloc(1, sizeof(*gco));
+       options_default_fill(&gco->o);
+       flist_add_tail(&gco->list, &gc->o_list);
 }
 
 static void connect_clicked(GtkWidget *widget, gpointer data)
@@ -1016,7 +1024,7 @@ static void edit_job_entry(GtkWidget *w, gpointer data)
 
        ge = get_ge_from_cur_tab(ui);
        if (ge && ge->client)
-               gopt_get_options_window(ui->window, &ge->client->o);
+               gopt_get_options_window(ui->window, ge->client);
 }
 
 static void start_job_entry(GtkWidget *w, gpointer data)
diff --git a/gfio.h b/gfio.h
index b8de680a06184e98e0facf127d72234fbffdcdf3..854f7adffbc5b62974838488ee7320bf68a87887 100644 (file)
--- a/gfio.h
+++ b/gfio.h
@@ -136,11 +136,16 @@ struct end_results {
        struct thread_stat ts;
 };
 
+struct gfio_client_options {
+       struct flist_head list;
+       struct thread_options o;
+};
+
 struct gfio_client {
        struct gui_entry *ge;
        struct fio_client *client;
        GtkWidget *err_entry;
-       struct thread_options o;
+       struct flist_head o_list;
 
        struct end_results *results;
        unsigned int nr_results;
index 49da0019d6d61a2bb14cf0fe3db83feb4ae34e20..202b0d2fddbfa61c5f9a8e71c412b763ff30914c 100644 (file)
@@ -856,10 +856,21 @@ static void gopt_add_group_tabs(GtkWidget *notebook, GtkWidget **vbox)
        } while (1);
 }
 
-void gopt_get_options_window(GtkWidget *window, struct thread_options *o)
+void gopt_get_options_window(GtkWidget *window, struct gfio_client *gc)
 {
        GtkWidget *dialog, *notebook;
        GtkWidget *vboxes[__FIO_OPT_C_NR];
+       struct gfio_client_options *gco;
+       struct thread_options *o;
+
+       /*
+        * Just choose the first item, we need to make each options
+        * entry the main notebook, with the below options view as
+        * a sub-notebook
+        */
+       assert(!flist_empty(&gc->o_list));
+       gco = flist_entry(gc->o_list.next, struct gfio_client_options, list);
+       o = &gco->o;
 
        dialog = gtk_dialog_new_with_buttons("Fio options",
                        GTK_WINDOW(window), GTK_DIALOG_DESTROY_WITH_PARENT,
index 4b409428153d3d1f99c6198d8b18cfad09972edc..e70a86dd040ae950cb0c0ad039d575057eb239d2 100644 (file)
@@ -1,6 +1,6 @@
 #ifndef GFIO_OPTIONS_H
 #define GFIO_OPTIONS_H
 
-void gopt_get_options_window(GtkWidget *window, struct thread_options *o);
+void gopt_get_options_window(GtkWidget *window, struct gfio_client *gc);
 
 #endif