By default the libhugetlbfs verbosity level is set to display messages
that are WARNINGS or ERRORS.  hugectl has the ability to make the library
more verbose, but not less without knowing the exact level to pass to
the --verbose option.  This patch addes a -q which will drop the verbosity
level by 1.

Signed-off-by: Eric B Munson <[email protected]>
---
 hugectl.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/hugectl.c b/hugectl.c
index 73fb0af..c968e14 100644
--- a/hugectl.c
+++ b/hugectl.c
@@ -124,6 +124,16 @@ void verbose(char *which)
        verbose_level = new_level;
 }
 
+void quiet(void)
+{
+       int new_level = verbose_level - 1;
+       if (new_level < 0) {
+               WARNING("verbosity must be at least 0\n");
+               new_level = 0;
+       }
+       verbose_level = new_level;
+}
+
 void setup_environment(char *var, char *val)
 {
        setenv(var, val, 1);
@@ -330,7 +340,7 @@ int main(int argc, char** argv)
        int opt_share = 0;
        char *opt_library = NULL;
 
-       char opts[] = "+hv";
+       char opts[] = "+hvq";
        int ret = 0, index = 0;
        struct option long_opts[] = {
                {"help",       no_argument, NULL, 'h'},
@@ -380,6 +390,10 @@ int main(int argc, char** argv)
                        verbose(optarg);
                        break;
 
+               case 'q':
+                       quiet();
+                       break;
+
                case LONG_NO_PRELOAD:
                        opt_preload = 0;
                        INFO("LD_PRELOAD disabled\n");
-- 
1.6.3.3


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Libhugetlbfs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to