mountpoint.c revision 26bedc1f8aace67ff8f19f625a403a097017845a
/* Copyright (c) 2006-2010 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "mountpoint.h"
#ifdef HAVE_SYS_VMOUNT_H
# include <stdio.h>
#elif defined(HAVE_STATVFS_MNTFROMNAME)
# define STATVFS_STR "statvfs"
#elif defined(HAVE_STATFS_MNTFROMNAME)
# define STATVFS_STR "statfs"
#elif defined(HAVE_MNTENT_H)
# include <stdio.h>
# include <mntent.h> /* Linux */
#elif defined(HAVE_SYS_MNTTAB_H)
# include <stdio.h>
#else
# define MOUNTPOINT_UNKNOWN
#endif
#ifdef HAVE_SYS_MNTTAB_H
#else
#endif
/* AIX doesn't have these defined */
#ifndef MNTTYPE_SWAP
# define MNTTYPE_SWAP "swap"
#endif
#ifndef MNTTYPE_IGNORE
# define MNTTYPE_IGNORE "ignore"
#endif
#ifndef MNTTYPE_JFS
# define MNTTYPE_JFS "jfs"
#endif
#ifndef MNTTYPE_NFS
# define MNTTYPE_NFS "nfs"
#endif
/* Linux sometimes has mtab entry for "rootfs" as well as the real root
entry. Skip the rootfs. */
#ifndef MNTTYPE_ROOTFS
# define MNTTYPE_ROOTFS "rootfs"
#endif
{
#ifdef MOUNTPOINT_UNKNOWN
return -1;
/* BSDs */
return 0;
return -1;
}
#ifdef __osf__ /* Tru64 */
#else
#endif
return 1;
#else
#ifdef HAVE_SYS_MNTTAB_H
union {
} ent;
#else
#endif
unsigned int block_size;
FILE *f;
return 0;
return -1;
}
#ifdef HAVE_SYS_VMOUNT_H
{
int i, count;
while (count == 0) {
}
if (count < 0) {
i_error("mntctl(MCTL_QUERY) failed: %m");
return -1;
}
switch (vmt->vmt_gfstype) {
case MNT_NFS:
case MNT_NFS3:
case MNT_NFS4:
case MNT_RFS4:
vmt_object, NULL);
type = MNTTYPE_NFS;
}
break;
case MNT_J2:
case MNT_JFS:
type = MNTTYPE_JFS;
}
break;
}
}
}
#elif defined(HAVE_SYS_MNTTAB_H)
/* Solaris */
if (f == NULL) {
return -1;
}
resetmnttab(f);
continue;
/* mnt_type contains tmpfs with swap */
continue;
break;
}
}
fclose(f);
#else
/* Linux */
if (f == NULL) {
return -1;
}
continue;
break;
}
}
endmntent(f);
#endif
if (device_path == NULL)
return 0;
return 1;
#endif
}