int VAttachPartitions(void) { int errors = 0; FILE *mfd; struct mntent *mntent; if ((mfd = setmntent("/proc/mounts", "r")) == NULL) { if ((mfd = setmntent("/etc/mtab", "r")) == NULL) { Log("Problems in getting mount entries(setmntent)\n"); exit(-1); } } while ((mntent = getmntent(mfd))) { /* If we're going to always attach this partition, do it later. */ if (VIsAlwaysAttach(mntent->mnt_dir)) continue; if (VCheckPartition(mntent->mnt_dir, mntent->mnt_fsname) < 0) errors++; } endmntent(mfd); /* Process the always-attach partitions, if any. */ VAttachPartitions2(); return errors; }
int VAttachPartitions(void) { int errors = 0; struct fstab *fsent; if (setfsent() < 0) { Log("Error listing filesystems.\n"); exit(-1); } while ((fsent = getfsent())) { if (strcmp(fsent->fs_type, "rw") != 0) continue; /* If we're going to always attach this partition, do it later. */ if (VIsAlwaysAttach(fsent->fs_file)) continue; if (VCheckPartition(fsent->fs_file, fsent->fs_spec) < 0) errors++; } endfsent(); /* Process the always-attach partitions, if any. */ VAttachPartitions2(); return errors; }
int VAttachPartitions(void) { int errors = 0; FILE *mfd; struct mntent *mntent; if ((mfd = setmntent(MOUNTED, "r")) == NULL) { Log("Problems in getting mount entries(setmntent)\n"); exit(-1); } while (mntent = getmntent(mfd)) { if (!hasmntopt(mntent, MNTOPT_RW)) continue; /* Skip this Partition? */ if (VIsNeverAttach(mntent->mnt_dir)) continue; /* If we're going to always attach this partition, do it later. */ if (VIsAlwaysAttach(mntent->mnt_dir, NULL)) continue; if (VCheckPartition(mntent->mnt_dir, mntent->mnt_fsname, 0) < 0) errors++; } endmntent(mfd); /* Process the always-attach partitions, if any. */ VAttachPartitions2(); return errors; }
int VAttachPartitions(void) { int errors = 0; int nmounts; struct vmount *vmountp; if ((nmounts = getmount(&vmountp)) <= 0) { Log("Problems in getting # of mount entries(getmount)\n"); exit(-1); } for (; nmounts; nmounts--, vmountp = (struct vmount *)((int)vmountp + vmountp->vmt_length)) { char *part = vmt2dataptr(vmountp, VMT_STUB); if (vmountp->vmt_flags & (MNT_READONLY | MNT_REMOVABLE | MNT_REMOTE)) continue; /* Ignore any "special" partitions */ #ifdef AFS_AIX42_ENV #ifndef AFS_NAMEI_ENV { struct superblock fs; /* The Log statements are non-sequiters in the SalvageLog and don't * even appear in the VolserLog, so restrict them to the FileLog. */ if (ReadSuper(&fs, vmt2dataptr(vmountp, VMT_OBJECT)) < 0) { if (programType == fileServer) Log("Can't read superblock for %s, ignoring it.\n", part); continue; } if (IsBigFilesFileSystem(&fs)) { if (programType == fileServer) Log("%s is a big files filesystem, ignoring it.\n", part); continue; } } #endif #endif /* Skip this Partition? */ if (VIsNeverAttach(part)) continue; /* If we're going to always attach this partition, do it later. */ if (VIsAlwaysAttach(part, NULL)) continue; if (VCheckPartition(part, vmt2dataptr(vmountp, VMT_OBJECT), 0) < 0) errors++; } /* Process the always-attach partitions, if any. */ VAttachPartitions2(); return errors; }
int VAttachPartitions(void) { int errors = 0; struct mnttab mnt; FILE *mntfile; if (!(mntfile = afs_fopen(MNTTAB, "r"))) { Log("Can't open %s\n", MNTTAB); perror(MNTTAB); exit(-1); } while (!getmntent(mntfile, &mnt)) { /* Ignore non ufs or non read/write partitions */ /* but allow zfs too if we're in the NAMEI environment */ if ( #ifdef AFS_NAMEI_ENV (((strcmp(mnt.mnt_fstype, "ufs") && strcmp(mnt.mnt_fstype, "zfs")))) #else (strcmp(mnt.mnt_fstype, "ufs") != 0) #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)) continue; #ifndef AFS_NAMEI_ENV if (hasmntopt(&mnt, "logging") != NULL) { Log("This program is compiled without AFS_NAMEI_ENV, and " "partition %s is mounted with the 'logging' option. " "Using the inode fileserver backend with 'logging' UFS " "partitions causes volume corruption, so please either " "mount the partition without logging, or use the namei " "fileserver backend. Aborting...\n", mnt.mnt_mountp); errors++; } #endif /* !AFS_NAMEI_ENV */ if (VCheckPartition(mnt.mnt_mountp, mnt.mnt_special) < 0) errors++; } (void)fclose(mntfile); /* Process the always-attach partitions, if any. */ VAttachPartitions2(); return errors; }
int VAttachPartitions(void) { int errors = 0; struct mnttab mnt; FILE *mntfile; if (!(mntfile = afs_fopen(MNTTAB, "r"))) { Log("Can't open %s\n", MNTTAB); perror(MNTTAB); exit(-1); } while (!getmntent(mntfile, &mnt)) { int logging = 0; /* Ignore non ufs or non read/write partitions */ /* but allow zfs too if we're in the NAMEI environment */ if ( #ifdef AFS_NAMEI_ENV (((strcmp(mnt.mnt_fstype, "ufs") && strcmp(mnt.mnt_fstype, "zfs")))) #else (strcmp(mnt.mnt_fstype, "ufs") != 0) #endif || (strncmp(mnt.mnt_mntopts, "ro,ignore", 9) == 0)) continue; /* Skip this Partition? */ if (VIsNeverAttach(mnt.mnt_mountp)) continue; /* If we're going to always attach this partition, do it later. */ if (VIsAlwaysAttach(mnt.mnt_mountp, NULL)) continue; #ifndef AFS_NAMEI_ENV if (hasmntopt(&mnt, "logging") != NULL) { logging = 1; } #endif /* !AFS_NAMEI_ENV */ if (VCheckPartition(mnt.mnt_mountp, mnt.mnt_special, logging) < 0) errors++; } (void)fclose(mntfile); /* Process the always-attach partitions, if any. */ VAttachPartitions2(); return errors; }