Bring show-ucode-levels support to the ncurses interface.

Signed-off-by: Gabriel Krisman Bertazi <kris...@linux.vnet.ibm.com>
---
 iprconfig.c | 37 +++++++++++++++++++++++++++++++++++++
 iprconfig.h | 11 +++++++++++
 2 files changed, 48 insertions(+)

diff --git a/iprconfig.c b/iprconfig.c
index 157cce7..c5c5c8a 100644
--- a/iprconfig.c
+++ b/iprconfig.c
@@ -11675,6 +11675,43 @@ int choose_ucode(i_container * i_con)
        return 0;
 }
 
+static int _show_ucode_levels(char *buffer, size_t size);
+
+/**
+ * ucode_status - Show-ucode-levels in ncurses interface.
+ * @i_con:             i_container struct
+ *
+ * Returns:
+ *   0 if success / non-zero on failure
+ **/
+int ucode_status(i_container *i_con)
+{
+       struct screen_output *s_out;
+       s_node *screen;
+       int rc = RC_SUCCESS;
+       int header_lines = 0;
+       char body[BUFSIZ];
+       char *header;
+       int offset;
+
+       i_con_head = i_con = NULL;
+       check_current_config(false);
+
+       header = body_init(n_ucode_show_levels.header, &header_lines);
+       offset = strlen(header);
+
+       strncpy(body, header, offset);
+       _show_ucode_levels(body + offset, BUFSIZ - offset);
+
+       screen = &n_ucode_show_levels;
+       screen->body = body;
+       s_out = screen_driver(screen, 0, i_con);
+       rc = s_out->rc;
+       free(s_out);
+       screen->body = NULL;
+       return rc;
+}
+
 /**
 * ucode_screen - Configure microcode screen
 * @i_con:            i_container struct
diff --git a/iprconfig.h b/iprconfig.h
index 5042c22..e69343c 100644
--- a/iprconfig.h
+++ b/iprconfig.h
@@ -136,6 +136,7 @@ int ioa_config(i_container * i_con);
 int change_disk_config(i_container *);
 int change_ioa_config(i_container *);
 int ucode_screen(i_container *i_con);
+int ucode_status(i_container *i_con);
 int download_ucode(i_container *);
 int choose_ucode(i_container *);
 int log_menu(i_container *);
@@ -1557,9 +1558,19 @@ s_node n_confirm_set_default_editor = {
                "" }
 };
 
+s_node n_ucode_show_levels = {
+       .rc_flags = (CANCEL_FLAG),
+       .f_flags  = (ENTER_FLAG | EXIT_FLAG | CANCEL_FLAG | FWD_FLAG),
+       .header   = {
+               __("Current Ucode level for adapters and devices are shown.\n"),
+               __("Also display the latest Ucode available in the filesystem "
+                  "for this device.\n\n"), "" },
+       .title    = __("Ucode Levels")
+};
 
 struct screen_opts ucode_screen_opt[] = {
        {download_ucode,      "1", __("Download Ucode")},
+       {ucode_status,        "2", __("Show Ucode Levels")},
 };
 
 s_node n_ucode_screen = {
-- 
2.1.0


------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Iprdd-devel mailing list
Iprdd-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iprdd-devel

Reply via email to