From 7f9445bbeb72bcb8257ba0e0608746e31efae40e Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Mon, 15 Jul 2019 16:24:10 -0500 Subject: [PATCH] afs: Fix a few ARCH/osi_vcache.c style errors Most of the ARCH/osi_vcache.c implementations were defining functions like: void osi_foo(args) { /* impl */ } But our prevailing style is: void osi_foo(args) { /* impl */ } Fix them to follow our prevailing style, and fix a couple of the more obvious errors with identation and goto label. Reviewed-on: https://gerrit.openafs.org/13699 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit ee7019a7630d01f29fecebd89ca69ad8a37e24e2) Change-Id: I2a34a0d8fd7b6c3721ede0c40c212c3993402235 Reviewed-on: https://gerrit.openafs.org/15400 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Reviewed-by: Cheyenne Wills Reviewed-by: Stephan Wiesand --- src/afs/AIX/osi_vcache.c | 28 +++++++++++++++++----------- src/afs/DARWIN/osi_vcache.c | 18 ++++++++++++------ src/afs/FBSD/osi_vcache.c | 12 ++++++++---- src/afs/HPUX/osi_vcache.c | 15 ++++++++++----- src/afs/IRIX/osi_vcache.c | 16 +++++++++++----- src/afs/LINUX/osi_vcache.c | 6 +++--- src/afs/OBSD/osi_vcache.c | 15 ++++++++++----- src/afs/SOLARIS/osi_vcache.c | 12 ++++++++---- src/afs/UKERNEL/osi_vcache.c | 16 +++++++++++----- 9 files changed, 90 insertions(+), 48 deletions(-) diff --git a/src/afs/AIX/osi_vcache.c b/src/afs/AIX/osi_vcache.c index 83006981db..351afbbad7 100644 --- a/src/afs/AIX/osi_vcache.c +++ b/src/afs/AIX/osi_vcache.c @@ -16,19 +16,21 @@ extern struct vnodeops *afs_ops; int -osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) { - int code; - if (!VREFCOUNT_GT(avc,0) - && avc->opens == 0 && (avc->f.states & CUnlinkedDel) == 0) { - code = afs_FlushVCache(avc, slept); +osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) +{ + int code; + if (!VREFCOUNT_GT(avc,0) + && avc->opens == 0 && (avc->f.states & CUnlinkedDel) == 0) { + code = afs_FlushVCache(avc, slept); if (code == 0) return 1; - } - return 0; + } + return 0; } struct vcache * -osi_NewVnode(void) { +osi_NewVnode(void) +{ struct vcache *tvc; tvc = afs_osi_Alloc(sizeof(struct vcache)); @@ -44,7 +46,8 @@ osi_NewVnode(void) { } void -osi_PrePopulateVCache(struct vcache *avc) { +osi_PrePopulateVCache(struct vcache *avc) +{ memset(avc, 0, sizeof(struct vcache)); #ifdef AFS_AIX32_ENV @@ -59,10 +62,13 @@ osi_PrePopulateVCache(struct vcache *avc) { } void -osi_AttachVnode(struct vcache *avc, int seq) { } +osi_AttachVnode(struct vcache *avc, int seq) +{ +} void -osi_PostPopulateVCache(struct vcache *avc) { +osi_PostPopulateVCache(struct vcache *avc) +{ avc->v.v_op = afs_ops; avc->v.v_vfsp = afs_globalVFS; diff --git a/src/afs/DARWIN/osi_vcache.c b/src/afs/DARWIN/osi_vcache.c index 7d19ddcc14..26493e6d6e 100644 --- a/src/afs/DARWIN/osi_vcache.c +++ b/src/afs/DARWIN/osi_vcache.c @@ -14,7 +14,8 @@ #include "afsincludes.h" /*AFS-based standard headers */ struct vcache * -osi_NewVnode(void) { +osi_NewVnode(void) +{ struct vcache *tvc; tvc = afs_osi_Alloc(sizeof(struct vcache)); @@ -29,7 +30,8 @@ osi_NewVnode(void) { #if defined(AFS_DARWIN80_ENV) int -osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) { +osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) +{ *slept = 0; /* we ignore defersleep, as we *always* need to sleep */ @@ -64,7 +66,8 @@ osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) { } #else int -osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) { +osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) +{ if (!VREFCOUNT_GT(avc,0) || ((VREFCOUNT(avc) == 1) && (UBCINFOEXISTS(AFSTOV(avc)))) && avc->opens == 0 && (avc->f.states & CUnlinkedDel) == 0) @@ -85,12 +88,14 @@ osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) { #endif /* AFS_DARWIN80_ENV */ void -osi_PrePopulateVCache(struct vcache *avc) { +osi_PrePopulateVCache(struct vcache *avc) +{ memset(avc, 0, sizeof(struct vcache)); } void -osi_AttachVnode(struct vcache *avc, int seq) { +osi_AttachVnode(struct vcache *avc, int seq) +{ ReleaseWriteLock(&afs_xvcache); AFS_GUNLOCK(); afs_darwin_getnewvnode(avc); /* includes one refcount */ @@ -104,7 +109,8 @@ osi_AttachVnode(struct vcache *avc, int seq) { } void -osi_PostPopulateVCache(struct vcache *avc) { +osi_PostPopulateVCache(struct vcache *avc) +{ #if !defined(AFS_DARWIN80_ENV) avc->v->v_mount = afs_globalVFS; vSetType(avc, VREG); diff --git a/src/afs/FBSD/osi_vcache.c b/src/afs/FBSD/osi_vcache.c index 2641f62301..7c0e21b3f2 100644 --- a/src/afs/FBSD/osi_vcache.c +++ b/src/afs/FBSD/osi_vcache.c @@ -65,7 +65,8 @@ osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) } struct vcache * -osi_NewVnode(void) { +osi_NewVnode(void) +{ struct vcache *tvc; tvc = afs_osi_Alloc(sizeof(struct vcache)); @@ -78,12 +79,14 @@ osi_NewVnode(void) { } void -osi_PrePopulateVCache(struct vcache *avc) { +osi_PrePopulateVCache(struct vcache *avc) +{ memset(avc, 0, sizeof(struct vcache)); } void -osi_AttachVnode(struct vcache *avc, int seq) { +osi_AttachVnode(struct vcache *avc, int seq) +{ struct vnode *vp; ReleaseWriteLock(&afs_xvcache); @@ -117,7 +120,8 @@ osi_AttachVnode(struct vcache *avc, int seq) { } void -osi_PostPopulateVCache(struct vcache *avc) { +osi_PostPopulateVCache(struct vcache *avc) +{ avc->v->v_mount = afs_globalVFS; vSetType(avc, VREG); } diff --git a/src/afs/HPUX/osi_vcache.c b/src/afs/HPUX/osi_vcache.c index 707a0526d1..80c7db62ee 100644 --- a/src/afs/HPUX/osi_vcache.c +++ b/src/afs/HPUX/osi_vcache.c @@ -14,7 +14,8 @@ #include "afsincludes.h" /*AFS-based standard headers */ int -osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) { +osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) +{ int code; /* we can't control whether we sleep */ @@ -28,23 +29,27 @@ osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) { } struct vcache * -osi_NewVnode(void) { +osi_NewVnode(void) +{ return afs_osi_Alloc(sizeof(struct vcache)); } void -osi_PrePopulateVCache(struct vcache *avc) { +osi_PrePopulateVCache(struct vcache *avc) +{ memset(avc, 0, sizeof(struct vcache)); avc->flushDV.low = avc->flushDV.high = AFS_MAXDV; } void -osi_AttachVnode(struct vcache *avc, int seq) { +osi_AttachVnode(struct vcache *avc, int seq) +{ } void -osi_PostPopulateVCache(struct vcache *avc) { +osi_PostPopulateVCache(struct vcache *avc) +{ AFSTOV(avc)->v_op = afs_ops; avc->v.v_vfsp = afs_globalVFS; vSetType(avc, VREG); diff --git a/src/afs/IRIX/osi_vcache.c b/src/afs/IRIX/osi_vcache.c index 088cfcc506..51f6dae7fc 100644 --- a/src/afs/IRIX/osi_vcache.c +++ b/src/afs/IRIX/osi_vcache.c @@ -14,7 +14,8 @@ #include "afsincludes.h" /*AFS-based standard headers */ int -osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) { +osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) +{ int code; /* we can't control whether we sleep */ if (!VREFCOUNT_GT(avc,0) @@ -29,7 +30,8 @@ osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) { extern char *makesname(); struct vcache * -osi_NewVnode(void) { +osi_NewVnode(void) +{ struct vcache *avc; char name[METER_NAMSZ]; @@ -47,16 +49,20 @@ osi_NewVnode(void) { } void -osi_PrePopulateVCache(struct vcache *avc) { +osi_PrePopulateVCache(struct vcache *avc) +{ avc->uncred = 0; memset(&(avc->f), 0, sizeof(struct fvcache)); } void -osi_AttachVnode(struct vcache *avc, int seq) { } +osi_AttachVnode(struct vcache *avc, int seq) +{ +} void -osi_PostPopulateVCache(struct vcache *avc) { +osi_PostPopulateVCache(struct vcache *avc) +{ memset(&(avc->vc_bhv_desc), 0, sizeof(avc->vc_bhv_desc)); bhv_desc_init(&(avc->vc_bhv_desc), avc, avc, &Afs_vnodeops); diff --git a/src/afs/LINUX/osi_vcache.c b/src/afs/LINUX/osi_vcache.c index 802604617f..b42f3c2aed 100644 --- a/src/afs/LINUX/osi_vcache.c +++ b/src/afs/LINUX/osi_vcache.c @@ -25,7 +25,7 @@ TryEvictDirDentries(struct inode *inode) afs_d_alias_lock(inode); -restart: + restart: #if defined(D_ALIAS_IS_HLIST) # if defined(HLIST_ITERATOR_NO_NODE) hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) { @@ -88,7 +88,7 @@ restart: } afs_d_alias_unlock(inode); -inuse: + inuse: return; } @@ -240,7 +240,7 @@ osi_ResetRootVCache(afs_uint32 volid) AFS_RELE(root); afs_globalVp = vcp; -out: + out: crfree(credp); afs_DestroyReq(treq); } diff --git a/src/afs/OBSD/osi_vcache.c b/src/afs/OBSD/osi_vcache.c index 58f709fe56..07416b1086 100644 --- a/src/afs/OBSD/osi_vcache.c +++ b/src/afs/OBSD/osi_vcache.c @@ -14,7 +14,8 @@ #include "afsincludes.h" /*AFS-based standard headers */ int -osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) { +osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) +{ *slept = 0; if (!VREFCOUNT_GT(avc,0) @@ -34,7 +35,8 @@ osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) { } struct vcache * -osi_NewVnode(void) { +osi_NewVnode(void) +{ struct vcache *tvc; tvc = afs_osi_Alloc(sizeof(struct vcache)); @@ -47,12 +49,14 @@ osi_NewVnode(void) { } void -osi_PrePopulateVCache(struct vcache *avc) { +osi_PrePopulateVCache(struct vcache *avc) +{ memset(avc, 0, sizeof(struct vcache)); } void -osi_AttachVnode(struct vcache *avc, int seq) { +osi_AttachVnode(struct vcache *avc, int seq) +{ ReleaseWriteLock(&afs_xvcache); AFS_GUNLOCK(); afs_obsd_getnewvnode(avc); /* includes one refcount */ @@ -62,7 +66,8 @@ osi_AttachVnode(struct vcache *avc, int seq) { } void -osi_PostPopulateVCache(struct vcache *avc) { +osi_PostPopulateVCache(struct vcache *avc) +{ AFSTOV(avc)->v_mount = afs_globalVFS; vSetType(avc, VREG); } diff --git a/src/afs/SOLARIS/osi_vcache.c b/src/afs/SOLARIS/osi_vcache.c index 5c14bc5327..e3cb9a447a 100644 --- a/src/afs/SOLARIS/osi_vcache.c +++ b/src/afs/SOLARIS/osi_vcache.c @@ -14,7 +14,8 @@ #include "afsincludes.h" /*AFS-based standard headers */ int -osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) { +osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) +{ int code; if (!VREFCOUNT_GT(avc,0) @@ -27,7 +28,8 @@ osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) { } struct vcache * -osi_NewVnode(void) { +osi_NewVnode(void) +{ struct vcache *avc; avc = afs_osi_Alloc(sizeof(struct vcache)); @@ -38,7 +40,8 @@ osi_NewVnode(void) { } void -osi_PrePopulateVCache(struct vcache *avc) { +osi_PrePopulateVCache(struct vcache *avc) +{ memset(avc, 0, sizeof(struct vcache)); QInit(&avc->multiPage); @@ -80,7 +83,8 @@ osi_AttachVnode(struct vcache *avc, int seq) } void -osi_PostPopulateVCache(struct vcache *avc) { +osi_PostPopulateVCache(struct vcache *avc) +{ AFSTOV(avc)->v_op = afs_ops; AFSTOV(avc)->v_vfsp = afs_globalVFS; vSetType(avc, VREG); diff --git a/src/afs/UKERNEL/osi_vcache.c b/src/afs/UKERNEL/osi_vcache.c index 7766d34ff4..b6846a6d91 100644 --- a/src/afs/UKERNEL/osi_vcache.c +++ b/src/afs/UKERNEL/osi_vcache.c @@ -14,7 +14,8 @@ #include "afsincludes.h" /*AFS-based standard headers */ int -osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) { +osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) +{ int code; if (!VREFCOUNT_GT(avc,0) @@ -27,21 +28,26 @@ osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) { } struct vcache * -osi_NewVnode(void) { +osi_NewVnode(void) +{ return afs_osi_Alloc(sizeof(struct vcache)); } void -osi_PrePopulateVCache(struct vcache *avc) { +osi_PrePopulateVCache(struct vcache *avc) +{ memset(avc, 0, sizeof(struct vcache)); } void -osi_AttachVnode(struct vcache *avc, int seq) { } +osi_AttachVnode(struct vcache *avc, int seq) +{ +} extern struct vnodeops *afs_ops; void -osi_PostPopulateVCache(struct vcache *avc) { +osi_PostPopulateVCache(struct vcache *avc) +{ AFSTOV(avc)->v_vfsp = afs_globalVFS; AFSTOV(avc)->v_op = afs_ops; vSetType(avc, VREG);