FBSD, DFBSD (future) vnode_pager_setsize updates
[openafs.git] / src / afs / VNOPS / afs_vnop_flock.c
index 5bf9367..d7698f8 100644 (file)
 
 
 /* Static prototypes */
-static int HandleGetLock(register struct vcache *avc,
-                        register struct AFS_FLOCK *af,
-                        register struct vrequest *areq, int clid);
+static int HandleGetLock(struct vcache *avc,
+                        struct AFS_FLOCK *af,
+                        struct vrequest *areq, int clid);
 static int GetFlockCount(struct vcache *avc, struct vrequest *areq);
 static int lockIdcmp2(struct AFS_FLOCK *flock1, struct vcache *vp,
-                     register struct SimpleLocks *alp, int onlymine,
+                     struct SimpleLocks *alp, int onlymine,
                      int clid);
 static void DoLockWarning(afs_ucred_t * acred);
 
@@ -178,11 +178,11 @@ lockIdSet(struct AFS_FLOCK *flock, struct SimpleLocks *slp, int clid)
 
 static int
 lockIdcmp2(struct AFS_FLOCK *flock1, struct vcache *vp,
-          register struct SimpleLocks *alp, int onlymine, int clid)
+          struct SimpleLocks *alp, int onlymine, int clid)
 {
-    register struct SimpleLocks *slp;
+    struct SimpleLocks *slp;
 #if    defined(AFS_SUN5_ENV)
-    register proc_t *procp = ttoproc(curthread);
+    proc_t *procp = ttoproc(curthread);
 #else
 #if !defined(AFS_AIX41_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_SGI65_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV)
 #ifdef AFS_SGI64_ENV
@@ -251,7 +251,7 @@ lockIdcmp2(struct AFS_FLOCK *flock1, struct vcache *vp,
 */
 /* clid - nonzero on sgi sunos osf1 only */
 int
-HandleFlock(register struct vcache *avc, int acom, struct vrequest *areq,
+HandleFlock(struct vcache *avc, int acom, struct vrequest *areq,
            pid_t clid, int onlymine)
 {
     struct afs_conn *tc;
@@ -317,7 +317,7 @@ HandleFlock(register struct vcache *avc, int acom, struct vrequest *areq,
                }
            }
        } else if (avc->flockCount == -1) {
-           afs_StoreAllSegments(avc, areq, AFS_ASYNC); /* fsync file early */
+           afs_StoreAllSegments(avc, areq, AFS_SYNC | AFS_VMSYNC);     /* fsync file early */
            avc->flockCount = 0;
            /* And remove the (only) exclusive lock entry from the list... */
            osi_FreeSmallSpace(avc->slocks);
@@ -434,6 +434,8 @@ HandleFlock(register struct vcache *avc, int acom, struct vrequest *areq,
                                 (tc, code, &avc->f.fid, areq,
                                  AFS_STATS_FS_RPCIDX_SETLOCK, SHARED_LOCK,
                                  NULL));
+                       if ((lockType == LockWrite) && (code == VREADONLY))
+                           code = EBADF; /* per POSIX; VREADONLY == EROFS */
                    } else
                        /* XXX - Should probably try and log this when we're
                         * XXX - running with logging enabled. But it's horrid
@@ -502,7 +504,7 @@ static afs_int32 lastWarnPid = 0;
 static void
 DoLockWarning(afs_ucred_t * acred)
 {
-    register afs_int32 now;
+    afs_int32 now;
     pid_t pid = MyPidxx2Pid(MyPidxx);
     char *procname;
 
@@ -525,7 +527,7 @@ DoLockWarning(afs_ucred_t * acred)
        lastWarnPid = pid;
 #ifdef AFS_LINUX26_ENV
        afs_warnuser
-           ("afs: byte-range locks only enforced for processes on this machine (pid %d (%s), user %ld).\n", pid, procname, afs_cr_uid(acred));
+           ("afs: byte-range locks only enforced for processes on this machine (pid %d (%s), user %ld).\n", pid, procname, (long)afs_cr_uid(acred));
 #else
        afs_warnuser
            ("afs: byte-range lock/unlock ignored; make sure no one else is running this program (pid %d (%s), user %ld).\n", pid, procname, afs_cr_uid(acred));
@@ -637,10 +639,10 @@ done:
  *       PID has the file read locked.
  */
 static int
-HandleGetLock(register struct vcache *avc, register struct AFS_FLOCK *af,
-             register struct vrequest *areq, int clid)
+HandleGetLock(struct vcache *avc, struct AFS_FLOCK *af,
+             struct vrequest *areq, int clid)
 {
-    register afs_int32 code;
+    afs_int32 code;
     struct AFS_FLOCK flock;
 
     lockIdSet(&flock, NULL, clid);
@@ -836,8 +838,8 @@ HandleGetLock(register struct vcache *avc, register struct AFS_FLOCK *af,
 static int
 GetFlockCount(struct vcache *avc, struct vrequest *areq)
 {
-    register struct afs_conn *tc;
-    register afs_int32 code;
+    struct afs_conn *tc;
+    afs_int32 code;
     struct AFSFetchStatus OutStatus;
     struct AFSCallBack CallBack;
     struct AFSVolSync tsync;