[ofw] ndinstall patch

Smith, Stan stan.smith at intel.com
Thu Jul 16 14:08:31 PDT 2009


Revert ndinstall cmd line behavior back to supporting a 'default' NetworkDirect provider.
Such that 'ndinstall -i' installs IBAL as the default ND provider.
'ndinstall -r' removes IBAL as the default ND provider.
The '-i' and '-r' switches accept an 'optional' provider name argument; defaulting to IBAL for now.
Updated usage text to reflect changes.
Added switches:
-h      usage text output.
-q      suppress output of providers for the case of install/uninstall operation.

--- C:/Documents and Settings/scsmith/Local Settings/Temp/installsp.-revBASE.svn001.tmp.c       Thu Jul 16 13:51:01 2009
+++ C:/Documents and Settings/scsmith/My Documents/openIB-windows/SVN/gen1/branches/WOF2-1/tools/ndinstall/user/installsp.c     Thu Jul 16 13:50:46 2009
@@ -52,6 +52,8 @@
 #define PFL_NETWORKDIRECT_PROVIDER          0x00000010
 #endif

+#define ND_DEFAULT_PROVIDER "ibal"
+
 /* Initialize the LSP's provider path for Infiniband Service Provider dll */
 #define IBAL_INDEX                     0
 #define IBAL_DEBUG_INDEX       1
@@ -97,14 +99,25 @@
 static void
 show_usage (char *progname)
 {
-       printf("usage: %s\n", progname);
-       printf("\tRemove, install, and list OFA NetworkDirect providers\n\n");
-       printf("\t[-[i|r] provider_name]  Install/remove the specified provider\n");
-       printf("\t[-d]                    Install/remove debug version of provider\n");
-       printf("\t[-l]                    list OFA ND providers\n");
-       printf("\tprovider_name must be one of the following:\n");
+       char drv[_MAX_DRIVE];
+       char dir[_MAX_DIR];
+       char fname[_MAX_FNAME];
+       char ext[_MAX_EXT];
+
+       _splitpath(progname,drv,dir,fname,ext); // sad basename() equivalent.
+
+       printf("usage: %s%s\n",fname,ext);
+       printf("\tRemove, install and list OFA NetworkDirect providers\n\n");
+       printf("\t[-[i|r] [provider]] Install/remove the specified/default"
+                       " provider\n");
+       printf("\t[-d]                Install/remove debug version of provider\n");
+       printf("\t[-l]                list OFA ND providers\n");
+       printf("\t[-q]                Suppress default listing of providers\n");
+       printf("\t[-h]                This text\n");
+       printf("\tprovider must be one of the following names:\n");
        printf("\t\tibal\n");
        printf("\t\twinverbs\n");
+       printf("\t\t<blank> use the default ND provider '%s'\n", ND_DEFAULT_PROVIDER);
 }


@@ -257,6 +270,9 @@
 {
        int i;

+       if ( !name )
+               name = ND_DEFAULT_PROVIDER;
+
        for (i = 0; i < MAX_INDEX; i++) {
                if (!_stricmp(provider_name[i], name)) {
                        index = i;
@@ -269,12 +285,14 @@
 int __cdecl main (int argc, char *argv[])
 {
        int ret=0, op;
-       int install = 0, remove = 0, debug = 0;
+       int install = 0, remove = 0, debug = 0, quiet = 0;
        WSADATA wsd;
        char *prov;

-       while ((op = getopt(argc, argv, "i:r:dl")) != -1) {
+       while ((op = getopt(argc, argv, "hi::r::dlq")) != -1) {
                switch (op) {
+               case 'h':
+                               goto usage;
                case 'i':
                        if (install || remove || get_prov_index(optarg)) {
                                goto usage;
@@ -291,6 +309,10 @@
                        debug = 1;
                        break;
                case 'l':
+                       quiet = 0;
+                       break;
+               case 'q':
+                       quiet = 1;
                        break;
                default:
                        goto usage;
@@ -317,7 +339,8 @@
                ret = remove_provider();
        }

-       print_providers();
+       if (quiet == 0)
+               print_providers();

 exit:
        WSACleanup();



More information about the ofw mailing list