14
14
* Copyright (c) 2012-2013 Los Alamos National Security, LLC.
15
15
* All rights reserved.
16
16
* Copyright (c) 2014 Intel, Inc. All rights reserved.
17
+ * Copyright (c) 2016 University of Houston. All rights reserved.
17
18
* $COPYRIGHT$
18
19
*
19
20
* Additional copyrights may follow
@@ -444,8 +445,9 @@ static char *opal_check_mtab(char *dev_path)
444
445
* If the file is not created, the parent directory is checked.
445
446
* This allows checking for NFS prior to opening the file.
446
447
*
447
- * @param[in] fname File name to check
448
- *
448
+ * @fname[in] File name to check
449
+ * @fstype[out] File system type if retval is true
450
+ *
449
451
* @retval true If fname is on NFS, Lustre, Panasas or GPFS
450
452
* @retval false otherwise
451
453
*
@@ -493,11 +495,14 @@ static char *opal_check_mtab(char *dev_path)
493
495
#ifndef AUTOFS_SUPER_MAGIC
494
496
#define AUTOFS_SUPER_MAGIC 0x0187
495
497
#endif
498
+ #ifndef PVFS2_SUPER_MAGIC
499
+ #define PVFS2_SUPER_MAGIC 0x20030528
500
+ #endif
496
501
497
502
#define MASK2 0xffff
498
503
#define MASK4 0xffffffff
499
504
500
- bool opal_path_nfs (char * fname )
505
+ bool opal_path_nfs (char * fname , char * * ret_fstype )
501
506
{
502
507
int i ;
503
508
int fsrc = -1 ;
@@ -523,7 +528,8 @@ bool opal_path_nfs(char *fname)
523
528
{NFS_SUPER_MAGIC , MASK2 , "nfs" },
524
529
{AUTOFS_SUPER_MAGIC , MASK2 , "autofs" },
525
530
{PAN_KERNEL_FS_CLIENT_SUPER_MAGIC , MASK4 , "panfs" },
526
- {GPFS_SUPER_MAGIC , MASK4 , "gpfs" }
531
+ {GPFS_SUPER_MAGIC , MASK4 , "gpfs" },
532
+ {PVFS2_SUPER_MAGIC , MASK4 , "pvfs2" }
527
533
};
528
534
#define FS_TYPES_NUM (int)(sizeof (fs_types)/sizeof (fs_types[0]))
529
535
@@ -555,6 +561,9 @@ bool opal_path_nfs(char *fname)
555
561
fname , errno , file ));
556
562
if (EPERM == errno ) {
557
563
free (file );
564
+ if ( NULL != ret_fstype ) {
565
+ * ret_fstype = NULL ;
566
+ }
558
567
return false;
559
568
}
560
569
@@ -563,6 +572,9 @@ bool opal_path_nfs(char *fname)
563
572
if (NULL == last_sep || (1 == strlen (last_sep ) &&
564
573
OPAL_PATH_SEP [0 ] == * last_sep )) {
565
574
free (file );
575
+ if ( NULL != ret_fstype ) {
576
+ * ret_fstype = NULL ;
577
+ }
566
578
return false;
567
579
}
568
580
* last_sep = '\0' ;
@@ -609,6 +621,9 @@ bool opal_path_nfs(char *fname)
609
621
}
610
622
611
623
free (file );
624
+ if ( NULL != ret_fstype ) {
625
+ * ret_fstype = NULL ;
626
+ }
612
627
return false;
613
628
614
629
found :
@@ -625,16 +640,25 @@ bool opal_path_nfs(char *fname)
625
640
if (0 == strcasecmp (fs_types [x ].f_fsname , fs_type )) {
626
641
OPAL_OUTPUT_VERBOSE ((10 , 0 , "opal_path_nfs: file:%s on fs:%s\n" , fname , fs_type ));
627
642
free (fs_type );
643
+ if ( NULL != ret_fstype ) {
644
+ * ret_fstype = strdup (fs_types [x ].f_fsname );
645
+ }
628
646
return true;
629
647
}
630
648
}
631
649
free (fs_type );
650
+ if ( NULL != ret_fstype ) {
651
+ * ret_fstype = NULL ;
652
+ }
632
653
return false;
633
654
}
634
655
}
635
656
636
657
OPAL_OUTPUT_VERBOSE ((10 , 0 , "opal_path_nfs: file:%s on fs:%s\n" ,
637
658
fname , fs_types [i ].f_fsname ));
659
+ if ( NULL != ret_fstype ) {
660
+ * ret_fstype = strdup (fs_types [i ].f_fsname );
661
+ }
638
662
return true;
639
663
640
664
#undef FS_TYPES_NUM
0 commit comments