#include <stdio.h>#include <string.h>#include <ctype.h>#include <math.h>
Go to the source code of this file.
Functions | |
| float | GetDiskSpace (char *) |
| int | IsNFS (char *) |
Variables | |
| char | buf [] |
| char | str [] |
| char | statusfile [] |
| float GetDiskSpace | ( | char * | dir | ) |
Definition at line 90 of file mardisk.c.
References disk.
Referenced by Command::exec_command(), and MarHW::NotEnoughDiskSpace().
{
float free= 999999.0 ;
if (strlen(dir) < 1 ) return( free );
#ifdef __sgi
if(statfs(dir, &disk, sizeof disk, 0) != 0) return( free );
#elif (__linux__ || __hpux || __DARWIN__)
if(statfs(dir, &disk) != 0) return( free );
#elif ( SUN )
if(statvfs(dir, &disk) != 0) return( free );
#elif __osf__
if(statfs(dir, &disk, sizeof disk ) != 0 )return( free );
#endif
#ifdef __osf__
free = (float)disk.f_bavail * (float)disk.f_fsize / 1024000.;
#else
if(disk.f_blocks > 0)
free = (float)disk.f_bfree * (float)disk.f_bsize / 1024000. ;
#endif
return( free );
}
| int IsNFS | ( | char * | dir | ) |
Definition at line 120 of file mardisk.c.
References debug, disk, and i.
{
int i,is_nfs = 0;
extern int debug;
if (strlen(dir) < 1 ) return( is_nfs );
#ifdef __sgi
if(statfs(dir, &disk, sizeof disk, 0) != 0) return( is_nfs );
i= sysfs( GETFSTYP, disk.f_fstyp, fstyp );
/*
* Possible filesystems are: efs, nfs, nfs2, nfs3, proc, socket,
* specfs, fd, namefs, fifofs, dos, iso9660, cdfs, hfs, autofs,
* lofs, xfs
*/
if ( strstr( fstyp, "nfs" ) )
is_nfs=1;
#ifdef DEBUG1
printf("mar345: >>>%s<<< fs-type=%s (0x%x)\n",dir,fstyp,disk.f_fstyp);
#endif
#elif (__linux__ )
/* NFS id is 0x6969, EFS id is 0xEF53 */
if(statfs(dir, &disk) != 0) return( is_nfs );
if ( disk.f_type == 0x6969 ) is_nfs = 1;
#ifdef DEBUG
if (debug)
printf("mar345: >>>%s<<< fs-type=0x%x\n",dir,disk.f_type);
#endif
#elif __hpux
/* NFS id is MOUNT_NFS (=1), UFS id is MOUNT_UFS (=0) */
if(statfs(dir, &disk) != 0) return( is_nfs );
if ( disk.f_type == MOUNT_NFS ) is_nfs = 1;
#elif SUN
/* NFS id is "NFS", UFS is "DUFST" */
if(statvfs(dir, &disk) != 0) return( is_nfs );
if ( strstr( disk.f_basetype, "NFS" ) )
is_nfs=1;
#ifdef DEBUG
if (debug)
printf("mar345: >>>%s<<< fs-type=0x%x\n",dir,disk.f_type);
#endif
#elif __osf__
if(statfs(dir, &disk, sizeof disk ) != 0 )return( is_nfs );
#endif
return(is_nfs);
}
| char buf[] |
Definition at line 87 of file marglobals.h.
Referenced by Command::exec_command(), GetConfig(), Getmar300Header(), Getmar345Header(), GetmarNBHeader(), MarXF::mar_start_scan_readout(), MarXF::output_header(), MarXF::output_image(), and Command::TestDirectory().
| char statusfile[] |
| char str[] |
Definition at line 87 of file marglobals.h.
1.7.3