/*
* Copyright 2000, International Business Machines Corporation and others.
* All Rights Reserved.
- *
+ *
* This software has been released under the terms of the IBM Public
* License. For details, see the LICENSE file in the top-level source
* directory or online at http://www.openafs.org/dl/license10.html
* attached (return value 1), or only attached when it is a separately
* mounted partition (return value 0). For non-NAMEI environments, it
* always returns 0.
+ *
+ * *awouldattach will be set to 1 if the given path at least looks like a vice
+ * partition (that is, if we return 0, the only thing preventing this partition
+ * from being attached is the existence of the AlwaysAttach file), or to 0
+ * otherwise. *awouldattach is set regardless of whether or not the partition
+ * should always be attached or not.
*/
static int
-VIsAlwaysAttach(char *part)
+VIsAlwaysAttach(char *part, int *awouldattach)
{
#ifdef AFS_NAMEI_ENV
struct afs_stat st;
char checkfile[256];
int ret;
+#endif /* AFS_NAMEI_ENV */
+
+ if (awouldattach) {
+ *awouldattach = 0;
+ }
+#ifdef AFS_NAMEI_ENV
if (strncmp(part, VICE_PARTITION_PREFIX, VICE_PREFIX_SIZE))
return 0;
+ if (awouldattach) {
+ *awouldattach = 1;
+ }
+
strncpy(checkfile, part, 100);
strcat(checkfile, "/");
strcat(checkfile, VICE_ALWAYSATTACH_FILE);
DIR *dirp;
struct dirent *de;
char pname[32];
+ int wouldattach;
dirp = opendir("/");
while ((de = readdir(dirp))) {
/* Only keep track of "/vicepx" partitions since automounter
* may hose us */
- if (VIsAlwaysAttach(pname))
+ if (VIsAlwaysAttach(pname, &wouldattach)) {
VCheckPartition(pname, "");
+ } else {
+ struct afs_stat st;
+ if (wouldattach && VGetPartition(pname, 0) == NULL &&
+ afs_stat(pname, &st) == 0 && S_ISDIR(st.st_mode)) {
+
+ /* This is a /vicep* dir, and it has not been attached as a
+ * partition. This probably means that this is a /vicep* dir
+ * that is not a separate partition, so just give a notice so
+ * admins are not confused as to why their /vicep* dirs are not
+ * being attached.
+ *
+ * It is possible that the dir _is_ a separate partition and we
+ * failed to attach it earlier, making this message a bit
+ * confusing. But that should be rare, and an error message
+ * about the failure will already be logged right before this,
+ * so it should be clear enough. */
+
+ Log("VAttachPartitions: not attaching %s; either it is not a "
+ "separate partition, or it failed to attach (create the "
+ "file %s/" VICE_ALWAYSATTACH_FILE " to force attachment)\n",
+ pname, pname);
+ }
+ }
}
closedir(dirp);
#endif /* AFS_NAMEI_ENV */
#endif
|| (strncmp(mnt.mnt_mntopts, "ro,ignore", 9) == 0))
continue;
-
+
/* If we're going to always attach this partition, do it later. */
- if (VIsAlwaysAttach(mnt.mnt_mountp))
+ if (VIsAlwaysAttach(mnt.mnt_mountp, NULL))
continue;
#ifndef AFS_NAMEI_ENV
continue;
/* If we're going to always attach this partition, do it later. */
- if (VIsAlwaysAttach(mntent->mnt_dir))
+ if (VIsAlwaysAttach(mntent->mnt_dir, NULL))
continue;
if (VCheckPartition(mntent->mnt_dir, mntent->mnt_fsname) < 0)
#endif
/* If we're going to always attach this partition, do it later. */
- if (VIsAlwaysAttach(part))
+ if (VIsAlwaysAttach(part, NULL))
continue;
if (VCheckPartition(part, vmt2dataptr(vmountp, VMT_OBJECT)) < 0)
continue;
/* If we're going to always attach this partition, do it later. */
- if (VIsAlwaysAttach(fsent->fs_file))
+ if (VIsAlwaysAttach(fsent->fs_file, NULL))
continue;
if (VCheckPartition(fsent->fs_file, fsent->fs_spec) < 0)
}
while ((mntent = getmntent(mfd))) {
/* If we're going to always attach this partition, do it later. */
- if (VIsAlwaysAttach(mntent->mnt_dir))
+ if (VIsAlwaysAttach(mntent->mnt_dir, NULL))
continue;
if (VCheckPartition(mntent->mnt_dir, mntent->mnt_fsname) < 0)
* @internal volume package internal use only
*/
-struct DiskPartition64 *
+struct DiskPartition64 *
VGetPartitionById_r(afs_int32 id, int abortp)
{
struct DiskPartition64 *dp = NULL;
return dp;
}
-static struct DiskPartition64 *
+static struct DiskPartition64 *
VLookupPartition_r(char * path)
{
afs_int32 id = volutil_GetPartitionID(path);
return DiskPartitionTable[id];
}
-static void
+static void
AddPartitionToTable_r(struct DiskPartition64 *dp)
{
assert(dp->index >= 0 && dp->index <= VOLMAXPARTS);
}
#if 0
-static void
+static void
DeletePartitionFromTable_r(struct DiskPartition64 *dp)
{
assert(dp->index >= 0 && dp->index <= VOLMAXPARTS);