From d8313d4404add128b23be24987e9055e0f3d49da Mon Sep 17 00:00:00 2001 From: Hartmut Reuter Date: Wed, 4 Apr 2001 18:14:23 +0000 Subject: [PATCH] make-vol-package-deal-with-namei-correctly-on-systems-which-can-be-compiled-with-or-without-namei-fileserver-20010404 If compiled without AFS_NAMEI_ENV existence of AFSIDat must stop us. If compiled with AFS_NAMEI_ENV volume headers in a partition, but no AFSIDat must stop us. --- src/vol/partition.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/vol/partition.c b/src/vol/partition.c index d773d2b..e1eb720 100644 --- a/src/vol/partition.c +++ b/src/vol/partition.c @@ -234,6 +234,9 @@ int VCheckPartition(part, devname) char *devname; { struct stat status; +#if !defined(AFS_LINUX20_ENV) && !defined(AFS_NT40_ENV) + char AFSIDatPath[MAXPATHLEN]; +#endif /* Only keep track of "/vicepx" partitions since it can get hairy * when NFS mounts are involved.. */ @@ -257,6 +260,33 @@ int VCheckPartition(part, devname) } #endif +#if !defined(AFS_LINUX20_ENV) && !defined(AFS_NT40_ENV) + strcpy(AFSIDatPath, part); + strcat(AFSIDatPath, "/AFSIDat"); +#ifdef AFS_NAMEI_ENV + if (stat(AFSIDatPath, &status) < 0) { + DIR *dirp; + struct dirent *dp; + + dirp = opendir(part); + assert(dirp); + while (dp = readdir(dirp)) { + if (dp->d_name[0] == 'V') { + Log("This program is compiled with AFS_NAMEI_ENV, but partition %s seems to contain volumes which don't use the namei-interface; aborting\n", part); + closedir(dirp); + return -1; + } + } + closedir(dirp); + } +#else /* AFS_NAMEI_ENV */ + if (stat(AFSIDatPath, &status) == 0) { + Log("This program is compiled without AFS_NAMEI_ENV, but partition %s seems to contain volumes which use the namei-interface; aborting\n", part); + return -1; + } +#endif /* AFS_NAMEI_ENV */f +#endif + #ifdef AFS_SGI_XFS_IOPS_ENV if (VerifyXFSInodeSize(part, status.st_fstype) < 0) return -1; -- 1.9.4