Whamcloud - gitweb
Land b1_2 onto HEAD (20040304_171022)
[fs/lustre-release.git] / lustre / utils / llmount.c
index 2f35ded..ce28e09 100644 (file)
@@ -70,6 +70,7 @@ int
 init_options(struct lustre_mount_data *lmd)
 {
         memset(lmd, 0, sizeof(lmd));
+        lmd->lmd_magic = LMD_MAGIC;
         lmd->lmd_server_nid = PTL_NID_ANY;
         lmd->lmd_local_nid = PTL_NID_ANY;
         lmd->lmd_port = 988;    /* XXX define LUSTRE_DEFAULT_PORT */
@@ -98,7 +99,7 @@ parse_options(char * options, struct lustre_mount_data *lmd)
         int val;
         char *opt;
         char * opteq;
-        
+
         /* parsing ideas here taken from util-linux/mount/nfsmount.c */
         for (opt = strtok(options, ","); opt; opt = strtok(NULL, ",")) {
                 if ((opteq = strchr(opt, '='))) {
@@ -178,31 +179,25 @@ set_local(struct lustre_mount_data *lmd)
                         return rc;
                 }
         } else if (lmd->lmd_nal == QSWNAL) {
-#if MULTIRAIL_EKC
                 char *pfiles[] = {"/proc/qsnet/elan3/device0/position",
                                   "/proc/qsnet/elan4/device0/position",
+                                  "/proc/elan/device0/position",
                                   NULL};
-#else
-                char *pfiles[] = {"/proc/elan/device0/position",
-                                  NULL};
-#endif
                 int   i = 0;
 
                 do {
                         rc = get_local_elan_id(pfiles[i], buf);
-                } while (rc != 0 &&
-                         pfiles[++i] != NULL);
-                
+                } while (rc != 0 && pfiles[++i] != NULL);
+
                 if (rc != 0) {
-                        fprintf(stderr, "mount: can't read elan ID"
-                                " from /proc\n");
+                        fprintf(stderr,
+                                "mount: can't read Elan ID from /proc\n");
                         return -1;
                 }
         }
 
         if (ptl_parse_nid (&nid, buf) != 0) {
-                fprintf (stderr, "mount: can't parse NID %s\n", 
-                         buf);
+                fprintf (stderr, "mount: can't parse NID %s\n", buf);
                 return (-1);
         }
 
@@ -261,6 +256,9 @@ build_data(char *source, char *options, struct lustre_mount_data *lmd)
         char *s;
         int rc;
 
+        if (lmd_bad_magic(lmd))
+                return -EINVAL;
+
         if (strlen(source) > sizeof(target) + 1) {
                 fprintf(stderr, "mount: "
                         "exessively long host:/mds/profile argument\n");
@@ -315,7 +313,6 @@ build_data(char *source, char *options, struct lustre_mount_data *lmd)
         }
         strcpy(lmd->lmd_profile, profile);
 
-        
         if (verbose)
                 print_options(lmd);
         return 0;