#include "obdctl.h"
#include <portals/ptlctl.h>
+#include <linux/lustre_idl.h>
int debug;
int verbose;
lmd->lmd_port = 988; /* XXX define LUSTRE_DEFAULT_PORT */
lmd->lmd_nal = SOCKNAL;
lmd->lmd_async = 0;
- lmd->lmd_nllu = 99;
- lmd->lmd_nllg = 99;
+ lmd->lmd_remote_flag = 0;
+ lmd->lmd_nllu = NOBODY_UID;
+ lmd->lmd_nllg = NOBODY_GID;
strncpy(lmd->lmd_security, "null", sizeof(lmd->lmd_security));
return 0;
}
*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 "
}
}
} else {
- val = 1;
- if (!strncmp(opt, "no", 2)) {
- val = 0;
- opt += 2;
- }
- if (!strcmp(opt, "debug")) {
- debug = val;
+ if (!strcmp(opt, "remote")) {
+ lmd->lmd_remote_flag = OBD_CONNECT_REMOTE;
+ } else if (!strcmp(opt, "local")) {
+ lmd->lmd_remote_flag = OBD_CONNECT_LOCAL;
} else if (!strcmp(opt, "async")) {
lmd->lmd_async = 1;
+ } else {
+ val = 1;
+ if (!strncmp(opt, "no", 2)) {
+ val = 0;
+ opt += 2;
+ }
+ if (!strcmp(opt, "debug")) {
+ debug = val;
+ }
}
}
}
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);
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",
return -1;
}
-#else
- } else if (lmd->lmd_nal == CRAY_KB_SSNAL) {
- return 0;
+ break;
+ }
#endif
}
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;
}
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",
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;
}