2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
15 Institution: The Information Technology Center, Carnegie-Mellon University
19 #include <afs/param.h>
26 #include <sys/param.h>
29 #include <sys/statvfs.h>
30 #endif /* AFS_HAVE_STATVFS */
32 #include <sys/mount.h>
35 #if !defined(AFS_SGI_ENV)
37 #include <sys/mount.h>
39 #else /* AFS_OSF_ENV */
40 #ifdef AFS_VFSINCL_ENV
43 #include <sys/fs/ufs_fs.h>
46 #include <ufs/ufs/dinode.h>
47 #include <ufs/ffs/fs.h>
52 #else /* AFS_VFSINCL_ENV */
53 #if !defined(AFS_AIX_ENV) && !defined(AFS_LINUX22_ENV) && !defined(AFS_DARWIN_ENV)
56 #endif /* AFS_VFSINCL_ENV */
57 #endif /* AFS_OSF_ENV */
58 #include <sys/errno.h>
64 #include <sys/lockf.h>
70 #include <checklist.h>
72 #if defined(AFS_SUN_ENV)
77 #include <sys/mnttab.h>
78 #include <sys/mntent.h>
80 #ifdef AFS_LINUX22_ENV
82 #include <sys/statfs.h>
89 #endif /* AFS_SGI_ENV */
90 #endif /* AFS_NT40_ENV */
91 #if defined(AFS_SGI_ENV)
92 #include <sys/errno.h>
100 #include <afs/afsint.h>
102 #include <afs/errors.h>
105 #include <afs/afssyscalls.h>
111 #include "namei_ops.h"
113 #endif /* AFS_NAMEI_ENV */
116 #include "partition.h"
117 #ifdef AFS_PTHREAD_ENV
119 #else /* AFS_PTHREAD_ENV */
120 #include <afs/assert.h>
121 #endif /* AFS_PTHREAD_ENV */
123 #if defined(AFS_HPUX_ENV)
124 #include <sys/types.h>
125 #include <sys/privgrp.h>
126 #endif /* defined(AFS_HPUX_ENV) */
129 #include <jfs/filsys.h>
132 int aixlow_water = 8; /* default 8% */
133 struct DiskPartition *DiskPartitionList;
135 #ifdef AFS_SGI_XFS_IOPS_ENV
136 /* Verify that the on disk XFS inodes on the partition are large enough to
137 * hold the AFS attribute. Returns -1 if the attribute can't be set or is
138 * too small to fit in the inode. Returns 0 if the attribute does fit in
141 #include <afs/xfsattrs.h>
142 static int VerifyXFSInodeSize(char *part, char *fstype)
145 int length = SIZEOF_XFS_ATTR_T;
150 if (strcmp("xfs", fstype))
153 if (attr_set(part, AFS_XFS_ATTR, &junk, length, ATTR_ROOT) == 0) {
154 if (((fd=open(part, O_RDONLY, 0)) != -1)
155 && (fcntl(fd, F_FSGETXATTRA, &fsx) == 0)) {
157 if (fsx.fsx_nextents) {
158 Log("Partition %s: XFS inodes too small, exiting.\n", part);
159 Log("Run xfs_size_check utility and remake partitions.\n");
167 (void) attr_remove(part, AFS_XFS_ATTR, ATTR_ROOT);
174 static void VInitPartition_r(char *path, char *devname, Device dev)
176 struct DiskPartition *dp, *op;
177 dp = (struct DiskPartition *) malloc(sizeof (struct DiskPartition));
178 /* Add it to the end, to preserve order when we print statistics */
179 for (op = DiskPartitionList; op; op = op->next) {
186 DiskPartitionList = dp;
188 strcpy(dp->name, path);
189 #if defined(AFS_NAMEI_ENV) && !defined(AFS_NT40_ENV)
191 strcpy(dp->devName, devname);
192 #else /* AFS_SUN5_ENV */
193 strcpy(dp->devName, path);
195 dp->device = volutil_GetPartitionID(path);
197 strcpy(dp->devName, devname);
202 dp->f_files = 1; /* just a default value */
203 #if defined(AFS_NAMEI_ENV) && !defined(AFS_NT40_ENV)
204 if (programType == fileServer)
205 (void) namei_ViceREADME(VPartitionPath(dp));
207 VSetPartitionDiskUsage_r(dp);
210 static void VInitPartition(char *path, char *devname, Device dev)
213 VInitPartition_r(path, devname, dev);
218 /* VAttachPartitions() finds the vice partitions on this server. Calls
219 * VCheckPartition() to do some basic checks on the partition. If the partition
220 * is a valid vice partition, VCheckPartition will add it to the DiskPartition
222 * Returns the number of errors returned by VCheckPartition. An error in
223 * VCheckPartition means that partition is a valid vice partition but the
224 * fileserver should not start because of the error found on that partition.
227 * No specific user space file system checks, since we don't know what
228 * is being used for vice partitions.
230 * Use partition name as devname.
232 int VCheckPartition(part, devname)
237 #if !defined(AFS_LINUX20_ENV) && !defined(AFS_NT40_ENV)
238 char AFSIDatPath[MAXPATHLEN];
241 /* Only keep track of "/vicepx" partitions since it can get hairy
242 * when NFS mounts are involved.. */
243 if (strncmp(part, VICE_PARTITION_PREFIX, VICE_PREFIX_SIZE)) {
246 if (stat(part, &status) < 0) {
247 Log("VInitVnodes: Couldn't find file system %s; ignored\n", part);
251 #ifndef AFS_AIX32_ENV
252 if (programType == fileServer) {
253 char salvpath[MAXPATHLEN];
254 strcpy(salvpath, part);
255 strcat(salvpath, "/FORCESALVAGE");
256 if (stat(salvpath, &status) == 0) {
257 Log("VInitVnodes: Found %s; aborting\n", salvpath);
263 #if !defined(AFS_LINUX20_ENV) && !defined(AFS_NT40_ENV)
264 strcpy(AFSIDatPath, part);
265 strcat(AFSIDatPath, "/AFSIDat");
267 if (stat(AFSIDatPath, &status) < 0) {
271 dirp = opendir(part);
273 while (dp = readdir(dirp)) {
274 if (dp->d_name[0] == 'V') {
275 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);
282 #else /* AFS_NAMEI_ENV */
283 if (stat(AFSIDatPath, &status) == 0) {
284 Log("This program is compiled without AFS_NAMEI_ENV, but partition %s seems to contain volumes which use the namei-interface; aborting\n", part);
287 #endif /* AFS_NAMEI_ENV */f
290 #ifdef AFS_SGI_XFS_IOPS_ENV
291 if (VerifyXFSInodeSize(part, status.st_fstype) < 0)
296 if (status.st_ino != ROOTINO) {
297 Log("%s is not a mounted file system; ignored.\n", part);
302 VInitPartition(part, devname, status.st_dev);
306 #endif /* AFS_NT40_ENV */
309 int VAttachPartitions(void)
315 if (!(mntfile = fopen(MNTTAB, "r"))) {
316 Log("Can't open %s\n", MNTTAB);
320 while (!getmntent(mntfile, &mnt)) {
321 /* Ignore non ufs or non read/write partitions */
322 if ((strcmp(mnt.mnt_fstype, "ufs") !=0) ||
323 (strncmp(mnt.mnt_mntopts, "ro,ignore",9) ==0))
326 if (VCheckPartition(mnt.mnt_mountp, mnt.mnt_special) < 0 )
330 (void) fclose(mntfile);
335 #endif /* AFS_SUN5_ENV */
336 #if defined(AFS_SGI_ENV) || (defined(AFS_SUN_ENV) && !defined(AFS_SUN5_ENV)) || defined(AFS_HPUX_ENV)
337 int VAttachPartitions(void)
341 struct mntent *mntent;
343 if ((mfd = setmntent(MOUNTED, "r")) == NULL) {
344 Log("Problems in getting mount entries(setmntent)\n");
347 while (mntent = getmntent(mfd)) {
348 if (!hasmntopt(mntent, MNTOPT_RW)) continue;
350 if (VCheckPartition(mntent->mnt_dir, mntent->mnt_fsname) < 0 )
361 * (This function was grabbed from df.c)
365 register struct vmount **vmountpp; /* place to tell where buffer is */
368 register struct vmount *vm;
371 /* set initial size of mntctl buffer to a MAGIC NUMBER */
374 /* try the operation until ok or a fatal error */
376 if ((vm = (struct vmount *)malloc(size)) == NULL) {
377 /* failed getting memory for mount status buf */
378 perror("FATAL ERROR: get_stat malloc failed\n");
383 * perform the QUERY mntctl - if it returns > 0, that is the
384 * number of vmount structures in the buffer. If it returns
385 * -1, an error occured. If it returned 0, then look in
386 * first word of buffer for needed size.
388 if ((nmounts = mntctl(MCTL_QUERY, size, (caddr_t)vm)) > 0) {
389 /* OK, got it, now return */
393 } else if (nmounts == 0) {
394 /* the buffer wasn't big enough .... */
395 /* .... get required buffer size */
400 /* some other kind of error occurred */
407 int VAttachPartitions(void)
411 struct vmount *vmountp;
413 if ((nmounts = getmount(&vmountp)) <= 0) {
414 Log("Problems in getting # of mount entries(getmount)\n");
417 for (; nmounts; nmounts--,
418 vmountp = (struct vmount *)((int)vmountp + vmountp->vmt_length)) {
419 char *part = vmt2dataptr(vmountp, VMT_STUB);
421 if (vmountp->vmt_flags & (MNT_READONLY|MNT_REMOVABLE|MNT_REMOTE))
422 continue; /* Ignore any "special" partitions */
426 struct superblock fs;
427 /* The Log statements are non-sequiters in the SalvageLog and don't
428 * even appear in the VolserLog, so restrict them to the FileLog.
430 if (ReadSuper(&fs, vmt2dataptr(vmountp, VMT_OBJECT))<0) {
431 if (programType == fileServer)
432 Log("Can't read superblock for %s, ignoring it.\n", part);
435 if (IsBigFilesFileSystem(&fs)) {
436 if (programType == fileServer)
437 Log("%s is a big files filesystem, ignoring it.\n", part);
443 if (VCheckPartition(part, vmt2dataptr(vmountp, VMT_OBJECT)) < 0 )
450 #if defined(AFS_DUX40_ENV) || defined(AFS_DARWIN_ENV)
451 int VAttachPartitions(void)
456 if (setfsent() < 0) {
457 Log("Error listing filesystems.\n");
461 while (fsent = getfsent()) {
462 if (strcmp(fsent->fs_type, "rw") != 0) continue;
464 if (VCheckPartition(fsent->fs_file, fsent->fs_spec) < 0 )
475 #include <sys/stat.h>
478 * validate names in vptab.
485 int VValidVPTEntry(struct vptab *vpe)
487 int len = strlen(vpe->vp_name);
490 if (len < VICE_PREFIX_SIZE+1 || len > VICE_PREFIX_SIZE + 2)
492 if (strncmp(vpe->vp_name, VICE_PARTITION_PREFIX, VICE_PREFIX_SIZE))
495 for (i=VICE_PREFIX_SIZE; i<len; i++) {
496 if (vpe->vp_name[i] < 'a' || vpe->vp_name[i] > 'z') {
497 Log("Invalid partition name %s in registry, ignoring it.\n",
502 if (len == VICE_PREFIX_SIZE + 2) {
503 i = (int)(vpe->vp_name[VICE_PREFIX_SIZE]-'a') * 26 +
504 (int)(vpe->vp_name[VICE_PREFIX_SIZE+1]-'a') ;
506 Log("Invalid partition name %s in registry, ignoring it.\n",
512 len = strlen(vpe->vp_dev);
513 if (len != 2 || vpe->vp_dev[1] != ':' || vpe->vp_dev[0] < 'A' ||
514 vpe->vp_dev[0] > 'Z') {
515 Log("Invalid device name %s in registry, ignoring it.\n",
523 int VCheckPartition(char *partName)
530 /* partName is presumed to be of the form "X:" */
531 (void) sprintf(volRoot, "%c:\\", *partName);
533 if (!GetVolumeInformation(volRoot, /* volume root directory */
534 NULL, /* volume name buffer */
535 0, /* volume name size */
536 NULL, /* volume serial number */
537 &dwDummy, /* max component length */
538 &dwDummy, /* file system flags */
539 volFsType, /* file system name */
540 sizeof(volFsType))) {
541 err = GetLastError();
542 Log("VCheckPartition: Failed to get partition information for %s, ignoring it.\n",
547 if (strcmp(volFsType, "NTFS")) {
548 Log("VCheckPartition: Partition %s is not an NTFS partition, ignoring it.\n", partName);
556 int VAttachPartitions(void)
558 struct DiskPartition *partP, *prevP, *nextP;
559 struct vpt_iter iter;
562 if (vpt_Start(&iter)<0) {
563 Log("No partitions to attach.\n");
567 while (0==vpt_NextEntry(&iter, &entry)) {
568 if (!VValidVPTEntry(&entry)) {
572 /* This test for duplicates relies on the fact that the method
573 * of storing the partition names in the NT registry means the same
574 * partition name will never appear twice in the list.
576 for (partP = DiskPartitionList; partP; partP = partP->next) {
577 if (*partP->devName == *entry.vp_dev) {
578 Log("Same drive (%s) used for both partition %s and partition %s, ignoring both.\n", entry.vp_dev, partP->name, entry.vp_name);
579 partP->flags = PART_DUPLICATE;
580 break; /* Only one entry will ever be in this list. */
583 if (partP) continue; /* found a duplicate */
585 if (VCheckPartition(entry.vp_dev)<0)
587 /* This test allows for manually inserting the FORCESALVAGE flag
588 * and thereby invoking the salvager. scandisk obviously won't be
591 if (programType == fileServer) {
593 char salvpath[MAXPATHLEN];
594 strcpy(salvpath, entry.vp_dev);
595 strcat(salvpath, "\\FORCESALVAGE");
596 if (stat(salvpath, &status) == 0) {
597 Log("VAttachPartitions: Found %s; aborting\n", salvpath);
601 VInitPartition(entry.vp_name, entry.vp_dev, *entry.vp_dev - 'A');
605 /* Run through partition list and clear out the dupes. */
606 prevP = nextP = NULL;
607 for (partP = DiskPartitionList; partP; partP = nextP) {
609 if (partP->flags == PART_DUPLICATE) {
611 prevP->next = partP->next;
613 DiskPartitionList = partP->next;
624 #ifdef AFS_LINUX22_ENV
625 int VAttachPartitions(void)
629 struct mntent *mntent;
631 if ((mfd = setmntent("/proc/mounts", "r")) == NULL) {
632 if ((mfd = setmntent("/etc/mtab", "r")) == NULL) {
633 Log("Problems in getting mount entries(setmntent)\n");
637 while (mntent = getmntent(mfd)) {
638 if (VCheckPartition(mntent->mnt_dir, mntent->mnt_fsname) < 0 )
645 #endif /* AFS_LINUX22_ENV */
647 /* This routine is to be called whenever the actual name of the partition
648 * is required. The canonical name is still in part->name.
650 char * VPartitionPath(struct DiskPartition *part)
653 return part->devName;
659 /* get partition structure, abortp tells us if we should abort on failure */
660 struct DiskPartition *VGetPartition_r(char *name, int abortp)
662 register struct DiskPartition *dp;
663 for (dp = DiskPartitionList; dp; dp = dp->next) {
664 if (strcmp(dp->name, name) == 0)
672 struct DiskPartition *VGetPartition(char *name, int abortp)
674 struct DiskPartition *retVal;
676 retVal = VGetPartition_r(name, abortp);
682 void VSetPartitionDiskUsage_r(register struct DiskPartition *dp)
684 ULARGE_INTEGER free_user, total, free_total;
685 int ufree, tot, tfree;
687 if (!GetDiskFreeSpaceEx(VPartitionPath(dp), &free_user, &total,
689 printf("Failed to get disk space info for %s, error = %d\n",
690 dp->name, GetLastError());
694 /* Convert to 1K units. */
695 ufree = (int) Int64ShraMod32(free_user.QuadPart, 10);
696 tot = (int) Int64ShraMod32(total.QuadPart, 10);
697 tfree = (int) Int64ShraMod32(free_total.QuadPart, 10);
699 dp->minFree = tfree - ufree; /* only used in VPrintDiskStats_r */
700 dp->totalUsable = tot;
705 void VSetPartitionDiskUsage_r(register struct DiskPartition *dp)
708 int fd, totalblks, free, used, availblks, bsize, code;
711 struct statvfs statbuf;
713 struct statfs statbuf;
716 if (dp->flags & PART_DONTUPDATE)
718 /* Note: we don't bother syncing because it's only an estimate, update
719 is syncing every 30 seconds anyway, we only have to keep the disk
720 approximately 10% from full--you just can't get the stuff in from
721 the net fast enough to worry */
723 code = statvfs(dp->name, &statbuf);
725 code = statfs(dp->name, &statbuf);
728 Log("statfs of %s failed in VSetPartitionDiskUsage (errno = %d)\n", dp->name, errno);
731 if (statbuf.f_blocks == -1) { /* Undefined; skip stats.. */
732 Log("statfs of %s failed in VSetPartitionDiskUsage\n", dp->name);
735 totalblks = statbuf.f_blocks;
736 free = statbuf.f_bfree;
737 reserved = free - statbuf.f_bavail;
739 bsize = statbuf.f_frsize;
741 bsize = statbuf.f_bsize;
743 availblks = totalblks - reserved;
744 dp->f_files = statbuf.f_files; /* max # of files in partition */
746 /* Now free and totalblks are in fragment units, but we want them in
750 free *= (bsize/1024);
751 totalblks *= (bsize / 1024);
752 availblks *= (bsize / 1024 );
753 reserved *= (bsize / 1024 );
756 free /= (1024/bsize);
757 totalblks /= (1024/bsize);
758 availblks /= (1024/bsize);
759 reserved /= (1024/bsize);
761 /* now compute remaining figures */
762 used = totalblks - free;
764 dp->minFree = reserved; /* only used in VPrintDiskStats_r */
765 dp->totalUsable = availblks;
766 dp->free = availblks - used; /* this is exactly f_bavail */
768 #endif /* AFS_NT40_ENV */
770 void VSetPartitionDiskUsage(register struct DiskPartition *dp)
773 VSetPartitionDiskUsage_r(dp);
777 void VResetDiskUsage_r(void)
779 struct DiskPartition *dp;
780 for (dp = DiskPartitionList; dp; dp = dp->next) {
781 VSetPartitionDiskUsage_r(dp);
782 #ifndef AFS_PTHREAD_ENV
784 #endif /* !AFS_PTHREAD_ENV */
788 void VResetDiskUsage(void)
795 void VAdjustDiskUsage_r(Error *ec, Volume *vp, afs_int32 blocks, afs_int32 checkBlocks)
797 afs_int32 rem, minavail;
799 /* why blocks instead of checkBlocks in the check below? Otherwise, any check
800 for less than BlocksSpare would skip the error-checking path, and we
801 could grow existing files forever, not just for another BlocksSpare
805 if ((rem = vp->partition->free - checkBlocks) <
806 (minavail = (vp->partition->totalUsable * aixlow_water) / 100))
808 if (vp->partition->free - checkBlocks < 0)
811 else if (V_maxquota(vp) && V_diskused(vp) + checkBlocks > V_maxquota(vp))
814 vp->partition->free -= blocks;
815 V_diskused(vp) += blocks;
818 void VAdjustDiskUsage(Error *ec, Volume *vp, afs_int32 blocks, afs_int32 checkBlocks)
821 VAdjustDiskUsage_r(ec, vp, blocks, checkBlocks);
825 int VDiskUsage_r(Volume *vp, afs_int32 blocks)
827 afs_int32 rem, minavail;
830 if ((rem = vp->partition->free - blocks) <
831 (minavail = (vp->partition->totalUsable * aixlow_water) / 100))
833 if (vp->partition->free - blocks < 0)
837 vp->partition->free -= blocks;
841 int VDiskUsage(Volume *vp, afs_int32 blocks)
845 retVal = VDiskUsage_r(vp, blocks);
850 void VPrintDiskStats_r(void)
852 struct DiskPartition *dp;
853 for (dp = DiskPartitionList; dp; dp = dp->next) {
854 Log("Partition %s: %d available 1K blocks (minfree=%d), ",
855 dp->name, dp->totalUsable, dp->minFree);
857 Log("overallocated by %d blocks\n", -dp->free);
859 Log("%d free blocks\n", dp->free);
863 void VPrintDiskStats(void)
871 /* Need a separate lock file on NT, since NT only has mandatory file locks. */
872 #define LOCKFILE "LOCKFILE"
873 void VLockPartition_r(char *name)
875 struct DiskPartition *dp = VGetPartition_r(name, 0);
879 if (dp->lock_fd == -1) {
882 (void) sprintf(path, "%s\\%s", VPartitionPath(dp), LOCKFILE);
883 dp->lock_fd = (int)CreateFile(path, GENERIC_WRITE,
884 FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,
885 CREATE_ALWAYS, FILE_ATTRIBUTE_HIDDEN, NULL);
886 assert (dp->lock_fd != (int)INVALID_HANDLE_VALUE);
888 memset((char*)&lap, 0, sizeof(lap));
889 rc = LockFileEx((HANDLE)dp->lock_fd, LOCKFILE_EXCLUSIVE_LOCK,
895 void VUnlockPartition_r(char *name)
897 register struct DiskPartition *dp = VGetPartition_r(name, 0);
900 if (!dp) return; /* no partition, will fail later */
901 memset((char*)&lap, 0, sizeof(lap));
903 UnlockFileEx((HANDLE)dp->lock_fd, 0, 1, 0, &lap);
904 CloseHandle((HANDLE)dp->lock_fd);
907 #else /* AFS_NT40_ENV */
909 #if defined(AFS_HPUX_ENV)
910 #define BITS_PER_CHAR (8)
911 #define BITS(type) (sizeof(type) * BITS_PER_CHAR)
913 #define LOCKRDONLY_OFFSET ((PRIV_LOCKRDONLY - 1) / BITS(int))
914 #endif /* defined(AFS_HPUX_ENV) */
916 void VLockPartition_r(char *name)
918 register struct DiskPartition *dp = VGetPartition_r(name, 0);
921 struct timeval pausing;
922 #if defined(AFS_HPUX_ENV)
924 struct privgrp_map privGrpList[PRIV_MAXGRPS];
925 unsigned int *globalMask;
927 #endif /* defined(AFS_HPUX_ENV) */
929 if (!dp) return; /* no partition, will fail later */
930 if (dp->lock_fd != -1) return;
932 #if defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV)
933 partitionName = dp->devName;
936 partitionName = dp->name;
940 for (retries=25; retries; retries--) {
941 dp->lock_fd = open(partitionName, code);
942 if (dp->lock_fd != -1) break;
944 pausing.tv_usec = 500000;
945 select(0, NULL, NULL, NULL, &pausing);
947 assert(retries != 0);
949 #if defined (AFS_HPUX_ENV)
951 assert(getprivgrp(privGrpList) == 0);
954 * In general, it will difficult and time-consuming ,if not impossible,
955 * to try to find the privgroup to which this process belongs that has the
956 * smallest membership, to minimise the security hole. So, we use the privgrp
957 * to which everybody belongs.
959 /* first, we have to find the global mask */
960 for (globalMaskIndex = 0; globalMaskIndex < PRIV_MAXGRPS;
962 if (privGrpList[globalMaskIndex].priv_groupno == PRIV_GLOBAL) {
963 globalMask = &(privGrpList[globalMaskIndex].
964 priv_mask[LOCKRDONLY_OFFSET]);
969 if (((*globalMask) & privmask(PRIV_LOCKRDONLY)) == 0) {
970 /* allow everybody to set a lock on a read-only file descriptor */
971 (*globalMask) |= privmask(PRIV_LOCKRDONLY);
972 assert(setprivgrp(PRIV_GLOBAL,
973 privGrpList[globalMaskIndex].priv_mask) == 0);
975 lockfRtn = lockf(dp->lock_fd, F_LOCK, 0);
977 /* remove the privilege granted to everybody to lock a read-only fd */
978 (*globalMask) &= ~(privmask(PRIV_LOCKRDONLY));
979 assert(setprivgrp(PRIV_GLOBAL,
980 privGrpList[globalMaskIndex].priv_mask) == 0);
983 /* in this case, we should be able to do this with impunity, anyway */
984 lockfRtn = lockf(dp->lock_fd, F_LOCK, 0);
987 assert (lockfRtn != -1);
989 #if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV)
990 assert (lockf(dp->lock_fd, F_LOCK, 0) != -1);
992 assert (flock(dp->lock_fd, LOCK_EX) == 0);
993 #endif /* defined(AFS_AIX_ENV) */
997 void VUnlockPartition_r(char *name)
999 register struct DiskPartition *dp = VGetPartition_r(name, 0);
1000 if (!dp) return; /* no partition, will fail later */
1005 #endif /* AFS_NT40_ENV */
1007 void VLockPartition(char *name)
1010 VLockPartition_r(name);
1014 void VUnlockPartition(char *name)
1017 VUnlockPartition_r(name);