From 9a2d1e080454dd4030b2cc203a24401809e3610d Mon Sep 17 00:00:00 2001 From: eeb Date: Tue, 5 Apr 2005 20:33:42 +0000 Subject: [PATCH] * bringing llmount.c up to date for RapidArray (XD1) and IB Nals --- lustre/utils/llmount.c | 91 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 70 insertions(+), 21 deletions(-) diff --git a/lustre/utils/llmount.c b/lustre/utils/llmount.c index e7f2354..1ad7759 100644 --- a/lustre/utils/llmount.c +++ b/lustre/utils/llmount.c @@ -285,6 +285,11 @@ int parse_options(char * options, struct lustre_mount_data *lmd) *opteq = '\0'; if (!strcmp(opt, "nettype")) { lmd->lmd_nal = ptl_name2nal(opteq + 1); + if (lmd->lmd_nal < 0) { + fprintf(stderr, "%s: can't parse NET " + "%s\n", progname, opteq + 1); + return (-1); + } } else if(!strcmp(opt, "cluster_id")) { if (ptl_parse_nid(&cluster_id, opteq+1) != 0) { fprintf (stderr, "%s: can't parse NID " @@ -385,12 +390,26 @@ set_local(struct lustre_mount_data *lmd) memset(buf, 0, sizeof(buf)); -#ifdef CRAY_PORTALS - if (lmd->lmd_nal == CRAY_KB_ERNAL) { + switch (lmd->lmd_nal) { + default: + fprintf(stderr, "%s: Unknown network type: %d\n", + progname, lmd->lmd_nal); + return 1; + +#if CRAY_PORTALS + case CRAY_KB_SSNAL: + return 0; + + case CRAY_KB_ERNAL: #else - if (lmd->lmd_nal == SOCKNAL || lmd->lmd_nal == TCPNAL || - lmd->lmd_nal == OPENIBNAL || lmd->lmd_nal == IIBNAL) { + case SOCKNAL: + case TCPNAL: + case OPENIBNAL: + case IIBNAL: + case VIBNAL: + case RANAL: #endif + { struct utsname uts; rc = gethostname(buf, sizeof(buf) - 1); @@ -427,8 +446,11 @@ set_local(struct lustre_mount_data *lmd) close(f); } } -#ifndef CRAY_PORTALS - } else if (lmd->lmd_nal == QSWNAL) { + break; + } +#if !CRAY_PORTALS + case QSWNAL: + { char *pfiles[] = {"/proc/qsnet/elan3/device0/position", "/proc/qsnet/elan4/device0/position", "/proc/elan/device0/position", @@ -445,9 +467,8 @@ set_local(struct lustre_mount_data *lmd) return -1; } -#else - } else if (lmd->lmd_nal == CRAY_KB_SSNAL) { - return 0; + break; + } #endif } @@ -466,17 +487,41 @@ set_peer(char *hostname, struct lustre_mount_data *lmd) ptl_nid_t nid = 0; int rc; -#ifdef CRAY_PORTALS - if (lmd->lmd_nal == CRAY_KB_ERNAL) { + switch (lmd->lmd_nal) { + default: + fprintf(stderr, "%s: Unknown network type: %d\n", + progname, lmd->lmd_nal); + return 1; + +#if CRAY_PORTALS + case CRAY_KB_SSNAL: + lmd->lmd_server_nid = strtoll(hostname,0,0); + return 0; + + case CRAY_KB_ERNAL: #else - if (lmd->lmd_nal == SOCKNAL || lmd->lmd_nal == TCPNAL || - lmd->lmd_nal == OPENIBNAL || lmd->lmd_nal == IIBNAL) { + case IIBNAL: + if (lmd->lmd_server_nid != PTL_NID_ANY) + break; + if (ptl_parse_nid (&nid, hostname) != 0) { + fprintf (stderr, "%s: can't parse NID %s\n", + progname, hostname); + return (1); + } + lmd->lmd_server_nid = nid; + break; + + case SOCKNAL: + case TCPNAL: + case OPENIBNAL: + case VIBNAL: + case RANAL: #endif if (lmd->lmd_server_nid == PTL_NID_ANY) { if (ptl_parse_nid (&nid, hostname) != 0) { fprintf (stderr, "%s: can't parse NID %s\n", progname, hostname); - return (-1); + return (1); } lmd->lmd_server_nid = nid; } @@ -486,9 +531,15 @@ set_peer(char *hostname, struct lustre_mount_data *lmd) progname, hostname); return (-1); } -#ifndef CRAY_PORTALS - } else if (lmd->lmd_nal == QSWNAL &&lmd->lmd_server_nid == PTL_NID_ANY){ + + break; + +#if !CRAY_PORTALS + case QSWNAL: { char buf[64]; + if (lmd->lmd_server_nid != PTL_NID_ANY) + break; + rc = sscanf(hostname, "%*[^0-9]%63[0-9]", buf); if (rc != 1) { fprintf (stderr, "%s: can't get elan id from host %s\n", @@ -501,13 +552,11 @@ set_peer(char *hostname, struct lustre_mount_data *lmd) return (-1); } lmd->lmd_server_nid = nid; -#else - } else if (lmd->lmd_nal == CRAY_KB_SSNAL) { - lmd->lmd_server_nid = strtoll(hostname,0,0); + + break; + } #endif } - - return 0; } -- 1.8.3.1