Whamcloud - gitweb
LU-1581 utils: more common helpers
[fs/lustre-release.git] / lustre / utils / mkfs_lustre.c
index 4236a4c..2c20ac9 100644 (file)
@@ -133,31 +133,6 @@ void usage(FILE *out)
         return;
 }
 
         return;
 }
 
-/*================ utility functions =====================*/
-
-static int check_mtab_entry(char *spec)
-{
-        FILE *fp;
-        struct mntent *mnt;
-
-        fp = setmntent(MOUNTED, "r");
-        if (fp == NULL)
-                return(0);
-
-        while ((mnt = getmntent(fp)) != NULL) {
-                if (strcmp(mnt->mnt_fsname, spec) == 0) {
-                        endmntent(fp);
-                        fprintf(stderr, "%s: according to %s %s is "
-                                "already mounted on %s\n",
-                                progname, MOUNTED, spec, mnt->mnt_dir);
-                        return(EEXIST);
-                }
-        }
-        endmntent(fp);
-
-        return(0);
-}
-
 /* ==================== Lustre config functions =============*/
 
 void print_ldd(char *str, struct lustre_disk_data *ldd)
 /* ==================== Lustre config functions =============*/
 
 void print_ldd(char *str, struct lustre_disk_data *ldd)
@@ -688,8 +663,8 @@ int main(int argc, char *const argv[])
                 goto out;
         }
 
                 goto out;
         }
 
-        if (check_mtab_entry(mop.mo_device))
-                return(EEXIST);
+       if (check_mtab_entry(mop.mo_device, mop.mo_device, NULL, NULL))
+               return(EEXIST);
 
         /* Create the loopback file */
         if (mop.mo_flags & MO_IS_LOOP) {
 
         /* Create the loopback file */
         if (mop.mo_flags & MO_IS_LOOP) {