pull-prototypes-to-head-20020821

pull up prototypes to head
This commit is contained in:
Nathan Neulinger 2002-08-21 19:52:17 +00:00 committed by Derrick Brashear
parent ba5ed52c87
commit 8f2df21ffe
494 changed files with 7946 additions and 8856 deletions

View File

@ -16,3 +16,63 @@ in one shot.)
Try to test builds using gmake -j # MAKE="gmake -j #", it seems like a good
way to find missing or order-dependent dependency rules. (Is there a better
way to do this?)
-- Prototyping and Style --
Prototypes for all source files in a given dir DDD should be placed
int the file DDD/DDD_prototypes.h. All externally used (either API
or used by other source files) routines and variables should be
prototyped in this file.
The prototypes should be a full prototype, with argument and return
types. (Should not generate a warning with gcc -Wstrict-prototypes.)
Format of the prototype files should look like:
Standard Copyright Notice
#ifndef AFS_SRC_DDD_PROTO_H
#define AFS_SRC_DDD_PROTO_H
/* filename.c */
prototypes
/* filename.c */
prototypes
#endif /* AFS_SRC_DDD_PROTO_H */
In most of the existing prototypes, the define is DDD_PROTOTYPES_H, which is
probably ok as well.
The declaration of the routines should be done in ANSI style. If at some
later date, it is determined that prototypes don't work on some platform
properly, we can use ansi2knr during the compile.
rettype routine(argtype arg)
{
}
All routines should have a return type specified, void if nothing returned,
and should have (void) if no arguments are taken.
Header files should not contain macros or other definitions unless they
are used across multiple source files.
All routines should be declared static if they are not used outside that
source file.
Compiles on gcc-using machines should strive to handle using
-Wstrict-prototypes -Werror. (this may take a while)
Routines shall be defined in source prior to use if possible, and
prototyped in block at top of file if static.
If you make a routine or variable static, be sure and remove it from
the AIX .exp files.
Suggested compiler flags:
gcc: -Wall -Wstrict-prototypes
Solaris Workshop CC: -fd -v
(You might not want the -fd, it isn't really useful, just complains about the
K&R style functions, but -v gives useful info.)

View File

@ -36,6 +36,8 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg }
#undef STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS
#undef STRUCT_INODE_HAS_I_DEVICES
#undef HAVE_STRUCT_BUF
/* glue for RedHat kernel bug */
#undef ENABLE_REDHAT_BUILDSYS

View File

@ -374,6 +374,23 @@ case $AFS_SYSNAME in
DARWIN_INFOFILE=afs.${AFS_SYSNAME}.plist
;;
esac
AC_MSG_CHECKING(for definition of struct buf)
AC_CACHE_VAL(ac_cv_have_struct_buf, [
ac_cv_have_struct_buf=no
AC_TRY_COMPILE(
[#include <sys/buf.h>],
[struct buf x;
printf("%d\n", sizeof(x));],
ac_cv_have_struct_buf=yes,)
]
)
AC_MSG_RESULT($ac_cv_have_struct_buf)
if test "$ac_cv_have_struct_buf" = yes; then
AC_DEFINE(HAVE_STRUCT_BUF)
fi
AC_CACHE_VAL(ac_cv_sockaddr_len,
[
AC_MSG_CHECKING([if struct sockaddr has sa_len field])

View File

@ -24,13 +24,12 @@ extern struct osi_dev cacheDev;
extern struct vfs *afs_cacheVfsp;
void *osi_UFSOpen(ainode)
afs_int32 ainode;
void *osi_UFSOpen(afs_int32 ainode)
{
struct inode *ip;
register struct osi_file *afile = NULL;
extern struct vfs *rootvfs;
struct vnode *vp = (struct vnode *)0;
struct vnode *vp = NULL;
extern int cacheDiskType;
afs_int32 code = 0;
int dummy;
@ -61,9 +60,8 @@ void *osi_UFSOpen(ainode)
return (void *)afile;
}
afs_osi_Stat(afile, astat)
register struct osi_file *afile;
register struct osi_stat *astat; {
int afs_osi_Stat(register struct osi_file *afile, register struct osi_stat *astat)
{
register afs_int32 code;
struct vattr tvattr;
AFS_STATCNT(osi_Stat);
@ -81,8 +79,7 @@ afs_osi_Stat(afile, astat)
return code;
}
osi_UFSClose(afile)
register struct osi_file *afile;
int osi_UFSClose(register struct osi_file *afile)
{
AFS_STATCNT(osi_Close);
if(afile->vnode) {
@ -107,9 +104,8 @@ osi_UFSClose(afile)
return 0;
}
osi_UFSTruncate(afile, asize)
register struct osi_file *afile;
afs_int32 asize; {
int osi_UFSTruncate(register struct osi_file *afile, afs_int32 asize)
{
struct AFS_UCRED *oldCred;
struct vattr tvattr;
register afs_int32 code;
@ -139,8 +135,7 @@ osi_UFSTruncate(afile, asize)
return code;
}
void osi_DisableAtimes(avp)
struct vnode *avp;
void osi_DisableAtimes(struct vnode *avp)
{
struct inode *ip = VTOIP(avp);
ip->i_flag &= ~IACC;
@ -148,11 +143,8 @@ struct vnode *avp;
/* Generic read interface */
afs_osi_Read(afile, offset, aptr, asize)
register struct osi_file *afile;
int offset;
char *aptr;
afs_int32 asize; {
int afs_osi_Read(register struct osi_file *afile, int offset, void *aptr, afs_int32 asize)
{
struct AFS_UCRED *oldCred;
unsigned int resid;
register afs_int32 code;
@ -200,11 +192,8 @@ retry_IO:
}
/* Generic write interface */
afs_osi_Write(afile, offset, aptr, asize)
register struct osi_file *afile;
char *aptr;
afs_int32 offset;
afs_int32 asize; {
int afs_osi_Write(register struct osi_file *afile, afs_int32 offset, void *aptr, afs_int32 asize)
{
struct AFS_UCRED *oldCred;
unsigned int resid;
register afs_int32 code;
@ -236,9 +225,7 @@ afs_osi_Write(afile, offset, aptr, asize)
/* This work should be handled by physstrat in ca/machdep.c.
This routine written from the RT NFS port strategy routine.
It has been generalized a bit, but should still be pretty clear. */
int afs_osi_MapStrategy(aproc, bp)
int (*aproc)();
register struct buf *bp;
int afs_osi_MapStrategy(int (*aproc)(), register struct buf *bp)
{
afs_int32 returnCode;
@ -250,8 +237,7 @@ int afs_osi_MapStrategy(aproc, bp)
void
shutdown_osifile()
void shutdown_osifile(void)
{
extern int afs_cold_shutdown;

View File

@ -141,7 +141,7 @@ devtovfs(dev_t dev)
AFS_STATCNT(devtovfs);
a.dev = dev;
a.ans = (struct vfs *)0;
a.ans = NULL;
vfs_search(devtovfs_func, &a);
return a.ans;
}
@ -249,7 +249,7 @@ out:
SYSENT(icreate, (dev, near_inode, param1, param2, param3, param4), ) {
struct inode *ip, *newip, *pip;
register int err, rval1, rc=0;
struct vnode *vp = (struct vnode *)0;
struct vnode *vp = NULL;
extern struct vfs *rootvfs;
register struct vfs *vfsp;
struct vfs *nvfsp = NULL;
@ -312,7 +312,7 @@ SYSENT(icreate, (dev, near_inode, param1, param2, param3, param4), ) {
SYSENT(iopen, (dev, inode, usrmod), ) {
struct file *fp;
register struct inode *ip;
struct vnode *vp = (struct vnode *)0;
struct vnode *vp = NULL;
extern struct fileops vnodefops;
register struct vfs *vfsp;
int fd;
@ -375,7 +375,7 @@ idec(dev, inode, inode_p1) {
SYSENT(iincdec, (dev, inode, inode_p1, amount), ) {
register struct inode *ip;
char error;
struct vnode *vp = (struct vnode *)0;
struct vnode *vp = NULL;
int dummy;
AFS_STATCNT(afs_syscall_iincdec);

View File

@ -19,8 +19,6 @@ RCSID("$Header$");
static int osi_TimedSleep(char *event, afs_int32 ams, int aintok);
void afs_osi_Wakeup(char *event);
void afs_osi_Sleep(char *event);
static char waitV;
@ -131,7 +129,7 @@ static afs_event_t *afs_getevent(char *event)
#define relevent(evp) ((evp)->refcount--)
void afs_osi_Sleep(char *event)
void afs_osi_Sleep(void *event)
{
struct afs_event *evp;
int seq;
@ -148,7 +146,7 @@ void afs_osi_Sleep(char *event)
relevent(evp);
}
int afs_osi_SleepSig(char *event)
int afs_osi_SleepSig(void *event)
{
afs_osi_Sleep(event);
return 0;
@ -202,7 +200,7 @@ static int osi_TimedSleep(char *event, afs_int32 ams, int aintok)
}
void afs_osi_Wakeup(char *event)
void afs_osi_Wakeup(void *event)
{
struct afs_event *evp;

View File

@ -117,8 +117,7 @@ static int afs_root_nolock (struct vfs *afsp, struct vnode **avpp)
credp = crref();
if (!(code = afs_InitReq(&treq, credp)) &&
!(code = afs_CheckInit())) {
tvp = afs_GetVCache(&afs_rootFid, &treq, (afs_int32 *)0,
(struct vcache*)0, WRITE_LOCK);
tvp = afs_GetVCache(&afs_rootFid, &treq, NULL, NULL);
/* we really want this to stay around */
if (tvp) {
afs_globalVp = tvp;

View File

@ -30,10 +30,7 @@ RCSID("$Header$");
* is not dropped and re-acquired for any platform. It may be that *slept is
* therefore obsolescent.
*/
int
osi_VM_FlushVCache(avc, slept)
struct vcache *avc;
int *slept;
int osi_VM_FlushVCache(struct vcache *avc, int *slept)
{
if (avc->vrefCount != 0)
return EBUSY;
@ -69,9 +66,7 @@ osi_VM_FlushVCache(avc, slept)
* Locking: the vcache entry's lock is held. It will usually be dropped and
* re-obtained.
*/
void
osi_VM_StoreAllSegments(avc)
struct vcache *avc;
void osi_VM_StoreAllSegments(struct vcache *avc)
{
if (avc->vmh) {
/*
@ -109,7 +104,7 @@ osi_VM_StoreAllSegments(avc)
avc->execsOrWriters--;
AFS_RELE(AFSTOV(avc));
crfree((struct ucred *)avc->linkData);
avc->linkData = (char *)0;
avc->linkData = NULL;
}
}
}
@ -123,11 +118,8 @@ osi_VM_StoreAllSegments(avc)
* Since we drop and re-obtain the lock, we can't guarantee that there won't
* be some pages around when we return, newly created by concurrent activity.
*/
void
osi_VM_TryToSmush(avc, acred, sync)
struct vcache *avc;
struct AFS_UCRED *acred;
int sync;
void osi_VM_TryToSmush(struct vcache *avc, struct AFS_UCRED *acred,
int sync)
{
if (avc->segid) {
ReleaseWriteLock(&avc->lock);
@ -143,10 +135,7 @@ osi_VM_TryToSmush(avc, acred, sync)
*
* Locking: No lock is held, not even the global lock.
*/
void
osi_VM_FlushPages(avc, credp)
struct vcache *avc;
struct AFS_UCRED *credp;
void osi_VM_FlushPages(struct vcache *avc, struct AFS_UCRED *credp)
{
if (avc->segid) {
vm_flushp(avc->segid, 0, MAXFSIZE/PAGESIZE - 1);
@ -163,11 +152,7 @@ osi_VM_FlushPages(avc, credp)
* activeV is raised. This is supposed to block pageins, but at present
* it only works on Solaris.
*/
void
osi_VM_Truncate(avc, alen, acred)
struct vcache *avc;
int alen;
struct AFS_UCRED *acred;
void osi_VM_Truncate(struct vcache *avc, int alen, struct AFS_UCRED *acred)
{
if (avc->segid) {
int firstpage = (alen + PAGESIZE-1)/PAGESIZE;

View File

@ -48,6 +48,7 @@ RCSID("$Header$");
#include "../afs/icl.h"
#include "../afs/prs_fs.h"
#include "../h/flock.h"
#include "../afs/afsincludes.h"
/*
@ -564,7 +565,7 @@ struct ucred *cred;
crhold(cred);
if (vcp->credp) {
struct ucred *crp = vcp->credp;
vcp->credp = (struct ucred *)0;
vcp->credp = NULL;
crfree(crp);
}
vcp->credp = cred;
@ -861,7 +862,7 @@ struct ucred *cred;
struct ucred *crp;
UpgradeSToWLock(&vcp->lock, 508);
crp = vcp->credp;
vcp->credp = (struct ucred *)0;
vcp->credp = NULL;
ConvertWToSLock(&vcp->lock);
crfree(crp);
}
@ -1509,7 +1510,7 @@ register struct buf *abp;
* Ensure that all comparable buffers are grouped contiguously.
* Later on, we'll merge adjacent buffers into a single request.
*/
firstComparable = (struct buf *) 0;
firstComparable = NULL;
lbp = &afs_asyncbuf;
for(qbp = *lbp; qbp; lbp = &qbp->av_forw, qbp = *lbp) {
if (EFS_COMPARABLE(tbp, qbp)) {
@ -1532,7 +1533,7 @@ register struct buf *abp;
/* do the insert before qbp now */
tbp->av_forw = *lbp;
*lbp = tbp;
if (firstComparable == (struct buf *) 0) {
if (firstComparable == NULL) {
/* next we're going to do all sorts of buffer merging tricks, but
* here we know we're the only COMPARABLE block in the
* afs_asyncbuf list, so we just skip that and continue with

View File

@ -91,8 +91,7 @@ dev_t VnodeToDev(vnode_t *avp)
osi_Panic("VnodeToDev called before cacheops initialized\n");
}
void *osi_UFSOpen(ainode)
afs_int32 ainode;
void *osi_UFSOpen(afs_int32 ainode)
{
struct vnode *vp;
struct vattr va;
@ -133,9 +132,8 @@ void *osi_UFSOpen(ainode)
return (void *)afile;
}
afs_osi_Stat(afile, astat)
register struct osi_file *afile;
register struct osi_stat *astat; {
int afs_osi_Stat(register struct osi_file *afile, register struct osi_stat *astat)
{
register afs_int32 code;
struct vattr tvattr;
AFS_STATCNT(osi_Stat);
@ -153,9 +151,8 @@ afs_osi_Stat(afile, astat)
return code;
}
osi_UFSClose(afile)
register struct osi_file *afile;
{
int osi_UFSClose(register struct osi_file *afile)
{
AFS_STATCNT(osi_Close);
if(afile->vnode) {
AFS_RELE(afile->vnode);
@ -163,11 +160,10 @@ osi_UFSClose(afile)
osi_FreeSmallSpace(afile);
return 0;
}
}
osi_UFSTruncate(afile, asize)
register struct osi_file *afile;
afs_int32 asize; {
int osi_UFSTruncate(register struct osi_file *afile, afs_int32 asize)
{
struct AFS_UCRED *oldCred;
struct vattr tvattr;
register afs_int32 code;
@ -190,8 +186,7 @@ osi_UFSTruncate(afile, asize)
return code;
}
void osi_DisableAtimes(avp)
struct vnode *avp;
void osi_DisableAtimes(struct vnode *avp)
{
@ -209,11 +204,8 @@ struct vnode *avp;
/* Generic read interface */
afs_osi_Read(afile, offset, aptr, asize)
register struct osi_file *afile;
int offset;
char *aptr;
afs_int32 asize; {
int afs_osi_Read(register struct osi_file *afile, int offset, void *aptr, afs_int32 asize)
{
struct AFS_UCRED *oldCred;
unsigned int resid;
register afs_int32 code;
@ -249,11 +241,8 @@ afs_osi_Read(afile, offset, aptr, asize)
}
/* Generic write interface */
afs_osi_Write(afile, offset, aptr, asize)
register struct osi_file *afile;
char *aptr;
afs_int32 offset;
afs_int32 asize; {
int afs_osi_Write(register struct osi_file *afile, afs_int32 offset, void *aptr, afs_int32 asize)
{
struct AFS_UCRED *oldCred;
unsigned int resid;
register afs_int32 code;
@ -284,8 +273,7 @@ afs_osi_Write(afile, offset, aptr, asize)
void
shutdown_osifile()
void shutdown_osifile(void)
{
extern int afs_cold_shutdown;

View File

@ -233,7 +233,7 @@ afs_syscall_iopen(dev, inode, usrmod, retval)
{
struct file *fp;
struct inode *ip;
struct vnode *vp = (struct vnode *)0;
struct vnode *vp = NULL;
int dummy;
int fd;
extern struct fileops vnops;

View File

@ -18,8 +18,6 @@ RCSID("$Header$");
static int osi_TimedSleep(char *event, afs_int32 ams, int aintok);
void afs_osi_Wakeup(char *event);
void afs_osi_Sleep(char *event);
static char waitV;
@ -122,7 +120,7 @@ static afs_event_t *afs_getevent(char *event)
#define relevent(evp) ((evp)->refcount--)
void afs_osi_Sleep(char *event)
void afs_osi_Sleep(void *event)
{
struct afs_event *evp;
int seq;
@ -144,7 +142,7 @@ void afs_osi_Sleep(char *event)
relevent(evp);
}
int afs_osi_SleepSig(char *event)
int afs_osi_SleepSig(void *event)
{
afs_osi_Sleep(event);
return 0;
@ -201,7 +199,7 @@ static int osi_TimedSleep(char *event, afs_int32 ams, int aintok)
}
void afs_osi_Wakeup(char *event)
void afs_osi_Wakeup(void *event)
{
struct afs_event *evp;

View File

@ -130,8 +130,7 @@ afs_root(struct mount *mp,
if (!(error = afs_InitReq(&treq, &cr)) &&
!(error = afs_CheckInit())) {
tvp = afs_GetVCache(&afs_rootFid, &treq, (afs_int32 *)0,
(struct vcache*)0, WRITE_LOCK);
tvp = afs_GetVCache(&afs_rootFid, &treq, NULL, NULL);
/* we really want this to stay around */
if (tvp) {
afs_globalVp = tvp;

View File

@ -33,10 +33,7 @@ RCSID("$Header$");
*
* OSF/1 Locking: VN_LOCK has been called.
*/
int
osi_VM_FlushVCache(avc, slept)
struct vcache *avc;
int *slept;
int osi_VM_FlushVCache(struct vcache *avc, int *slept)
{
struct vnode *vp=AFSTOV(avc);
#ifdef AFS_DARWIN14_ENV
@ -76,9 +73,7 @@ osi_VM_FlushVCache(avc, slept)
* Locking: the vcache entry's lock is held. It will usually be dropped and
* re-obtained.
*/
void
osi_VM_StoreAllSegments(avc)
struct vcache *avc;
void osi_VM_StoreAllSegments(struct vcache *avc)
{
struct vnode *vp=AFSTOV(avc);
ReleaseWriteLock(&avc->lock);
@ -99,11 +94,8 @@ osi_VM_StoreAllSegments(avc)
* Since we drop and re-obtain the lock, we can't guarantee that there won't
* be some pages around when we return, newly created by concurrent activity.
*/
void
osi_VM_TryToSmush(avc, acred, sync)
struct vcache *avc;
struct AFS_UCRED *acred;
int sync;
void osi_VM_TryToSmush(struct vcache *avc, struct AFS_UCRED *acred,
int sync)
{
struct vnode *vp=AFSTOV(avc);
void *object;
@ -129,10 +121,7 @@ osi_VM_TryToSmush(avc, acred, sync)
/* XXX this seems to not be referenced anywhere. *somebody* ought to be calling
this, and also making sure that ubc's idea of the filesize is right more
often */
void
osi_VM_FlushPages(avc, credp)
struct vcache *avc;
struct AFS_UCRED *credp;
void osi_VM_FlushPages(struct vcache *avc, struct AFS_UCRED *credp)
{
struct vnode *vp=AFSTOV(avc);
void *object;
@ -155,11 +144,7 @@ osi_VM_FlushPages(avc, credp)
* activeV is raised. This is supposed to block pageins, but at present
* it only works on Solaris.
*/
void
osi_VM_Truncate(avc, alen, acred)
struct vcache *avc;
int alen;
struct AFS_UCRED *acred;
void osi_VM_Truncate(struct vcache *avc, int alen, struct AFS_UCRED *acred)
{
struct vnode *vp=AFSTOV(avc);
if (UBCINFOEXISTS(vp)) {
@ -167,14 +152,10 @@ osi_VM_Truncate(avc, alen, acred)
}
}
extern struct AFS_UCRED afs_osi_cred;
extern afs_rwlock_t afs_xvcache;
/* vnreclaim and vinactive are probably not aggressive enough to keep
enough afs vcaches free, so we try to do some of it ourselves */
/* XXX there's probably not nearly enough locking here */
void osi_VM_TryReclaim(avc, slept)
struct vcache *avc;
int *slept;
void osi_VM_TryReclaim(struct vcache *avc, int *slept)
{
struct proc *p=current_proc();
struct vnode *vp=AFSTOV(avc);
@ -273,8 +254,8 @@ void osi_VM_TryReclaim(avc, slept)
ObtainReadLock(&afs_xvcache);
}
void osi_VM_NukePages(struct vnode *vp, off_t offset, off_t size) {
void osi_VM_NukePages(struct vnode *vp, off_t offset, off_t size)
{
void *object;
struct vcache *avc = VTOAFS(vp);
@ -318,9 +299,10 @@ void osi_VM_NukePages(struct vnode *vp, off_t offset, off_t size) {
ubc_setsize(vp, size);
#endif
#endif
}
int osi_VM_Setup(struct vcache *avc) {
int osi_VM_Setup(struct vcache *avc)
{
int error;
struct vnode *vp=AFSTOV(avc);

View File

@ -24,8 +24,7 @@ extern struct osi_dev cacheDev;
extern struct mount *afs_cacheVfsp;
void *osi_UFSOpen(ainode)
afs_int32 ainode;
void *osi_UFSOpen(afs_int32 ainode)
{
static struct vnode *tags_vnode = NULL;
struct inode *ip;
@ -105,9 +104,8 @@ void *osi_UFSOpen(ainode)
return afile;
}
afs_osi_Stat(afile, astat)
register struct osi_file *afile;
register struct osi_stat *astat; {
int afs_osi_Stat(register struct osi_file *afile, register struct osi_stat *astat)
{
register afs_int32 code;
struct vattr tvattr;
AFS_STATCNT(osi_Stat);
@ -125,9 +123,8 @@ afs_osi_Stat(afile, astat)
return code;
}
osi_UFSClose(afile)
register struct osi_file *afile;
{
int osi_UFSClose(register struct osi_file *afile)
{
AFS_STATCNT(osi_Close);
if(afile->vnode) {
AFS_RELE(afile->vnode);
@ -135,11 +132,10 @@ osi_UFSClose(afile)
osi_FreeSmallSpace(afile);
return 0;
}
}
osi_UFSTruncate(afile, asize)
register struct osi_file *afile;
afs_int32 asize; {
int osi_UFSTruncate(register struct osi_file *afile, afs_int32 asize)
{
struct AFS_UCRED *oldCred;
struct vattr tvattr;
register afs_int32 code;
@ -168,8 +164,7 @@ osi_UFSTruncate(afile, asize)
return code;
}
void osi_DisableAtimes(avp)
struct vnode *avp;
void osi_DisableAtimes(struct vnode *avp)
{
struct inode *ip;
assert(avp->v_tag == VT_UFS);
@ -179,11 +174,8 @@ struct vnode *avp;
/* Generic read interface */
afs_osi_Read(afile, offset, aptr, asize)
register struct osi_file *afile;
int offset;
char *aptr;
afs_int32 asize; {
int afs_osi_Read(register struct osi_file *afile, int offset, void *aptr, afs_int32 asize)
{
struct AFS_UCRED *oldCred;
unsigned int resid;
register afs_int32 code;
@ -220,11 +212,8 @@ afs_osi_Read(afile, offset, aptr, asize)
}
/* Generic write interface */
afs_osi_Write(afile, offset, aptr, asize)
register struct osi_file *afile;
char *aptr;
afs_int32 offset;
afs_int32 asize; {
int afs_osi_Write(register struct osi_file *afile, afs_int32 offset, void *aptr, afs_int32 asize)
{
struct AFS_UCRED *oldCred;
unsigned int resid;
register afs_int32 code;
@ -258,9 +247,7 @@ afs_osi_Write(afile, offset, aptr, asize)
/* This work should be handled by physstrat in ca/machdep.c.
This routine written from the RT NFS port strategy routine.
It has been generalized a bit, but should still be pretty clear. */
int afs_osi_MapStrategy(aproc, bp)
int (*aproc)();
register struct buf *bp;
int afs_osi_MapStrategy(int (*aproc)(), register struct buf *bp)
{
afs_int32 returnCode;
@ -272,8 +259,7 @@ int afs_osi_MapStrategy(aproc, bp)
void
shutdown_osifile()
void shutdown_osifile(void)
{
extern int afs_cold_shutdown;

View File

@ -251,7 +251,7 @@ afs_syscall_iopen(dev, inode, usrmod, retval)
{
struct file *fp;
struct inode *ip;
struct vnode *vp = (struct vnode *)0;
struct vnode *vp = NULL;
int dummy;
int fd;
extern struct fileops vnops;

View File

@ -19,8 +19,6 @@ RCSID("$Header$");
static int osi_TimedSleep(char *event, afs_int32 ams, int aintok);
void afs_osi_Wakeup(char *event);
void afs_osi_Sleep(char *event);
static char waitV;
@ -124,7 +122,7 @@ static afs_event_t *afs_getevent(char *event)
#define relevent(evp) ((evp)->refcount--)
void afs_osi_Sleep(char *event)
void afs_osi_Sleep(void *event)
{
struct afs_event *evp;
int seq;
@ -141,7 +139,7 @@ void afs_osi_Sleep(char *event)
relevent(evp);
}
int afs_osi_SleepSig(char *event)
int afs_osi_SleepSig(void *event)
{
afs_osi_Sleep(event);
return 0;
@ -180,7 +178,7 @@ static int osi_TimedSleep(char *event, afs_int32 ams, int aintok)
}
void afs_osi_Wakeup(char *event)
void afs_osi_Wakeup(void *event)
{
struct afs_event *evp;

View File

@ -143,8 +143,7 @@ int mp_afs_root (struct mount *afsp, struct vnode **avpp)
if (!(code = afs_InitReq(&treq, u.u_cred)) &&
!(code = afs_CheckInit())) {
tvp = afs_GetVCache(&afs_rootFid, &treq, (afs_int32 *)0,
(struct vcache*)0, WRITE_LOCK);
tvp = afs_GetVCache(&afs_rootFid, &treq, NULL, NULL);
/* we really want this to stay around */
if (tvp) {
afs_globalVp = tvp;

View File

@ -34,10 +34,7 @@ RCSID("$Header$");
*
* OSF/1 Locking: VN_LOCK has been called.
*/
int
osi_VM_FlushVCache(avc, slept)
struct vcache *avc;
int *slept;
int osi_VM_FlushVCache(struct vcache *avc, int *slept)
{
if (avc->vrefCount > 1)
return EBUSY;
@ -82,10 +79,8 @@ osi_VM_FlushVCache(avc, slept)
*
* Called with the global lock NOT held.
*/
void
osi_ubc_flush_dirty_and_wait(vp, flags)
struct vnode *vp;
int flags; {
static void osi_ubc_flush_dirty_and_wait(struct vnode *vp, int flags)
{
int retry;
vm_page_t pp;
int first;
@ -126,9 +121,7 @@ int flags; {
* Locking: the vcache entry's lock is held. It will usually be dropped and
* re-obtained.
*/
void
osi_VM_StoreAllSegments(avc)
struct vcache *avc;
void osi_VM_StoreAllSegments(struct vcache *avc)
{
ReleaseWriteLock(&avc->lock);
AFS_GUNLOCK();
@ -146,11 +139,7 @@ osi_VM_StoreAllSegments(avc)
* Since we drop and re-obtain the lock, we can't guarantee that there won't
* be some pages around when we return, newly created by concurrent activity.
*/
void
osi_VM_TryToSmush(avc, acred, sync)
struct vcache *avc;
struct AFS_UCRED *acred;
int sync;
void osi_VM_TryToSmush(struct vcache *avc, struct AFS_UCRED *acred, int sync)
{
ReleaseWriteLock(&avc->lock);
AFS_GUNLOCK();
@ -164,10 +153,7 @@ osi_VM_TryToSmush(avc, acred, sync)
*
* Locking: No lock is held, not even the global lock.
*/
void
osi_VM_FlushPages(avc, credp)
struct vcache *avc;
struct AFS_UCRED *credp;
void osi_VM_FlushPages(struct vcache *avc, struct AFS_UCRED *credp)
{
ubc_flush_dirty(AFSTOV(avc)->v_object, 0);
ubc_invalidate(AFSTOV(avc)->v_object, 0, 0, B_INVAL);
@ -179,11 +165,7 @@ osi_VM_FlushPages(avc, credp)
* activeV is raised. This is supposed to block pageins, but at present
* it only works on Solaris.
*/
void
osi_VM_Truncate(avc, alen, acred)
struct vcache *avc;
int alen;
struct AFS_UCRED *acred;
void osi_VM_Truncate(struct vcache *avc, int alen, struct AFS_UCRED *acred)
{
ubc_invalidate(AFSTOV(avc)->v_object, alen,
MAXINT - alen, B_INVAL);

View File

@ -1129,9 +1129,9 @@ lookupname(namep, seg, follow, dvpp, cvpp)
ndp->ni_segflg = seg;
ndp->ni_dirp = namep;
error = namei(ndp);
if (dvpp != (struct vnode **)0)
if (dvpp != NULL)
*dvpp = ndp->ni_dvp;
if (cvpp != (struct vnode **)0)
if (cvpp != NULL)
*cvpp = ndp->ni_vp;
return(error);
}

View File

@ -24,8 +24,7 @@ extern struct osi_dev cacheDev;
extern struct mount *afs_cacheVfsp;
void *osi_UFSOpen(ainode)
afs_int32 ainode;
void *osi_UFSOpen(afs_int32 ainode)
{
struct inode *ip;
register struct osi_file *afile = NULL;
@ -59,9 +58,8 @@ void *osi_UFSOpen(ainode)
return (void *)afile;
}
afs_osi_Stat(afile, astat)
register struct osi_file *afile;
register struct osi_stat *astat; {
int afs_osi_Stat(register struct osi_file *afile, register struct osi_stat *astat)
{
register afs_int32 code;
struct vattr tvattr;
AFS_STATCNT(osi_Stat);
@ -79,8 +77,7 @@ afs_osi_Stat(afile, astat)
return code;
}
osi_UFSClose(afile)
register struct osi_file *afile;
int osi_UFSClose(register struct osi_file *afile)
{
AFS_STATCNT(osi_Close);
if(afile->vnode) {
@ -91,9 +88,8 @@ osi_UFSClose(afile)
return 0;
}
osi_UFSTruncate(afile, asize)
register struct osi_file *afile;
afs_int32 asize; {
int osi_UFSTruncate(register struct osi_file *afile, afs_int32 asize)
{
struct vattr tvattr;
register afs_int32 code;
struct osi_stat tstat;
@ -115,8 +111,7 @@ osi_UFSTruncate(afile, asize)
return code;
}
void osi_DisableAtimes(avp)
struct vnode *avp;
void osi_DisableAtimes(struct vnode *avp)
{
struct inode *ip = VTOI(avp);
ip->i_flag &= ~IN_ACCESS;
@ -124,11 +119,8 @@ struct vnode *avp;
/* Generic read interface */
afs_osi_Read(afile, offset, aptr, asize)
register struct osi_file *afile;
int offset;
char *aptr;
afs_int32 asize; {
int afs_osi_Read(register struct osi_file *afile, int offset, void *aptr, afs_int32 asize)
{
unsigned int resid;
register afs_int32 code;
register afs_int32 cnt1=0;
@ -164,11 +156,8 @@ afs_osi_Read(afile, offset, aptr, asize)
}
/* Generic write interface */
afs_osi_Write(afile, offset, aptr, asize)
register struct osi_file *afile;
char *aptr;
afs_int32 offset;
afs_int32 asize; {
int afs_osi_Write(register struct osi_file *afile, afs_int32 offset, void *aptr, afs_int32 asize)
{
unsigned int resid;
register afs_int32 code;
AFS_STATCNT(osi_Write);
@ -198,9 +187,7 @@ afs_osi_Write(afile, offset, aptr, asize)
/* This work should be handled by physstrat in ca/machdep.c.
This routine written from the RT NFS port strategy routine.
It has been generalized a bit, but should still be pretty clear. */
int afs_osi_MapStrategy(aproc, bp)
int (*aproc)();
register struct buf *bp;
int afs_osi_MapStrategy(int (*aproc)(), register struct buf *bp)
{
afs_int32 returnCode;
@ -212,8 +199,7 @@ int afs_osi_MapStrategy(aproc, bp)
void
shutdown_osifile()
void shutdown_osifile(void)
{
extern int afs_cold_shutdown;

View File

@ -192,7 +192,7 @@ afs_syscall_iopen(dev, inode, usrmod, retval)
{
struct file *fp;
struct inode *ip;
struct vnode *vp = (struct vnode *)0;
struct vnode *vp = NULL;
int dummy;
int fd;
extern struct fileops vnops;

View File

@ -20,8 +20,6 @@ RCSID("$Header$");
static int osi_TimedSleep(char *event, afs_int32 ams, int aintok);
void afs_osi_Wakeup(char *event);
void afs_osi_Sleep(char *event);
static char waitV;
@ -125,7 +123,7 @@ static afs_event_t *afs_getevent(char *event)
#define relevent(evp) ((evp)->refcount--)
void afs_osi_Sleep(char *event)
void afs_osi_Sleep(void *event)
{
struct afs_event *evp;
int seq;
@ -141,7 +139,7 @@ void afs_osi_Sleep(char *event)
relevent(evp);
}
int afs_osi_SleepSig(char *event)
int afs_osi_SleepSig(void *event)
{
afs_osi_Sleep(event);
return 0;
@ -182,7 +180,7 @@ static int osi_TimedSleep(char *event, afs_int32 ams, int aintok)
}
void afs_osi_Wakeup(char *event)
void afs_osi_Wakeup(void *event)
{
struct afs_event *evp;

View File

@ -129,8 +129,7 @@ afs_root(struct mount *mp,
if (!(error = afs_InitReq(&treq, &cr)) &&
!(error = afs_CheckInit())) {
tvp = afs_GetVCache(&afs_rootFid, &treq, (afs_int32 *)0,
(struct vcache*)0, WRITE_LOCK);
tvp = afs_GetVCache(&afs_rootFid, &treq, NULL, NULL);
/* we really want this to stay around */
if (tvp) {
afs_globalVp = tvp;

View File

@ -47,10 +47,7 @@ RCSID("$Header$");
*
* OSF/1 Locking: VN_LOCK has been called.
*/
int
osi_VM_FlushVCache(avc, slept)
struct vcache *avc;
int *slept;
int osi_VM_FlushVCache(struct vcache *avc, int *slept)
{
struct vm_object *obj;
struct vnode *vp;
@ -89,9 +86,7 @@ osi_VM_FlushVCache(avc, slept)
* Locking: the vcache entry's lock is held. It will usually be dropped and
* re-obtained.
*/
void
osi_VM_StoreAllSegments(avc)
struct vcache *avc;
void osi_VM_StoreAllSegments(struct vcache *avc)
{
struct vnode *vp;
struct vm_object *obj;
@ -130,11 +125,7 @@ osi_VM_StoreAllSegments(avc)
* Since we drop and re-obtain the lock, we can't guarantee that there won't
* be some pages around when we return, newly created by concurrent activity.
*/
void
osi_VM_TryToSmush(avc, acred, sync)
struct vcache *avc;
struct AFS_UCRED *acred;
int sync;
void osi_VM_TryToSmush(struct vcache *avc, struct AFS_UCRED *acred, int sync)
{
struct vnode *vp;
struct vm_object *obj;
@ -174,10 +165,7 @@ osi_VM_TryToSmush(avc, acred, sync)
*
* Locking: No lock is held, not even the global lock.
*/
void
osi_VM_FlushPages(avc, credp)
struct vcache *avc;
struct AFS_UCRED *credp;
void osi_VM_FlushPages(struct vcache *avc, struct AFS_UCRED *credp)
{
struct vnode *vp;
struct vm_object *obj;
@ -196,11 +184,7 @@ osi_VM_FlushPages(avc, credp)
* activeV is raised. This is supposed to block pageins, but at present
* it only works on Solaris.
*/
void
osi_VM_Truncate(avc, alen, acred)
struct vcache *avc;
int alen;
struct AFS_UCRED *acred;
void osi_VM_Truncate(struct vcache *avc, int alen, struct AFS_UCRED *acred)
{
vnode_pager_setsize(AFSTOV(avc), alen);
}

View File

@ -25,8 +25,7 @@ extern struct osi_dev cacheDev;
extern struct vfs *afs_cacheVfsp;
void *osi_UFSOpen(ainode)
afs_int32 ainode;
void *osi_UFSOpen(afs_int32 ainode)
{
struct inode *ip;
register struct osi_file *afile = NULL;
@ -61,9 +60,8 @@ void *osi_UFSOpen(ainode)
return (void *)afile;
}
afs_osi_Stat(afile, astat)
register struct osi_file *afile;
register struct osi_stat *astat; {
int afs_osi_Stat(register struct osi_file *afile, register struct osi_stat *astat)
{
register afs_int32 code;
struct vattr tvattr;
AFS_STATCNT(osi_Stat);
@ -81,9 +79,8 @@ afs_osi_Stat(afile, astat)
return code;
}
osi_UFSClose(afile)
register struct osi_file *afile;
{
int osi_UFSClose(register struct osi_file *afile)
{
AFS_STATCNT(osi_Close);
if(afile->vnode) {
AFS_RELE(afile->vnode);
@ -91,11 +88,10 @@ osi_UFSClose(afile)
osi_FreeSmallSpace(afile);
return 0;
}
}
osi_UFSTruncate(afile, asize)
register struct osi_file *afile;
afs_int32 asize; {
int osi_UFSTruncate(register struct osi_file *afile, afs_int32 asize)
{
struct AFS_UCRED *oldCred;
struct vattr tvattr;
register afs_int32 code;
@ -124,8 +120,7 @@ osi_UFSTruncate(afile, asize)
return code;
}
void osi_DisableAtimes(avp)
struct vnode *avp;
void osi_DisableAtimes(struct vnode *avp)
{
struct inode *ip = VTOI(avp);
ip->i_flag &= ~IACC;
@ -133,11 +128,8 @@ struct vnode *avp;
/* Generic read interface */
afs_osi_Read(afile, offset, aptr, asize)
register struct osi_file *afile;
int offset;
char *aptr;
afs_int32 asize; {
int afs_osi_Read(register struct osi_file *afile, int offset, void *aptr, afs_int32 asize)
{
struct AFS_UCRED *oldCred;
long resid;
register afs_int32 code;
@ -184,11 +176,8 @@ retry_IO:
}
/* Generic write interface */
afs_osi_Write(afile, offset, aptr, asize)
register struct osi_file *afile;
char *aptr;
afs_int32 offset;
afs_int32 asize; {
int afs_osi_Write(register struct osi_file *afile, afs_int32 offset, void *aptr, afs_int32 asize)
{
struct AFS_UCRED *oldCred;
long resid;
register afs_int32 code;
@ -216,8 +205,7 @@ afs_osi_Write(afile, offset, aptr, asize)
}
void
shutdown_osifile()
void shutdown_osifile(void)
{
extern int afs_cold_shutdown;

View File

@ -34,7 +34,7 @@ getinode(struct vfs *vfsp, dev_t dev, ino_t inode, int *perror)
if (!mp && !(mp = getmp(dev))) {
u.u_error = ENXIO;
return((struct inode *)0);
return(NULL);
}
pip=iget(dev,mp,inode);
if(!pip)
@ -123,7 +123,7 @@ int dev, inode, usrmod;
{
struct file *fp;
struct inode *ip;
struct vnode *vp = (struct vnode *)0;
struct vnode *vp = NULL;
int dummy;
extern struct fileops vnodefops;
register int code;

View File

@ -107,7 +107,7 @@ int afs_osi_Wait(afs_int32 ams, struct afs_osi_WaitHandle *ahandle, int aintok)
return code;
}
int afs_osi_SleepSig(char *event)
int afs_osi_SleepSig(void *event)
{
afs_osi_Sleep(event);
return 0;

View File

@ -85,8 +85,7 @@ int afs_root (struct vfs *afsp, struct vnode **avpp, char *unused1)
if (!(code = afs_InitReq(&treq, p_cred(u.u_procp))) &&
!(code = afs_CheckInit())) {
tvp = afs_GetVCache(&afs_rootFid, &treq, (afs_int32 *)0,
(struct vcache*)0, WRITE_LOCK);
tvp = afs_GetVCache(&afs_rootFid, &treq, NULL, NULL);
/* we really want this to stay around */
if (tvp) {
afs_globalVp = tvp;

View File

@ -30,10 +30,7 @@ RCSID("$Header$");
* is not dropped and re-acquired for any platform. It may be that *slept is
* therefore obsolescent.
*/
int
osi_VM_FlushVCache(avc, slept)
struct vcache *avc;
int *slept;
int osi_VM_FlushVCache(struct vcache *avc, int *slept)
{
if (avc->vrefCount > 1)
return EBUSY;
@ -49,9 +46,7 @@ osi_VM_FlushVCache(avc, slept)
* Locking: the vcache entry's lock is held. It will usually be dropped and
* re-obtained.
*/
void
osi_VM_StoreAllSegments(avc)
struct vcache *avc;
void osi_VM_StoreAllSegments(struct vcache *avc)
{
; /* Nothing here yet */
}
@ -62,11 +57,7 @@ osi_VM_StoreAllSegments(avc)
* Locking: the vcache entry's lock is held. It may be dropped and
* re-obtained.
*/
void
osi_VM_TryToSmush(avc, acred, sync)
struct vcache *avc;
struct AFS_UCRED *acred;
int sync;
void osi_VM_TryToSmush(struct vcache *avc, struct AFS_UCRED *acred, int sync)
{
struct vnode *vp = AFSTOV(avc);
@ -87,10 +78,7 @@ osi_VM_TryToSmush(avc, acred, sync)
*
* Locking: No lock is held, not even the global lock.
*/
void
osi_VM_FlushPages(avc, credp)
struct vcache *avc;
struct AFS_UCRED *credp;
void osi_VM_FlushPages(struct vcache *avc, struct AFS_UCRED *credp)
{
; /* Nothing here yet */
}
@ -101,11 +89,7 @@ osi_VM_FlushPages(avc, credp)
* activeV is raised. This is supposed to block pageins, but at present
* it only works on Solaris.
*/
void
osi_VM_Truncate(avc, alen, acred)
struct vcache *avc;
int alen;
struct AFS_UCRED *acred;
void osi_VM_Truncate(struct vcache *avc, int alen, struct AFS_UCRED *acred)
{
; /* Nothing here yet */
}

View File

@ -89,9 +89,8 @@ void *osi_UFSOpen(ino_t ainode)
return (void *)afile;
}
afs_osi_Stat(afile, astat)
register struct osi_file *afile;
register struct osi_stat *astat; {
int afs_osi_Stat(register struct osi_file *afile, register struct osi_stat *astat)
{
register afs_int32 code;
struct vattr tvattr;
AFS_STATCNT(osi_Stat);
@ -110,9 +109,8 @@ afs_osi_Stat(afile, astat)
return code;
}
osi_UFSClose(afile)
register struct osi_file *afile;
{
int osi_UFSClose(register struct osi_file *afile)
{
AFS_STATCNT(osi_Close);
if(afile->vnode) {
VN_RELE(afile->vnode);
@ -120,11 +118,10 @@ osi_UFSClose(afile)
osi_FreeSmallSpace(afile);
return 0;
}
}
osi_UFSTruncate(afile, asize)
register struct osi_file *afile;
afs_int32 asize; {
int osi_UFSTruncate(register struct osi_file *afile, afs_int32 asize)
{
struct AFS_UCRED *oldCred;
struct vattr tvattr;
register afs_int32 code;
@ -149,8 +146,7 @@ osi_UFSTruncate(afile, asize)
}
#ifdef AFS_SGI_EFS_IOPS_ENV
void osi_DisableAtimes(avp)
struct vnode *avp;
void osi_DisableAtimes(struct vnode *avp)
{
if (afs_CacheFSType == AFS_SGI_EFS_CACHE)
{
@ -163,11 +159,8 @@ struct vnode *avp;
/* Generic read interface */
afs_osi_Read(afile, offset, aptr, asize)
register struct osi_file *afile;
int offset;
char *aptr;
afs_int32 asize; {
int afs_osi_Read(register struct osi_file *afile, int offset, void *aptr, afs_int32 asize)
{
struct AFS_UCRED *oldCred;
ssize_t resid;
register afs_int32 code;
@ -206,11 +199,8 @@ afs_osi_Read(afile, offset, aptr, asize)
}
/* Generic write interface */
afs_osi_Write(afile, offset, aptr, asize)
register struct osi_file *afile;
char *aptr;
afs_int32 offset;
afs_int32 asize; {
int afs_osi_Write(register struct osi_file *afile, afs_int32 offset, void *aptr, afs_int32 asize)
{
struct AFS_UCRED *oldCred;
ssize_t resid;
register afs_int32 code;
@ -240,9 +230,7 @@ afs_osi_Write(afile, offset, aptr, asize)
/* This work should be handled by physstrat in ca/machdep.c.
This routine written from the RT NFS port strategy routine.
It has been generalized a bit, but should still be pretty clear. */
int afs_osi_MapStrategy(aproc, bp)
int (*aproc)();
register struct buf *bp;
int afs_osi_MapStrategy(int (*aproc)(), register struct buf *bp)
{
afs_int32 returnCode;
@ -254,8 +242,7 @@ int afs_osi_MapStrategy(aproc, bp)
void
shutdown_osifile()
void shutdown_osifile(void)
{
extern int afs_cold_shutdown;

View File

@ -426,13 +426,13 @@ xfs_icreatename64(struct vfs *vfsp, int datap, int datalen,
if (params[1] == INODESPECIAL)
AFS_LOCK_VOL_CREATE();
code = gop_lookupname(path, AFS_UIOSYS, FOLLOW, (struct vnode **) 0, &dvp);
code = gop_lookupname(path, AFS_UIOSYS, FOLLOW, NULL, &dvp);
if (code == ENOENT) {
/* Maybe it's an old directory name format. */
AFS_COPYINSTR((char*)datap, name, AFS_PNAME_SIZE-1, &junk, unused);
strcat(name, "/.");
strcat(name, int_to_base64(stmp1, rw_vno));
code = gop_lookupname(name, AFS_UIOSYS, FOLLOW, (struct vnode **) 0,
code = gop_lookupname(name, AFS_UIOSYS, FOLLOW, NULL,
&dvp);
if (!code) {
/* Use old name format. */
@ -450,7 +450,7 @@ xfs_icreatename64(struct vfs *vfsp, int datap, int datalen,
if (code) {
if (code == EEXIST) {
/* someone beat us to it? */
code = gop_lookupname(path, AFS_UIOSYS, 0, (struct vnode **) 0,
code = gop_lookupname(path, AFS_UIOSYS, 0, NULL,
&dvp);
}
if (code) {

View File

@ -19,8 +19,6 @@ RCSID("$Header$");
static int osi_TimedSleep(char *event, afs_int32 ams, int aintok);
void afs_osi_Wakeup(char *event);
void afs_osi_Sleep(char *event);
static char waitV;
@ -129,7 +127,7 @@ static afs_event_t *afs_getevent(char *event)
#define relevent(evp) ((evp)->refcount--)
void afs_osi_Sleep(char *event)
void afs_osi_Sleep(void *event)
{
struct afs_event *evp;
int seq;
@ -143,7 +141,7 @@ void afs_osi_Sleep(char *event)
relevent(evp);
}
int afs_osi_SleepSig(char *event)
int afs_osi_SleepSig(void *event)
{
afs_osi_Sleep(event);
return 0;
@ -185,7 +183,7 @@ static int osi_TimedSleep(char *event, afs_int32 ams, int aintok)
}
void afs_osi_Wakeup(char *event)
void afs_osi_Wakeup(void *event)
{
struct afs_event *evp;

View File

@ -284,8 +284,7 @@ afs_root (OSI_VFS_ARG(afsp), avpp)
if (!(code = afs_InitReq(&treq, OSI_GET_CURRENT_CRED())) &&
!(code = afs_CheckInit())) {
tvp = afs_GetVCache(&afs_rootFid, &treq, (afs_int32 *)0,
(struct vcache*)0, WRITE_LOCK);
tvp = afs_GetVCache(&afs_rootFid, &treq, NULL, NULL);
/* we really want this to stay around */
if (tvp) {
afs_globalVp = tvp;
@ -555,8 +554,7 @@ afs_vget(OSI_VFS_DECL(afsp), vnode_t **avcp, struct fid *fidp)
if (code = afs_InitReq(&treq, OSI_GET_CURRENT_CRED()))
goto out;
*avcp = (vnode_t*) afs_GetVCache(&vfid, &treq, (afs_int32 *)0,
(struct vcache*)0, 0);
*avcp = (vnode_t*) afs_GetVCache(&vfid, &treq, NULL, (struct vcache*)0);
if (! *avcp) {
code = ENOENT;
}

View File

@ -33,10 +33,7 @@ extern struct vnodeops Afs_vnodeops;
* is not dropped and re-acquired for any platform. It may be that *slept is
* therefore obsolescent.
*/
int
osi_VM_FlushVCache(avc, slept)
struct vcache *avc;
int *slept;
int osi_VM_FlushVCache(struct vcache *avc, int *slept)
{
int s, code;
vnode_t *vp = &avc->v;
@ -144,11 +141,7 @@ osi_VM_FlushVCache(avc, slept)
* Since we drop and re-obtain the lock, we can't guarantee that there won't
* be some pages around when we return, newly created by concurrent activity.
*/
void
osi_VM_TryToSmush(avc, acred, sync)
struct vcache *avc;
struct AFS_UCRED *acred;
int sync;
void osi_VM_TryToSmush(struct vcache *avc, struct AFS_UCRED *acred, int sync)
{
ReleaseWriteLock(&avc->lock);
AFS_GUNLOCK();
@ -165,9 +158,7 @@ osi_VM_TryToSmush(avc, acred, sync)
*
* Locking: only the global lock is held.
*/
void
osi_VM_FSyncInval(avc)
struct vcache *avc;
void osi_VM_FSyncInval(struct vcache *avc)
{
AFS_GUNLOCK();
PFLUSHINVALVP((vnode_t *)avc, (off_t)0, (off_t)avc->m.Length);
@ -179,9 +170,7 @@ osi_VM_FSyncInval(avc)
* Locking: the vcache entry's lock is held. It will usually be dropped and
* re-obtained.
*/
void
osi_VM_StoreAllSegments(avc)
struct vcache *avc;
void osi_VM_StoreAllSegments(struct vcache *avc)
{
int error;
osi_Assert(valusema(&avc->vc_rwlock) <= 0);
@ -221,10 +210,7 @@ osi_VM_StoreAllSegments(avc)
*
* Locking: No lock is held, not even the global lock.
*/
void
osi_VM_FlushPages(avc, credp)
struct vcache *avc;
struct AFS_UCRED *credp;
void osi_VM_FlushPages(struct vcache *avc, struct AFS_UCRED *credp)
{
vnode_t *vp = (vnode_t *)avc;
@ -248,11 +234,7 @@ osi_VM_FlushPages(avc, credp)
* activeV is raised. This is supposed to block pageins, but at present
* it only works on Solaris.
*/
void
osi_VM_Truncate(avc, alen, acred)
struct vcache *avc;
int alen;
struct AFS_UCRED *acred;
void osi_VM_Truncate(struct vcache *avc, int alen, struct AFS_UCRED *acred)
{
PTOSSVP(&avc->v, (off_t)alen, (off_t)MAXLONG);
}

View File

@ -350,7 +350,7 @@ void osi_linux_free(void *addr)
lmem.chunk = addr;
/* remove this chunk from our hash table */
if ( lmp = (struct osi_linux_mem *)afs_lhash_remove(lh_mem_htab, hash_chunk(addr), &lmem)) {
if ((lmp = (struct osi_linux_mem *)afs_lhash_remove(lh_mem_htab, hash_chunk(addr), &lmem))) {
linux_free(lmp->chunk); /* this contains the piggybacked type info*/
afs_atomlist_put(al_mem_pool, lmp); /* return osi_linux_mem struct to pool*/
afs_linux_cur_allocs--;

View File

@ -24,8 +24,7 @@ afs_lock_t afs_xosi; /* lock is for tvattr */
extern struct osi_dev cacheDev;
extern struct super_block *afs_cacheSBp;
void *osi_UFSOpen(ainode)
afs_int32 ainode;
void *osi_UFSOpen(afs_int32 ainode)
{
struct inode *ip;
register struct osi_file *afile = NULL;
@ -76,9 +75,8 @@ void *osi_UFSOpen(ainode)
return (void *)afile;
}
afs_osi_Stat(afile, astat)
register struct osi_file *afile;
register struct osi_stat *astat; {
int afs_osi_Stat(register struct osi_file *afile, register struct osi_stat *astat)
{
register afs_int32 code;
AFS_STATCNT(osi_Stat);
MObtainWriteLock(&afs_xosi,320);
@ -91,8 +89,7 @@ afs_osi_Stat(afile, astat)
return code;
}
osi_UFSClose(afile)
register struct osi_file *afile;
int osi_UFSClose(register struct osi_file *afile)
{
AFS_STATCNT(osi_Close);
if (afile) {
@ -108,9 +105,8 @@ osi_UFSClose(afile)
return 0;
}
osi_UFSTruncate(afile, asize)
register struct osi_file *afile;
afs_int32 asize; {
int osi_UFSTruncate(register struct osi_file *afile, afs_int32 asize)
{
struct AFS_UCRED *oldCred;
register afs_int32 code;
struct osi_stat tstat;
@ -163,11 +159,8 @@ osi_UFSTruncate(afile, asize)
/* Generic read interface */
afs_osi_Read(afile, offset, aptr, asize)
register struct osi_file *afile;
int offset;
char *aptr;
afs_int32 asize; {
int afs_osi_Read(register struct osi_file *afile, int offset, void *aptr, afs_int32 asize)
{
struct AFS_UCRED *oldCred;
size_t resid;
register afs_int32 code;
@ -202,11 +195,8 @@ afs_osi_Read(afile, offset, aptr, asize)
}
/* Generic write interface */
afs_osi_Write(afile, offset, aptr, asize)
register struct osi_file *afile;
char *aptr;
afs_int32 offset;
afs_int32 asize; {
int afs_osi_Write(register struct osi_file *afile, afs_int32 offset, void *aptr, afs_int32 asize)
{
struct AFS_UCRED *oldCred;
size_t resid;
register afs_int32 code;
@ -235,9 +225,7 @@ afs_osi_Write(afile, offset, aptr, asize)
/* This work should be handled by physstrat in ca/machdep.c.
This routine written from the RT NFS port strategy routine.
It has been generalized a bit, but should still be pretty clear. */
int afs_osi_MapStrategy(aproc, bp)
int (*aproc)();
register struct buf *bp;
int afs_osi_MapStrategy(int (*aproc)(), register struct buf *bp)
{
afs_int32 returnCode;
@ -247,8 +235,7 @@ int afs_osi_MapStrategy(aproc, bp)
return returnCode;
}
void
shutdown_osifile()
void shutdown_osifile(void)
{
extern int afs_cold_shutdown;

View File

@ -165,7 +165,7 @@ do { \
#define AFS_GUNLOCK() \
do { \
if (!ISAFS_GLOCK()) \
osi_Panic("afs global lock not held"); \
osi_Panic("afs global lock not held at %s:%d", __FILE__, __LINE__); \
afs_global_owner = 0; \
up(&afs_global_lock); \
} while (0)

View File

@ -348,7 +348,7 @@ void osi_clear_inode(struct inode *ip)
#else
if (ip->i_count > 1)
#endif
printf("afs_put_inode: ino %d (0x%x) has count %d\n", ip->i_ino, ip);
printf("afs_put_inode: ino %d (0x%x) has count %d\n", ip->i_ino, ip, ip->i_count);
afs_InactiveVCache(vcp, credp);
ObtainWriteLock(&vcp->lock, 504);
@ -443,14 +443,16 @@ void check_bad_parent(struct dentry *dp)
struct task_struct *rxk_ListenerTask;
void osi_linux_mask() {
void osi_linux_mask(void)
{
spin_lock_irq(&current->sigmask_lock);
sigfillset(&current->blocked);
recalc_sigpending(current);
spin_unlock_irq(&current->sigmask_lock);
}
void osi_linux_unmask() {
void osi_linux_unmask(void)
{
spin_lock_irq(&rxk_ListenerTask->sigmask_lock);
sigemptyset(&rxk_ListenerTask->blocked);
flush_signals(rxk_ListenerTask);
@ -458,6 +460,7 @@ void osi_linux_unmask() {
spin_unlock_irq(&rxk_ListenerTask->sigmask_lock);
}
void osi_linux_rxkreg() {
void osi_linux_rxkreg(void)
{
rxk_ListenerTask = current;
}

View File

@ -16,14 +16,10 @@ RCSID("$Header$");
#include "../afs/afsincludes.h" /* Afs-based standard headers */
#include "../afs/afs_stats.h" /* afs statistics */
static int osi_TimedSleep(char *event, afs_int32 ams, int aintok);
void afs_osi_Wakeup(char *event);
void afs_osi_Sleep(char *event);
static char waitV, dummyV;
void afs_osi_InitWaitHandle(struct afs_osi_WaitHandle *achandle)
{
AFS_STATCNT(osi_InitWaitHandle);
@ -48,9 +44,9 @@ void afs_osi_CancelWait(struct afs_osi_WaitHandle *achandle)
*/
int afs_osi_Wait(afs_int32 ams, struct afs_osi_WaitHandle *ahandle, int aintok)
{
int code;
afs_int32 endTime, tid;
afs_int32 endTime;
struct timer_list *timer = NULL;
int code;
AFS_STATCNT(osi_Wait);
endTime = osi_Time() + (ams/1000);
@ -58,11 +54,9 @@ int afs_osi_Wait(afs_int32 ams, struct afs_osi_WaitHandle *ahandle, int aintok)
ahandle->proc = (caddr_t) current;
do {
AFS_ASSERT_GLOCK();
code = 0;
code = osi_TimedSleep(&waitV, ams, aintok);
if (code) break;
AFS_ASSERT_GLOCK();
code = osi_TimedSleep(&waitV, ams, 1);
if (code) break;
if (ahandle && (ahandle->proc == (caddr_t) 0)) {
/* we've been signalled */
break;
@ -165,7 +159,7 @@ static void afs_addevent(char *event)
* Waits for an event to be notified, returning early if a signal
* is received. Returns EINTR if signaled, and 0 otherwise.
*/
int afs_osi_SleepSig(char *event)
int afs_osi_SleepSig(void *event)
{
struct afs_event *evp;
int seq, retval;
@ -210,7 +204,7 @@ int afs_osi_SleepSig(char *event)
* caller that the wait has been interrupted and the stack should be cleaned
* up preparatory to signal delivery
*/
void afs_osi_Sleep(char *event)
void afs_osi_Sleep(void *event)
{
sigset_t saved_set;
@ -277,7 +271,7 @@ static int osi_TimedSleep(char *event, afs_int32 ams, int aintok)
}
void afs_osi_Wakeup(char *event)
void afs_osi_Wakeup(void *event)
{
struct afs_event *evp;

View File

@ -130,8 +130,7 @@ static int afs_root(struct super_block *afsp)
if (!(code = afs_InitReq(&treq, credp)) &&
!(code = afs_CheckInit())) {
tvp = afs_GetVCache(&afs_rootFid, &treq, (afs_int32 *)0,
(struct vcache*)0, WRITE_LOCK);
tvp = afs_GetVCache(&afs_rootFid, &treq, NULL, NULL);
if (tvp) {
extern struct inode_operations afs_dir_iops;
#if defined(AFS_LINUX24_ENV)

View File

@ -334,7 +334,7 @@ tagain:
if (!dirpos)
break;
de = (struct DirEntry*)afs_dir_GetBlob(&tdc->f.inode, dirpos);
de = afs_dir_GetBlob(&tdc->f.inode, dirpos);
if (!de)
break;
@ -356,7 +356,7 @@ tagain:
if ((avc->states & CForeign) == 0 &&
(ntohl(de->fid.vnode) & 1)) {
type=DT_DIR;
} else if ((tvc=afs_FindVCache(&afid,0,0,0,0))) {
} else if ((tvc=afs_FindVCache(&afid,0,0))) {
if (tvc->mvstat) {
type=DT_DIR;
} else if (((tvc->states) & (CStatd|CTruth))) {
@ -373,7 +373,7 @@ tagain:
/* what other types does AFS support? */
}
/* clean up from afs_FindVCache */
afs_PutVCache(tvc, WRITE_LOCK);
afs_PutVCache(tvc);
}
code = (*filldir)(dirbuf, de->name, len, offset, ino, type);
}
@ -778,7 +778,7 @@ static int afs_linux_revalidate(struct dentry *dp)
if (afs_fakestat_enable && vcp->mvstat == 1 && vcp->mvid &&
(vcp->states & CMValid) && (vcp->states & CStatd)) {
ObtainSharedLock(&afs_xvcache, 680);
rootvp = afs_FindVCache(vcp->mvid, 0, 0, 0, 0);
rootvp = afs_FindVCache(vcp->mvid, 0, 0);
ReleaseSharedLock(&afs_xvcache);
}
@ -797,7 +797,7 @@ static int afs_linux_revalidate(struct dentry *dp)
#ifdef AFS_LINUX24_ENV
unlock_kernel();
#endif
if (rootvp) afs_PutVCache(rootvp, 0);
if (rootvp) afs_PutVCache(rootvp);
AFS_GUNLOCK();
return 0;
}
@ -855,14 +855,14 @@ static int afs_linux_dentry_revalidate(struct dentry *dp)
goto done;
}
if (code = afs_InitReq(&treq, credp))
if ((code = afs_InitReq(&treq, credp)))
goto done;
Check_AtSys(parentvcp, dp->d_name.name, &sysState, &treq);
name = sysState.name;
/* First try looking up the DNLC */
if (lookupvcp = osi_dnlc_lookup(parentvcp, name, WRITE_LOCK)) {
if ((lookupvcp = osi_dnlc_lookup(parentvcp, name, WRITE_LOCK))) {
/* Verify that the dentry does not point to an old inode */
if (vcp != lookupvcp)
goto done;
@ -886,7 +886,7 @@ static int afs_linux_dentry_revalidate(struct dentry *dp)
done:
/* Clean up */
if (lookupvcp)
afs_PutVCache(lookupvcp, WRITE_LOCK);
afs_PutVCache(lookupvcp);
if (sysState.allocked)
osi_FreeLargeSpace(name);

View File

@ -24,8 +24,7 @@ extern struct osi_dev cacheDev;
extern struct mount *afs_cacheVfsp;
void *osi_UFSOpen(ainode)
afs_int32 ainode;
void *osi_UFSOpen(afs_int32 ainode)
{
struct inode *ip;
register struct osi_file *afile = NULL;
@ -59,9 +58,8 @@ void *osi_UFSOpen(ainode)
return (void *)afile;
}
afs_osi_Stat(afile, astat)
register struct osi_file *afile;
register struct osi_stat *astat; {
int afs_osi_Stat(register struct osi_file *afile, register struct osi_stat *astat)
{
register afs_int32 code;
struct vattr tvattr;
AFS_STATCNT(osi_Stat);
@ -79,8 +77,7 @@ afs_osi_Stat(afile, astat)
return code;
}
osi_UFSClose(afile)
register struct osi_file *afile;
int osi_UFSClose(register struct osi_file *afile)
{
AFS_STATCNT(osi_Close);
if(afile->vnode) {
@ -91,9 +88,8 @@ osi_UFSClose(afile)
return 0;
}
osi_UFSTruncate(afile, asize)
register struct osi_file *afile;
afs_int32 asize; {
int osi_UFSTruncate(register struct osi_file *afile, afs_int32 asize)
{
struct AFS_UCRED *oldCred;
struct vattr tvattr;
register afs_int32 code;
@ -123,8 +119,7 @@ osi_UFSTruncate(afile, asize)
return code;
}
void osi_DisableAtimes(avp)
struct vnode *avp;
void osi_DisableAtimes(struct vnode *avp)
{
struct inode *ip = VTOI(avp);
ip->i_flag &= ~IACC;
@ -132,11 +127,8 @@ struct vnode *avp;
/* Generic read interface */
afs_osi_Read(afile, offset, aptr, asize)
register struct osi_file *afile;
int offset;
char *aptr;
afs_int32 asize; {
int afs_osi_Read(register struct osi_file *afile, int offset, void *aptr, afs_int32 asize)
{
struct AFS_UCRED *oldCred;
unsigned int resid;
register afs_int32 code;
@ -173,11 +165,8 @@ afs_osi_Read(afile, offset, aptr, asize)
}
/* Generic write interface */
afs_osi_Write(afile, offset, aptr, asize)
register struct osi_file *afile;
char *aptr;
afs_int32 offset;
afs_int32 asize; {
int afs_osi_Write(register struct osi_file *afile, afs_int32 offset, void *aptr, afs_int32 asize)
{
struct AFS_UCRED *oldCred;
unsigned int resid;
register afs_int32 code;
@ -211,9 +200,7 @@ afs_osi_Write(afile, offset, aptr, asize)
/* This work should be handled by physstrat in ca/machdep.c.
This routine written from the RT NFS port strategy routine.
It has been generalized a bit, but should still be pretty clear. */
int afs_osi_MapStrategy(aproc, bp)
int (*aproc)();
register struct buf *bp;
int afs_osi_MapStrategy(int (*aproc)(), register struct buf *bp)
{
afs_int32 returnCode;
@ -225,8 +212,7 @@ int afs_osi_MapStrategy(aproc, bp)
void
shutdown_osifile()
void shutdown_osifile(void)
{
extern int afs_cold_shutdown;

View File

@ -215,7 +215,7 @@ afs_syscall_iopen(dev, inode, usrmod, retval)
{
struct file *fp;
struct inode *ip;
struct vnode *vp = (struct vnode *)0;
struct vnode *vp = NULL;
int dummy;
int fd;
extern struct fileops vnops;

View File

@ -20,9 +20,6 @@ RCSID("$Header$");
static int osi_TimedSleep(char *event, afs_int32 ams, int aintok);
void afs_osi_Wakeup(char *event);
void afs_osi_Sleep(char *event);
static char waitV;
@ -125,7 +122,7 @@ static afs_event_t *afs_getevent(char *event)
#define relevent(evp) ((evp)->refcount--)
void afs_osi_Sleep(char *event)
void afs_osi_Sleep(void *event)
{
struct afs_event *evp;
int seq;
@ -142,7 +139,7 @@ void afs_osi_Sleep(char *event)
relevent(evp);
}
int afs_osi_SleepSig(char *event)
int afs_osi_SleepSig(void *event)
{
afs_osi_Sleep(event);
return 0;
@ -181,7 +178,7 @@ static int osi_TimedSleep(char *event, afs_int32 ams, int aintok)
}
void afs_osi_Wakeup(char *event)
void afs_osi_Wakeup(void *event)
{
struct afs_event *evp;

View File

@ -143,8 +143,7 @@ int mp_afs_root (struct mount *afsp, struct vnode **avpp)
if (!(code = afs_InitReq(&treq, cred)) &&
!(code = afs_CheckInit())) {
tvp = afs_GetVCache(&afs_rootFid, &treq, (afs_int32 *)0,
(struct vcache*)0, WRITE_LOCK);
tvp = afs_GetVCache(&afs_rootFid, &treq, NULL, NULL);
/* we really want this to stay around */
if (tvp) {
afs_globalVp = tvp;

View File

@ -46,10 +46,7 @@ RCSID("$Header$");
*
* OSF/1 Locking: VN_LOCK has been called.
*/
int
osi_VM_FlushVCache(avc, slept)
struct vcache *avc;
int *slept;
int osi_VM_FlushVCache(struct vcache *avc, int *slept)
{
#ifdef SECRETLY_OSF1
if (avc->vrefCount > 1)
@ -96,10 +93,8 @@ osi_VM_FlushVCache(avc, slept)
*
* Called with the global lock NOT held.
*/
void
osi_ubc_flush_dirty_and_wait(vp, flags)
struct vnode *vp;
int flags; {
static void osi_ubc_flush_dirty_and_wait(struct vnode *vp, int flags)
{
int retry;
vm_page_t pp;
int first;
@ -142,9 +137,7 @@ int flags; {
* Locking: the vcache entry's lock is held. It will usually be dropped and
* re-obtained.
*/
void
osi_VM_StoreAllSegments(avc)
struct vcache *avc;
void osi_VM_StoreAllSegments(struct vcache *avc)
{
#ifdef SECRETLY_OSF1
ReleaseWriteLock(&avc->lock);
@ -164,11 +157,7 @@ osi_VM_StoreAllSegments(avc)
* Since we drop and re-obtain the lock, we can't guarantee that there won't
* be some pages around when we return, newly created by concurrent activity.
*/
void
osi_VM_TryToSmush(avc, acred, sync)
struct vcache *avc;
struct AFS_UCRED *acred;
int sync;
void osi_VM_TryToSmush(struct vcache *avc, struct AFS_UCRED *acred, int sync)
{
#ifdef SECRETLY_OSF1
ReleaseWriteLock(&avc->lock);
@ -184,10 +173,7 @@ osi_VM_TryToSmush(avc, acred, sync)
*
* Locking: No lock is held, not even the global lock.
*/
void
osi_VM_FlushPages(avc, credp)
struct vcache *avc;
struct AFS_UCRED *credp;
void osi_VM_FlushPages(struct vcache *avc, struct AFS_UCRED *credp)
{
#ifdef SECRETLY_OSF1
ubc_flush_dirty(((struct vnode *)avc)->v_object, 0);
@ -201,11 +187,7 @@ osi_VM_FlushPages(avc, credp)
* activeV is raised. This is supposed to block pageins, but at present
* it only works on Solaris.
*/
void
osi_VM_Truncate(avc, alen, acred)
struct vcache *avc;
int alen;
struct AFS_UCRED *acred;
void osi_VM_Truncate(struct vcache *avc, int alen, struct AFS_UCRED *acred)
{
#ifdef SECRETLY_OSF1
ubc_invalidate(((struct vnode *)avc)->v_object, alen,

View File

@ -1086,9 +1086,9 @@ lookupname(namep, seg, follow, dvpp, cvpp)
ndp->ni_segflg = seg;
ndp->ni_dirp = namep;
error = namei(ndp);
if (dvpp != (struct vnode **)0)
if (dvpp != NULL)
*dvpp = ndp->ni_dvp;
if (cvpp != (struct vnode **)0)
if (cvpp != NULL)
*cvpp = ndp->ni_vp;
return(error);
}

View File

@ -125,8 +125,7 @@ afs_int32 VnodeToSize(vnode_t *vp)
return (afs_int32)(vattr.va_size);
}
void *osi_VxfsOpen(ainode)
afs_int32 ainode;
void *osi_VxfsOpen(afs_int32 ainode)
{
struct vnode *vp;
register struct osi_file *afile = NULL;
@ -149,8 +148,7 @@ void *osi_VxfsOpen(ainode)
}
#endif /* AFS_HAVE_VXFS */
void *osi_UfsOpen(ainode)
afs_int32 ainode;
void *osi_UfsOpen(afs_int32 ainode)
{
struct inode *ip;
register struct osi_file *afile = NULL;
@ -178,8 +176,7 @@ void *osi_UfsOpen(ainode)
#if defined(AFS_SUN57_64BIT_ENV)
void *osi_UFSOpen(ino_t ainode)
#else
void *osi_UFSOpen(ainode)
afs_int32 ainode;
void *osi_UFSOpen(afs_int32 ainode)
#endif
{
extern int cacheDiskType;
@ -200,9 +197,8 @@ void *osi_UFSOpen(ainode)
return osi_UfsOpen(ainode);
}
afs_osi_Stat(afile, astat)
register struct osi_file *afile;
register struct osi_stat *astat; {
int afs_osi_Stat(register struct osi_file *afile, register struct osi_stat *astat)
{
register afs_int32 code;
struct vattr tvattr;
AFS_STATCNT(osi_Stat);
@ -222,8 +218,7 @@ afs_osi_Stat(afile, astat)
return code;
}
osi_UFSClose(afile)
register struct osi_file *afile;
int osi_UFSClose(register struct osi_file *afile)
{
AFS_STATCNT(osi_Close);
if(afile->vnode) {
@ -234,9 +229,8 @@ osi_UFSClose(afile)
return 0;
}
osi_UFSTruncate(afile, asize)
register struct osi_file *afile;
afs_int32 asize; {
int osi_UFSTruncate(register struct osi_file *afile, afs_int32 asize)
{
struct AFS_UCRED *oldCred;
struct vattr tvattr;
register afs_int32 code;
@ -262,8 +256,7 @@ osi_UFSTruncate(afile, asize)
return code;
}
void osi_DisableAtimes(avp)
struct vnode *avp;
void osi_DisableAtimes(struct vnode *avp)
{
if (afs_CacheFSType == AFS_SUN_UFS_CACHE) {
struct inode *ip = VTOI(avp);
@ -277,11 +270,8 @@ struct vnode *avp;
/* Generic read interface */
afs_osi_Read(afile, offset, aptr, asize)
register struct osi_file *afile;
int offset;
char *aptr;
afs_int32 asize; {
int afs_osi_Read(register struct osi_file *afile, int offset, void *aptr, afs_int32 asize)
{
struct AFS_UCRED *oldCred;
#if defined(AFS_SUN57_ENV)
ssize_t resid;
@ -322,11 +312,8 @@ afs_osi_Read(afile, offset, aptr, asize)
}
/* Generic write interface */
afs_osi_Write(afile, offset, aptr, asize)
register struct osi_file *afile;
char *aptr;
afs_int32 offset;
afs_int32 asize; {
int afs_osi_Write(register struct osi_file *afile, afs_int32 offset, void *aptr, afs_int32 asize)
{
struct AFS_UCRED *oldCred;
#if defined(AFS_SUN57_ENV)
ssize_t resid;
@ -360,9 +347,7 @@ afs_osi_Write(afile, offset, aptr, asize)
/* This work should be handled by physstrat in ca/machdep.c.
This routine written from the RT NFS port strategy routine.
It has been generalized a bit, but should still be pretty clear. */
int afs_osi_MapStrategy(aproc, bp)
int (*aproc)();
register struct buf *bp;
int afs_osi_MapStrategy(int (*aproc)(), register struct buf *bp)
{
afs_int32 returnCode;
@ -374,8 +359,7 @@ int afs_osi_MapStrategy(aproc, bp)
void
shutdown_osifile()
void shutdown_osifile(void)
{
extern int afs_cold_shutdown;

View File

@ -236,7 +236,7 @@ afs_syscall_iopen(dev, inode, usrmod, rvp, credp)
{
struct file *fp;
struct inode *ip;
struct vnode *vp = (struct vnode *)0;
struct vnode *vp = NULL;
int dummy;
int fd;
register int code;

View File

@ -17,8 +17,6 @@ RCSID("$Header$");
#include "../afs/afs_stats.h" /* afs statistics */
static int osi_TimedSleep(char *event, afs_int32 ams, int aintok);
void afs_osi_Wakeup(char *event);
void afs_osi_Sleep(char *event);
static char waitV;
@ -122,7 +120,7 @@ static afs_event_t *afs_getevent(char *event)
#define relevent(evp) ((evp)->refcount--)
void afs_osi_Sleep(char *event)
void afs_osi_Sleep(void *event)
{
struct afs_event *evp;
int seq;
@ -136,7 +134,7 @@ void afs_osi_Sleep(char *event)
relevent(evp);
}
int afs_osi_SleepSig(char *event)
int afs_osi_SleepSig(void *event)
{
struct afs_event *evp;
int seq, code = 0;
@ -187,7 +185,7 @@ static int osi_TimedSleep(char *event, afs_int32 ams, int aintok)
}
void afs_osi_Wakeup(char *event)
void afs_osi_Wakeup(void *event)
{
struct afs_event *evp;

View File

@ -118,8 +118,7 @@ int afs_root (struct vfs *afsp, struct vnode **avpp)
if (!(code = afs_InitReq(&treq, proc->p_cred)) &&
!(code = afs_CheckInit())) {
tvp = afs_GetVCache(&afs_rootFid, &treq, (afs_int32 *)0,
(struct vcache*)0, WRITE_LOCK);
tvp = afs_GetVCache(&afs_rootFid, &treq, NULL, NULL);
/* we really want this to stay around */
if (tvp) {
afs_globalVp = tvp;

View File

@ -42,10 +42,7 @@ RCSID("$Header$");
*
* Locking: only the global lock is held on entry.
*/
int
osi_VM_GetDownD(avc, adc)
struct vcache *avc;
struct dcache *adc;
int osi_VM_GetDownD(struct vcache *avc, struct dcache *adc)
{
int code;
@ -73,10 +70,7 @@ osi_VM_GetDownD(avc, adc)
* is not dropped and re-acquired for any platform. It may be that *slept is
* therefore obsolescent.
*/
int
osi_VM_FlushVCache(avc, slept)
struct vcache *avc;
int *slept;
int osi_VM_FlushVCache(struct vcache *avc, int *slept)
{
if (avc->vrefCount != 0)
return EBUSY;
@ -113,9 +107,7 @@ osi_VM_FlushVCache(avc, slept)
* Locking: the vcache entry's lock is held. It will usually be dropped and
* re-obtained.
*/
void
osi_VM_StoreAllSegments(avc)
struct vcache *avc;
void osi_VM_StoreAllSegments(struct vcache *avc)
{
AFS_GUNLOCK();
#if defined(AFS_SUN56_ENV)
@ -133,11 +125,7 @@ osi_VM_StoreAllSegments(avc)
* Locking: the vcache entry's lock is held. It may be dropped and
* re-obtained.
*/
void
osi_VM_TryToSmush(avc, acred, sync)
struct vcache *avc;
struct AFS_UCRED *acred;
int sync;
void osi_VM_TryToSmush(struct vcache *avc, struct AFS_UCRED *acred, int sync)
{
AFS_GUNLOCK();
#if defined(AFS_SUN56_ENV)
@ -154,10 +142,7 @@ osi_VM_TryToSmush(avc, acred, sync)
*
* Locking: No lock is held, not even the global lock.
*/
void
osi_VM_FlushPages(avc, credp)
struct vcache *avc;
struct AFS_UCRED *credp;
void osi_VM_FlushPages(struct vcache *avc, struct AFS_UCRED *credp)
{
extern int afs_pvn_vptrunc;
@ -174,11 +159,7 @@ osi_VM_FlushPages(avc, credp)
* The caller will raise activeV (to prevent pageins), but this function must
* be called first, since it causes a pagein.
*/
void
osi_VM_PreTruncate(avc, alen, acred)
struct vcache *avc;
int alen;
struct AFS_UCRED *acred;
void osi_VM_PreTruncate(struct vcache *avc, int alen, struct AFS_UCRED *acred)
{
page_t *pp;
int pageOffset = (alen & PAGEOFFSET);
@ -203,11 +184,7 @@ osi_VM_PreTruncate(avc, alen, acred)
* Locking: no lock is held, not even the global lock.
* Pageins are blocked (activeV is raised).
*/
void
osi_VM_Truncate(avc, alen, acred)
struct vcache *avc;
int alen;
struct AFS_UCRED *acred;
void osi_VM_Truncate(struct vcache *avc, int alen, struct AFS_UCRED *acred)
{
/*
* It's OK to specify afs_putapage here, even though we aren't holding

View File

@ -572,7 +572,7 @@ retry:
} /* while (1) ... */
AFS_GLOCK();
pl[slot] = (struct page *) 0;
pl[slot] = NULL;
ReleaseReadLock(&tdc->lock);
/* Prefetch next chunk if we're at a chunk boundary */

View File

@ -176,9 +176,7 @@ struct {
/*
* Never call afs_brelse
*/
int ufs_brelse(vp, bp)
struct usr_vnode *vp;
struct usr_buf *bp;
int ufs_brelse(struct usr_vnode *vp, struct usr_buf *bp)
{
usr_assert(0);
}
@ -186,14 +184,12 @@ struct usr_buf *bp;
/*
* I am not sure what to do with these, they assert for now
*/
int iodone(bp)
struct usr_buf *bp;
int iodone(struct usr_buf *bp)
{
usr_assert(0);
}
struct usr_file *getf(fd)
int fd;
struct usr_file *getf(int fd)
{
usr_assert(0);
}
@ -201,14 +197,12 @@ int fd;
/*
* Every user is a super user
*/
int afs_osi_suser(credp)
struct usr_ucred *credp;
int afs_osi_suser(void *credp)
{
return 1;
}
int afs_suser(credp)
struct usr_ucred *credp;
int afs_suser(void *credp)
{
return 1;
}
@ -217,8 +211,7 @@ struct usr_ucred *credp;
* These are no-ops in user space
*/
int afs_osi_SetTime(atv)
osi_timeval_t *atv;
int afs_osi_SetTime(osi_timeval_t *atv)
{
return 0;
}
@ -227,7 +220,7 @@ osi_timeval_t *atv;
* xflock should never fall through, the only files we know
* about are AFS files
*/
int usr_flock()
int usr_flock(void)
{
usr_assert(0);
}
@ -236,7 +229,7 @@ int usr_flock()
* ioctl should never fall through, the only files we know
* about are AFS files
*/
int usr_ioctl()
int usr_ioctl(void)
{
usr_assert(0);
}
@ -244,22 +237,22 @@ int usr_ioctl()
/*
* We do not support the inode related system calls
*/
int afs_syscall_icreate()
int afs_syscall_icreate(void)
{
usr_assert(0);
}
int afs_syscall_iincdec()
int afs_syscall_iincdec(void)
{
usr_assert(0);
}
int afs_syscall_iopen()
int afs_syscall_iopen(void)
{
usr_assert(0);
}
int afs_syscall_ireadwrite()
int afs_syscall_ireadwrite(void)
{
usr_assert(0);
}
@ -268,22 +261,22 @@ int afs_syscall_ireadwrite()
* these routines are referenced in the vfsops structure, but
* should never get called
*/
int vno_close()
int vno_close(void)
{
usr_assert(0);
}
int vno_ioctl()
int vno_ioctl(void)
{
usr_assert(0);
}
int vno_rw()
int vno_rw(void)
{
usr_assert(0);
}
int vno_select()
int vno_select(void)
{
usr_assert(0);
}
@ -291,11 +284,7 @@ int vno_select()
/*
* uiomove copies data between kernel buffers and uio buffers
*/
int usr_uiomove(kbuf, n, rw, uio)
char *kbuf;
int n;
int rw;
struct usr_uio *uio;
int usr_uiomove(char *kbuf, int n, int rw, struct usr_uio *uio)
{
int nio;
int len;
@ -337,8 +326,7 @@ struct usr_uio *uio;
/*
* routines to manage user credentials
*/
struct usr_ucred *usr_crcopy(credp)
struct usr_ucred *credp;
struct usr_ucred *usr_crcopy(struct usr_ucred *credp)
{
struct usr_ucred *newcredp;
@ -348,7 +336,7 @@ struct usr_ucred *credp;
return newcredp;
}
struct usr_ucred *usr_crget()
struct usr_ucred *usr_crget(void)
{
struct usr_ucred *newcredp;
@ -357,8 +345,7 @@ struct usr_ucred *usr_crget()
return newcredp;
}
int usr_crfree(credp)
struct usr_ucred *credp;
int usr_crfree(struct usr_ucred *credp)
{
credp->cr_ref--;
if (credp->cr_ref == 0) {
@ -366,14 +353,12 @@ struct usr_ucred *credp;
}
}
int usr_crhold(credp)
struct usr_ucred *credp;
int usr_crhold(struct usr_ucred *credp)
{
credp->cr_ref++;
}
void usr_vattr_null(vap)
struct usr_vattr *vap;
void usr_vattr_null(struct usr_vattr *vap)
{
int n;
char *cp;
@ -390,7 +375,7 @@ struct usr_vattr *vap;
* kernel environment for each thread. The user structure
* is stored in the thread specific data.
*/
void uafs_InitThread()
void uafs_InitThread(void)
{
int st;
struct usr_user *uptr;
@ -417,7 +402,7 @@ void uafs_InitThread()
* this routine is used to implement the global 'u' structure. Initializes
* the thread if needed.
*/
struct usr_user *get_user_struct()
struct usr_user *get_user_struct(void)
{
struct usr_user *uptr;
int st;
@ -441,8 +426,7 @@ struct usr_user *get_user_struct()
/*
* Sleep on an event
*/
int afs_osi_Sleep(x)
caddr_t x;
void afs_osi_Sleep(void *x)
{
int index;
osi_wait_t *waitp;
@ -487,15 +471,13 @@ caddr_t x;
}
}
int afs_osi_SleepSig(x)
caddr_t x;
int afs_osi_SleepSig(void *x)
{
afs_osi_Sleep(x);
return 0;
}
int afs_osi_Wakeup(x)
caddr_t x;
void afs_osi_Wakeup(void *x)
{
int index;
osi_wait_t *waitp;
@ -513,10 +495,7 @@ caddr_t x;
usr_mutex_unlock(&osi_waitq_lock);
}
int afs_osi_Wait(msec, handle, intok)
afs_int32 msec;
struct afs_osi_WaitHandle *handle;
int intok;
int afs_osi_Wait(afs_int32 msec, struct afs_osi_WaitHandle *handle, int intok)
{
int index;
osi_wait_t *waitp;
@ -589,17 +568,16 @@ int intok;
return ret;
}
void afs_osi_CancelWait(handle)
struct afs_osi_WaitHandle *handle;
void afs_osi_CancelWait(struct afs_osi_WaitHandle *handle)
{
afs_osi_Wakeup((caddr_t)handle);
afs_osi_Wakeup(handle);
}
/*
* Netscape NSAPI doesn't have a cond_timed_wait, so we need
* to explicitly signal cond_timed_waits when their timers expire
*/
int afs_osi_CheckTimedWaits()
int afs_osi_CheckTimedWaits(void)
{
time_t curTime;
osi_wait_t *waitp;
@ -636,12 +614,8 @@ int max_osi_files = 0;
* Allocate a slot in the file table if there is not one there already,
* copy in the file name and kludge up the vnode and inode structures
*/
int lookupname(fnamep, segflg, followlink, dirvpp, compvpp)
char *fnamep;
int segflg;
int followlink;
struct usr_vnode **dirvpp;
struct usr_vnode **compvpp;
int lookupname(char *fnamep, int segflg, int followlink,
struct usr_vnode **dirvpp, struct usr_vnode **compvpp)
{
int i;
int code;
@ -695,8 +669,7 @@ struct usr_vnode **compvpp;
/*
* open a file given its i-node number
*/
void *osi_UFSOpen(ino)
int ino;
void *osi_UFSOpen(afs_int32 ino)
{
int rc;
struct osi_file *fp;
@ -735,8 +708,7 @@ int ino;
return fp;
}
int osi_UFSClose(fp)
struct osi_file *fp;
int osi_UFSClose(struct osi_file *fp)
{
int rc;
@ -755,9 +727,7 @@ struct osi_file *fp;
return 0;
}
int osi_UFSTruncate(fp, len)
struct osi_file *fp;
int len;
int osi_UFSTruncate(struct osi_file *fp, afs_int32 len)
{
int rc;
@ -775,11 +745,7 @@ int len;
return 0;
}
int afs_osi_Read(fp, offset, buf, len)
struct osi_file *fp;
int offset;
char *buf;
int len;
int afs_osi_Read(struct osi_file *fp, int offset, char *buf, afs_int32 len)
{
int rc, ret;
int code;
@ -817,11 +783,7 @@ int len;
return ret;
}
int afs_osi_Write(fp, offset, buf, len)
struct osi_file *fp;
int offset;
char *buf;
int len;
int afs_osi_Write(struct osi_file *fp, afs_int32 offset, char *buf, afs_int32 len)
{
int rc, ret;
int code;
@ -859,9 +821,7 @@ int len;
return ret;
}
int afs_osi_Stat(fp, stp)
struct osi_file *fp;
struct osi_stat *stp;
int afs_osi_Stat(struct osi_file *fp, struct osi_stat *stp)
{
int rc;
struct stat st;
@ -963,72 +923,65 @@ void osi_FreeSmallSpace(void *ptr)
afs_osi_Free(ptr, 0);
}
void shutdown_osi()
void shutdown_osi(void)
{
AFS_STATCNT(shutdown_osi);
return;
}
void shutdown_osinet()
void shutdown_osinet(void)
{
AFS_STATCNT(shutdown_osinet);
return;
}
void shutdown_osifile()
void shutdown_osifile(void)
{
AFS_STATCNT(shutdown_osifile);
return;
}
int afs_nfsclient_init()
int afs_nfsclient_init(void)
{
return 0;
}
void shutdown_nfsclnt()
void shutdown_nfsclnt(void)
{
return;
}
int afs_osi_Invisible()
void afs_osi_Invisible(void)
{
return 0;
return;
}
int osi_GetTime(tv)
struct timeval *tv;
int osi_GetTime(struct timeval *tv)
{
gettimeofday(tv, NULL);
return 0;
}
int osi_SetTime(tv)
struct timeval *tv;
int osi_SetTime(struct timeval *tv)
{
return 0;
}
int osi_Active(avc)
struct vcache *avc;
int osi_Active(struct vcache *avc)
{
AFS_STATCNT(osi_Active);
if (avc->opens > 0) return(1);
return 0;
}
int afs_osi_MapStrategy(aproc, bp)
int (*aproc)();
struct usr_buf *bp;
int afs_osi_MapStrategy(int (*aproc)(), struct usr_buf *bp)
{
afs_int32 returnCode;
returnCode = (*aproc)(bp);
return returnCode;
}
osi_FlushPages(avc, credp)
register struct vcache *avc;
struct AFS_UCRED *credp;
void osi_FlushPages(register struct vcache *avc, struct AFS_UCRED *credp)
{
ObtainSharedLock(&avc->lock,555);
if ((hcmp((avc->m.DataVersion), (avc->mapDV)) <= 0) ||
@ -1042,8 +995,7 @@ osi_FlushPages(avc, credp)
return;
}
osi_FlushText_really(vp)
register struct vcache *vp;
void osi_FlushText_really(register struct vcache *vp)
{
if (hcmp(vp->m.DataVersion, vp->flushDV) > 0) {
hset(vp->flushDV, vp->m.DataVersion);
@ -1051,21 +1003,17 @@ osi_FlushText_really(vp)
return;
}
int osi_SyncVM(avc)
struct vcache *avc;
int osi_SyncVM(struct vcache *avc)
{
return 0;
}
void osi_ReleaseVM(avc, len, credp)
struct vcache *avc;
int len;
struct usr_ucred *credp;
void osi_ReleaseVM(struct vcache *avc, int len, struct usr_ucred *credp)
{
return;
}
void osi_Init()
void osi_Init(void)
{
int i;
int rc;
@ -1144,8 +1092,7 @@ void osi_Init()
* None.
*------------------------------------------------------------------------*/
int GetVFileNumber(fname)
char *fname;
int GetVFileNumber(char *fname)
{
int computedVNumber; /*The computed file number we return*/
int filenameLen; /*Number of chars in filename*/
@ -1203,8 +1150,7 @@ int GetVFileNumber(fname)
* As described.
*------------------------------------------------------------------------*/
int CreateCacheFile(fname)
char *fname;
int CreateCacheFile(char *fname)
{
static char rn[] = "CreateCacheFile"; /*Routine name*/
int cfd; /*File descriptor to AFS cache file*/
@ -1257,8 +1203,7 @@ int CreateCacheFile(fname)
* delete files as explained above.
*------------------------------------------------------------------------*/
int SweepAFSCache(vFilesFound)
int *vFilesFound;
int SweepAFSCache(int *vFilesFound)
{
static char rn[] = "SweepAFSCache"; /*Routine name*/
char fullpn_FileToDelete[1024]; /*File to be deleted from cache*/
@ -1270,7 +1215,7 @@ int SweepAFSCache(vFilesFound)
if (cacheFlags & AFSCALL_INIT_MEMCACHE) {
if (afsd_debug)
printf("%s: Memory Cache, no cache sweep done\n");
printf("%s: Memory Cache, no cache sweep done\n", rn);
*vFilesFound = 0;
return 0;
}
@ -1405,10 +1350,8 @@ int SweepAFSCache(vFilesFound)
return(0);
}
static ConfigCell(aci, arock, adir)
register struct afsconf_cell *aci;
char *arock;
struct afsconf_dir *adir; {
static ConfigCell(register struct afsconf_cell *aci, char *arock, struct afsconf_dir *adir)
{
register int isHomeCell;
register int i;
afs_int32 cellFlags;
@ -1443,8 +1386,7 @@ struct afsconf_dir *adir; {
/*
* Set the UDP port number RX uses for UDP datagrams
*/
void uafs_SetRxPort(
int port)
void uafs_SetRxPort(int port)
{
usr_assert(usr_rx_port == 0);
usr_rx_port = port;
@ -1659,7 +1601,7 @@ void uafs_Init(
memset(pathname_for_V, 0, (cacheFiles * sizeof(char *)));
if (afsd_debug)
printf("%s: %d pathname_for_V entries at 0x%x, %d bytes\n",
rn, cacheFiles, (cacheFiles * sizeof(AFSD_INO_T)));
rn, cacheFiles, pathname_for_V, (cacheFiles * sizeof(AFSD_INO_T)));
/*
* Set up all the pathnames we'll need for later.
@ -1729,7 +1671,7 @@ void uafs_Init(
*/
lookingForHomeCell = 1;
afsconf_CellApply(afs_cdir, ConfigCell, (char *) 0);
afsconf_CellApply(afs_cdir, ConfigCell, NULL);
/*
* If we're still looking for the home cell after the whole cell
@ -1913,7 +1855,7 @@ void uafs_Init(
return;
}
void uafs_Shutdown()
void uafs_Shutdown(void)
{
int rc;
@ -1931,7 +1873,7 @@ void uafs_Shutdown()
/*
* Donate the current thread to the RX server pool.
*/
void uafs_RxServerProc()
void uafs_RxServerProc(void)
{
osi_socket sock;
int threadID;
@ -1964,11 +1906,10 @@ struct syscallThreadArgs {
};
#ifdef NETSCAPE_NSAPI
void syscallThread(argp)
void syscallThread(void *argp)
#else /* NETSCAPE_NSAPI */
void *syscallThread(argp)
void *syscallThread(void *argp)
#endif /* NETSCAPE_NSAPI */
void *argp;
{
int i;
struct usr_ucred *crp;
@ -2060,7 +2001,7 @@ int uafs_SetTokens(char *tbuffer, int tlen)
return 0;
}
int uafs_RPCStatsEnableProc()
int uafs_RPCStatsEnableProc(void)
{
int rc;
struct afs_ioctl iob;
@ -2079,7 +2020,7 @@ int uafs_RPCStatsEnableProc()
return rc;
}
int uafs_RPCStatsDisableProc()
int uafs_RPCStatsDisableProc(void)
{
int rc;
struct afs_ioctl iob;
@ -2098,7 +2039,7 @@ int uafs_RPCStatsDisableProc()
return rc;
}
int uafs_RPCStatsClearProc()
int uafs_RPCStatsClearProc(void)
{
int rc;
struct afs_ioctl iob;
@ -2117,7 +2058,7 @@ int uafs_RPCStatsClearProc()
return rc;
}
int uafs_RPCStatsEnablePeer()
int uafs_RPCStatsEnablePeer(void)
{
int rc;
struct afs_ioctl iob;
@ -2136,7 +2077,7 @@ int uafs_RPCStatsEnablePeer()
return rc;
}
int uafs_RPCStatsDisablePeer()
int uafs_RPCStatsDisablePeer(void)
{
int rc;
struct afs_ioctl iob;
@ -2155,7 +2096,7 @@ int uafs_RPCStatsDisablePeer()
return rc;
}
int uafs_RPCStatsClearPeer()
int uafs_RPCStatsClearPeer(void)
{
int rc;
struct afs_ioctl iob;
@ -2474,8 +2415,7 @@ char *uafs_LastPath(char *path)
/*
* Set the working directory.
*/
int uafs_chdir(
char *path)
int uafs_chdir(char *path)
{
int retval;
AFS_GLOCK();
@ -2484,8 +2424,7 @@ int uafs_chdir(
return retval;
}
int uafs_chdir_r(
char *path)
int uafs_chdir_r(char *path)
{
int code;
struct vnode *dirP;
@ -2508,9 +2447,7 @@ int uafs_chdir_r(
/*
* Create a directory.
*/
int uafs_mkdir(
char *path,
int mode)
int uafs_mkdir(char *path, int mode)
{
int retval;
AFS_GLOCK();
@ -2519,9 +2456,7 @@ int uafs_mkdir(
return retval;
}
int uafs_mkdir_r(
char *path,
int mode)
int uafs_mkdir_r(char *path, int mode)
{
int code;
char *nameP;
@ -2602,10 +2537,7 @@ int uafs_IsRoot(char *path)
* Open a file
* Note: file name may not end in a slash.
*/
int uafs_open(
char *path,
int flags,
int mode)
int uafs_open(char *path, int flags, int mode)
{
int retval;
AFS_GLOCK();
@ -2614,10 +2546,7 @@ int uafs_open(
return retval;
}
int uafs_open_r(
char *path,
int flags,
int mode)
int uafs_open_r(char *path, int flags, int mode)
{
int fd;
int code;
@ -2791,18 +2720,14 @@ int uafs_open_r(
/*
* Create a file
*/
int uafs_creat(
char *path,
int mode)
int uafs_creat(char *path, int mode)
{
int rc;
rc = uafs_open(path, O_CREAT|O_WRONLY|O_TRUNC, mode);
return rc;
}
int uafs_creat_r(
char *path,
int mode)
int uafs_creat_r(char *path, int mode)
{
int rc;
rc = uafs_open_r(path, O_CREAT|O_WRONLY|O_TRUNC, mode);
@ -2812,10 +2737,7 @@ int uafs_creat_r(
/*
* Write to a file
*/
int uafs_write(
int fd,
char *buf,
int len)
int uafs_write(int fd, char *buf, int len)
{
int retval;
AFS_GLOCK();
@ -2824,10 +2746,7 @@ int uafs_write(
return retval;
}
int uafs_write_r(
int fd,
char *buf,
int len)
int uafs_write_r(int fd, char *buf, int len)
{
int code;
struct usr_uio uio;
@ -2872,10 +2791,7 @@ int uafs_write_r(
/*
* Read from a file
*/
int uafs_read(
int fd,
char *buf,
int len)
int uafs_read(int fd, char *buf, int len)
{
int retval;
AFS_GLOCK();
@ -2884,10 +2800,7 @@ int uafs_read(
return retval;
}
int uafs_read_r(
int fd,
char *buf,
int len)
int uafs_read_r(int fd, char *buf, int len)
{
int code;
struct usr_uio uio;
@ -2934,9 +2847,7 @@ int uafs_read_r(
*
* NOTE: Caller must hold the global AFS lock.
*/
int uafs_GetAttr(
struct usr_vnode *vp,
struct stat *stats)
int uafs_GetAttr(struct usr_vnode *vp, struct stat *stats)
{
int code;
struct usr_vattr attrs;
@ -4082,7 +3993,7 @@ int uafs_klog_r(
/*
* Destroy AFS credentials from the kernel cache
*/
int uafs_unlog()
int uafs_unlog(void)
{
int code;
@ -4092,7 +4003,7 @@ int uafs_unlog()
return code;
}
int uafs_unlog_r()
int uafs_unlog_r(void)
{
int retval;
AFS_GUNLOCK();

View File

@ -24,4 +24,5 @@
#include "../afs/dir.h"
#include "../afs/afs_axscache.h"
#include "../afs/icl.h"
#include "../afs/afs_stats.h"
#include "../afs/afs_prototypes.h"

View File

@ -98,7 +98,7 @@ int usr_setpag(
}
*newpag = (pagvalue == -1 ? genpag(): pagvalue);
afs_get_groups_from_pag(*newpag, &gidset[0], &gidset[1]);
if (code = afs_setgroups(cred, ngroups, gidset, change_parent)) {
if ((code = afs_setgroups(cred, ngroups, gidset, change_parent))) {
osi_FreeSmallSpace((char *)gidset);
return (code);
}

View File

@ -85,8 +85,7 @@ afs_root (OSI_VFS_ARG(afsp), avpp)
if (!(code = afs_InitReq(&treq, u.u_cred)) &&
!(code = afs_CheckInit())) {
tvp = afs_GetVCache(&afs_rootFid, &treq, (afs_int32 *)0,
(struct vcache*)0, WRITE_LOCK);
tvp = afs_GetVCache(&afs_rootFid, &treq, NULL, NULL);
/* we really want this to stay around */
if (tvp) {
afs_globalVp = tvp;

View File

@ -16,38 +16,27 @@ RCSID("$Header$");
#include "../afs/afsincludes.h" /* Afs-based standard headers */
#include "../afs/afs_stats.h" /* statistics */
void osi_VM_Truncate(avc, alen, acred)
struct vcache *avc;
int alen;
struct AFS_UCRED *acred;
void osi_VM_Truncate(struct vcache *avc, int alen, struct AFS_UCRED *acred)
{
return;
}
int osi_VM_FlushVCache(avc, slept)
struct vcache *avc;
int *slept;
int osi_VM_FlushVCache(struct vcache *avc, int *slept)
{
return 0;
}
void osi_VM_StoreAllSegments(avc)
struct vcache *avc;
void osi_VM_StoreAllSegments(struct vcache *avc)
{
return;
}
void osi_VM_TryToSmush(avc, acred, sync)
struct vcache *avc;
struct AFS_UCRED *acred;
int sync;
void osi_VM_TryToSmush(struct vcache *avc, struct AFS_UCRED *acred, int sync)
{
return;
}
void osi_VM_FlushPages(avc, credp)
struct vcache *avc;
struct AFS_UCRED *credp;
void osi_VM_FlushPages(struct vcache *avc, struct AFS_UCRED *credp)
{
return;
}

View File

@ -1364,7 +1364,7 @@ struct usr_user {
#define u_rval1 u_r.r_val1
#define u (*(get_user_struct()))
extern struct usr_user *get_user_struct();
extern struct usr_user *get_user_struct(void);
#define USR_DIRSIZE 2048

View File

@ -51,10 +51,8 @@ static char fileModeMap[8] = {
};
/* avc must be held. Returns bit map of mode bits. Ignores file mode bits */
afs_int32 afs_GetAccessBits (avc, arights, areq)
register struct vcache *avc;
register afs_int32 arights;
register struct vrequest *areq;
afs_int32 afs_GetAccessBits(register struct vcache *avc, register afs_int32 arights,
register struct vrequest *areq)
{
AFS_STATCNT(afs_GetAccessBits);
/* see if anyuser has the required access bits */
@ -105,10 +103,9 @@ afs_int32 afs_GetAccessBits (avc, arights, areq)
/* the new access ok function. AVC must be held but not locked. if avc is a
* file, its parent need not be held, and should not be locked. */
afs_AccessOK(avc, arights, areq, check_mode_bits)
struct vcache *avc;
afs_int32 arights, check_mode_bits;
struct vrequest *areq; {
int afs_AccessOK(struct vcache *avc, afs_int32 arights, struct vrequest *areq,
afs_int32 check_mode_bits)
{
register struct vcache *tvc;
struct VenusFid dirFid;
register afs_int32 mask;
@ -136,11 +133,10 @@ struct vrequest *areq; {
dirFid.Fid.Vnode = avc->parentVnode;
dirFid.Fid.Unique = avc->parentUnique;
/* Avoid this GetVCache call */
tvc = afs_GetVCache(&dirFid, areq, (afs_int32 *)0,
(struct vcache*)0, WRITE_LOCK);
tvc = afs_GetVCache(&dirFid, areq, NULL, NULL);
if (tvc) {
dirBits = afs_GetAccessBits(tvc, arights, areq);
afs_PutVCache(tvc, WRITE_LOCK);
afs_PutVCache(tvc);
}
}
else
@ -177,15 +173,12 @@ struct vrequest *areq; {
}
#if defined(AFS_SUN5_ENV) || (defined(AFS_SGI_ENV) && !defined(AFS_SGI65_ENV))
afs_access(OSI_VC_ARG(avc), amode, flags, acred)
int flags;
#if defined(AFS_SUN5_ENV) || (defined(AFS_SGI_ENV) && !defined(AFS_SGI65_ENV))
int afs_access(OSI_VC_DECL(avc), register afs_int32 amode, int flags, struct AFS_UCRED *acred)
#else
afs_access(OSI_VC_ARG(avc), amode, acred)
int afs_access(OSI_VC_DECL(avc), register afs_int32 amode, struct AFS_UCRED *acred)
#endif
OSI_VC_DECL(avc);
register afs_int32 amode;
struct AFS_UCRED *acred; {
{
register afs_int32 code;
struct vrequest treq;
struct afs_fakestat_state fakestate;
@ -196,7 +189,7 @@ afs_access(OSI_VC_ARG(avc), amode, acred)
ICL_TYPE_INT32, amode,
ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length));
afs_InitFakeStat(&fakestate);
if (code = afs_InitReq(&treq, acred)) return code;
if ((code = afs_InitReq(&treq, acred))) return code;
code = afs_EvalFakeStat(&avc, &fakestate, &treq);
if (code) {
@ -294,10 +287,7 @@ afs_access(OSI_VC_ARG(avc), amode, acred)
* afs_getRights
* This function is just an interface to afs_GetAccessBits
*/
int afs_getRights(OSI_VC_ARG(avc), arights, acred)
OSI_VC_DECL(avc);
register afs_int32 arights;
struct AFS_UCRED *acred;
int afs_getRights(OSI_VC_DECL(avc), register afs_int32 arights, struct AFS_UCRED *acred)
{
register afs_int32 code;
struct vrequest treq;

View File

@ -35,9 +35,7 @@ struct afs_exporter *afs_nfsexporter;
extern struct vcache *afs_globalVp;
/* copy out attributes from cache entry */
afs_CopyOutAttrs(avc, attrs)
register struct vattr *attrs;
register struct vcache *avc;
int afs_CopyOutAttrs(register struct vcache *avc, register struct vattr *attrs)
{
register struct volume *tvp;
register struct cell *tcell;
@ -187,14 +185,10 @@ afs_CopyOutAttrs(avc, attrs)
#if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
afs_getattr(OSI_VC_ARG(avc), attrs, flags, acred)
int flags;
int afs_getattr(OSI_VC_DECL(avc), struct vattr *attrs, int flags, struct AFS_UCRED *acred)
#else
afs_getattr(OSI_VC_ARG(avc), attrs, acred)
int afs_getattr(OSI_VC_DECL(avc), struct vattr *attrs, struct AFS_UCRED *acred)
#endif
OSI_VC_DECL(avc);
struct vattr *attrs;
struct AFS_UCRED *acred;
{
afs_int32 code;
struct vrequest treq;
@ -257,7 +251,7 @@ afs_getattr(OSI_VC_ARG(avc), attrs, acred)
if (afs_nfsexporter) {
if (!inited) {
if (code = afs_InitReq(&treq, acred))
if ((code = afs_InitReq(&treq, acred)))
return code;
inited = 1;
}
@ -275,7 +269,7 @@ afs_getattr(OSI_VC_ARG(avc), attrs, acred)
#endif
}
}
if (au = afs_FindUser(treq.uid, -1, READ_LOCK)) {
if ((au = afs_FindUser(treq.uid, -1, READ_LOCK))) {
register struct afs_exporter *exporter = au->exporter;
if (exporter && !(afs_nfsexporter->exp_states & EXP_UNIXMODE)) {
@ -329,10 +323,9 @@ afs_getattr(OSI_VC_ARG(avc), attrs, acred)
}
/* convert a Unix request into a status store request */
afs_VAttrToAS(avc, av, as)
register struct vcache *avc;
register struct vattr *av;
register struct AFSStoreStatus *as; {
int afs_VAttrToAS(register struct vcache *avc, register struct vattr *av,
register struct AFSStoreStatus *as)
{
register int mask;
mask = 0;
AFS_STATCNT(afs_VAttrToAS);
@ -412,15 +405,12 @@ register struct AFSStoreStatus *as; {
/* We don't set CDirty bit in avc->states because setattr calls WriteVCache
* synchronously, therefore, it's not needed.
*/
#if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
afs_setattr(OSI_VC_ARG(avc), attrs, flags, acred)
int flags;
#if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
int afs_setattr(OSI_VC_DECL(avc), register struct vattr *attrs, int flags, struct AFS_UCRED *acred)
#else
afs_setattr(avc, attrs, acred)
int afs_setattr(OSI_VC_DECL(avc), register struct vattr *attrs, struct AFS_UCRED *acred)
#endif
OSI_VC_DECL(avc);
register struct vattr *attrs;
struct AFS_UCRED *acred; {
{
struct vrequest treq;
struct AFSStoreStatus astat;
register afs_int32 code;
@ -430,7 +420,7 @@ afs_setattr(avc, attrs, acred)
AFS_STATCNT(afs_setattr);
afs_Trace2(afs_iclSetp, CM_TRACE_SETATTR, ICL_TYPE_POINTER, avc,
ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length));
if (code = afs_InitReq(&treq, acred)) return code;
if ((code = afs_InitReq(&treq, acred))) return code;
afs_InitFakeStat(&fakestate);
code = afs_EvalFakeStat(&avc, &fakestate, &treq);

View File

@ -25,38 +25,31 @@ RCSID("$Header$");
#include "../afs/nfsclient.h"
#include "../afs/afs_osidnlc.h"
extern afs_rwlock_t afs_xvcache;
extern afs_rwlock_t afs_xcbhash;
/* question: does afs_create need to set CDirty in the adp or the avc?
* I think we can get away without it, but I'm not sure. Note that
* afs_setattr is called in here for truncation.
*/
#ifdef AFS_OSF_ENV
afs_create(ndp, attrs)
struct nameidata *ndp;
struct vattr *attrs; {
int afs_create(struct nameidata *ndp, struct vattr *attrs)
#else /* AFS_OSF_ENV */
#ifdef AFS_SGI64_ENV
int afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, int flags,
int amode, struct vcache **avcp, struct AFS_UCRED *acred)
#else /* AFS_SGI64_ENV */
int afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, enum vcexcl aexcl,
int amode, struct vcache **avcp, struct AFS_UCRED *acred)
#endif /* AFS_SGI64_ENV */
#endif /* AFS_OSF_ENV */
{
#ifdef AFS_OSF_ENV
register struct vcache *adp = VTOAFS(ndp->ni_dvp);
char *aname = ndp->ni_dent.d_name;
enum vcexcl aexcl = NONEXCL; /* XXX - create called properly */
int amode = 0; /* XXX - checked in higher level */
struct vcache **avcp = (struct vcache **)&(ndp->ni_vp);
struct ucred *acred = ndp->ni_cred;
#else /* AFS_OSF_ENV */
#ifdef AFS_SGI64_ENV
afs_create(OSI_VC_ARG(adp), aname, attrs, flags, amode, avcp, acred)
int flags;
#else /* AFS_SGI64_ENV */
afs_create(OSI_VC_ARG(adp), aname, attrs, aexcl, amode, avcp, acred)
enum vcexcl aexcl;
#endif /* AFS_SGI64_ENV */
OSI_VC_DECL(adp);
char *aname;
struct vattr *attrs;
int amode;
struct vcache **avcp;
struct AFS_UCRED *acred; {
#endif /* AFS_OSF_ENV */
#endif
afs_int32 origCBs, origZaps, finalZaps;
struct vrequest treq;
register afs_int32 code;
@ -78,7 +71,7 @@ afs_create(OSI_VC_ARG(adp), aname, attrs, aexcl, amode, avcp, acred)
AFS_STATCNT(afs_create);
if (code = afs_InitReq(&treq, acred))
if ((code = afs_InitReq(&treq, acred)))
goto done2;
afs_Trace3(afs_iclSetp, CM_TRACE_CREATE, ICL_TYPE_POINTER, adp,
@ -165,14 +158,12 @@ tagain:
/* found the file, so use it */
newFid.Cell = adp->fid.Cell;
newFid.Fid.Volume = adp->fid.Fid.Volume;
tvc = (struct vcache *)0;
tvc = NULL;
if (newFid.Fid.Unique == 0) {
tvc = afs_LookupVCache(&newFid, &treq, (afs_int32 *)0,
WRITE_LOCK, adp, aname);
tvc = afs_LookupVCache(&newFid, &treq, NULL, adp, aname);
}
if (!tvc) /* lookup failed or wasn't called */
tvc = afs_GetVCache(&newFid, &treq, (afs_int32 *)0,
(struct vcache*)0, WRITE_LOCK);
tvc = afs_GetVCache(&newFid, &treq, NULL, NULL);
if (tvc) {
/* if the thing exists, we need the right access to open it.
@ -186,7 +177,7 @@ tagain:
*/
if ((amode & VREAD) &&
!afs_AccessOK(tvc, PRSFS_READ, &treq, CHECK_MODE_BITS)) {
afs_PutVCache(tvc, READ_LOCK);
afs_PutVCache(tvc);
code = EACCES;
goto done;
}
@ -202,7 +193,7 @@ tagain:
tvc->parentUnique = adp->fid.Fid.Unique;
/* need write mode for these guys */
if (!afs_AccessOK(tvc, PRSFS_WRITE, &treq, CHECK_MODE_BITS)) {
afs_PutVCache(tvc, READ_LOCK);
afs_PutVCache(tvc);
code = EACCES;
goto done;
}
@ -214,7 +205,7 @@ tagain:
#endif
{
if (vType(tvc) != VREG) {
afs_PutVCache(tvc, READ_LOCK);
afs_PutVCache(tvc);
code = EISDIR;
goto done;
}
@ -242,7 +233,7 @@ tagain:
tvc->states &= ~CCreating;
ReleaseWriteLock(&tvc->lock);
if (code) {
afs_PutVCache(tvc, 0);
afs_PutVCache(tvc);
goto done;
}
}
@ -292,23 +283,19 @@ tagain:
hostp = tc->srvr->server; /* remember for callback processing */
now = osi_Time();
XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_CREATEFILE);
#ifdef RX_ENABLE_LOCKS
AFS_GUNLOCK();
#endif /* RX_ENABLE_LOCKS */
RX_AFS_GUNLOCK();
code = RXAFS_CreateFile(tc->id, (struct AFSFid *) &adp->fid.Fid,
aname, &InStatus, (struct AFSFid *)
&newFid.Fid, &OutFidStatus,
&OutDirStatus, &CallBack, &tsync);
#ifdef RX_ENABLE_LOCKS
AFS_GLOCK();
#endif /* RX_ENABLE_LOCKS */
RX_AFS_GLOCK();
XSTATS_END_TIME;
CallBack.ExpirationTime += now;
}
else code = -1;
} while
(afs_Analyze(tc, code, &adp->fid, &treq,
AFS_STATS_FS_RPCIDX_CREATEFILE, SHARED_LOCK, (struct cell *)0));
AFS_STATS_FS_RPCIDX_CREATEFILE, SHARED_LOCK, NULL));
#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
if (code == EEXIST && aexcl == NONEXCL) {
@ -336,11 +323,11 @@ tagain:
#if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
#if defined(AFS_SGI64_ENV)
code = afs_lookup(VNODE_TO_FIRST_BHV((vnode_t*)adp), aname, avcp,
(struct pathname *)0, 0,
(struct vnode *)0, acred);
NULL, 0,
NULL, acred);
#else
code = afs_lookup(adp, aname, avcp, (struct pathname *)0, 0,
(struct vnode *)0, acred);
code = afs_lookup(adp, aname, avcp, NULL, 0,
NULL, acred);
#endif /* AFS_SGI64_ENV */
#else /* SUN5 || SGI */
code = afs_lookup(adp, aname, avcp, acred);
@ -410,9 +397,8 @@ tagain:
freeing of the vnode will change evenZaps. Don't need to update the VLRU
queue, since the find will only succeed in the event of a create race, and
then the vcache will be at the front of the VLRU queue anyway... */
if (!(tvc = afs_FindVCache(&newFid, 0, WRITE_LOCK,
0, DO_STATS))) {
tvc = afs_NewVCache(&newFid, hostp, 0, WRITE_LOCK);
if (!(tvc = afs_FindVCache(&newFid, 0, DO_STATS))) {
tvc = afs_NewVCache(&newFid, hostp);
if (tvc) {
int finalCBs;
ObtainWriteLock(&tvc->lock,139);
@ -479,7 +465,7 @@ done:
done2:
#ifdef AFS_OSF_ENV
afs_PutVCache(adp, 0);
afs_PutVCache(adp);
#endif /* AFS_OSF_ENV */
return code;
@ -496,11 +482,9 @@ done2:
* This routine must be called with the stat cache entry write-locked,
* and dcache entry write-locked.
*/
afs_LocalHero(avc, adc, astat, aincr)
register struct vcache *avc;
register AFSFetchStatus *astat;
register struct dcache *adc;
register int aincr; {
int afs_LocalHero(register struct vcache *avc, register struct dcache *adc,
register AFSFetchStatus *astat, register int aincr)
{
register afs_int32 ok;
afs_hyper_t avers;

View File

@ -70,7 +70,7 @@ afs_mkdir(OSI_VC_ARG(adp), aname, attrs, avcp, acred)
afs_Trace2(afs_iclSetp, CM_TRACE_MKDIR, ICL_TYPE_POINTER, adp,
ICL_TYPE_STRING, aname);
if (code = afs_InitReq(&treq, acred))
if ((code = afs_InitReq(&treq, acred)))
goto done2;
afs_InitFakeStat(&fakestate);
@ -107,15 +107,11 @@ afs_mkdir(OSI_VC_ARG(adp), aname, attrs, avcp, acred)
if (tc) {
XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_MAKEDIR);
now = osi_Time();
#ifdef RX_ENABLE_LOCKS
AFS_GUNLOCK();
#endif /* RX_ENABLE_LOCKS */
RX_AFS_GUNLOCK();
code = RXAFS_MakeDir(tc->id, (struct AFSFid *) &adp->fid.Fid, aname,
&InStatus, (struct AFSFid *) &newFid.Fid,
&OutFidStatus, &OutDirStatus, &CallBack, &tsync);
#ifdef RX_ENABLE_LOCKS
AFS_GLOCK();
#endif /* RX_ENABLE_LOCKS */
RX_AFS_GLOCK();
XSTATS_END_TIME;
CallBack.ExpirationTime += now;
/* DON'T forget to Set the callback value... */
@ -123,7 +119,7 @@ afs_mkdir(OSI_VC_ARG(adp), aname, attrs, avcp, acred)
else code = -1;
} while
(afs_Analyze(tc, code, &adp->fid, &treq,
AFS_STATS_FS_RPCIDX_MAKEDIR, SHARED_LOCK, (struct cell *)0));
AFS_STATS_FS_RPCIDX_MAKEDIR, SHARED_LOCK, NULL));
if (code) {
if (code < 0) {
@ -156,7 +152,7 @@ afs_mkdir(OSI_VC_ARG(adp), aname, attrs, avcp, acred)
newFid.Fid.Volume = adp->fid.Fid.Volume;
ReleaseWriteLock(&adp->lock);
/* now we're done with parent dir, create the real dir's cache entry */
tvc = afs_GetVCache(&newFid, &treq, (afs_int32 *)0, (struct vcache*)0, 0);
tvc = afs_GetVCache(&newFid, &treq, NULL, NULL);
if (tvc) {
code = 0;
*avcp = tvc;
@ -193,7 +189,7 @@ afs_rmdir(adp, aname, acred)
#endif
struct vrequest treq;
register struct dcache *tdc;
register struct vcache *tvc = (struct vcache *)0;
register struct vcache *tvc = NULL;
register afs_int32 code;
register struct conn *tc;
afs_size_t offset, len;
@ -208,7 +204,7 @@ afs_rmdir(adp, aname, acred)
afs_Trace2(afs_iclSetp, CM_TRACE_RMDIR, ICL_TYPE_POINTER, adp,
ICL_TYPE_STRING, aname);
if (code = afs_InitReq(&treq, acred))
if ((code = afs_InitReq(&treq, acred)))
goto done2;
afs_InitFakeStat(&fakestate);
@ -246,12 +242,10 @@ afs_rmdir(adp, aname, acred)
unlinkFid.Cell = adp->fid.Cell;
unlinkFid.Fid.Volume = adp->fid.Fid.Volume;
if (unlinkFid.Fid.Unique == 0) {
tvc = afs_LookupVCache(&unlinkFid, &treq, &cached,
WRITE_LOCK, adp, aname);
tvc = afs_LookupVCache(&unlinkFid, &treq, &cached, adp, aname);
} else {
ObtainReadLock(&afs_xvcache);
tvc = afs_FindVCache(&unlinkFid, 1, WRITE_LOCK,
0, 1/* do xstats */);
tvc = afs_FindVCache(&unlinkFid, 0, 1/* do xstats */);
ReleaseReadLock(&afs_xvcache);
}
}
@ -261,20 +255,16 @@ afs_rmdir(adp, aname, acred)
tc = afs_Conn(&adp->fid, &treq, SHARED_LOCK);
if (tc) {
XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_REMOVEDIR);
#ifdef RX_ENABLE_LOCKS
AFS_GUNLOCK();
#endif /* RX_ENABLE_LOCKS */
RX_AFS_GUNLOCK();
code = RXAFS_RemoveDir(tc->id, (struct AFSFid *) &adp->fid.Fid,
aname, &OutDirStatus, &tsync);
#ifdef RX_ENABLE_LOCKS
AFS_GLOCK();
#endif /* RX_ENABLE_LOCKS */
RX_AFS_GLOCK();
XSTATS_END_TIME;
}
else code = -1;
} while
(afs_Analyze(tc, code, &adp->fid, &treq,
AFS_STATS_FS_RPCIDX_REMOVEDIR, SHARED_LOCK, (struct cell *)0));
AFS_STATS_FS_RPCIDX_REMOVEDIR, SHARED_LOCK, NULL));
if (code) {
if (tdc) {
@ -318,7 +308,7 @@ afs_rmdir(adp, aname, acred)
ObtainWriteLock(&tvc->lock,155);
tvc->states &= ~CUnique; /* For the dfs xlator */
ReleaseWriteLock(&tvc->lock);
afs_PutVCache(tvc, WRITE_LOCK);
afs_PutVCache(tvc);
}
ReleaseWriteLock(&adp->lock);
/* don't worry about link count since dirs can not be hardlinked */
@ -329,8 +319,8 @@ done:
code = afs_CheckCode(code, &treq, 27);
done2:
#ifdef AFS_OSF_ENV
afs_PutVCache(adp, 0);
afs_PutVCache(ndp->ni_vp, 0);
afs_PutVCache(adp);
afs_PutVCache(ndp->ni_vp);
#endif /* AFS_OSF_ENV */
return code;
}

View File

@ -24,22 +24,16 @@ RCSID("$Header$");
#include "../afs/nfsclient.h"
#include "../afs/afs_osidnlc.h"
#if defined(AFS_HPUX102_ENV)
#define AFS_FLOCK k_flock
#else
#if defined(AFS_SUN56_ENV) || defined(AFS_LINUX24_ENV)
#define AFS_FLOCK flock64
#else
#define AFS_FLOCK flock
#endif /* AFS_SUN65_ENV */
#endif /* AFS_HPUX102_ENV */
/* Static prototypes */
static int HandleGetLock(register struct vcache *avc,
register struct AFS_FLOCK *af, register 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, int clid);
static void DoLockWarning(void);
void lockIdSet(flock, slp, clid)
int clid; /* non-zero on SGI, OSF, SunOS, Darwin, xBSD *//* XXX ptr type */
struct SimpleLocks *slp;
struct AFS_FLOCK *flock;
/* int clid; * non-zero on SGI, OSF, SunOS, Darwin, xBSD ** XXX ptr type */
void lockIdSet(struct AFS_FLOCK *flock, struct SimpleLocks *slp, int clid)
{
#if defined(AFS_SUN5_ENV)
register proc_t *procp = ttoproc(curthread);
@ -146,13 +140,11 @@ void lockIdSet(flock, slp, clid)
* to p_ppid? Especially in the context of the lower loop, where
* the repeated comparison doesn't make much sense...
*/
static int lockIdcmp2(flock1, vp, alp, onlymine, clid)
struct AFS_FLOCK *flock1;
struct vcache *vp;
register struct SimpleLocks *alp;
int onlymine; /* don't match any locks which are held by my */
/* parent */
int clid; /* Only Irix 6.5 for now. */
/* onlymine - don't match any locks which are held by my parent */
/* clid - only irix 6.5 */
static int lockIdcmp2(struct AFS_FLOCK *flock1, struct vcache *vp,
register struct SimpleLocks *alp, int onlymine, int clid)
{
register struct SimpleLocks *slp;
#if defined(AFS_SUN5_ENV)
@ -166,7 +158,6 @@ static int lockIdcmp2(flock1, vp, alp, onlymine, clid)
#endif /* AFS_SGI64_ENV */
#endif
#endif
int code = 0;
if (alp) {
#if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
@ -219,12 +210,10 @@ static int lockIdcmp2(flock1, vp, alp, onlymine, clid)
file, I guess we'll permit it. however, we don't want simple,
innocent closes by children to unlock files in the parent process.
*/
HandleFlock(avc, acom, areq, clid, onlymine)
pid_t clid; /* non-zero on SGI, SunOS, OSF1 only */
register struct vcache *avc;
struct vrequest *areq;
int onlymine;
int acom; {
/* clid - nonzero on sgi sunos osf1 only */
int HandleFlock(register struct vcache *avc, int acom,
struct vrequest *areq, pid_t clid, int onlymine)
{
struct conn *tc;
struct SimpleLocks *slp, *tlp, **slpp;
afs_int32 code;
@ -235,7 +224,7 @@ HandleFlock(avc, acom, areq, clid, onlymine)
AFS_STATCNT(HandleFlock);
code = 0; /* default when we don't make any network calls */
lockIdSet(&flock, (struct SimpleLocks *)0, clid);
lockIdSet(&flock, NULL, clid);
#if defined(AFS_SGI_ENV)
osi_Assert(valusema(&avc->vc_rwlock) <= 0);
@ -262,7 +251,7 @@ HandleFlock(avc, acom, areq, clid, onlymine)
}
}
#endif
if (lockIdcmp2(&flock, avc, (struct SimpleLocks *)0, onlymine, clid)) {
if (lockIdcmp2(&flock, avc, NULL, onlymine, clid)) {
ReleaseWriteLock(&avc->lock);
return 0;
}
@ -301,21 +290,17 @@ HandleFlock(avc, acom, areq, clid, onlymine)
tc = afs_Conn(&avc->fid, areq, SHARED_LOCK);
if (tc) {
XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_RELEASELOCK);
#ifdef RX_ENABLE_LOCKS
AFS_GUNLOCK();
#endif /* RX_ENABLE_LOCKS */
RX_AFS_GUNLOCK();
code = RXAFS_ReleaseLock(tc->id, (struct AFSFid *)
&avc->fid.Fid, &tsync);
#ifdef RX_ENABLE_LOCKS
AFS_GLOCK();
#endif /* RX_ENABLE_LOCKS */
RX_AFS_GLOCK();
XSTATS_END_TIME;
}
else code = -1;
} while
(afs_Analyze(tc, code, &avc->fid, areq,
AFS_STATS_FS_RPCIDX_RELEASELOCK,
SHARED_LOCK, (struct cell *)0));
SHARED_LOCK, NULL));
}
}
else {
@ -359,25 +344,21 @@ HandleFlock(avc, acom, areq, clid, onlymine)
tc = afs_Conn(&avc->fid, areq, SHARED_LOCK);
if (tc) {
XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_RELEASELOCK);
#ifdef RX_ENABLE_LOCKS
AFS_GUNLOCK();
#endif /* RX_ENABLE_LOCKS */
RX_AFS_GUNLOCK();
code = RXAFS_ReleaseLock(tc->id,
(struct AFSFid *) &avc->fid.Fid,
&tsync);
#ifdef RX_ENABLE_LOCKS
AFS_GLOCK();
#endif /* RX_ENABLE_LOCKS */
RX_AFS_GLOCK();
XSTATS_END_TIME;
}
else code = -1;
} while
(afs_Analyze(tc, code, &avc->fid, areq,
AFS_STATS_FS_RPCIDX_RELEASELOCK,
SHARED_LOCK, (struct cell *)0));
SHARED_LOCK, NULL));
}
} else if (avc->flockCount == -1 && (acom & LOCK_EX)) {
if (lockIdcmp2(&flock, avc, (struct SimpleLocks *)0, 1, clid)) {
if (lockIdcmp2(&flock, avc, NULL, 1, clid)) {
code = EWOULDBLOCK;
} else
code = 0;
@ -394,21 +375,17 @@ HandleFlock(avc, acom, areq, clid, onlymine)
tc = afs_Conn(&avc->fid, areq, SHARED_LOCK);
if (tc) {
XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_SETLOCK);
#ifdef RX_ENABLE_LOCKS
AFS_GUNLOCK();
#endif /* RX_ENABLE_LOCKS */
RX_AFS_GUNLOCK();
code = RXAFS_SetLock(tc->id, (struct AFSFid *)
&avc->fid.Fid, lockType, &tsync);
#ifdef RX_ENABLE_LOCKS
AFS_GLOCK();
#endif /* RX_ENABLE_LOCKS */
RX_AFS_GLOCK();
XSTATS_END_TIME;
}
else code = -1;
} while
(afs_Analyze(tc, code, &avc->fid, areq,
AFS_STATS_FS_RPCIDX_SETLOCK,
SHARED_LOCK, (struct cell *)0));
SHARED_LOCK, NULL));
}
else code = 0; /* otherwise, pretend things worked */
}
@ -424,7 +401,7 @@ HandleFlock(avc, acom, areq, clid, onlymine)
#endif
slp->type = LockWrite;
slp->next = (struct SimpleLocks *)0;
slp->next = NULL;
avc->slocks = slp;
avc->flockCount = -1;
} else {
@ -464,8 +441,9 @@ HandleFlock(avc, acom, areq, clid, onlymine)
/* warn a user that a lock has been ignored */
afs_int32 lastWarnTime = 0;
static void DoLockWarning() {
afs_int32 lastWarnTime = 0; /* this is used elsewhere */
static void DoLockWarning(void)
{
register afs_int32 now;
now = osi_Time();
@ -480,24 +458,18 @@ static void DoLockWarning() {
#ifdef AFS_OSF_ENV
afs_lockctl(avc, af, flag, acred, clid, offset)
struct eflock *af;
int flag;
pid_t clid;
off_t offset;
afs_lockctl(struct vcache *avc, struct eflock *af, int flag,
struct AFS_UCRED *acred, pid_t clid, off_t offset)
#else
#if defined(AFS_SGI_ENV) || (defined(AFS_SUN_ENV) && !defined(AFS_SUN5_ENV)) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
afs_lockctl(avc, af, acmd, acred, clid)
afs_lockctl(struct vcache *avc, struct AFS_FLOCK *af, int acmd, struct AFS_UCRED *acred, pid_t clid)
pid_t clid;
#else
u_int clid=0;
afs_lockctl(avc, af, acmd, acred)
afs_lockctl(struct vcache *avc, struct AFS_FLOCK *af, int acmd, struct AFS_UCRED *acred)
#endif
struct AFS_FLOCK *af;
int acmd;
#endif
struct vcache *avc;
struct AFS_UCRED *acred; {
{
struct vrequest treq;
afs_int32 code;
#ifdef AFS_OSF_ENV
@ -506,7 +478,7 @@ struct AFS_UCRED *acred; {
struct afs_fakestat_state fakestate;
AFS_STATCNT(afs_lockctl);
if (code = afs_InitReq(&treq, acred)) return code;
if ((code = afs_InitReq(&treq, acred))) return code;
afs_InitFakeStat(&fakestate);
code = afs_EvalFakeStat(&avc, &fakestate, &treq);
if (code) {
@ -616,16 +588,13 @@ struct AFS_UCRED *acred; {
* PID has the file read locked.
*/
#ifndef AFS_OSF_ENV /* getlock is a no-op for osf (for now) */
HandleGetLock(avc, af, areq, clid)
int clid; /* not used by some OSes */
register struct vcache *avc;
register struct vrequest *areq;
register struct AFS_FLOCK *af;
static int HandleGetLock(register struct vcache *avc,
register struct AFS_FLOCK *af, register struct vrequest *areq, int clid)
{
register afs_int32 code;
struct AFS_FLOCK flock;
lockIdSet(&flock, (struct SimpleLocks *)0, clid);
lockIdSet(&flock, NULL, clid);
ObtainWriteLock(&avc->lock,122);
if (avc->flockCount == 0) {
@ -656,7 +625,7 @@ HandleGetLock(avc, af, areq, clid)
* write lock, say it is unlocked.
*/
if (avc->flockCount > 0 || /* only read locks */
!lockIdcmp2(&flock, avc, (struct SimpleLocks *)0, 1, clid)) {
!lockIdcmp2(&flock, avc, NULL, 1, clid)) {
af->l_type = F_UNLCK;
goto unlck_leave;
}
@ -682,7 +651,7 @@ HandleGetLock(avc, af, areq, clid)
* already, and it is not this process, we fail.
*/
if (avc->flockCount < 0) {
if (lockIdcmp2(&flock, avc, (struct SimpleLocks *)0, 1, clid)) {
if (lockIdcmp2(&flock, avc, NULL, 1, clid)) {
af->l_type = F_WRLCK;
if (avc->slocks) {
af->l_pid = avc->slocks->pid;
@ -707,7 +676,7 @@ HandleGetLock(avc, af, areq, clid)
* If there is more than one, or it isn't us, we cannot lock.
*/
if ((avc->flockCount > 1)
|| lockIdcmp2(&flock, avc, (struct SimpleLocks *)0, 1, clid)) {
|| lockIdcmp2(&flock, avc, NULL, 1, clid)) {
struct SimpleLocks *slp;
af->l_type = F_RDLCK;
@ -717,7 +686,7 @@ HandleGetLock(avc, af, areq, clid)
#endif
/* find a pid that isn't our own */
for (slp = avc->slocks; slp; slp = slp->next) {
if (lockIdcmp2(&flock, (struct vcache *)0, slp, 1, clid)) {
if (lockIdcmp2(&flock, NULL, slp, 1, clid)) {
af->l_pid = slp->pid;
#if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
af->l_sysid = avc->slocks->sysid;
@ -733,7 +702,7 @@ HandleGetLock(avc, af, areq, clid)
* already, and it is not this process, we fail.
*/
if (avc->flockCount < 0) {
if (lockIdcmp2(&flock, avc, (struct SimpleLocks *)0, 1, clid)) {
if (lockIdcmp2(&flock, avc, NULL, 1, clid)) {
af->l_type = F_WRLCK;
if (avc->slocks) {
af->l_pid = avc->slocks->pid;
@ -758,7 +727,7 @@ HandleGetLock(avc, af, areq, clid)
* If there is more than one, or it isn't us, we cannot lock.
*/
if ((avc->flockCount > 1)
|| lockIdcmp2(&flock, avc, (struct SimpleLocks *)0, 1, clid)) {
|| lockIdcmp2(&flock, avc, NULL, 1, clid)) {
struct SimpleLocks *slp;
af->l_type = F_RDLCK;
af->l_pid = 0;
@ -767,7 +736,7 @@ HandleGetLock(avc, af, areq, clid)
#endif
/* find a pid that isn't our own */
for (slp = avc->slocks; slp; slp = slp->next) {
if (lockIdcmp2(&flock, (struct vcache *)0, slp, 1, clid)) {
if (lockIdcmp2(&flock, NULL, slp, 1, clid)) {
af->l_pid = slp->pid;
#if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
af->l_sysid = avc->slocks->sysid;
@ -830,20 +799,16 @@ static int GetFlockCount(struct vcache *avc, struct vrequest *areq)
tc = afs_Conn(&avc->fid, areq, SHARED_LOCK);
if (tc){
XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_FETCHSTATUS);
#ifdef RX_ENABLE_LOCKS
AFS_GUNLOCK();
#endif /* RX_ENABLE_LOCKS */
RX_AFS_GUNLOCK();
code = RXAFS_FetchStatus(tc->id, (struct AFSFid *) &avc->fid.Fid,
&OutStatus, &CallBack, &tsync);
#ifdef RX_ENABLE_LOCKS
AFS_GLOCK();
#endif /* RX_ENABLE_LOCKS */
RX_AFS_GLOCK();
XSTATS_END_TIME;
} else code = -1;
} while
(afs_Analyze(tc, code, &avc->fid, areq,
AFS_STATS_FS_RPCIDX_FETCHSTATUS,
SHARED_LOCK, (struct cell *)0));
SHARED_LOCK, NULL));
if (temp)
areq->flags &= ~O_NONBLOCK;
@ -861,14 +826,12 @@ static int GetFlockCount(struct vcache *avc, struct vrequest *areq)
/* Flock not support on System V systems */
#ifdef AFS_OSF_ENV
extern struct fileops afs_fileops;
afs_xflock (p, args, retval)
struct proc *p;
void *args;
int *retval;
{
int afs_xflock (struct proc *p, void *args, int *retval)
#else /* AFS_OSF_ENV */
afs_xflock () {
int afs_xflock (void)
#endif
{
int code = 0;
struct a {
int fd;

View File

@ -64,7 +64,7 @@ afs_link(avc, OSI_VC_ARG(adp), aname, acred)
afs_Trace3(afs_iclSetp, CM_TRACE_LINK, ICL_TYPE_POINTER, adp,
ICL_TYPE_POINTER, avc, ICL_TYPE_STRING, aname);
/* create a hard link; new entry is aname in dir adp */
if (code = afs_InitReq(&treq, acred))
if ((code = afs_InitReq(&treq, acred)))
goto done2;
afs_InitFakeStat(&vfakestate);
@ -99,22 +99,18 @@ afs_link(avc, OSI_VC_ARG(adp), aname, acred)
tc = afs_Conn(&adp->fid, &treq, SHARED_LOCK);
if (tc) {
XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_LINK);
#ifdef RX_ENABLE_LOCKS
AFS_GUNLOCK();
#endif /* RX_ENABLE_LOCKS */
RX_AFS_GUNLOCK();
code = RXAFS_Link(tc->id, (struct AFSFid *) &adp->fid.Fid, aname,
(struct AFSFid *) &avc->fid.Fid, &OutFidStatus,
&OutDirStatus, &tsync);
#ifdef RX_ENABLE_LOCKS
AFS_GLOCK();
#endif /* RX_ENABLE_LOCKS */
RX_AFS_GLOCK();
XSTATS_END_TIME;
}
else code = -1;
} while
(afs_Analyze(tc, code, &adp->fid, &treq,
AFS_STATS_FS_RPCIDX_LINK, SHARED_LOCK, (struct cell *)0));
AFS_STATS_FS_RPCIDX_LINK, SHARED_LOCK, NULL));
if (code) {
if (tdc) afs_PutDCache(tdc);
@ -165,7 +161,7 @@ done:
afs_PutFakeStat(&dfakestate);
done2:
#ifdef AFS_OSF_ENV
afs_PutVCache(adp, WRITE_LOCK);
afs_PutVCache(adp);
#endif /* AFS_OSF_ENV */
return code;
}

View File

@ -62,9 +62,7 @@ int afs_fakestat_enable = 0;
* what "@sys" is in binary... */
#define AFS_EQ_ATSYS(name) (((name)[0]=='@')&&((name)[1]=='s')&&((name)[2]=='y')&&((name)[3]=='s')&&(!(name)[4]))
char *
afs_strcat(s1, s2)
register char *s1, *s2;
char *afs_strcat(register char *s1, register char *s2)
{
register char *os1;
@ -73,21 +71,21 @@ afs_strcat(s1, s2)
while (*s1++)
;
--s1;
while (*s1++ = *s2++)
while ((*s1++ = *s2++))
;
return (os1);
}
char *afs_index(a, c)
register char *a, c; {
char *afs_index(register char *a, register char c)
{
register char tc;
AFS_STATCNT(afs_index);
while (tc = *a) {
while ((tc = *a)) {
if (tc == c) return a;
else a++;
}
return (char *) 0;
return NULL;
}
/* call under write lock, evaluate mvid field from a mt pt.
@ -99,11 +97,8 @@ char *afs_index(a, c)
*
* NOTE: this function returns a held volume structure in *volpp if it returns 0!
*/
EvalMountPoint(avc, advc, avolpp, areq)
register struct vcache *avc;
struct volume **avolpp;
struct vcache *advc; /* the containing dir */
register struct vrequest *areq;
int EvalMountPoint(register struct vcache *avc, struct vcache *advc,
struct volume **avolpp, register struct vrequest *areq)
{
afs_int32 code;
struct volume *tvp = 0;
@ -119,7 +114,7 @@ EvalMountPoint(avc, advc, avolpp, areq)
#ifdef notdef
if (avc->mvid && (avc->states & CMValid)) return 0; /* done while racing */
#endif
*avolpp = (struct volume *)0;
*avolpp = NULL;
code = afs_HandleLink(avc, areq);
if (code) return code;
@ -247,10 +242,7 @@ EvalMountPoint(avc, advc, avolpp, areq)
* without calling afs_EvalFakeStat is legal, as long as this
* function is called.
*/
void
afs_InitFakeStat(state)
struct afs_fakestat_state *state;
void afs_InitFakeStat(struct afs_fakestat_state *state)
{
state->valid = 1;
state->did_eval = 0;
@ -265,12 +257,8 @@ afs_InitFakeStat(state)
*
* Only issues RPCs if canblock is non-zero.
*/
static int
afs_EvalFakeStat_int(avcp, state, areq, canblock)
struct vcache **avcp;
struct afs_fakestat_state *state;
struct vrequest *areq;
int canblock;
int afs_EvalFakeStat_int(struct vcache **avcp, struct afs_fakestat_state *state,
struct vrequest *areq, int canblock)
{
struct vcache *tvc, *root_vp;
struct volume *tvolp = NULL;
@ -308,15 +296,15 @@ afs_EvalFakeStat_int(avcp, state, areq, canblock)
do {
retry = 0;
ObtainWriteLock(&afs_xvcache, 597);
root_vp = afs_FindVCache(tvc->mvid, 0, 0, &retry, 0);
root_vp = afs_FindVCache(tvc->mvid, &retry, 0);
if (root_vp && retry) {
ReleaseWriteLock(&afs_xvcache);
afs_PutVCache(root_vp, 0);
afs_PutVCache(root_vp);
}
} while (root_vp && retry);
ReleaseWriteLock(&afs_xvcache);
} else {
root_vp = afs_GetVCache(tvc->mvid, areq, NULL, NULL, WRITE_LOCK);
root_vp = afs_GetVCache(tvc->mvid, areq, NULL, NULL);
}
if (!root_vp) {
code = canblock ? ENOENT : 0;
@ -360,10 +348,8 @@ done:
* something goes wrong and the error code should be returned to the user.
*/
int
afs_EvalFakeStat(avcp, state, areq)
struct vcache **avcp;
struct afs_fakestat_state *state;
struct vrequest *areq;
afs_EvalFakeStat(struct vcache **avcp, struct afs_fakestat_state *state,
struct vrequest *areq)
{
return afs_EvalFakeStat_int(avcp, state, areq, 1);
}
@ -378,11 +364,8 @@ afs_EvalFakeStat(avcp, state, areq)
* Returns 0 if everything succeeds and *avcp points to a valid
* vcache entry (possibly evaluated).
*/
int
afs_TryEvalFakeStat(avcp, state, areq)
struct vcache **avcp;
struct afs_fakestat_state *state;
struct vrequest *areq;
int afs_TryEvalFakeStat(struct vcache **avcp, struct afs_fakestat_state *state,
struct vrequest *areq)
{
return afs_EvalFakeStat_int(avcp, state, areq, 0);
}
@ -393,18 +376,16 @@ afs_TryEvalFakeStat(avcp, state, areq)
* Perform any necessary cleanup at the end of a vnode op, given that
* afs_InitFakeStat was previously called with this state.
*/
void
afs_PutFakeStat(state)
struct afs_fakestat_state *state;
void afs_PutFakeStat(struct afs_fakestat_state *state)
{
osi_Assert(state->valid == 1);
if (state->need_release)
afs_PutVCache(state->root_vp, 0);
afs_PutVCache(state->root_vp);
state->valid = 0;
}
afs_ENameOK(aname)
register char *aname; {
int afs_ENameOK(register char *aname)
{
register char tc;
register int tlen;
@ -414,10 +395,8 @@ afs_ENameOK(aname)
return 1;
}
afs_getsysname(areq, adp, bufp)
register struct vrequest *areq;
register struct vcache *adp;
register char *bufp;
int afs_getsysname(register struct vrequest *areq, register struct vcache *adp,
register char *bufp)
{
static char sysname[MAXSYSNAME];
register struct unixuser *au;
@ -431,7 +410,7 @@ afs_getsysname(areq, adp, bufp)
au = afs_GetUser(areq->uid, adp->fid.Cell, 0);
afs_PutUser(au, 0);
if (au->exporter) {
error = EXP_SYSNAME(au->exporter, (char *)0, bufp);
error = EXP_SYSNAME(au->exporter, NULL, bufp);
if (error)
strcpy(bufp, "@sys");
return -1;
@ -441,11 +420,8 @@ afs_getsysname(areq, adp, bufp)
}
}
Check_AtSys(avc, aname, state, areq)
register struct vcache *avc;
char *aname;
struct sysname_info *state;
struct vrequest *areq;
int Check_AtSys(register struct vcache *avc, const char *aname,
struct sysname_info *state, struct vrequest *areq)
{
if (AFS_EQ_ATSYS(aname)) {
state->offset = 0;
@ -460,10 +436,8 @@ Check_AtSys(avc, aname, state, areq)
}
}
Next_AtSys(avc, areq, state)
register struct vcache *avc;
struct vrequest *areq;
struct sysname_info *state;
int Next_AtSys(register struct vcache *avc, struct vrequest *areq,
struct sysname_info *state)
{
if (state->index == -1)
return 0; /* No list */
@ -518,11 +492,9 @@ extern int BlobScan(afs_int32 *afile, afs_int32 ablob);
* ensure that vcaches created for failed RPC's to older servers have the
* CForeign bit set.
*/
struct vcache * BStvc = (struct vcache *) 0;
int afs_DoBulkStat(adp, dirCookie, areqp)
struct vcache *adp;
long dirCookie;
struct vrequest *areqp;
static struct vcache *BStvc = NULL;
int afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp)
{
int nentries; /* # of entries to prefetch */
int nskip; /* # of slots in the LRU queue to skip */
@ -688,14 +660,14 @@ tagain:
do {
retry = 0;
ObtainWriteLock(&afs_xvcache, 130);
tvcp = afs_FindVCache(&tfid, 0, 0, &retry, 0 /* no stats | LRU */);
tvcp = afs_FindVCache(&tfid, &retry, 0 /* no stats | LRU */);
if (tvcp && retry) {
ReleaseWriteLock(&afs_xvcache);
afs_PutVCache(tvcp, 0);
afs_PutVCache(tvcp);
}
} while (tvcp && retry);
if (!tvcp) { /* otherwise, create manually */
tvcp = afs_NewVCache(&tfid, hostp, 0, 0);
tvcp = afs_NewVCache(&tfid, hostp);
ObtainWriteLock(&tvcp->lock, 505);
ReleaseWriteLock(&afs_xvcache);
afs_RemoveVCB(&tfid);
@ -742,7 +714,7 @@ tagain:
tvcp->m.Length = statSeqNo;
fidIndex++;
}
afs_PutVCache(tvcp, 0);
afs_PutVCache(tvcp);
} /* if dir vnode has non-zero entry */
/* move to the next dir entry by adding in the # of entries
@ -780,9 +752,7 @@ tagain:
if (tcp) {
hostp = tcp->srvr->server;
XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_BULKSTATUS);
#ifdef RX_ENABLE_LOCKS
AFS_GUNLOCK();
#endif /* RX_ENABLE_LOCKS */
RX_AFS_GUNLOCK();
if (!(tcp->srvr->server->flags & SNO_INLINEBULK)) {
code = RXAFS_InlineBulkStatus(tcp->id, &fidParm, &statParm,
@ -799,14 +769,12 @@ tagain:
code = RXAFS_BulkStatus(tcp->id, &fidParm, &statParm, &cbParm,
&volSync);
}
#ifdef RX_ENABLE_LOCKS
AFS_GLOCK();
#endif /* RX_ENABLE_LOCKS */
RX_AFS_GLOCK();
XSTATS_END_TIME;
}
else code = -1;
} while (afs_Analyze(tcp, code, &adp->fid, areqp,
AFS_STATS_FS_RPCIDX_BULKSTATUS, SHARED_LOCK, (struct cell *)0));
AFS_STATS_FS_RPCIDX_BULKSTATUS, SHARED_LOCK, NULL));
/* now, if we didnt get the info, bail out. */
if (code) goto done;
@ -879,7 +847,7 @@ tagain:
do {
retry = 0;
ObtainReadLock(&afs_xvcache);
tvcp = afs_FindVCache(&afid, 1, 0, &retry, 0/* !stats&!lru*/);
tvcp = afs_FindVCache(&afid, &retry, 0/* !stats&!lru*/);
ReleaseReadLock(&afs_xvcache);
} while (tvcp && retry);
@ -900,7 +868,7 @@ tagain:
if (!(tvcp->states & CBulkFetching) || (tvcp->m.Length != statSeqNo)) {
flagIndex++;
ReleaseWriteLock(&tvcp->lock);
afs_PutVCache(tvcp, 0);
afs_PutVCache(tvcp);
continue;
}
@ -917,10 +885,10 @@ tagain:
}
if ((QNext(QPrev(&tvcp->vlruq)) != &tvcp->vlruq)
|| (QPrev(QNext(&tvcp->vlruq)) != &tvcp->vlruq))
refpanic ("Bulkstat VLRU inconsistent4");
{ refpanic ("Bulkstat VLRU inconsistent4"); }
if ((QNext(QPrev(&lruvcp->vlruq)) != &lruvcp->vlruq)
|| (QPrev(QNext(&lruvcp->vlruq)) != &lruvcp->vlruq))
refpanic ("Bulkstat VLRU inconsistent5");
{ refpanic ("Bulkstat VLRU inconsistent5"); }
if (tvcp != lruvcp) { /* if they are == don't move it, don't corrupt vlru */
QRemove(&tvcp->vlruq);
@ -932,10 +900,10 @@ tagain:
}
if ((QNext(QPrev(&tvcp->vlruq)) != &tvcp->vlruq)
|| (QPrev(QNext(&tvcp->vlruq)) != &tvcp->vlruq))
refpanic ("Bulkstat VLRU inconsistent5");
{ refpanic ("Bulkstat VLRU inconsistent5"); }
if ((QNext(QPrev(&lruvcp->vlruq)) != &lruvcp->vlruq)
|| (QPrev(QNext(&lruvcp->vlruq)) != &lruvcp->vlruq))
refpanic ("Bulkstat VLRU inconsistent6");
{ refpanic ("Bulkstat VLRU inconsistent6"); }
ReleaseWriteLock(&afs_xvcache);
ObtainWriteLock(&afs_xcbhash, 494);
@ -947,7 +915,7 @@ tagain:
flagIndex++;
ReleaseWriteLock(&tvcp->lock);
ReleaseWriteLock(&afs_xcbhash);
afs_PutVCache(tvcp, 0);
afs_PutVCache(tvcp);
continue;
}
@ -1007,11 +975,11 @@ tagain:
ReleaseWriteLock(&tvcp->lock);
/* finally, we're done with the entry */
afs_PutVCache(tvcp, 0);
afs_PutVCache(tvcp);
} /* for all files we got back */
/* finally return the pointer into the LRU queue */
afs_PutVCache(lruvcp, 0);
afs_PutVCache(lruvcp);
done:
/* Be sure to turn off the CBulkFetching flags */
@ -1023,7 +991,7 @@ tagain:
do {
retry = 0;
ObtainReadLock(&afs_xvcache);
tvcp = afs_FindVCache(&afid, 1, 0, &retry, 0/* !stats&!lru*/);
tvcp = afs_FindVCache(&afid, &retry, 0/* !stats&!lru*/);
ReleaseReadLock(&afs_xvcache);
} while (tvcp && retry);
if (tvcp != NULL
@ -1032,7 +1000,7 @@ tagain:
tvcp->states &= ~CBulkFetching;
}
if (tvcp != NULL) {
afs_PutVCache(tvcp, 0);
afs_PutVCache(tvcp);
}
}
if ( volp )
@ -1043,7 +1011,7 @@ tagain:
if ((&statsp[0])->errorCode) {
afs_Analyze(tcp, (&statsp[0])->errorCode, &adp->fid, areqp,
AFS_STATS_FS_RPCIDX_BULKSTATUS, SHARED_LOCK,
(struct cell *)0);
NULL);
code = (&statsp[0])->errorCode;
}
} else {
@ -1055,7 +1023,7 @@ tagain:
}
/* was: (AFS_DEC_ENV) || defined(AFS_OSF30_ENV) || defined(AFS_NCR_ENV) */
int AFSDOBULK = 1;
static int AFSDOBULK = 1;
#ifdef AFS_OSF_ENV
afs_lookup(adp, ndp)
@ -1086,7 +1054,7 @@ afs_lookup(adp, aname, avcp, acred)
struct AFS_UCRED *acred; {
#endif
struct vrequest treq;
char *tname = (char *)0;
char *tname = NULL;
register struct vcache *tvc=0;
register afs_int32 code;
register afs_int32 bulkcode = 0;
@ -1104,7 +1072,7 @@ afs_lookup(adp, aname, avcp, acred)
AFS_STATCNT(afs_lookup);
afs_InitFakeStat(&fakestate);
if (code = afs_InitReq(&treq, acred))
if ((code = afs_InitReq(&treq, acred)))
goto done;
#ifdef AFS_OSF_ENV
@ -1134,17 +1102,17 @@ afs_lookup(adp, aname, avcp, acred)
if (code)
goto done;
*avcp = (struct vcache *) 0; /* Since some callers don't initialize it */
*avcp = NULL; /* Since some callers don't initialize it */
/* come back to here if we encounter a non-existent object in a read-only
volume's directory */
redo:
*avcp = (struct vcache *) 0; /* Since some callers don't initialize it */
*avcp = NULL; /* Since some callers don't initialize it */
bulkcode = 0;
if (!(adp->states & CStatd)) {
if (code = afs_VerifyVCache2(adp, &treq)) {
if ((code = afs_VerifyVCache2(adp, &treq))) {
goto done;
}
}
@ -1171,8 +1139,7 @@ afs_lookup(adp, aname, avcp, acred)
goto done;
}
/* otherwise we have the fid here, so we use it */
tvc = afs_GetVCache(adp->mvid, &treq, (afs_int32 *)0,
(struct vcache*)0, 0);
tvc = afs_GetVCache(adp->mvid, &treq, NULL, NULL);
afs_Trace3(afs_iclSetp, CM_TRACE_GETVCDOTDOT,
ICL_TYPE_FID, adp->mvid, ICL_TYPE_POINTER, tvc,
ICL_TYPE_INT32, code);
@ -1191,7 +1158,7 @@ afs_lookup(adp, aname, avcp, acred)
/* now check the access */
if (treq.uid != adp->last_looker) {
if (!afs_AccessOK(adp, PRSFS_LOOKUP, &treq, CHECK_MODE_BITS)) {
*avcp = (struct vcache *)0;
*avcp = NULL;
code = EACCES;
goto done;
}
@ -1236,8 +1203,8 @@ afs_lookup(adp, aname, avcp, acred)
if (tvc) {
if (no_read_access && vType(tvc) != VDIR && vType(tvc) != VLNK) {
/* need read access on dir to stat non-directory / non-link */
afs_PutVCache(tvc, WRITE_LOCK);
*avcp = (struct vcache *)0;
afs_PutVCache(tvc);
*avcp = NULL;
code = EACCES;
goto done;
}
@ -1267,7 +1234,7 @@ afs_lookup(adp, aname, avcp, acred)
/* now we have to lookup the next fid */
tdc = afs_GetDCache(adp, (afs_size_t) 0, &treq, &dirOffset, &dirLen, 1);
if (!tdc) {
*avcp = (struct vcache *)0; /* redundant, but harmless */
*avcp = NULL; /* redundant, but harmless */
code = EIO;
goto done;
}
@ -1372,7 +1339,7 @@ afs_lookup(adp, aname, avcp, acred)
do {
retry = 0;
ObtainReadLock(&afs_xvcache);
tvc = afs_FindVCache(&tfid, 1, 0, &retry, 0/* !stats,!lru */);
tvc = afs_FindVCache(&tfid, &retry, 0/* !stats,!lru */);
ReleaseReadLock(&afs_xvcache);
} while (tvc && retry);
@ -1383,11 +1350,11 @@ afs_lookup(adp, aname, avcp, acred)
/* if the vcache isn't usable, release it */
if (tvc && !(tvc->states & CStatd)) {
afs_PutVCache(tvc, 0);
tvc = (struct vcache *) 0;
afs_PutVCache(tvc);
tvc = NULL;
}
} else {
tvc = (struct vcache *) 0;
tvc = NULL;
bulkcode = 0;
}
@ -1401,12 +1368,10 @@ afs_lookup(adp, aname, avcp, acred)
if (!tvc) {
afs_int32 cached = 0;
if (!tfid.Fid.Unique && (adp->states & CForeign)) {
tvc = afs_LookupVCache(&tfid, &treq, &cached, WRITE_LOCK,
adp, tname);
tvc = afs_LookupVCache(&tfid, &treq, &cached, adp, tname);
}
if (!tvc && !bulkcode) { /* lookup failed or wasn't called */
tvc = afs_GetVCache(&tfid, &treq, &cached, (struct vcache*)0,
WRITE_LOCK);
tvc = afs_GetVCache(&tfid, &treq, &cached, NULL);
}
} /* if !tvc */
} /* sub-block just to reduce stack usage */
@ -1431,7 +1396,7 @@ afs_lookup(adp, aname, avcp, acred)
ReleaseWriteLock(&tvc->lock);
if (code) {
afs_PutVCache(tvc, WRITE_LOCK);
afs_PutVCache(tvc);
if (tvolp) afs_PutVolume(tvolp, WRITE_LOCK);
goto done;
}
@ -1446,12 +1411,11 @@ afs_lookup(adp, aname, avcp, acred)
if (tvolp && (tvolp->states & VForeign)) {
/* XXXX tvolp has ref cnt on but not locked! XXX */
tvc = afs_GetRootVCache(tvc->mvid, &treq, (afs_int32 *)0, tvolp, WRITE_LOCK);
tvc = afs_GetRootVCache(tvc->mvid, &treq, NULL, tvolp);
} else {
tvc = afs_GetVCache(tvc->mvid, &treq, (afs_int32 *)0,
(struct vcache*)0, WRITE_LOCK);
tvc = afs_GetVCache(tvc->mvid, &treq, NULL, NULL);
}
afs_PutVCache(uvc, WRITE_LOCK); /* we're done with it */
afs_PutVCache(uvc); /* we're done with it */
if (!tvc) {
code = ENOENT;
@ -1466,7 +1430,7 @@ afs_lookup(adp, aname, avcp, acred)
* ptr to point back to the appropriate place */
if (tvolp) {
ObtainWriteLock(&tvc->lock,134);
if (tvc->mvid == (struct VenusFid *) 0) {
if (tvc->mvid == NULL) {
tvc->mvid = (struct VenusFid *) osi_AllocSmallSpace(sizeof(struct VenusFid));
}
/* setup backpointer */
@ -1476,7 +1440,7 @@ afs_lookup(adp, aname, avcp, acred)
}
}
else {
afs_PutVCache(tvc, WRITE_LOCK);
afs_PutVCache(tvc);
code = ENOENT;
if (tvolp) afs_PutVolume(tvolp, WRITE_LOCK);
goto done;
@ -1522,7 +1486,7 @@ done:
/* Handle RENAME; only need to check rename "." */
if (opflag == RENAME && wantparent && *ndp->ni_next == 0) {
if (!FidCmp(&(tvc->fid), &(adp->fid))) {
afs_PutVCache(*avcp, WRITE_LOCK);
afs_PutVCache(*avcp);
*avcp = NULL;
afs_PutFakeStat(&fakestate);
return afs_CheckCode(EISDIR, &treq, 18);
@ -1559,7 +1523,7 @@ done:
/* If there is an error, make sure *avcp is null.
* Alphas panic otherwise - defect 10719.
*/
*avcp = (struct vcache *)0;
*avcp = NULL;
}
afs_PutFakeStat(&fakestate);

View File

@ -49,7 +49,7 @@ afs_open(avcp, aflags, acred)
struct afs_fakestat_state fakestate;
AFS_STATCNT(afs_open);
if (code = afs_InitReq(&treq, acred)) return code;
if ((code = afs_InitReq(&treq, acred))) return code;
#ifdef AFS_SGI64_ENV
/* avcpp can be, but is not necesarily, bhp's vnode. */
tvc = VTOAFS(BHV_TO_VNODE(bhv));
@ -110,7 +110,7 @@ afs_open(avcp, aflags, acred)
crhold(acred);
if (tvc->credp) {
struct ucred *crp = tvc->credp;
tvc->credp = (struct ucred *)0;
tvc->credp = NULL;
crfree(crp);
}
tvc->credp = acred;

View File

@ -47,13 +47,8 @@ extern afs_hyper_t afs_indexCounter; /* Fake time for marking index */
void afs_PrefetchChunk(struct vcache *avc, struct dcache *adc,
struct AFS_UCRED *acred, struct vrequest *areq);
afs_MemRead(avc, auio, acred, albn, abpp, noLock)
register struct vcache *avc;
struct uio *auio;
struct AFS_UCRED *acred;
daddr_t albn;
int noLock;
struct buf **abpp;
int afs_MemRead(register struct vcache *avc, struct uio *auio, struct AFS_UCRED *acred,
daddr_t albn, struct buf **abpp, int noLock)
{
afs_size_t totalLength;
afs_size_t transferLength;
@ -73,7 +68,7 @@ afs_MemRead(avc, auio, acred, albn, abpp, noLock)
return EIO;
/* check that we have the latest status info in the vnode cache */
if (code = afs_InitReq(&treq, acred)) return code;
if ((code = afs_InitReq(&treq, acred))) return code;
if (!noLock) {
code = afs_VerifyVCache(avc, &treq);
if (code) {
@ -250,7 +245,7 @@ tagain:
/* don't have current data, so get it below */
ReleaseReadLock(&tdc->lock);
afs_PutDCache(tdc);
tdc = (struct dcache *) 0;
tdc = NULL;
}
}
@ -439,13 +434,8 @@ void afs_PrefetchChunk(struct vcache *avc, struct dcache *adc,
* Also need to worry about DFFetching, and IFFree, I think. */
static struct dcache *savedc = 0;
afs_UFSReadFast(avc, auio, acred, albn, abpp, noLock)
register struct vcache *avc;
struct uio *auio;
struct AFS_UCRED *acred;
int noLock;
daddr_t albn;
struct buf **abpp;
int afs_UFSReadFast(register struct vcache *avc, struct uio *auio,
struct AFS_UCRED *acred, daddr_t albn, struct buf **abpp, int noLock)
{
struct vrequest treq;
int offDiff;
@ -585,13 +575,8 @@ afs_UFSReadFast(avc, auio, acred, albn, abpp, noLock)
return afs_UFSRead(avc, auio, acred, albn, abpp, noLock);
}
afs_UFSRead(avc, auio, acred, albn, abpp, noLock)
struct vcache *avc;
struct uio *auio;
struct AFS_UCRED *acred;
daddr_t albn;
int noLock;
struct buf **abpp;
int afs_UFSRead(register struct vcache *avc, struct uio *auio,
struct AFS_UCRED *acred, daddr_t albn, struct buf **abpp, int noLock)
{
afs_size_t totalLength;
afs_size_t transferLength;
@ -613,7 +598,7 @@ afs_UFSRead(avc, auio, acred, albn, abpp, noLock)
return EIO;
/* check that we have the latest status info in the vnode cache */
if (code = afs_InitReq(&treq, acred)) return code;
if ((code = afs_InitReq(&treq, acred))) return code;
if (!noLock) {
if (!avc)
osi_Panic ("null avc in afs_UFSRead");
@ -793,7 +778,7 @@ tagain:
/* don't have current data, so get it below */
ReleaseReadLock(&tdc->lock);
afs_PutDCache(tdc);
tdc = (struct dcache *) 0;
tdc = NULL;
}
}

View File

@ -241,15 +241,15 @@ struct vcache * avc;
if ((avc->states & CForeign) == 0 &&
(ntohl(ade->fid.vnode) & 1)) {
return DT_DIR;
} else if ((tvc=afs_FindVCache(&tfid,0,0,0,0))) {
} else if ((tvc=afs_FindVCache(&tfid,0,0))) {
if (tvc->mvstat) {
afs_PutVCache(tvc, WRITE_LOCK);
afs_PutVCache(tvc);
return DT_DIR;
} else if (((tvc->states) & (CStatd|CTruth))) {
/* CTruth will be set if the object has
*ever* been statd */
vtype=vType(tvc);
afs_PutVCache(tvc, WRITE_LOCK);
afs_PutVCache(tvc);
if (vtype == VDIR)
return DT_DIR;
else if (vtype == VREG)
@ -259,7 +259,7 @@ struct vcache * avc;
type=DT_LNK; */
/* what other types does AFS support? */
} else
afs_PutVCache(tvc, WRITE_LOCK);
afs_PutVCache(tvc);
}
return DT_UNKNOWN;
}
@ -529,7 +529,7 @@ afs_readdir(OSI_VC_ARG(avc), auio, acred)
|| AfsLargeFileSize(auio->uio_offset, auio->uio_resid) )
return EFBIG;
if (code = afs_InitReq(&treq, acred)) {
if ((code = afs_InitReq(&treq, acred))) {
#ifdef AFS_HPUX_ENV
osi_FreeSmallSpace((char *)sdirEntry);
#endif
@ -795,7 +795,7 @@ afs1_readdir(avc, auio, acred, eofp)
#else
afs1_readdir(avc, auio, acred)
#endif
register struct vcache *avc;
struct vcache *avc;
struct uio *auio;
struct AFS_UCRED *acred; {
struct vrequest treq;

View File

@ -94,13 +94,10 @@ afs_IsWired(avc)
}
#endif /* AFS_OSF_ENV */
afsremove(adp, tdc, tvc, aname, acred, treqp)
register struct vcache *adp;
register struct dcache *tdc;
register struct vcache *tvc;
char *aname;
struct vrequest *treqp;
struct AFS_UCRED *acred; {
int afsremove(register struct vcache *adp, register struct dcache *tdc,
register struct vcache *tvc, char *aname, struct AFS_UCRED *acred,
struct vrequest *treqp)
{
register afs_int32 code;
register struct conn *tc;
struct AFSFetchStatus OutDirStatus;
@ -111,20 +108,16 @@ afsremove(adp, tdc, tvc, aname, acred, treqp)
tc = afs_Conn(&adp->fid, treqp, SHARED_LOCK);
if (tc) {
XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_REMOVEFILE);
#ifdef RX_ENABLE_LOCKS
AFS_GUNLOCK();
#endif /* RX_ENABLE_LOCKS */
RX_AFS_GUNLOCK();
code = RXAFS_RemoveFile(tc->id, (struct AFSFid *) &adp->fid.Fid,
aname, &OutDirStatus, &tsync);
#ifdef RX_ENABLE_LOCKS
AFS_GLOCK();
#endif /* RX_ENABLE_LOCKS */
RX_AFS_GLOCK();
XSTATS_END_TIME;
}
else code = -1;
} while
(afs_Analyze(tc, code, &adp->fid, treqp,
AFS_STATS_FS_RPCIDX_REMOVEFILE, SHARED_LOCK, (struct cell *)0));
AFS_STATS_FS_RPCIDX_REMOVEFILE, SHARED_LOCK, NULL));
osi_dnlc_remove (adp, aname, tvc);
if (tvc) afs_symhint_inval(tvc); /* XXX: don't really need to be so extreme */
@ -134,7 +127,7 @@ afsremove(adp, tdc, tvc, aname, acred, treqp)
ReleaseSharedLock(&tdc->lock);
afs_PutDCache(tdc);
}
if (tvc) afs_PutVCache(tvc, WRITE_LOCK);
if (tvc) afs_PutVCache(tvc);
if (code < 0) {
ObtainWriteLock(&afs_xcbhash, 497);
@ -183,12 +176,13 @@ afsremove(adp, tdc, tvc, aname, acred, treqp)
#if defined(AFS_SUN_ENV) || defined(AFS_ALPHA_ENV) || defined(AFS_SUN5_ENV)
afs_BozonUnlock(&tvc->pvnLock, tvc);
#endif
afs_PutVCache(tvc, WRITE_LOCK);
afs_PutVCache(tvc);
}
return (0);
}
static char *newname() {
static char *newname(void)
{
char *name, *sp, *p = ".__afs";
afs_int32 rd = afs_random() & 0xffff;
@ -242,10 +236,10 @@ afs_remove(OSI_VC_ARG(adp), aname, acred)
tvc = (struct vcache *)ndp->ni_vp; /* should never be null */
#endif
if (code = afs_InitReq(&treq, acred)) {
if ((code = afs_InitReq(&treq, acred))) {
#ifdef AFS_OSF_ENV
afs_PutVCache(adp, 0);
afs_PutVCache(tvc, 0);
afs_PutVCache(adp);
afs_PutVCache(tvc);
#endif
return code;
}
@ -255,8 +249,8 @@ afs_remove(OSI_VC_ARG(adp), aname, acred)
if (code) {
afs_PutFakeStat(&fakestate);
#ifdef AFS_OSF_ENV
afs_PutVCache(adp, 0);
afs_PutVCache(tvc, 0);
afs_PutVCache(adp);
afs_PutVCache(tvc);
#endif
return code;
}
@ -266,16 +260,16 @@ afs_remove(OSI_VC_ARG(adp), aname, acred)
code = afs_DynrootVOPRemove(adp, acred, aname);
afs_PutFakeStat(&fakestate);
#ifdef AFS_OSF_ENV
afs_PutVCache(adp, 0);
afs_PutVCache(tvc, 0);
afs_PutVCache(adp);
afs_PutVCache(tvc);
#endif
return code;
}
if (strlen(aname) > AFSNAMEMAX) {
afs_PutFakeStat(&fakestate);
#ifdef AFS_OSF_ENV
afs_PutVCache(adp, 0);
afs_PutVCache(tvc, 0);
afs_PutVCache(adp);
afs_PutVCache(tvc);
#endif
return ENAMETOOLONG;
}
@ -284,13 +278,13 @@ tagain:
#ifdef AFS_OSF_ENV
tvc = VTOAFS(ndp->ni_vp); /* should never be null */
if (code) {
afs_PutVCache(adp, 0);
afs_PutVCache(tvc, 0);
afs_PutVCache(adp);
afs_PutVCache(tvc);
afs_PutFakeStat(&fakestate);
return afs_CheckCode(code, &treq, 22);
}
#else /* AFS_OSF_ENV */
tvc = (struct vcache *) 0;
tvc = NULL;
if (code) {
code = afs_CheckCode(code, &treq, 23);
afs_PutFakeStat(&fakestate);
@ -303,8 +297,8 @@ tagain:
*/
if ( adp->states & CRO ) {
#ifdef AFS_OSF_ENV
afs_PutVCache(adp, 0);
afs_PutVCache(tvc, 0);
afs_PutVCache(adp);
afs_PutVCache(tvc);
#endif
code = EROFS;
afs_PutFakeStat(&fakestate);
@ -344,12 +338,10 @@ tagain:
unlinkFid.Cell = adp->fid.Cell;
unlinkFid.Fid.Volume = adp->fid.Fid.Volume;
if (unlinkFid.Fid.Unique == 0) {
tvc = afs_LookupVCache(&unlinkFid, &treq, &cached,
WRITE_LOCK, adp, aname);
tvc = afs_LookupVCache(&unlinkFid, &treq, &cached, adp, aname);
} else {
ObtainReadLock(&afs_xvcache);
tvc = afs_FindVCache(&unlinkFid, 1, WRITE_LOCK,
0 , DO_STATS );
tvc = afs_FindVCache(&unlinkFid, 0, DO_STATS);
ReleaseReadLock(&afs_xvcache);
}
}
@ -397,12 +389,12 @@ tagain:
}
if ( tdc )
afs_PutDCache(tdc);
afs_PutVCache(tvc, WRITE_LOCK);
afs_PutVCache(tvc);
} else {
code = afsremove(adp, tdc, tvc, aname, acred, &treq);
}
#ifdef AFS_OSF_ENV
afs_PutVCache(adp, WRITE_LOCK);
afs_PutVCache(adp);
#endif /* AFS_OSF_ENV */
afs_PutFakeStat(&fakestate);
return code;
@ -414,9 +406,7 @@ tagain:
*
* CAUTION -- may be called with avc unheld. */
afs_remunlink(avc, doit)
register struct vcache *avc;
register int doit;
int afs_remunlink(register struct vcache *avc, register int doit)
{
struct AFS_UCRED *cred;
char *unlname;
@ -430,7 +420,7 @@ afs_remunlink(avc, doit)
return 0;
if (avc->mvid && (doit || (avc->states & CUnlinkedDel))) {
if (code = afs_InitReq(&treq, avc->uncred)) {
if ((code = afs_InitReq(&treq, avc->uncred))) {
ReleaseWriteLock(&avc->lock);
}
else {
@ -466,8 +456,7 @@ afs_remunlink(avc, doit)
dirFid.Fid.Volume = avc->fid.Fid.Volume;
dirFid.Fid.Vnode = avc->parentVnode;
dirFid.Fid.Unique = avc->parentUnique;
adp = afs_GetVCache(&dirFid, &treq, (afs_int32 *)0,
(struct vcache *)0, WRITE_LOCK);
adp = afs_GetVCache(&dirFid, &treq, NULL, NULL);
if (adp) {
tdc = afs_FindDCache(adp, 0);
@ -476,10 +465,10 @@ afs_remunlink(avc, doit)
/* afsremove releases the adp & tdc locks, and does vn_rele(avc) */
code = afsremove(adp, tdc, avc, unlname, cred, &treq);
afs_PutVCache(adp, WRITE_LOCK);
afs_PutVCache(adp);
} else {
/* we failed - and won't be back to try again. */
afs_PutVCache(avc, WRITE_LOCK);
afs_PutVCache(avc);
}
osi_FreeSmallSpace(unlname);
crfree(cred);

View File

@ -168,21 +168,17 @@ tagain:
tc = afs_Conn(&aodp->fid, areq, SHARED_LOCK);
if (tc) {
XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_RENAME);
#ifdef RX_ENABLE_LOCKS
AFS_GUNLOCK();
#endif /* RX_ENABLE_LOCKS */
RX_AFS_GUNLOCK();
code = RXAFS_Rename(tc->id, (struct AFSFid *) &aodp->fid.Fid, aname1,
(struct AFSFid *) &andp->fid.Fid, aname2,
&OutOldDirStatus, &OutNewDirStatus, &tsync);
#ifdef RX_ENABLE_LOCKS
AFS_GLOCK();
#endif /* RX_ENABLE_LOCKS */
RX_AFS_GLOCK();
XSTATS_END_TIME;
} else code = -1;
} while
(afs_Analyze(tc, code, &andp->fid, areq,
AFS_STATS_FS_RPCIDX_RENAME, SHARED_LOCK, (struct cell *)0));
AFS_STATS_FS_RPCIDX_RENAME, SHARED_LOCK, NULL));
returnCode = code; /* remember for later */
@ -293,14 +289,12 @@ tagain:
if (unlinkFid.Fid.Vnode) {
unlinkFid.Fid.Volume = aodp->fid.Fid.Volume;
unlinkFid.Cell = aodp->fid.Cell;
tvc = (struct vcache *)0;
tvc = NULL;
if (!unlinkFid.Fid.Unique) {
tvc = afs_LookupVCache(&unlinkFid, areq, (afs_int32 *)0, WRITE_LOCK,
aodp, aname1);
tvc = afs_LookupVCache(&unlinkFid, areq, NULL, aodp, aname1);
}
if (!tvc) /* lookup failed or wasn't called */
tvc = afs_GetVCache(&unlinkFid, areq, (afs_int32 *)0,
(struct vcache*)0, WRITE_LOCK);
tvc = afs_GetVCache(&unlinkFid, areq, NULL, NULL);
if (tvc) {
#if defined(AFS_SUN_ENV) || defined(AFS_ALPHA_ENV) || defined(AFS_SUN5_ENV)
@ -324,7 +318,7 @@ tagain:
#if defined(AFS_SUN_ENV) || defined(AFS_ALPHA_ENV) || defined(AFS_SUN5_ENV)
afs_BozonUnlock(&tvc->pvnLock, tvc);
#endif
afs_PutVCache(tvc, WRITE_LOCK);
afs_PutVCache(tvc);
}
}
@ -333,10 +327,9 @@ tagain:
fileFid.Fid.Volume = aodp->fid.Fid.Volume;
fileFid.Cell = aodp->fid.Cell;
if (!fileFid.Fid.Unique)
tvc = afs_LookupVCache(&fileFid, areq, (afs_int32 *)0, WRITE_LOCK, andp, aname2);
tvc = afs_LookupVCache(&fileFid, areq, NULL, andp, aname2);
else
tvc = afs_GetVCache(&fileFid, areq, (afs_int32 *)0,
(struct vcache*)0, WRITE_LOCK);
tvc = afs_GetVCache(&fileFid, areq, NULL, (struct vcache*)0);
if (tvc && (vType(tvc) == VDIR)) {
ObtainWriteLock(&tvc->lock,152);
tdc1 = afs_FindDCache(tvc, 0);
@ -349,12 +342,12 @@ tagain:
}
osi_dnlc_remove(tvc, "..", 0);
ReleaseWriteLock(&tvc->lock);
afs_PutVCache(tvc, WRITE_LOCK);
afs_PutVCache(tvc);
} else if (tvc) {
/* True we shouldn't come here since tvc SHOULD be a dir, but we
* 'syntactically' need to unless we change the 'if' above...
*/
afs_PutVCache(tvc, WRITE_LOCK);
afs_PutVCache(tvc);
}
}
code = returnCode;

View File

@ -80,7 +80,7 @@ afs_symlink
afs_Trace2(afs_iclSetp, CM_TRACE_SYMLINK, ICL_TYPE_POINTER, adp,
ICL_TYPE_STRING, aname);
if (code = afs_InitReq(&treq, acred))
if ((code = afs_InitReq(&treq, acred)))
goto done2;
afs_InitFakeStat(&fakestate);
@ -135,32 +135,24 @@ afs_symlink
XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_SYMLINK);
if (adp->states & CForeign) {
now = osi_Time();
#ifdef RX_ENABLE_LOCKS
AFS_GUNLOCK();
#endif /* RX_ENABLE_LOCKS */
RX_AFS_GUNLOCK();
code = RXAFS_DFSSymlink(tc->id, (struct AFSFid *) &adp->fid.Fid, aname,
atargetName, &InStatus, (struct AFSFid *) &newFid.Fid,
&OutFidStatus, &OutDirStatus, &CallBack, &tsync);
#ifdef RX_ENABLE_LOCKS
AFS_GLOCK();
#endif /* RX_ENABLE_LOCKS */
RX_AFS_GLOCK();
} else {
#ifdef RX_ENABLE_LOCKS
AFS_GUNLOCK();
#endif /* RX_ENABLE_LOCKS */
RX_AFS_GUNLOCK();
code = RXAFS_Symlink(tc->id, (struct AFSFid *) &adp->fid.Fid, aname,
atargetName, &InStatus, (struct AFSFid *) &newFid.Fid,
&OutFidStatus, &OutDirStatus, &tsync);
#ifdef RX_ENABLE_LOCKS
AFS_GLOCK();
#endif /* RX_ENABLE_LOCKS */
RX_AFS_GLOCK();
}
XSTATS_END_TIME;
}
else code = -1;
} while
(afs_Analyze(tc, code, &adp->fid, &treq,
AFS_STATS_FS_RPCIDX_SYMLINK, SHARED_LOCK, (struct cell *)0));
AFS_STATS_FS_RPCIDX_SYMLINK, SHARED_LOCK, NULL));
UpgradeSToWLock(&afs_xvcache,40);
if (code) {
@ -199,7 +191,7 @@ afs_symlink
/* now we're done with parent dir, create the link's entry. Note that
* no one can get a pointer to the new cache entry until we release
* the xvcache lock. */
tvc = afs_NewVCache(&newFid, hostp, 1, WRITE_LOCK);
tvc = afs_NewVCache(&newFid, hostp);
ObtainWriteLock(&tvc->lock,157);
ObtainWriteLock(&afs_xcbhash, 500);
tvc->states |= CStatd; /* have valid info */
@ -226,7 +218,7 @@ afs_symlink
}
ReleaseWriteLock(&tvc->lock);
ReleaseWriteLock(&afs_xvcache);
afs_PutVCache(tvc, WRITE_LOCK);
afs_PutVCache(tvc);
code = 0;
done:
afs_PutFakeStat(&fakestate);
@ -240,10 +232,8 @@ done2:
return code;
}
afs_MemHandleLink(avc, areq)
register struct vcache *avc;
struct vrequest *areq;
{
int afs_MemHandleLink(register struct vcache *avc, struct vrequest *areq)
{
register struct dcache *tdc;
register char *tp, *rbuf;
afs_size_t offset, len;
@ -289,9 +279,7 @@ afs_MemHandleLink(avc, areq)
return 0;
}
afs_UFSHandleLink(avc, areq)
register struct vcache *avc;
struct vrequest *areq;
int afs_UFSHandleLink(register struct vcache *avc, struct vrequest *areq)
{
register struct dcache *tdc;
register char *tp, *rbuf;
@ -354,7 +342,7 @@ afs_readlink(OSI_VC_ARG(avc), auio, acred)
AFS_STATCNT(afs_readlink);
afs_Trace1(afs_iclSetp, CM_TRACE_READLINK, ICL_TYPE_POINTER, avc);
if (code = afs_InitReq(&treq, acred)) return code;
if ((code = afs_InitReq(&treq, acred))) return code;
afs_InitFakeStat(&fakestat);
code = afs_EvalFakeStat(&avc, &fakestat, &treq);
if (code) goto done;

View File

@ -37,9 +37,7 @@ extern unsigned char *afs_indexFlags;
* afs_FlushActiveVCaches routine (when CCORE is on).
* avc->lock must be write-locked.
*/
afs_StoreOnLastReference(avc, treq)
register struct vcache *avc;
register struct vrequest *treq;
int afs_StoreOnLastReference(register struct vcache *avc, register struct vrequest *treq)
{
int code = 0;
@ -61,7 +59,7 @@ register struct vrequest *treq;
avc->execsOrWriters--;
AFS_RELE(AFSTOV(avc)); /* VN_HOLD at set CCore(afs_FakeClose)*/
crfree((struct AFS_UCRED *)avc->linkData); /* "crheld" in afs_FakeClose */
avc->linkData = (char *)0;
avc->linkData = NULL;
}
/* Now, send the file back. Used to require 0 writers left, but now do
* it on every close for write, since two closes in a row are harmless
@ -88,11 +86,8 @@ register struct vrequest *treq;
afs_MemWrite(avc, auio, aio, acred, noLock)
register struct vcache *avc;
struct uio *auio;
int aio, noLock;
struct AFS_UCRED *acred;
int afs_MemWrite(register struct vcache *avc, struct uio *auio, int aio,
struct AFS_UCRED *acred, int noLock)
{
afs_size_t totalLength;
afs_size_t transferLength;
@ -117,7 +112,7 @@ afs_MemWrite(avc, auio, aio, acred, noLock)
return avc->vc_error;
startDate = osi_Time();
if (code = afs_InitReq(&treq, acred)) return code;
if ((code = afs_InitReq(&treq, acred))) return code;
/* otherwise we read */
totalLength = auio->afsio_resid;
filePos = auio->afsio_offset;
@ -332,11 +327,8 @@ afs_MemWrite(avc, auio, aio, acred, noLock)
/* called on writes */
afs_UFSWrite(avc, auio, aio, acred, noLock)
register struct vcache *avc;
struct uio *auio;
int aio, noLock;
struct AFS_UCRED *acred;
int afs_UFSWrite(register struct vcache *avc, struct uio *auio,
int aio, struct AFS_UCRED *acred, int noLock)
{
afs_size_t totalLength;
afs_size_t transferLength;
@ -363,7 +355,7 @@ afs_UFSWrite(avc, auio, aio, acred, noLock)
return avc->vc_error;
startDate = osi_Time();
if (code = afs_InitReq(&treq, acred)) return code;
if ((code = afs_InitReq(&treq, acred))) return code;
/* otherwise we read */
totalLength = auio->afsio_resid;
filePos = auio->afsio_offset;
@ -673,9 +665,8 @@ afs_UFSWrite(avc, auio, aio, acred, noLock)
}
/* do partial write if we're low on unmodified chunks */
afs_DoPartialWrite(avc, areq)
register struct vcache *avc;
struct vrequest *areq; {
int afs_DoPartialWrite(register struct vcache *avc, struct vrequest *areq)
{
register afs_int32 code;
if (afs_stats_cmperf.cacheCurrDirtyChunks <= afs_stats_cmperf.cacheMaxDirtyChunks)
@ -714,8 +705,8 @@ struct vrequest *areq; {
* N.B: Intercepting close syscall doesn't trap aborts or exit system
* calls.
*/
afs_closex(afd)
register struct file *afd; {
int afs_closex(register struct file *afd)
{
struct vrequest treq;
struct vcache *tvc;
afs_int32 flags;
@ -725,7 +716,7 @@ afs_closex(afd)
AFS_STATCNT(afs_closex);
/* setup the credentials */
if (code = afs_InitReq(&treq, u.u_cred)) return code;
if ((code = afs_InitReq(&treq, u.u_cred))) return code;
afs_InitFakeStat(&fakestat);
closeDone = 0;
@ -1010,7 +1001,7 @@ off_t start, stop;
AFS_STATCNT(afs_fsync);
afs_Trace1(afs_iclSetp, CM_TRACE_FSYNC, ICL_TYPE_POINTER, avc);
if (code = afs_InitReq(&treq, acred)) return code;
if ((code = afs_InitReq(&treq, acred))) return code;
#if defined(AFS_SGI_ENV)
AFS_RWLOCK((vnode_t *)avc, VRWLOCK_WRITE);

View File

@ -39,6 +39,17 @@ extern int afs_shuttingdown;
#endif
#endif
/* Moved from VNOPS/afs_vnop_flocks so can be used in prototypes */
#if defined(AFS_HPUX102_ENV)
#define AFS_FLOCK k_flock
#else
#if defined(AFS_SUN56_ENV) || defined(AFS_LINUX24_ENV)
#define AFS_FLOCK flock64
#else
#define AFS_FLOCK flock
#endif /* AFS_SUN65_ENV */
#endif /* AFS_HPUX102_ENV */
/* The following are various levels of afs debugging */
#define AFSDEB_GENERAL 1 /* Standard debugging */
#define AFSDEB_NETWORK 2 /* low level afs networking */
@ -1014,57 +1025,6 @@ extern struct brequest afs_brs[NBRS]; /* request structures */
#define SHash(aserv) ((ntohl(aserv)) & (NSERVERS-1))
#define FVHash(acell,avol) (((avol)+(acell)) & (NFENTRIES-1))
extern struct cell *afs_GetCell();
extern struct cell *afs_GetCellNoLock();
extern struct cell *afs_GetCellByName();
extern struct cell *afs_FindCellByName();
extern struct cell *afs_GetCellByIndex();
extern struct unixuser *afs_GetUser();
extern struct volume *afs_GetVolume();
extern struct volume *afs_GetVolumeByName();
extern struct conn *afs_Conn();
extern struct conn *afs_ConnByHost();
extern struct conn *afs_ConnByMHosts();
extern afs_int32 afs_NewCell();
extern struct dcache *afs_GetDCache();
extern struct dcache *afs_FindDCache();
extern struct dcache *afs_NewDCache();
extern struct dcache *afs_GetDSlot();
extern struct vcache *afs_GetVCache();
extern struct brequest *afs_BQueue();
/* afs_cache.c */
extern int afs_CacheInit();
extern void afs_StoreWarn();
extern void afs_AdjustSize();
extern void afs_ComputeCacheParms();
extern void afs_FlushDCache();
extern void afs_FlushActiveVcaches();
extern void afs_StuffVcache();
extern void afs_PutVCache();
extern void afs_TryToSmush();
extern void afs_ProcessFS();
extern void afs_WriteThroughDSlots();
extern void shutdown_cache();
/* afs_call.c */
extern void afs_shutdown();
/* afs_osifile.c */
extern void shutdown_osifile();
/* afs_dynroot.c */
extern int afs_IsDynrootFid();
extern void afs_GetDynrootFid();
extern int afs_IsDynroot();
extern void afs_RefreshDynroot();
extern void afs_GetDynroot();
extern void afs_PutDynroot();
extern int afs_DynrootNewVnode();
extern int afs_SetDynrootEnable();
extern int afs_GetDynrootEnable();
extern int afs_DynrootVOPSymlink();
extern int afs_DynrootVOPRemove();
/* Performance hack - we could replace VerifyVCache2 with the appropriate
* GetVCache incantation, and could eliminate even this code from afs_UFSRead
* by making intentionally invalidating quick.stamp in the various callbacks
@ -1108,11 +1068,6 @@ extern int afs_DynrootVOPRemove();
#define afs_nlrdwr(avc, uio, rw, io, cred) \
(((rw) == UIO_WRITE) ? afs_write(avc, uio, io, cred, 1) : afs_read(avc, uio, cred, 0, 0, 1))
extern afs_int32 afs_blocksUsed, afs_blocksDiscarded;
extern afs_int32 afs_discardDCCount, afs_freeDCCount;
extern afs_int32 afs_bulkStatsDone, afs_bulkStatsLost;
extern int afs_TruncateDaemonRunning;
extern int afs_CacheTooFull;
/* Cache size truncation uses the following low and high water marks:
* If the cache is more than 95% full (CM_DCACHECOUNTFREEPCT), the cache
* truncation daemon is awakened and will free up space until the cache is 85%
@ -1122,9 +1077,6 @@ extern int afs_CacheTooFull;
* afs_GetDownD wakes those processes once the cache is 95% full
* (CM_CACHESIZEDRAINEDPCT).
*/
extern void afs_MaybeWakeupTruncateDaemon();
extern void afs_CacheTruncateDaemon();
extern int afs_WaitForCacheDrain;
#define CM_MAXDISCARDEDCHUNKS 16 /* # of chunks */
#define CM_DCACHECOUNTFREEPCT 95 /* max pct of chunks in use */
#define CM_DCACHESPACEFREEPCT 90 /* max pct of space in use */
@ -1141,12 +1093,9 @@ extern int afs_WaitForCacheDrain;
/* Handy max length of a numeric string. */
#define CVBS 12 /* max afs_int32 is 2^32 ~ 4*10^9, +1 for NULL, +luck */
extern int afs_norefpanic;
#define refpanic(foo) if (afs_norefpanic) \
{ printf( foo ); afs_norefpanic++;} else osi_Panic( foo )
/*
** these are defined in the AIX source code sys/fs_locks.h but are not
** defined anywhere in the /usr/include directory
@ -1182,6 +1131,24 @@ extern int afs_norefpanic;
#endif /* AFS_SGI62_ENV */
#endif
/* Note: this should agree with the definition in kdump.c */
#if defined(AFS_OSF_ENV)
#if !defined(UKERNEL)
#define AFS_USEBUFFERS 1
#endif
#endif
#if !defined(UKERNEL) && !defined(HAVE_STRUCT_BUF)
/* declare something so that prototypes don't flip out */
/* this is really a sick hack, but appears struct buf stuff is only actually passed
around as a pointer, except with libuafs, in which case it is actually defined */
struct buf {
int bogus;
};
#endif
/* fakestat support: opaque storage for afs_EvalFakeStat to remember
* what vcache should be released.
*/
@ -1194,5 +1161,28 @@ struct afs_fakestat_state {
extern int afs_fakestat_enable;
struct buffer {
ino_t fid[1]; /* Unique cache key + i/o addressing */
afs_int32 page;
afs_int32 accesstime;
struct buffer *hashNext;
char *data;
char lockers;
char dirty;
char hashIndex;
#if AFS_USEBUFFERS
struct buf *bufp;
#endif
afs_rwlock_t lock; /* the lock for this structure */
};
/* afs_memcache.c */
struct memCacheEntry {
int size; /* # of valid bytes in this entry */
int dataSize; /* size of allocated data area */
afs_lock_t afs_memLock;
char *data; /* bytes */
};
#endif /* _AFS_H_ */

View File

@ -35,7 +35,6 @@ RCSID("$Header$");
#include "../afs/afsincludes.h" /* Afs-based standard headers */
#include "../afs/afs_stats.h" /* afs statistics */
#include "../afs/afs_util.h"
#include "../afs/afs_prototypes.h"
#if defined(AFS_SUN56_ENV)
#include <inet/led.h>
@ -61,15 +60,11 @@ RCSID("$Header$");
int afs_BusyWaitPeriod = 15; /* poll every 15 seconds */
afs_int32 hm_retry_RO=0; /* don't wait */
afs_int32 hm_retry_RW=0; /* don't wait */
afs_int32 hm_retry_int=0; /* don't wait */
void afs_CopyError(afrom, ato)
register struct vrequest *afrom;
register struct vrequest *ato;
void afs_CopyError(register struct vrequest *afrom, register struct vrequest *ato)
{
AFS_STATCNT(afs_CopyError);
if (!afrom->initd)
@ -84,12 +79,9 @@ void afs_CopyError(afrom, ato)
if (afrom->permWriteError)
ato->permWriteError = 1;
} /*afs_CopyError*/
void afs_FinalizeReq(areq)
register struct vrequest *areq;
}
void afs_FinalizeReq(register struct vrequest *areq)
{
AFS_STATCNT(afs_FinalizeReq);
if (areq->initd)
@ -101,14 +93,9 @@ void afs_FinalizeReq(areq)
areq->permWriteError = 0;
areq->initd = 1;
} /*afs_FinalizeReq*/
afs_CheckCode(acode, areq, where)
afs_int32 acode;
struct vrequest *areq;
int where;
}
int afs_CheckCode(afs_int32 acode, struct vrequest *areq, int where)
{
AFS_STATCNT(afs_CheckCode);
if (acode) {
@ -152,9 +139,7 @@ int lastcode;
#define DIFFERENT 0
#define SAME 1
#define DUNNO 2
static int VLDB_Same (afid, areq)
struct VenusFid *afid;
struct vrequest *areq;
static int VLDB_Same (struct VenusFid *afid, struct vrequest *areq)
{
struct vrequest treq;
struct conn *tconn;
@ -173,7 +158,7 @@ static int VLDB_Same (afid, areq)
AFS_STATCNT(CheckVLDB);
afs_FinalizeReq(areq);
if (i = afs_InitReq(&treq, &afs_osi_cred)) return DUNNO;
if ((i = afs_InitReq(&treq, &afs_osi_cred))) return DUNNO;
tcell = afs_GetCell(afid->Cell, READ_LOCK);
bp = afs_cv2string(&tbuf[CVBS], afid->Fid.Volume);
do {
@ -217,7 +202,7 @@ static int VLDB_Same (afid, areq)
}
} else
i = -1;
} while (afs_Analyze(tconn, i, (struct VenusFid *) 0, &treq,
} while (afs_Analyze(tconn, i, NULL, &treq,
-1, /* no op code for this */
SHARED_LOCK, tcell));
@ -304,16 +289,10 @@ static int VLDB_Same (afid, areq)
* The retry return value is used by afs_StoreAllSegments to determine
* if this is a temporary or permanent error.
*------------------------------------------------------------------------*/
int afs_Analyze(aconn, acode, afid, areq, op, locktype, cellp)
register struct conn *aconn;
afs_int32 acode;
register struct vrequest *areq;
struct VenusFid *afid;
int op;
afs_int32 locktype;
struct cell *cellp;
{ /*afs_Analyze*/
int afs_Analyze(register struct conn *aconn, afs_int32 acode,
struct VenusFid *afid, register struct vrequest *areq, int op,
afs_int32 locktype, struct cell *cellp)
{
afs_int32 i, code;
struct srvAddr *sa;
struct server *tsp;

View File

@ -17,17 +17,15 @@ RCSID("$Header$");
#include "../afs/afs_stats.h" /* statistics */
#include "afs/stds.h"
static struct axscache *afs_axsfreelist = NULL;
static struct xfreelist { struct xfreelist *next; } *xfreemallocs = 0, *xsp = 0;
int afs_xaxscnt = 0;
static struct xfreelist { struct xfreelist *next; } *xfreemallocs = 0;
static int afs_xaxscnt = 0;
afs_rwlock_t afs_xaxs;
/* takes an address of an access cache & uid, returns ptr */
/* PRECONDITION: first field has been checked and doesn't match!
* INVARIANT: isparent(i,j) ^ isparent(j,i) (ie, they switch around)
*/
struct axscache *afs_SlowFindAxs(cachep,id)
struct axscache **cachep;
afs_int32 id;
struct axscache *afs_SlowFindAxs(struct axscache **cachep, afs_int32 id)
{
register struct axscache *i,*j;
@ -39,7 +37,7 @@ struct axscache *afs_SlowFindAxs(cachep,id)
return(i);
}
if (j=i->next) { /* ASSIGNMENT HERE! */
if ((j=i->next)) { /* ASSIGNMENT HERE! */
if (j->uid == id) {
axs_Front(cachep,i,j);
return(j);
@ -53,14 +51,14 @@ struct axscache *afs_SlowFindAxs(cachep,id)
#define NAXSs (1000 / sizeof(struct axscache))
struct axscache *axs_Alloc()
struct axscache *axs_Alloc(void)
{
register struct axscache *i, *j, *xsp;
struct axscache *h;
int k;
ObtainWriteLock(&afs_xaxs,174);
if (h = afs_axsfreelist) {
if ((h = afs_axsfreelist)) {
afs_axsfreelist = h->next;
} else {
h=i=j= (struct axscache *) afs_osi_Alloc(NAXSs * sizeof(struct axscache));
@ -93,8 +91,7 @@ struct axscache *axs_Alloc()
/* I optimize for speed on lookup, and don't give a RIP about delete.
*/
void afs_RemoveAxs(headp, axsp)
struct axscache **headp, *axsp;
void afs_RemoveAxs(struct axscache **headp, struct axscache *axsp)
{
struct axscache *i, *j;
@ -114,7 +111,7 @@ void afs_RemoveAxs(headp, axsp)
axs_Free(axsp);
return;
}
if (i = j->next) { /* ASSIGNMENT HERE! */
if ((i = j->next)) { /* ASSIGNMENT HERE! */
j->next = i->next;
axs_Free(axsp);
return;
@ -130,8 +127,7 @@ void afs_RemoveAxs(headp, axsp)
* Takes an entire list of access cache structs and prepends them, lock, stock,
* and barrel, to the front of the freelist.
*/
void afs_FreeAllAxs(headp)
struct axscache **headp;
void afs_FreeAllAxs(struct axscache **headp)
{
struct axscache *i,*j;
@ -162,7 +158,9 @@ void afs_FreeAllAxs(headp)
}
void shutdown_xscache()
/* doesn't appear to be used at all */
#if 0
static void shutdown_xscache(void)
{
struct xfreelist *xp, *nxp;
@ -176,3 +174,4 @@ void shutdown_xscache()
afs_axsfreelist = NULL;
xfreemallocs = NULL;
}
#endif

View File

@ -31,23 +31,19 @@ struct axscache {
struct axscache * next;
};
extern struct axscache *axs_Alloc(), *afs_SlowFindAxs();
extern void afs_RemoveAxs(), afs_FreeAllAxs();
extern afs_rwlock_t afs_xaxs;
/* DON'T use this with a NULL pointer!
* the quick check should cover 99.9% of the cases
*/
#define afs_FindAxs(cachep,id) (((cachep)->uid == id) ? cachep : afs_SlowFindAxs(&(cachep),id))
#define afs_FindAxs(cachep,id) (((cachep)->uid == id) ? (cachep) : afs_SlowFindAxs(&(cachep),(id)))
#define axs_Front(head,pp,p) {(pp)->next = (p)->next; (p)->next= *(head);*(head)=(p);}
#define afs_AddAxs(cachep,id,bits) { \
struct axscache *ac; \
if (ac = axs_Alloc()) { \
ac->uid = id; \
ac->axess = (afs_int32)bits; \
ac->next = cachep; \
if ((ac = axs_Alloc())) { \
ac->uid = (id); \
ac->axess = (afs_int32)(bits); \
ac->next = (cachep); \
cachep = ac; }}
#endif

View File

@ -13,6 +13,7 @@
RCSID("$Header$");
#include "../afs/sysincludes.h"
#include "../afs/afsincludes.h"
#if !defined(UKERNEL)
#include "../h/param.h"
#include "../h/types.h"
@ -33,6 +34,10 @@ RCSID("$Header$");
#include "../h/buf.h"
#endif /* !defined(UKERNEL) */
#if !defined(UKERNEL) && !defined(AFS_SUN5_ENV)
#include "../afs/osi_vfs.h"
#endif
#include "../afs/stds.h"
#include "../afs/volerrors.h"
#include "../afs/exporter.h"
@ -42,6 +47,7 @@ RCSID("$Header$");
#include "../afs/afs_stats.h"
#include "../afs/longc_procs.h"
#include "../afs/afs.h"
#ifndef BUF_TIME_MAX
#define BUF_TIME_MAX 0x7fffffff
@ -63,33 +69,12 @@ RCSID("$Header$");
#define pHash(fid,page) ((((afs_int32)((fid)[0])) & PHFIDMASK) \
| (page & PHPAGEMASK))
/* Note: this should agree with the definition in kdump.c */
#if defined(AFS_OSF_ENV)
#if !defined(UKERNEL)
#define AFS_USEBUFFERS 1
#endif
#endif
#ifdef dirty
#undef dirty /* XXX */
#endif
struct buffer {
ino_t fid[1]; /* Unique cache key + i/o addressing */
afs_int32 page;
afs_int32 accesstime;
struct buffer *hashNext;
char *data;
char lockers;
char dirty;
char hashIndex;
#if AFS_USEBUFFERS
struct buf *bufp;
#endif
afs_rwlock_t lock; /* the lock for this structure */
} *Buffers = 0;
char *BufferData;
static struct buffer *Buffers = 0;
static char *BufferData;
#ifdef AFS_AIX_ENV
extern struct buf *geteblk();
@ -102,14 +87,15 @@ extern struct buf *geteblk();
*/
static afs_lock_t afs_bufferLock;
static struct buffer *phTable[PHSIZE]; /* page hash table */
int nbuffers;
afs_int32 timecounter;
static int nbuffers;
static afs_int32 timecounter;
static struct buffer *afs_newslot();
/* Prototypes for static routines */
static struct buffer *afs_newslot (ino_t *afid, afs_int32 apage,register struct buffer *lp);
static int dinit_flag = 0;
void DInit (abuffers)
int abuffers; {
void DInit (int abuffers)
{
/* Initialize the venus buffer system. */
register int i;
register struct buffer *tb;
@ -161,9 +147,8 @@ void DInit (abuffers)
return;
}
char *DRead(fid,page)
register ino_t *fid;
register int page; {
char *DRead(register ino_t *fid, register int page)
{
/* Read a page from the disk. */
register struct buffer *tb, *tb2;
void *tfile;
@ -182,7 +167,7 @@ char *DRead(fid,page)
* of larger code size. This could be simplified by better use of
* macros.
*/
if ( tb = phTable[pHash(fid,page)] ) { /* ASSMT HERE */
if ((tb = phTable[pHash(fid,page)])) {
if (bufmatch(tb)) {
MObtainWriteLock(&tb->lock,257);
ReleaseWriteLock(&afs_bufferLock);
@ -195,7 +180,7 @@ char *DRead(fid,page)
else {
register struct buffer **bufhead;
bufhead = &( phTable[pHash(fid,page)] );
while (tb2 = tb->hashNext) {
while ((tb2 = tb->hashNext)) {
if (bufmatch(tb2)) {
buf_Front(bufhead,tb,tb2);
MObtainWriteLock(&tb2->lock,258);
@ -206,7 +191,7 @@ char *DRead(fid,page)
MReleaseWriteLock(&tb2->lock);
return tb2->data;
}
if (tb = tb2->hashNext) { /* ASSIGNMENT HERE! */
if ((tb = tb2->hashNext)) {
if (bufmatch(tb)) {
buf_Front(bufhead,tb2,tb);
MObtainWriteLock(&tb->lock,259);
@ -262,8 +247,8 @@ char *DRead(fid,page)
return tb->data;
}
static void FixupBucket(ap)
register struct buffer *ap; {
static void FixupBucket(register struct buffer *ap)
{
register struct buffer **lp, *tp;
register int i;
/* first try to get it out of its current hash bucket, in which it
@ -285,10 +270,8 @@ static void FixupBucket(ap)
phTable[i] = ap; /* at the front, since it's LRU */
}
static struct buffer *afs_newslot (afid,apage,lp)
ino_t *afid;
afs_int32 apage;
register struct buffer *lp; /* pointer to a fairly-old buffer */
/* lp is pointer to a fairly-old buffer */
static struct buffer *afs_newslot (ino_t *afid, afs_int32 apage,register struct buffer *lp)
{
/* Find a usable buffer slot */
register afs_int32 i;
@ -374,9 +357,8 @@ static struct buffer *afs_newslot (afid,apage,lp)
return lp;
}
void DRelease (bp,flag)
register struct buffer *bp;
int flag; {
void DRelease (register struct buffer *bp, int flag)
{
/* Release a buffer, specifying whether or not the buffer has been
* modified by the locker. */
register int index;
@ -407,8 +389,8 @@ void DRelease (bp,flag)
MReleaseWriteLock(&bp->lock);
}
DVOffset (ap)
register void *ap; {
int DVOffset (register void *ap)
{
/* Return the byte within a file represented by a buffer pointer. */
register struct buffer *bp;
register int index;
@ -441,8 +423,7 @@ DVOffset (ap)
* of the hash function. Oh well. This should use the list traversal
* method of DRead...
*/
void DZap (fid)
ino_t *fid;
void DZap (ino_t *fid)
{
register int i;
/* Destroy all buffers pertaining to a particular fid. */
@ -462,9 +443,10 @@ void DZap (fid)
MReleaseReadLock(&afs_bufferLock);
}
void DFlush () {
void DFlush (void)
{
/* Flush all the modified buffers. */
register int i, code;
register int i;
register struct buffer *tb;
void *tfile;
@ -491,9 +473,7 @@ void DFlush () {
MReleaseReadLock(&afs_bufferLock);
}
char *DNew (fid,page)
register int page;
register ino_t *fid;
char *DNew (register ino_t *fid, register int page)
{
/* Same as read, only do *not* even try to read the page, since it probably doesn't exist. */
register struct buffer *tb;
@ -510,7 +490,8 @@ char *DNew (fid,page)
return tb->data;
}
void shutdown_bufferpackage() {
void shutdown_bufferpackage(void)
{
#if AFS_USEBUFFERS
register struct buffer *tp;
#endif

View File

@ -124,6 +124,8 @@ static int afs_InitSetup(int preallocs)
return code;
}
/* leaving as is, probably will barf if we add prototypes here since it's likely being called
with partial list */
afs_syscall_call(parm, parm2, parm3, parm4, parm5, parm6)
long parm, parm2, parm3, parm4, parm5, parm6;
{
@ -293,8 +295,8 @@ long parm, parm2, parm3, parm4, parm5, parm6;
else {
AFS_COPYIN((char *)parm3, tcell.cellName, parm4, code);
if (!code)
afs_NewCell(tcell.cellName, tcell.hosts, parm5, (char *)0,
(u_short)0, (u_short)0, (int)0, (char *)0);
afs_NewCell(tcell.cellName, tcell.hosts, parm5,
0, 0, 0, 0, 0);
}
}
} else if (parm == AFSOP_ADDCELL2) {
@ -323,8 +325,8 @@ long parm, parm2, parm3, parm4, parm5, parm6;
}
}
if (!code)
afs_NewCell(tbuffer1, tcell.hosts, cflags, lcnamep,
(u_short)0, (u_short)0, (int)0, (char *)0);
afs_NewCell(tbuffer1, tcell.hosts, cflags,
lcnamep, 0, 0, 0, 0);
}
}
osi_FreeSmallSpace(tbuffer);
@ -349,7 +351,7 @@ long parm, parm2, parm3, parm4, parm5, parm6;
if (!code) afs_NewCell(aliasName, /* new entry name */
0, /* host list */
CAlias, /* flags */
(char *) 0, /* linked cell */
NULL, /* linked cell */
0, 0, /* fs & vl ports */
0, /* timeout */
cellName); /* real cell name */
@ -409,7 +411,7 @@ long parm, parm2, parm3, parm4, parm5, parm6;
#ifdef AFS_SGI62_ENV
ainode = (ainode << 32) | (parm3 & 0xffffffff);
#endif
code = afs_InitCacheFile((char *) 0, ainode);
code = afs_InitCacheFile(NULL, ainode);
}
else if (parm == AFSOP_ROOTVOLUME) {
#if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
@ -1211,7 +1213,8 @@ out:
* incorrectly.
* Initstate of 300 means that the volume has been *successfully* looked up.
*/
afs_CheckInit() {
int afs_CheckInit(void)
{
register int code = 0;
AFS_STATCNT(afs_CheckInit);
@ -1225,8 +1228,7 @@ afs_CheckInit() {
}
int afs_shuttingdown = 0;
void
afs_shutdown()
void afs_shutdown(void)
{
extern short afs_brsDaemons;
extern afs_int32 afs_CheckServerDaemonStarted;
@ -1281,14 +1283,17 @@ afs_shutdown()
while (afs_termState == AFSOP_STOP_RXEVENT)
afs_osi_Sleep(&afs_termState);
#if defined(RXK_LISTENER_ENV)
afs_warn("RxListener... ");
#ifndef UKERNEL
afs_warn("UnmaskRxkSignals... ");
afs_osi_UnmaskRxkSignals();
#endif
/* cancel rx listener */
afs_warn("RxListener... ");
osi_StopListener(); /* This closes rx_socket. */
while (afs_termState == AFSOP_STOP_RXK_LISTENER)
while (afs_termState == AFSOP_STOP_RXK_LISTENER) {
afs_warn("Sleep... ");
afs_osi_Sleep(&afs_termState);
}
#endif
#else
afs_termState = AFSOP_STOP_COMPLETE;
@ -1337,7 +1342,7 @@ afs_shutdown()
#endif
}
shutdown_afstest()
void shutdown_afstest(void)
{
AFS_STATCNT(shutdown_afstest);
afs_initState = afs_termState = afs_setTime = 0;
@ -1350,8 +1355,10 @@ shutdown_afstest()
/* In case there is a bunch of dynamically build bkg daemons to free */
afs_shutdown_BKG()
{ AFS_STATCNT(shutdown_BKG); }
void afs_shutdown_BKG(void)
{
AFS_STATCNT(shutdown_BKG);
}
#if defined(AFS_ALPHA_ENV) || defined(AFS_SGI61_ENV)
@ -1368,7 +1375,7 @@ int afs_icl_sizeofLong = 1;
int afs_icl_inited = 0;
/* init function, called once, under afs_icl_lock */
afs_icl_Init()
int afs_icl_Init(void)
{
afs_icl_inited = 1;
return 0;
@ -1602,11 +1609,8 @@ Afscall_icl(long opcode, long p1, long p2, long p3, long p4, long *retval)
afs_lock_t afs_icl_lock;
/* exported routine: a 4 parameter event */
afs_icl_Event4(setp, eventID, lAndT, p1, p2, p3, p4)
register struct afs_icl_set *setp;
afs_int32 eventID;
afs_int32 lAndT;
long p1, p2, p3, p4;
int afs_icl_Event4(register struct afs_icl_set *setp, afs_int32 eventID,
afs_int32 lAndT, long p1, long p2, long p3, long p4)
{
register struct afs_icl_log *logp;
afs_int32 mask;
@ -1638,37 +1642,26 @@ afs_icl_Event4(setp, eventID, lAndT, p1, p2, p3, p4)
* Whole purpose is to avoid compiler warnings about parameter # mismatches.
* Otherwise, could call afs_icl_Event4 directly.
*/
afs_icl_Event3(setp, eventID, lAndT, p1, p2, p3)
register struct afs_icl_set *setp;
afs_int32 eventID;
afs_int32 lAndT;
long p1, p2, p3;
int afs_icl_Event3(register struct afs_icl_set *setp, afs_int32 eventID,
afs_int32 lAndT, long p1, long p2, long p3)
{
return afs_icl_Event4(setp, eventID, lAndT, p1, p2, p3, (long)0);
}
afs_icl_Event2(setp, eventID, lAndT, p1, p2)
register struct afs_icl_set *setp;
afs_int32 eventID;
afs_int32 lAndT;
long p1, p2;
int afs_icl_Event2(register struct afs_icl_set *setp, afs_int32 eventID,
afs_int32 lAndT, long p1, long p2)
{
return afs_icl_Event4(setp, eventID, lAndT, p1, p2, (long)0, (long)0);
}
afs_icl_Event1(setp, eventID, lAndT, p1)
register struct afs_icl_set *setp;
afs_int32 eventID;
afs_int32 lAndT;
long p1;
int afs_icl_Event1(register struct afs_icl_set *setp, afs_int32 eventID,
afs_int32 lAndT, long p1)
{
return afs_icl_Event4(setp, eventID, lAndT, p1, (long)0, (long)0, (long)0);
}
afs_icl_Event0(setp, eventID, lAndT)
register struct afs_icl_set *setp;
afs_int32 eventID;
afs_int32 lAndT;
int afs_icl_Event0(register struct afs_icl_set *setp, afs_int32 eventID,
afs_int32 lAndT)
{
return afs_icl_Event4(setp, eventID, lAndT, (long)0, (long)0, (long)0, (long)0);
}
@ -1681,9 +1674,7 @@ struct afs_icl_log *afs_icl_allLogs = 0;
*
* Log must be write-locked.
*/
static afs_icl_GetLogSpace(logp, minSpace)
register struct afs_icl_log *logp;
afs_int32 minSpace;
static afs_icl_GetLogSpace(register struct afs_icl_log *logp, afs_int32 minSpace)
{
register unsigned int tsize;
@ -1703,9 +1694,7 @@ static afs_icl_GetLogSpace(logp, minSpace)
* log must be write-locked.
*/
#define ICL_CHARSPERLONG 4
static afs_int32 afs_icl_AppendString(logp, astr)
struct afs_icl_log *logp;
char *astr;
static afs_int32 afs_icl_AppendString(struct afs_icl_log *logp, char *astr)
{
char *op; /* ptr to char to write */
int tc;
@ -1768,8 +1757,7 @@ static afs_int32 afs_icl_AppendString(logp, astr)
/* routine to tell whether we're dealing with the address or the
* object itself
*/
afs_icl_UseAddr(type)
int type;
int afs_icl_UseAddr(int type)
{
if (type == ICL_TYPE_HYPER || type == ICL_TYPE_STRING
|| type == ICL_TYPE_FID || type == ICL_TYPE_INT64)
@ -1783,11 +1771,8 @@ afs_icl_UseAddr(type)
* pretty soon, anyway. The log must be unlocked.
*/
afs_icl_AppendRecord(logp, op, types, p1, p2, p3, p4)
register struct afs_icl_log *logp;
afs_int32 op;
afs_int32 types;
long p1, p2, p3, p4;
int afs_icl_AppendRecord(register struct afs_icl_log *logp, afs_int32 op,
afs_int32 types, long p1, long p2, long p3, long p4)
{
int rsize; /* record size in longs */
register int tsize; /* temp size */
@ -2034,10 +2019,7 @@ afs_icl_AppendRecord(logp, op, types, p1, p2, p3, p4)
/* create a log with size logSize; return it in *outLogpp and tag
* it with name "name."
*/
afs_icl_CreateLog(name, logSize, outLogpp)
char *name;
afs_int32 logSize;
struct afs_icl_log **outLogpp;
int afs_icl_CreateLog(char *name, afs_int32 logSize, struct afs_icl_log **outLogpp)
{
return afs_icl_CreateLogWithFlags(name, logSize, /*flags*/0, outLogpp);
}
@ -2045,11 +2027,8 @@ afs_icl_CreateLog(name, logSize, outLogpp)
/* create a log with size logSize; return it in *outLogpp and tag
* it with name "name." 'flags' can be set to make the log unclearable.
*/
afs_icl_CreateLogWithFlags(name, logSize, flags, outLogpp)
char *name;
afs_int32 logSize;
afs_uint32 flags;
struct afs_icl_log **outLogpp;
int afs_icl_CreateLogWithFlags(char *name, afs_int32 logSize, afs_uint32 flags,
struct afs_icl_log **outLogpp)
{
register struct afs_icl_log *logp;
@ -2082,7 +2061,7 @@ afs_icl_CreateLogWithFlags(name, logSize, flags, outLogpp)
strcpy(logp->name, name);
LOCK_INIT(&logp->lock, "logp lock");
logp->logSize = logSize;
logp->datap = (afs_int32 *)0; /* don't allocate it until we need it */
logp->datap = NULL; /* don't allocate it until we need it */
if (flags & ICL_CRLOG_FLAG_PERSISTENT)
logp->states |= ICL_LOGF_PERSISTENT;
@ -2101,12 +2080,8 @@ afs_icl_CreateLogWithFlags(name, logSize, flags, outLogpp)
* in *flagsp. The flag ICL_COPYOUTF_MISSEDSOME is set if we can't
* find the record with cookie value cookie.
*/
afs_icl_CopyOut(logp, bufferp, bufSizep, cookiep, flagsp)
register struct afs_icl_log *logp;
afs_int32 *bufferp;
afs_int32 *bufSizep;
afs_uint32 *cookiep;
afs_int32 *flagsp;
int afs_icl_CopyOut(register struct afs_icl_log *logp, afs_int32 *bufferp,
afs_int32 *bufSizep, afs_uint32 *cookiep, afs_int32 *flagsp)
{
afs_int32 nwords; /* number of words to copy out */
afs_uint32 startCookie; /* first cookie to use */
@ -2218,10 +2193,8 @@ afs_icl_CopyOut(logp, bufferp, bufSizep, cookiep, flagsp)
}
/* return basic parameter information about a log */
afs_icl_GetLogParms(logp, maxSizep, curSizep)
struct afs_icl_log *logp;
afs_int32 *maxSizep;
afs_int32 *curSizep;
int afs_icl_GetLogParms(struct afs_icl_log *logp, afs_int32 *maxSizep,
afs_int32 *curSizep)
{
ObtainReadLock(&logp->lock);
*maxSizep = logp->logSize;
@ -2232,8 +2205,7 @@ afs_icl_GetLogParms(logp, maxSizep, curSizep)
/* hold and release logs */
afs_icl_LogHold(logp)
register struct afs_icl_log *logp;
int afs_icl_LogHold(register struct afs_icl_log *logp)
{
ObtainWriteLock(&afs_icl_lock,187);
logp->refCount++;
@ -2242,16 +2214,14 @@ afs_icl_LogHold(logp)
}
/* hold and release logs, called with lock already held */
afs_icl_LogHoldNL(logp)
register struct afs_icl_log *logp;
int afs_icl_LogHoldNL(register struct afs_icl_log *logp)
{
logp->refCount++;
return 0;
}
/* keep track of how many sets believe the log itself is allocated */
afs_icl_LogUse(logp)
register struct afs_icl_log *logp;
int afs_icl_LogUse(register struct afs_icl_log *logp)
{
ObtainWriteLock(&logp->lock,188);
if (logp->setCount == 0) {
@ -2271,8 +2241,7 @@ afs_icl_LogUse(logp)
}
/* decrement the number of real users of the log, free if possible */
afs_icl_LogFreeUse(logp)
register struct afs_icl_log *logp;
int afs_icl_LogFreeUse(register struct afs_icl_log *logp)
{
ObtainWriteLock(&logp->lock,189);
if (--logp->setCount == 0) {
@ -2283,16 +2252,14 @@ afs_icl_LogFreeUse(logp)
#endif
logp->firstUsed = logp->firstFree = 0;
logp->logElements = 0;
logp->datap = (afs_int32 *)0;
logp->datap = NULL;
}
ReleaseWriteLock(&logp->lock);
return 0;
}
/* set the size of the log to 'logSize' */
afs_icl_LogSetSize(logp, logSize)
register struct afs_icl_log *logp;
afs_int32 logSize;
int afs_icl_LogSetSize(register struct afs_icl_log *logp, afs_int32 logSize)
{
ObtainWriteLock(&logp->lock,190);
if (!logp->datap) {
@ -2321,8 +2288,7 @@ afs_icl_LogSetSize(logp, logSize)
}
/* free a log. Called with afs_icl_lock locked. */
afs_icl_ZapLog(logp)
register struct afs_icl_log *logp;
int afs_icl_ZapLog(register struct afs_icl_log *logp)
{
register struct afs_icl_log **lpp, *tp;
@ -2340,8 +2306,7 @@ afs_icl_ZapLog(logp)
}
/* do the release, watching for deleted entries */
afs_icl_LogRele(logp)
register struct afs_icl_log *logp;
int afs_icl_LogRele(register struct afs_icl_log *logp)
{
ObtainWriteLock(&afs_icl_lock,191);
if (--logp->refCount == 0 && (logp->states & ICL_LOGF_DELETED)) {
@ -2352,8 +2317,7 @@ afs_icl_LogRele(logp)
}
/* do the release, watching for deleted entries, log already held */
afs_icl_LogReleNL(logp)
register struct afs_icl_log *logp;
int afs_icl_LogReleNL(register struct afs_icl_log *logp)
{
if (--logp->refCount == 0 && (logp->states & ICL_LOGF_DELETED)) {
afs_icl_ZapLog(logp); /* destroys logp's lock! */
@ -2362,8 +2326,7 @@ afs_icl_LogReleNL(logp)
}
/* zero out the log */
afs_icl_ZeroLog(logp)
register struct afs_icl_log *logp;
int afs_icl_ZeroLog(register struct afs_icl_log *logp)
{
ObtainWriteLock(&logp->lock,192);
logp->firstUsed = logp->firstFree = 0;
@ -2374,8 +2337,7 @@ afs_icl_ZeroLog(logp)
}
/* free a log entry, and drop its reference count */
afs_icl_LogFree(logp)
register struct afs_icl_log *logp;
int afs_icl_LogFree(register struct afs_icl_log *logp)
{
ObtainWriteLock(&logp->lock,193);
logp->states |= ICL_LOGF_DELETED;
@ -2385,8 +2347,7 @@ afs_icl_LogFree(logp)
}
/* find a log by name, returning it held */
struct afs_icl_log *afs_icl_FindLog(name)
char *name;
struct afs_icl_log *afs_icl_FindLog(char *name)
{
register struct afs_icl_log *tp;
ObtainWriteLock(&afs_icl_lock,194);
@ -2401,9 +2362,7 @@ struct afs_icl_log *afs_icl_FindLog(name)
return tp;
}
afs_icl_EnumerateLogs(aproc, arock)
int (*aproc)();
char *arock;
int afs_icl_EnumerateLogs(int (*aproc)(), char *arock)
{
register struct afs_icl_log *tp;
register afs_int32 code;
@ -2427,11 +2386,8 @@ afs_icl_EnumerateLogs(aproc, arock)
struct afs_icl_set *afs_icl_allSets = 0;
afs_icl_CreateSet(name, baseLogp, fatalLogp, outSetpp)
char *name;
struct afs_icl_log *baseLogp;
struct afs_icl_log *fatalLogp;
struct afs_icl_set **outSetpp;
int afs_icl_CreateSet(char *name, struct afs_icl_log *baseLogp,
struct afs_icl_log *fatalLogp, struct afs_icl_set **outSetpp)
{
return afs_icl_CreateSetWithFlags(name, baseLogp, fatalLogp,
/*flags*/0, outSetpp);
@ -2443,12 +2399,8 @@ afs_icl_CreateSet(name, baseLogp, fatalLogp, outSetpp)
* addds references from the new afs_icl_set. When the set is destroyed,
* those references will be released.
*/
afs_icl_CreateSetWithFlags(name, baseLogp, fatalLogp, flags, outSetpp)
char *name;
struct afs_icl_log *baseLogp;
struct afs_icl_log *fatalLogp;
afs_uint32 flags;
struct afs_icl_set **outSetpp;
int afs_icl_CreateSetWithFlags(char *name, struct afs_icl_log *baseLogp,
struct afs_icl_log *fatalLogp, afs_uint32 flags, struct afs_icl_set **outSetpp)
{
register struct afs_icl_set *setp;
register int i;
@ -2528,10 +2480,7 @@ afs_icl_CreateSetWithFlags(name, baseLogp, fatalLogp, flags, outSetpp)
}
/* function to change event enabling information for a particular set */
afs_icl_SetEnable(setp, eventID, setValue)
struct afs_icl_set *setp;
afs_int32 eventID;
int setValue;
int afs_icl_SetEnable(struct afs_icl_set *setp, afs_int32 eventID, int setValue)
{
char *tp;
@ -2553,10 +2502,8 @@ afs_icl_SetEnable(setp, eventID, setValue)
* for tracing. If *getValuep is set to 0, the event is disabled,
* otherwise it is enabled. All events start out enabled by default.
*/
afs_icl_GetEnable(setp, eventID, getValuep)
struct afs_icl_set *setp;
afs_int32 eventID;
int *getValuep;
int afs_icl_GetEnable(struct afs_icl_set *setp, afs_int32 eventID,
int *getValuep)
{
ObtainReadLock(&setp->lock);
if (!ICL_EVENTOK(setp, eventID)) {
@ -2572,8 +2519,7 @@ afs_icl_GetEnable(setp, eventID, getValuep)
}
/* hold and release event sets */
afs_icl_SetHold(setp)
register struct afs_icl_set *setp;
int afs_icl_SetHold(register struct afs_icl_set *setp)
{
ObtainWriteLock(&afs_icl_lock,201);
setp->refCount++;
@ -2582,8 +2528,7 @@ afs_icl_SetHold(setp)
}
/* free a set. Called with afs_icl_lock locked */
afs_icl_ZapSet(setp)
register struct afs_icl_set *setp;
int afs_icl_ZapSet(register struct afs_icl_set *setp)
{
register struct afs_icl_set **lpp, *tp;
int i;
@ -2599,7 +2544,7 @@ afs_icl_ZapSet(setp)
unpin((char *)setp->eventFlags, ICL_DEFAULTEVENTS);
#endif
for(i=0; i < ICL_LOGSPERSET; i++) {
if (tlp = setp->logs[i])
if ((tlp = setp->logs[i]))
afs_icl_LogReleNL(tlp);
}
osi_FreeSmallSpace(setp);
@ -2610,8 +2555,7 @@ afs_icl_ZapSet(setp)
}
/* do the release, watching for deleted entries */
afs_icl_SetRele(setp)
register struct afs_icl_set *setp;
int afs_icl_SetRele(register struct afs_icl_set *setp)
{
ObtainWriteLock(&afs_icl_lock,202);
if (--setp->refCount == 0 && (setp->states & ICL_SETF_DELETED)) {
@ -2622,8 +2566,7 @@ afs_icl_SetRele(setp)
}
/* free a set entry, dropping its reference count */
afs_icl_SetFree(setp)
register struct afs_icl_set *setp;
int afs_icl_SetFree(register struct afs_icl_set *setp)
{
ObtainWriteLock(&setp->lock,203);
setp->states |= ICL_SETF_DELETED;
@ -2633,8 +2576,7 @@ afs_icl_SetFree(setp)
}
/* find a set by name, returning it held */
struct afs_icl_set *afs_icl_FindSet(name)
char *name;
struct afs_icl_set *afs_icl_FindSet(char *name)
{
register struct afs_icl_set *tp;
ObtainWriteLock(&afs_icl_lock,204);
@ -2650,8 +2592,7 @@ struct afs_icl_set *afs_icl_FindSet(name)
}
/* zero out all the logs in the set */
afs_icl_ZeroSet(setp)
struct afs_icl_set *setp;
int afs_icl_ZeroSet(struct afs_icl_set *setp)
{
register int i;
int code = 0;
@ -2672,9 +2613,7 @@ afs_icl_ZeroSet(setp)
return code;
}
afs_icl_EnumerateSets(aproc, arock)
int (*aproc)();
char *arock;
int afs_icl_EnumerateSets(int (*aproc)(), char *arock)
{
register struct afs_icl_set *tp, *np;
register afs_int32 code;
@ -2695,9 +2634,7 @@ afs_icl_EnumerateSets(aproc, arock)
return code;
}
afs_icl_AddLogToSet(setp, newlogp)
struct afs_icl_set *setp;
struct afs_icl_log *newlogp;
int afs_icl_AddLogToSet(struct afs_icl_set *setp, struct afs_icl_log *newlogp)
{
register int i;
int code = -1;
@ -2720,9 +2657,7 @@ afs_icl_AddLogToSet(setp, newlogp)
return code;
}
afs_icl_SetSetStat(setp, op)
struct afs_icl_set *setp;
int op;
int afs_icl_SetSetStat(struct afs_icl_set *setp, int op)
{
int i;
afs_int32 code;

View File

@ -23,9 +23,6 @@ RCSID("$Header$");
#include "../afs/afs_stats.h" /*Cache Manager stats*/
#include "../afs/afs_args.h"
extern struct volume *afs_volumes[NVOLS]; /* volume hash table */
extern void afs_DequeueCallback();
extern void afs_ComputePAGStats();
afs_int32 afs_allCBs = 0; /*Break callbacks on all objects */
afs_int32 afs_oddCBs = 0; /*Break callbacks on dirs*/
afs_int32 afs_evenCBs = 0; /*Break callbacks received on files*/
@ -33,17 +30,6 @@ afs_int32 afs_allZaps = 0; /*Objects entries deleted */
afs_int32 afs_oddZaps = 0; /*Dir cache entries deleted*/
afs_int32 afs_evenZaps = 0; /*File cache entries deleted*/
afs_int32 afs_connectBacks = 0;
extern struct rx_service *afs_server;
extern afs_lock_t afs_xvcb, afs_xbrs, afs_xdcache;
extern afs_rwlock_t afs_xvcache, afs_xserver, afs_xcell, afs_xuser;
extern afs_rwlock_t afs_xvolume, afs_puttofileLock, afs_ftf, afs_xinterface;
extern afs_rwlock_t afs_xconn;
extern struct afs_lock afs_xaxs;
extern afs_lock_t afs_xcbhash;
extern struct srvAddr *afs_srvAddrs[NSERVERS];
extern struct afs_q CellLRU;
extern struct cm_initparams cm_initParams;
/*
* Some debugging aids.
@ -52,20 +38,20 @@ static struct ltable {
char *name;
char *addr;
} ltable []= {
"afs_xvcache", (char *)&afs_xvcache,
"afs_xdcache", (char *)&afs_xdcache,
"afs_xserver", (char *)&afs_xserver,
"afs_xvcb", (char *)&afs_xvcb,
"afs_xbrs", (char *)&afs_xbrs,
"afs_xcell", (char *)&afs_xcell,
"afs_xconn", (char *)&afs_xconn,
"afs_xuser", (char *)&afs_xuser,
"afs_xvolume", (char *)&afs_xvolume,
"puttofile", (char *)&afs_puttofileLock,
"afs_ftf", (char *)&afs_ftf,
"afs_xcbhash", (char *)&afs_xcbhash,
"afs_xaxs", (char *)&afs_xaxs,
"afs_xinterface", (char *)&afs_xinterface,
{"afs_xvcache", (char *)&afs_xvcache},
{"afs_xdcache", (char *)&afs_xdcache},
{"afs_xserver", (char *)&afs_xserver},
{"afs_xvcb", (char *)&afs_xvcb},
{"afs_xbrs", (char *)&afs_xbrs},
{"afs_xcell", (char *)&afs_xcell},
{"afs_xconn", (char *)&afs_xconn},
{"afs_xuser", (char *)&afs_xuser},
{"afs_xvolume", (char *)&afs_xvolume},
{"puttofile", (char *)&afs_puttofileLock},
{"afs_ftf", (char *)&afs_ftf},
{"afs_xcbhash", (char *)&afs_xcbhash},
{"afs_xaxs", (char *)&afs_xaxs},
{"afs_xinterface", (char *)&afs_xinterface}
};
unsigned long lastCallBack_vnode;
unsigned int lastCallBack_dv;
@ -97,12 +83,8 @@ struct interfaceAddr afs_cb_interface;
* As advertised.
*------------------------------------------------------------------------*/
int SRXAFSCB_GetCE(a_call, a_index, a_result)
struct rx_call *a_call;
afs_int32 a_index;
struct AFSDBCacheEntry *a_result;
{ /*SRXAFSCB_GetCE*/
int SRXAFSCB_GetCE(struct rx_call *a_call, afs_int32 a_index, struct AFSDBCacheEntry *a_result)
{
register int i; /*Loop variable*/
register struct vcache *tvc; /*Ptr to current cache entry*/
@ -123,7 +105,7 @@ int SRXAFSCB_GetCE(a_call, a_index, a_result)
} /*Zip through hash chains*/
searchDone:
if (tvc == (struct vcache *) 0) {
if (tvc == NULL) {
/*Past EOF*/
code = 1;
goto fcnDone;
@ -178,13 +160,8 @@ fcnDone:
} /*SRXAFSCB_GetCE*/
int SRXAFSCB_GetCE64(a_call, a_index, a_result)
struct rx_call *a_call;
afs_int32 a_index;
struct AFSDBCacheEntry64 *a_result;
{ /*SRXAFSCB_GetCE64*/
int SRXAFSCB_GetCE64(struct rx_call *a_call, afs_int32 a_index, struct AFSDBCacheEntry64 *a_result)
{
register int i; /*Loop variable*/
register struct vcache *tvc; /*Ptr to current cache entry*/
int code; /*Return code*/
@ -204,7 +181,7 @@ int SRXAFSCB_GetCE64(a_call, a_index, a_result)
} /*Zip through hash chains*/
searchDone:
if (tvc == (struct vcache *) 0) {
if (tvc == NULL) {
/*Past EOF*/
code = 1;
goto fcnDone;
@ -289,13 +266,8 @@ fcnDone:
* As advertised.
*------------------------------------------------------------------------*/
int SRXAFSCB_GetLock (a_call, a_index, a_result)
struct rx_call *a_call;
afs_int32 a_index;
struct AFSDBLock *a_result;
{ /*SRXAFSCB_GetLock*/
int SRXAFSCB_GetLock (struct rx_call *a_call, afs_int32 a_index, struct AFSDBLock *a_result)
{
struct ltable *tl; /*Ptr to lock table entry*/
int nentries; /*Num entries in table*/
int code; /*Return code*/
@ -365,14 +337,13 @@ int SRXAFSCB_GetLock (a_call, a_index, a_result)
*
* Side Effects:
* As advertised.
Appears to need to be called with GLOCK held, as the icl_Event4 stuff asserts otherwise
*------------------------------------------------------------------------*/
static ClearCallBack(a_conn, a_fid)
register struct rx_connection *a_conn;
register struct AFSFid *a_fid;
{ /*ClearCallBack*/
static int ClearCallBack(register struct rx_connection *a_conn, register struct AFSFid *a_fid)
{
register struct vcache *tvc;
register int i;
struct VenusFid localFid;
@ -380,6 +351,8 @@ static ClearCallBack(a_conn, a_fid)
AFS_STATCNT(ClearCallBack);
AFS_ASSERT_GLOCK();
/*
* XXXX Don't hold any server locks here because of callback protocol XXX
*/
@ -400,7 +373,7 @@ static ClearCallBack(a_conn, a_fid)
for (i = 0; i < VCSIZE; i++)
for (tvc = afs_vhashT[i]; tvc; tvc = tvc->hnext) {
if (tvc->fid.Fid.Volume == a_fid->Volume) {
tvc->callback = (struct server *)0;
tvc->callback = NULL;
tvc->quick.stamp = 0;
if (!localFid.Cell)
localFid.Cell = tvc->fid.Cell;
@ -451,7 +424,7 @@ static ClearCallBack(a_conn, a_fid)
if (tvc->fid.Fid.Vnode == a_fid->Vnode
&& tvc->fid.Fid.Volume == a_fid->Volume
&& tvc->fid.Fid.Unique == a_fid->Unique ) {
tvc->callback = (struct server *)0;
tvc->callback = NULL;
tvc->quick.stamp = 0;
tvc->h1.dchint = NULL; /* invalidate hints */
ObtainWriteLock(&afs_xcbhash, 450);
@ -504,13 +477,8 @@ static ClearCallBack(a_conn, a_fid)
* As advertised.
*------------------------------------------------------------------------*/
int SRXAFSCB_CallBack(a_call, a_fids, a_callbacks)
struct rx_call *a_call;
register struct AFSCBFids *a_fids;
struct AFSCBs *a_callbacks;
{ /*SRXAFSCB_CallBack*/
int SRXAFSCB_CallBack(struct rx_call *a_call, register struct AFSCBFids *a_fids, struct AFSCBs *a_callbacks)
{
register int i; /*Loop variable*/
struct AFSFid *tfid; /*Ptr to current fid*/
register struct rx_connection *tconn; /*Call's connection*/
@ -522,7 +490,7 @@ int SRXAFSCB_CallBack(a_call, a_fids, a_callbacks)
XSTATS_START_CMTIME(AFS_STATS_CM_RPCIDX_CALLBACK);
AFS_STATCNT(SRXAFSCB_CallBack);
if (!(tconn = rx_ConnectionOf(a_call))) return;
if (!(tconn = rx_ConnectionOf(a_call))) return(0);
tfid = (struct AFSFid *) a_fids->AFSCBFids_val;
/*
@ -562,10 +530,8 @@ int SRXAFSCB_CallBack(a_call, a_fids, a_callbacks)
* As advertised.
*------------------------------------------------------------------------*/
int SRXAFSCB_Probe(a_call)
struct rx_call *a_call;
{ /*SRXAFSCB_Probe*/
int SRXAFSCB_Probe(struct rx_call *a_call)
{
int code = 0;
XSTATS_DECLS;
@ -602,18 +568,14 @@ int SRXAFSCB_Probe(a_call)
* As advertised.
*------------------------------------------------------------------------*/
int SRXAFSCB_InitCallBackState(a_call)
struct rx_call *a_call;
{ /*SRXAFSCB_InitCallBackState*/
int SRXAFSCB_InitCallBackState(struct rx_call *a_call)
{
register int i;
register struct vcache *tvc;
register struct rx_connection *tconn;
register struct rx_peer *peer;
struct server *ts;
int code = 0;
extern int osi_dnlc_purge();
XSTATS_DECLS;
RX_AFS_GLOCK();
@ -637,7 +599,7 @@ int SRXAFSCB_InitCallBackState(a_call)
if (tvc->callback == ts) {
ObtainWriteLock(&afs_xcbhash, 451);
afs_DequeueCallback(tvc);
tvc->callback = (struct server *)0;
tvc->callback = NULL;
tvc->states &= ~(CStatd | CUnique | CBulkFetching);
ReleaseWriteLock(&afs_xcbhash);
}
@ -691,11 +653,8 @@ int SRXAFSCB_InitCallBackState(a_call)
* As advertised.
*------------------------------------------------------------------------*/
int SRXAFSCB_XStatsVersion(a_call, a_versionP)
struct rx_call *a_call;
afs_int32 *a_versionP;
{ /*SRXAFSCB_XStatsVersion*/
int SRXAFSCB_XStatsVersion(struct rx_call *a_call, afs_int32 *a_versionP)
{
int code=0;
XSTATS_DECLS;
@ -740,16 +699,10 @@ int SRXAFSCB_XStatsVersion(a_call, a_versionP)
* As advertised.
*------------------------------------------------------------------------*/
int SRXAFSCB_GetXStats(a_call, a_clientVersionNum, a_collectionNumber, a_srvVersionNumP, a_timeP, a_dataP)
struct rx_call *a_call;
afs_int32 a_clientVersionNum;
afs_int32 a_collectionNumber;
afs_int32 *a_srvVersionNumP;
afs_int32 *a_timeP;
AFSCB_CollData *a_dataP;
{ /*SRXAFSCB_GetXStats*/
int SRXAFSCB_GetXStats(struct rx_call *a_call, afs_int32 a_clientVersionNum,
afs_int32 a_collectionNumber, afs_int32 *a_srvVersionNumP,
afs_int32 *a_timeP, AFSCB_CollData *a_dataP)
{
register int code; /*Return value*/
afs_int32 *dataBuffP; /*Ptr to data to be returned*/
afs_int32 dataBytes; /*Bytes in data buffer*/
@ -776,7 +729,7 @@ int SRXAFSCB_GetXStats(a_call, a_clientVersionNum, a_collectionNumber, a_srvVers
* no data.
*/
a_dataP->AFSCB_CollData_len = 0;
a_dataP->AFSCB_CollData_val = (afs_int32 *)0;
a_dataP->AFSCB_CollData_val = NULL;
#else
switch(a_collectionNumber) {
case AFSCB_XSTATSCOLL_CALL_INFO:
@ -842,7 +795,7 @@ int SRXAFSCB_GetXStats(a_call, a_clientVersionNum, a_collectionNumber, a_srvVers
* Illegal collection number.
*/
a_dataP->AFSCB_CollData_len = 0;
a_dataP->AFSCB_CollData_val = (afs_int32 *)0;
a_dataP->AFSCB_CollData_val = NULL;
code = 1;
} /*Switch on collection number*/
#endif /* AFS_NOSTATS */
@ -875,9 +828,8 @@ int SRXAFSCB_GetXStats(a_call, a_clientVersionNum, a_collectionNumber, a_srvVers
* As advertised.
*------------------------------------------------------------------------*/
int afs_RXCallBackServer()
{ /*afs_RXCallBackServer*/
int afs_RXCallBackServer(void)
{
AFS_STATCNT(afs_RXCallBackServer);
while (1) {
@ -914,12 +866,8 @@ int afs_RXCallBackServer()
* As advertised.
*------------------------------------------------------------------------*/
int shutdown_CB()
{ /*shutdown_CB*/
extern int afs_cold_shutdown;
int shutdown_CB(void)
{
AFS_STATCNT(shutdown_CB);
if (afs_cold_shutdown) {
@ -951,9 +899,7 @@ int shutdown_CB()
* None
*------------------------------------------------------------------------*/
int SRXAFSCB_InitCallBackState2(a_call, addr)
struct rx_call *a_call;
struct interfaceAddr * addr;
int SRXAFSCB_InitCallBackState2(struct rx_call *a_call, struct interfaceAddr *addr)
{
return RXGEN_OPCODE;
}
@ -982,9 +928,7 @@ struct interfaceAddr * addr;
* As advertised.
*------------------------------------------------------------------------*/
int SRXAFSCB_WhoAreYou(a_call, addr)
struct rx_call *a_call;
struct interfaceAddr *addr;
int SRXAFSCB_WhoAreYou(struct rx_call *a_call, struct interfaceAddr *addr)
{
int i;
int code = 0;
@ -1033,9 +977,7 @@ struct interfaceAddr *addr;
* As advertised.
*------------------------------------------------------------------------*/
int SRXAFSCB_InitCallBackState3(a_call, a_uuid)
struct rx_call *a_call;
afsUUID *a_uuid;
int SRXAFSCB_InitCallBackState3(struct rx_call *a_call, afsUUID *a_uuid)
{
int code;
@ -1071,9 +1013,7 @@ afsUUID *a_uuid;
* As advertised.
*------------------------------------------------------------------------*/
int SRXAFSCB_ProbeUuid(a_call, a_uuid)
struct rx_call *a_call;
afsUUID *a_uuid;
int SRXAFSCB_ProbeUuid(struct rx_call *a_call, afsUUID *a_uuid)
{
int code = 0;
XSTATS_DECLS;
@ -1115,11 +1055,8 @@ afsUUID *a_uuid;
* As advertised.
*------------------------------------------------------------------------*/
int SRXAFSCB_GetServerPrefs(
struct rx_call *a_call,
afs_int32 a_index,
afs_int32 *a_srvr_addr,
afs_int32 *a_srvr_rank)
int SRXAFSCB_GetServerPrefs(struct rx_call *a_call, afs_int32 a_index,
afs_int32 *a_srvr_addr, afs_int32 *a_srvr_rank)
{
int i, j;
struct srvAddr *sa;
@ -1171,15 +1108,11 @@ int SRXAFSCB_GetServerPrefs(
* As advertised.
*------------------------------------------------------------------------*/
int SRXAFSCB_GetCellServDB(
struct rx_call *a_call,
afs_int32 a_index,
char **a_name,
serverList *a_hosts)
int SRXAFSCB_GetCellServDB(struct rx_call *a_call, afs_int32 a_index,
char **a_name, serverList *a_hosts)
{
afs_int32 i, j;
struct cell *tcell;
struct afs_q *cq, *tq;
char *t_name, *p_name = NULL;
RX_AFS_GLOCK();
@ -1241,9 +1174,7 @@ int SRXAFSCB_GetCellServDB(
* As advertised.
*------------------------------------------------------------------------*/
int SRXAFSCB_GetLocalCell(
struct rx_call *a_call,
char **a_name)
int SRXAFSCB_GetLocalCell(struct rx_call *a_call, char **a_name)
{
int plen;
struct cell *tcell;
@ -1309,10 +1240,8 @@ int SRXAFSCB_GetLocalCell(
*
* Returns void.
*/
static void afs_MarshallCacheConfig(
afs_uint32 callerVersion,
cm_initparams_v1 *config,
afs_uint32 *ptr)
static void afs_MarshallCacheConfig(afs_uint32 callerVersion,
cm_initparams_v1 *config, afs_uint32 *ptr)
{
AFS_STATCNT(afs_MarshallCacheConfig);
/*
@ -1327,7 +1256,6 @@ static void afs_MarshallCacheConfig(
*(ptr++) = config->cacheSize;
*(ptr++) = config->setTime;
*(ptr++) = config->memCache;
}
@ -1356,12 +1284,8 @@ static void afs_MarshallCacheConfig(
* As advertised.
*------------------------------------------------------------------------*/
int SRXAFSCB_GetCacheConfig(
struct rx_call *a_call,
afs_uint32 callerVersion,
afs_uint32 *serverVersion,
afs_uint32 *configCount,
cacheConfig *config)
int SRXAFSCB_GetCacheConfig(struct rx_call *a_call, afs_uint32 callerVersion,
afs_uint32 *serverVersion, afs_uint32 *configCount, cacheConfig *config)
{
afs_uint32 *t_config;
size_t allocsize;
@ -1426,13 +1350,8 @@ int SRXAFSCB_GetCacheConfig(
*
* Side Effects:
*------------------------------------------------------------------------*/
SRXAFSCB_FetchData(rxcall, Fid, Fd, Position, Length, TotalLength)
struct rx_call *rxcall;
struct AFSFid *Fid;
afs_int32 Fd;
afs_int64 Position;
afs_int64 Length;
afs_int64 *TotalLength;
int SRXAFSCB_FetchData(struct rx_call *rxcall, struct AFSFid *Fid, afs_int32 Fd,
afs_int64 Position, afs_int64 Length, afs_int64 *TotalLength)
{
return ENOSYS;
}
@ -1462,13 +1381,8 @@ SRXAFSCB_FetchData(rxcall, Fid, Fd, Position, Length, TotalLength)
* Side Effects:
* As advertised.
*------------------------------------------------------------------------*/
SRXAFSCB_StoreData(rxcall, Fid, Fd, Position, Length, TotalLength)
struct rx_call *rxcall;
struct AFSFid *Fid;
afs_int32 Fd;
afs_int64 Position;
afs_int64 Length;
afs_int64 *TotalLength;
int SRXAFSCB_StoreData(struct rx_call *rxcall, struct AFSFid *Fid, afs_int32 Fd,
afs_int64 Position, afs_int64 Length, afs_int64 *TotalLength)
{
return ENOSYS;
}

View File

@ -90,12 +90,8 @@ struct bucket {
struct afs_q head;
/* struct afs_lock lock; only if you want lots of locks... */
};
struct bucket cbHashT[CBHTSIZE];
static struct bucket cbHashT[CBHTSIZE];
struct afs_lock afs_xcbhash;
extern afs_int32 afs_cacheStats;
extern struct volume * afs_FindVolume();
extern unsigned int afs_paniconwarn;
void afs_FlushCBs();
/* afs_QueueCallback
* Takes a write-locked vcache pointer and a callback expiration time
@ -112,13 +108,8 @@ void afs_FlushCBs();
* NOTE: The caller must hold a write lock on afs_xcbhash
*/
void afs_QueueCallback(avc, atime, avp)
struct vcache *avc;
unsigned int atime;
struct volume *avp;
void afs_QueueCallback(struct vcache *avc, unsigned int atime, struct volume *avp)
{
struct vcache *list;
if (avp && (avp->expireTime < avc->cbExpires))
avp->expireTime = avc->cbExpires;
if (!(avc->callsort.next)) {
@ -141,8 +132,7 @@ return ;
*
* NOTE: The caller must hold a write lock on afs_xcbhash
*/
void afs_DequeueCallback(avc)
struct vcache *avc;
void afs_DequeueCallback(struct vcache *avc)
{
debugvc=avc;
@ -191,14 +181,12 @@ struct vcache *avc;
/* Sanity check on the callback queue. Allow for slop in the computation. */
#ifdef AFS_OSF_ENV
extern afs_int32 afs_maxvcount;
#define CBQ_LIMIT (afs_maxvcount + 10)
#else
#define CBQ_LIMIT (afs_cacheStats + afs_stats_cmperf.vcacheXAllocs + 10)
#endif
void afs_CheckCallbacks(secs)
unsigned int secs;
void afs_CheckCallbacks(unsigned int secs)
{
struct vcache *tvc;
register struct afs_q *tq;
@ -306,7 +294,7 @@ return;
* the floor, without giving them back to the server. It's ok, the server can
* deal with it, but it is a little bit rude.
*/
void afs_FlushCBs()
void afs_FlushCBs(void)
{
register int i;
register struct vcache *tvc;
@ -334,8 +322,7 @@ void afs_FlushCBs()
* the floor for a specific server, without giving them back to the server.
* It's ok, the server can deal with it, but it is a little bit rude.
*/
void afs_FlushServerCBs(srvp)
struct server *srvp;
void afs_FlushServerCBs(struct server *srvp)
{
register int i;
register struct vcache *tvc;
@ -364,8 +351,7 @@ struct server *srvp;
* called to initialize static and global variables associated with
* the Callback expiration management mechanism.
*/
void afs_InitCBQueue(doLockInit)
int doLockInit;
void afs_InitCBQueue(int doLockInit)
{
register int i;
@ -402,12 +388,10 @@ if (doLockInit)
* but weren't (say, if the server was down), they will be examined at every
* opportunity thereafter.
*/
int afs_BumpBase()
int afs_BumpBase(void)
{
afs_uint32 now;
int didbump;
struct vcache *tvca, *tvcb;
afs_int32 ttime;
u_int oldbase;
ObtainWriteLock(&afs_xcbhash,87);
@ -426,17 +410,3 @@ ReleaseWriteLock(&afs_xcbhash);
return didbump;
}

View File

@ -19,13 +19,7 @@
/* how many slots in the table */
#define CBHTSIZE 128
/* 7 is LOG2(slotlen) */
#define CBHash(t) (t>>7)
extern int afs_BumpBase();
extern void afs_InitCBQueue();
extern void afs_CheckCallbacks();
extern void afs_DequeueCallback();
extern void afs_QueueCallback();
#define CBHash(t) ((t)>>7)
#define CBQTOV(e) ((struct vcache *)(((char *) (e)) - (((char *)(&(((struct vcache *)(e))->callsort))) - ((char *)(e)))))

View File

@ -53,9 +53,9 @@ afs_uint32 afs_nextCellNum = 0x100;
struct cell *afs_rootcell = 0;
/* Handler waiting for request from client */
static char afs_AfsdbHandlerWait;
static int afs_AfsdbHandlerWait;
/* Client waiting for handler to become available or finish request */
static char afs_AfsdbLookupWait;
static int afs_AfsdbLookupWait;
/* Set to 1 when we've seen the userspace AFSDB process at least once */
char afs_AfsdbHandlerPresent = 0;
@ -77,9 +77,7 @@ char afs_AfsdbHandler_ReqPending = 0;
/* Handler sets Completed to 1 when it completes the client request */
char afs_AfsdbHandler_Completed = 0;
int afs_strcasecmp(s1, s2)
register char *s1, *s2;
int afs_strcasecmp(register char *s1, register char *s2)
{
while (*s1 && *s2) {
register char c1, c2;
@ -97,7 +95,7 @@ int afs_strcasecmp(s1, s2)
#ifdef AFS_AFSDB_ENV
void afs_StopAfsdb()
void afs_StopAfsdb(void)
{
if (afs_AfsdbHandlerPresent) {
afs_osi_Wakeup(&afs_AfsdbHandlerWait);
@ -107,10 +105,7 @@ void afs_StopAfsdb()
}
}
int afs_AfsdbHandler(acellName, acellNameLen, kernelMsg)
char *acellName;
int acellNameLen;
afs_int32 *kernelMsg;
int afs_AfsdbHandler(char *acellName, int acellNameLen, afs_int32 *kernelMsg)
{
/* afs_syscall_call() has already grabbed the global lock */
@ -165,11 +160,8 @@ int afs_AfsdbHandler(acellName, acellNameLen, kernelMsg)
#endif
int afs_GetCellHostsFromDns(acellName, acellHosts, timeout, realName)
char *acellName;
afs_int32 *acellHosts;
int *timeout;
char **realName;
int afs_GetCellHostsFromDns(char *acellName, afs_int32 *acellHosts,
int *timeout, char **realName)
{
#ifdef AFS_AFSDB_ENV
char grab_glock = 0;
@ -218,8 +210,7 @@ int afs_GetCellHostsFromDns(acellName, acellHosts, timeout, realName)
}
void afs_RefreshCell(ac)
register struct cell *ac;
void afs_RefreshCell(register struct cell *ac)
{
afs_int32 cellHosts[MAXCELLHOSTS];
char *realName = NULL;
@ -236,7 +227,7 @@ void afs_RefreshCell(ac)
goto done;
/* Refresh the DB servers for the real cell; other values stay the same. */
afs_NewCell(realName, cellHosts, 0, (char *) 0, 0, 0, timeout, (char *) 0);
afs_NewCell(realName, cellHosts, 0, NULL, 0, 0, timeout, NULL);
/* If this is an alias, update the alias entry too */
if (afs_strcasecmp(ac->cellName, realName)) {
@ -247,7 +238,7 @@ void afs_RefreshCell(ac)
tc = afs_FindCellByName(realName, READ_LOCK);
if (tc) {
afs_NewCell(ac->cellName, 0, CAlias, (char *) 0, 0, 0,
afs_NewCell(ac->cellName, 0, CAlias, NULL, 0, 0,
timeout, tc->cellName);
afs_PutCell(tc, READ_LOCK);
}
@ -259,9 +250,7 @@ done:
}
struct cell *afs_GetCellByName_Dns(acellName, locktype)
register char *acellName;
afs_int32 locktype;
struct cell *afs_GetCellByName_Dns(register char *acellName, afs_int32 locktype)
{
afs_int32 cellHosts[MAXCELLHOSTS];
char *realName = NULL;
@ -270,8 +259,8 @@ struct cell *afs_GetCellByName_Dns(acellName, locktype)
if (afs_GetCellHostsFromDns(acellName, cellHosts, &timeout, &realName))
goto bad;
if (afs_NewCell(realName, cellHosts, CNoSUID, (char *) 0, 0, 0,
timeout, (char *) 0))
if (afs_NewCell(realName, cellHosts, CNoSUID, NULL, 0, 0,
timeout, NULL))
goto bad;
/* If this is an alias, create an entry for it too */
@ -284,7 +273,7 @@ struct cell *afs_GetCellByName_Dns(acellName, locktype)
if (!tc)
goto bad;
if (afs_NewCell(acellName, 0, CAlias, (char *) 0, 0, 0,
if (afs_NewCell(acellName, 0, CAlias, NULL, 0, 0,
timeout, tc->cellName)) {
afs_PutCell(tc, READ_LOCK);
goto bad;
@ -300,13 +289,11 @@ struct cell *afs_GetCellByName_Dns(acellName, locktype)
bad:
if (realName)
afs_osi_Free(realName, strlen(realName) + 1);
return (struct cell *) 0;
return NULL;
}
struct cell *afs_FindCellByName(acellName, locktype)
register char *acellName;
afs_int32 locktype;
struct cell *afs_FindCellByName(register char *acellName, afs_int32 locktype)
{
register struct cell *tc;
register struct afs_q *cq, *tq;
@ -324,7 +311,7 @@ retry:
afs_RefreshCell(tc);
if ((tc->states & CAlias) && (didAlias == 0)) {
acellName = tc->realName;
if (!acellName) return (struct cell *) 0;
if (!acellName) return NULL;
didAlias = 1;
goto retry;
}
@ -333,27 +320,22 @@ retry:
}
ReleaseWriteLock(&afs_xcell);
return (struct cell *) 0;
} /*afs_FindCellByName*/
return NULL;
}
struct cell *afs_GetCellByName(acellName, locktype)
register char *acellName;
afs_int32 locktype;
struct cell *afs_GetCellByName(register char *acellName, afs_int32 locktype)
{
struct cell *tc;
tc = afs_FindCellByName(acellName, locktype);
if (!tc)
tc = afs_GetCellByName_Dns(acellName, locktype);
return tc;
} /*afs_GetCellByName*/
}
static struct cell *afs_GetCellInternal(acell, locktype, holdxcell)
register afs_int32 acell;
afs_int32 locktype;
int holdxcell;
static struct cell *afs_GetCellInternal(register afs_int32 acell,
afs_int32 locktype, int holdxcell)
{
register struct cell *tc;
register struct afs_q *cq, *tq;
@ -375,29 +357,23 @@ static struct cell *afs_GetCellInternal(acell, locktype, holdxcell)
}
if (holdxcell)
ReleaseWriteLock(&afs_xcell);
return (struct cell *) 0;
return NULL;
} /*afs_GetCell*/
}
struct cell *afs_GetCell(acell, locktype)
register afs_int32 acell;
afs_int32 locktype;
struct cell *afs_GetCell(register afs_int32 acell, afs_int32 locktype)
{
return afs_GetCellInternal(acell, locktype, 1);
}
/* This is only to be called if the caller is already holding afs_xcell */
struct cell *afs_GetCellNoLock(acell, locktype)
register afs_int32 acell;
afs_int32 locktype;
struct cell *afs_GetCellNoLock(register afs_int32 acell, afs_int32 locktype)
{
return afs_GetCellInternal(acell, locktype, 0);
}
struct cell *afs_GetCellByIndex(cellindex, locktype, refresh)
register afs_int32 cellindex;
afs_int32 locktype;
afs_int32 refresh;
struct cell *afs_GetCellByIndex(register afs_int32 cellindex,
afs_int32 locktype, afs_int32 refresh)
{
register struct cell *tc;
register struct afs_q *cq, *tq;
@ -415,15 +391,12 @@ struct cell *afs_GetCellByIndex(cellindex, locktype, refresh)
}
}
ReleaseWriteLock(&afs_xcell);
return (struct cell *) 0;
return NULL;
} /*afs_GetCellByIndex*/
}
struct cell *afs_GetRealCellByIndex(cellindex, locktype, refresh)
register afs_int32 cellindex;
afs_int32 locktype;
afs_int32 refresh;
struct cell *afs_GetRealCellByIndex(register afs_int32 cellindex, afs_int32 locktype, afs_int32 refresh)
{
register struct cell *tc;
register struct afs_q *cq, *tq;
@ -441,18 +414,12 @@ struct cell *afs_GetRealCellByIndex(cellindex, locktype, refresh)
}
}
ReleaseWriteLock(&afs_xcell);
return (struct cell *) 0;
return NULL;
} /*afs_GetRealCellByIndex*/
afs_int32 afs_NewCell(acellName, acellHosts, aflags, linkedcname, fsport, vlport, timeout, aliasFor)
int aflags;
char *acellName;
register afs_int32 *acellHosts;
char *linkedcname;
u_short fsport, vlport;
int timeout;
char *aliasFor;
afs_int32 afs_NewCell(char *acellName, register afs_int32 *acellHosts, int aflags,
char *linkedcname, u_short fsport, u_short vlport, int timeout, char *aliasFor)
{
register struct cell *tc, *tcl=0;
register afs_int32 i, newc=0, code=0;
@ -507,7 +474,7 @@ afs_int32 afs_NewCell(acellName, acellHosts, aflags, linkedcname, fsport, vlport
tc->cell = afs_nextCellNum++;
}
tc->states = 0;
tc->lcellp = (struct cell *)0;
tc->lcellp = NULL;
tc->fsport = (fsport ? fsport : AFS_FSPORT);
tc->vlport = (vlport ? vlport : AFS_VLPORT);
afs_stats_cmperf.numCellsVisible++;
@ -536,7 +503,7 @@ afs_int32 afs_NewCell(acellName, acellHosts, aflags, linkedcname, fsport, vlport
goto bad;
}
if (tcl->lcellp) { /* XXX Overwriting if one existed before! XXX */
tcl->lcellp->lcellp = (struct cell *)0;
tcl->lcellp->lcellp = NULL;
tcl->lcellp->states &= ~CLinkedCell;
}
tc->lcellp = tcl;
@ -585,10 +552,9 @@ bad:
}
ReleaseWriteLock(&afs_xcell);
return code;
}
} /*afs_NewCell*/
afs_RemoveCellEntry(struct server *srvp)
void afs_RemoveCellEntry(struct server *srvp)
{
struct cell *tc;
afs_int32 j, k;

View File

@ -26,13 +26,6 @@
#else /* AFS_NOCHUNKING */
extern afs_int32 afs_OtherCSize, afs_LogChunk, afs_FirstCSize;
#ifdef AFS_64BIT_CLIENT
#ifdef AFS_VM_RDWR_ENV
extern afs_size_t afs_vmMappingEnd;
#endif /* AFS_VM_RDWR_ENV */
#endif /* AFS_64BIT_CLIENT */
#define AFS_OTHERCSIZE (afs_OtherCSize)
#define AFS_LOGCHUNK (afs_LogChunk)
#define AFS_FIRSTCSIZE (afs_FirstCSize)
@ -45,19 +38,6 @@ extern afs_size_t afs_vmMappingEnd;
#define AFS_MINCHUNK 13 /* 8k is minimum */
#define AFS_MAXCHUNK 18 /* 256K is maximum */
#ifdef notdef
extern int afs_ChunkOffset(), afs_Chunk(), afs_ChunkBase(), afs_ChunkSize(),
afs_ChunkToBase(), afs_ChunkToSize();
/* macros */
#define AFS_CHUNKOFFSET(x) afs_ChunkOffset(x)
#define AFS_CHUNK(x) afs_Chunk(x)
#define AFS_CHUNKBASE(x) afs_ChunkBase(x)
#define AFS_CHUNKSIZE(x) afs_ChunkSize(x)
#define AFS_CHUNKTOBASE(x) afs_ChunkToBase(x)
#define AFS_CHUNKTOSIZE(x) afs_ChunkToSize(x)
#endif
#define AFS_CHUNKOFFSET(offset) ((offset < afs_FirstCSize) ? offset : \
((offset - afs_FirstCSize) & (afs_OtherCSize - 1)))
@ -79,28 +59,30 @@ extern int afs_ChunkOffset(), afs_Chunk(), afs_ChunkBase(), afs_ChunkSize(),
#define AFS_SETCHUNKSIZE(chunk) { afs_LogChunk = chunk; \
afs_FirstCSize = afs_OtherCSize = (1 << chunk); }
extern void afs_CacheTruncateDaemon();
/*
* Functions exported by a cache type
*/
extern struct afs_cacheOps *afs_cacheType;
struct afs_cacheOps {
void *(*open)();
int (*truncate)();
int (*fread)();
int (*fwrite)();
int (*close)();
int (*vread)();
int (*vwrite)();
int (*FetchProc)();
int (*StoreProc)();
struct dcache *(*GetDSlot)();
struct volume *(*GetVolSlot)();
int (*HandleLink)();
void *(*open)(afs_int32 ainode);
int (*truncate)(struct osi_file *fp, int len);
int (*fread)(struct osi_file *fp, int offset, char *buf, int len);
int (*fwrite)(struct osi_file *fp, int offset, char *buf, int len);
int (*close)(struct osi_file *fp);
int (*vread)(register struct vcache *avc, struct uio *auio,
struct AFS_UCRED *acred, daddr_t albn, struct buf **abpp, int noLock);
int (*vwrite)(register struct vcache *avc, struct uio *auio,
int aio, struct AFS_UCRED *acred, int noLock);
int (*FetchProc)(register struct rx_call *acall,
struct osi_file *afile, afs_size_t abase, struct dcache *adc,
struct vcache *avc, afs_size_t *abytesToXferP,
afs_size_t *abytesXferredP, afs_int32 lengthFound);
int (*StoreProc)(register struct rx_call *acall,
struct osi_file *afile, register afs_int32 alen, struct vcache *avc,
int *shouldWake, afs_size_t *abytesToXferP, afs_size_t *abytesXferredP);
struct dcache *(*GetDSlot)(register afs_int32 aslot, register struct dcache *tmpdc);
struct volume *(*GetVolSlot)(void);
int (*HandleLink)(register struct vcache *avc, struct vrequest *areq);
};
/* Ideally we should have used consistent naming - like COP_OPEN, COP_TRUNCATE, etc. */

View File

@ -42,33 +42,20 @@ RCSID("$Header$");
#include <inet/ip.h>
#endif
/* Imported variables */
/* these are for storing alternate interface addresses - from afs_callback.c */
extern struct interfaceAddr afs_cb_interface;
/* Imported functions. */
struct rx_securityClass *rxnull_NewClientSecurityObject();
struct rx_securityClass *rxkad_NewClientSecurityObject();
/* Exported variables */
afs_rwlock_t afs_xconn; /* allocation lock for new things */
afs_rwlock_t afs_xinterface; /* for multiple client address */
/* Local variables */
afs_int32 cryptall = 0;
afs_int32 cryptall = 0; /* encrypt all communications */
unsigned int VNOSERVERS = 0;
struct conn *afs_Conn(afid, areq, locktype)
register struct VenusFid *afid;
register struct vrequest *areq;
afs_int32 locktype;
struct conn *afs_Conn(register struct VenusFid *afid,
register struct vrequest *areq, afs_int32 locktype)
{
u_short fsport=AFS_FSPORT;
struct volume *tv;
struct conn *tconn = (struct conn *)0;
struct srvAddr *lowp= (struct srvAddr *)0;
struct conn *tconn = NULL;
struct srvAddr *lowp= NULL;
struct unixuser *tu;
int notbusy;
int i;
@ -81,7 +68,7 @@ struct conn *afs_Conn(afid, areq, locktype)
afs_FinalizeReq(areq);
areq->volumeError = 1;
}
return (struct conn *) 0;
return NULL;
}
if (tv->serverHost[0] && tv->serverHost[0]->cell) {
@ -148,7 +135,7 @@ struct conn *afs_ConnBySA(struct srvAddr *sap, unsigned short aport,
if (!sap || ((sap->sa_flags & SRVR_ISDOWN) && !force_if_down)) {
/* sa is known down, and we don't want to force it. */
return (struct conn *)0;
return NULL;
}
ObtainSharedLock(&afs_xconn,15);
@ -160,7 +147,7 @@ struct conn *afs_ConnBySA(struct srvAddr *sap, unsigned short aport,
if (!tc && !create) {
ReleaseSharedLock(&afs_xconn);
return (struct conn *)0;
return NULL;
}
if (!tc) {
@ -262,15 +249,9 @@ struct conn *afs_ConnBySA(struct srvAddr *sap, unsigned short aport,
* Having force... true and UTokensBad true simultaneously means that the tokens
* went bad and we're supposed to create a new, unauthenticated, connection.
*/
struct conn *afs_ConnByHost(aserver, aport, acell, areq, aforce, locktype)
struct server *aserver;
afs_int32 acell;
unsigned short aport;
struct vrequest *areq;
int aforce;
afs_int32 locktype;
{ /*afs_ConnByHost*/
struct conn *afs_ConnByHost(struct server *aserver, unsigned short aport,
afs_int32 acell, struct vrequest *areq, int aforce, afs_int32 locktype)
{
struct unixuser *tu;
struct conn *tc=0;
struct srvAddr *sa=0;
@ -308,12 +289,8 @@ struct conn *afs_ConnByHost(aserver, aport, acell, areq, aforce, locktype)
} /*afs_ConnByHost*/
struct conn *afs_ConnByMHosts(ahosts, aport, acell, areq, locktype)
struct server *ahosts[];
afs_int32 acell;
unsigned short aport;
register struct vrequest *areq;
afs_int32 locktype;
struct conn *afs_ConnByMHosts(struct server *ahosts[], unsigned short aport,
afs_int32 acell, register struct vrequest *areq, afs_int32 locktype)
{
register afs_int32 i;
register struct conn *tconn;
@ -322,21 +299,19 @@ struct conn *afs_ConnByMHosts(ahosts, aport, acell, areq, locktype)
/* try to find any connection from the set */
AFS_STATCNT(afs_ConnByMHosts);
for (i=0;i<MAXCELLHOSTS;i++) {
if ((ts = ahosts[i]) == (struct server *) 0) break;
if ((ts = ahosts[i]) == NULL) break;
tconn = afs_ConnByHost(ts, aport, acell,
areq, 0, locktype);
if (tconn) {
return tconn;
}
}
return (struct conn *) 0;
return NULL;
} /*afs_ConnByMHosts*/
void afs_PutConn(ac, locktype)
register struct conn *ac;
afs_int32 locktype;
void afs_PutConn(register struct conn *ac, afs_int32 locktype)
{
AFS_STATCNT(afs_PutConn);
ac->refCount--;
@ -347,8 +322,7 @@ void afs_PutConn(ac, locktype)
client network interface going down. We need to reopen new
connections in this case
*/
ForceNewConnections(sap)
struct srvAddr *sap;
void ForceNewConnections(struct srvAddr *sap)
{
struct conn *tc=0;

View File

@ -34,29 +34,22 @@ static int rxepoch_checked=0;
#define afs_CheckRXEpoch() {if (rxepoch_checked == 0 && rxkad_EpochWasSet) { \
rxepoch_checked = 1; afs_GCUserData(/* force flag */ 1); } }
extern char afs_rootVolumeName[];
extern struct vcache *afs_globalVp;
extern struct VenusFid afs_rootFid;
extern struct osi_dev cacheDev;
extern char *afs_indexFlags;
extern afs_rwlock_t afs_xvcache;
extern struct afs_exporter *afs_nfsexporter;
extern int cacheDiskType;
extern int afs_BumpBase();
extern void afs_CheckCallbacks();
/* PAG garbage collection */
/* We induce a compile error if param.h does not define AFS_GCPAGS */
afs_int32 afs_gcpags=AFS_GCPAGS;
afs_int32 afs_gcpags_procsize;
afs_int32 afs_CheckServerDaemonStarted = 0;
#ifdef DEFAULT_PROBE_INTERVAL
afs_int32 PROBE_INTERVAL=DEFAULT_PROBE_INTERVAL; /* overridding during compile */
#else
afs_int32 PROBE_INTERVAL=180; /* default to 3 min */
#endif
#define PROBE_WAIT() (1000 * (PROBE_INTERVAL - ((afs_random() & 0x7fffffff) \
% (PROBE_INTERVAL/2))))
afs_CheckServerDaemon()
int afs_CheckServerDaemon(void)
{
afs_int32 now, delay, lastCheck, last10MinCheck;
@ -75,13 +68,13 @@ afs_CheckServerDaemon()
now = osi_Time();
if (PROBE_INTERVAL + lastCheck <= now) {
afs_CheckServers(1, (struct cell *) 0); /* check down servers */
afs_CheckServers(1, NULL); /* check down servers */
lastCheck = now = osi_Time();
}
if (600 + last10MinCheck <= now) {
afs_Trace1(afs_iclSetp, CM_TRACE_PROBEUP, ICL_TYPE_INT32, 600);
afs_CheckServers(0, (struct cell *) 0);
afs_CheckServers(0, NULL);
last10MinCheck = now = osi_Time();
}
/* shutdown check. */
@ -103,9 +96,9 @@ afs_CheckServerDaemon()
afs_CheckServerDaemonStarted = 0;
}
void afs_Daemon() {
void afs_Daemon(void)
{
afs_int32 code;
extern struct afs_exporter *root_exported;
struct afs_exporter *exporter;
afs_int32 now;
afs_int32 last3MinCheck, last10MinCheck, last60MinCheck, lastNMinCheck;
@ -186,7 +179,7 @@ void afs_Daemon() {
}
if (lastNMinCheck + PROBE_INTERVAL < now) {
/* only check down servers */
afs_CheckServers(1, (struct cell *) 0);
afs_CheckServers(1, NULL);
lastNMinCheck = now;
}
}
@ -206,7 +199,7 @@ void afs_Daemon() {
}
#endif /* else AFS_USERSPACE_IP_ADDR */
if (!afs_CheckServerDaemonStarted)
afs_CheckServers(0, (struct cell *) 0);
afs_CheckServers(0, NULL);
afs_GCUserData(0); /* gc old conns */
/* This is probably the wrong way of doing GC for the various exporters but it will suffice for a while */
for (exporter = root_exported; exporter; exporter = exporter->exp_next) {
@ -266,7 +259,8 @@ void afs_Daemon() {
}
}
afs_CheckRootVolume () {
int afs_CheckRootVolume (void)
{
char rootVolName[32];
register struct volume *tvp;
int usingDynroot = afs_GetDynrootEnable();
@ -280,9 +274,9 @@ afs_CheckRootVolume () {
}
if (usingDynroot) {
afs_GetDynrootFid(&afs_rootFid);
tvp = afs_GetVolume(&afs_rootFid, (struct vrequest *) 0, READ_LOCK);
tvp = afs_GetVolume(&afs_rootFid, NULL, READ_LOCK);
} else {
tvp = afs_GetVolumeByName(rootVolName, LOCALCELL, 1, (struct vrequest *) 0, READ_LOCK);
tvp = afs_GetVolumeByName(rootVolName, LOCALCELL, 1, NULL, READ_LOCK);
}
if (!tvp) {
char buf[128];
@ -291,7 +285,7 @@ afs_CheckRootVolume () {
if ((len < 9) || strcmp(&rootVolName[len - 9], ".readonly")) {
strcpy(buf, rootVolName);
afs_strcat(buf, ".readonly");
tvp = afs_GetVolumeByName(buf, LOCALCELL, 1, (struct vrequest *) 0, READ_LOCK);
tvp = afs_GetVolumeByName(buf, LOCALCELL, 1, NULL, READ_LOCK);
}
}
if (tvp) {
@ -322,8 +316,6 @@ afs_CheckRootVolume () {
/* This is to make sure that we update the root gnode */
/* every time root volume gets released */
{
extern struct vfs *afs_globalVFS;
extern int afs_root();
struct gnode *rootgp;
struct mount *mp;
int code;
@ -348,11 +340,11 @@ afs_CheckRootVolume () {
}
/* ptr_parm 0 is the pathname, size_parm 0 to the fetch is the chunk number */
void BPath(ab)
register struct brequest *ab; {
register struct dcache *tdc;
struct vcache *tvc;
struct vnode *tvn;
static void BPath(register struct brequest *ab)
{
register struct dcache *tdc = NULL;
struct vcache *tvc = NULL;
struct vnode *tvn = NULL;
#ifdef AFS_LINUX22_ENV
struct dentry *dp = NULL;
#endif
@ -361,14 +353,14 @@ void BPath(ab)
afs_int32 code;
AFS_STATCNT(BPath);
if (code = afs_InitReq(&treq, ab->cred)) return;
if ((code = afs_InitReq(&treq, ab->cred))) return;
AFS_GUNLOCK();
#ifdef AFS_LINUX22_ENV
code = gop_lookupname((char *)ab->ptr_parm[0], AFS_UIOSYS, 1, (struct vnode **) 0, &dp);
code = gop_lookupname((char *)ab->ptr_parm[0], AFS_UIOSYS, 1, NULL, &dp);
if (dp)
tvn = (struct vnode*)dp->d_inode;
#else
code = gop_lookupname((char *)ab->ptr_parm[0], AFS_UIOSYS, 1, (struct vnode **) 0, (struct vnode **)&tvn);
code = gop_lookupname((char *)ab->ptr_parm[0], AFS_UIOSYS, 1, NULL, (struct vnode **)&tvn);
#endif
AFS_GLOCK();
osi_FreeLargeSpace((char *)ab->ptr_parm[0]); /* free path name buffer here */
@ -414,15 +406,15 @@ void BPath(ab)
* ptr_parm 0 is the dcache entry to wakeup,
* size_parm 1 is true iff we should release the dcache entry here.
*/
void BPrefetch(ab)
register struct brequest *ab; {
static void BPrefetch(register struct brequest *ab)
{
register struct dcache *tdc;
register struct vcache *tvc;
afs_size_t offset, len;
struct vrequest treq;
AFS_STATCNT(BPrefetch);
if (len = afs_InitReq(&treq, ab->cred)) return;
if ((len = afs_InitReq(&treq, ab->cred))) return;
tvc = ab->vnode;
tdc = afs_GetDCache(tvc, ab->size_parm[0], &treq, &offset, &len, 1);
if (tdc) {
@ -448,8 +440,8 @@ void BPrefetch(ab)
}
void BStore(ab)
register struct brequest *ab; {
static void BStore(register struct brequest *ab)
{
register struct vcache *tvc;
register afs_int32 code;
struct vrequest treq;
@ -458,7 +450,7 @@ void BStore(ab)
#endif
AFS_STATCNT(BStore);
if (code = afs_InitReq(&treq, ab->cred)) return;
if ((code = afs_InitReq(&treq, ab->cred))) return;
code = 0;
tvc = ab->vnode;
#if defined(AFS_SGI_ENV)
@ -496,8 +488,8 @@ void BStore(ab)
}
/* release a held request buffer */
void afs_BRelease(ab)
register struct brequest *ab; {
void afs_BRelease(register struct brequest *ab)
{
AFS_STATCNT(afs_BRelease);
MObtainWriteLock(&afs_xbrs,294);
@ -509,19 +501,16 @@ void afs_BRelease(ab)
}
/* return true if bkg fetch daemons are all busy */
int afs_BBusy() {
int afs_BBusy(void)
{
AFS_STATCNT(afs_BBusy);
if (afs_brsDaemons > 0) return 0;
return 1;
}
struct brequest *afs_BQueue(aopcode, avc, dontwait, ause, acred, asparm0, asparm1, apparm0)
register short aopcode;
afs_int32 ause, dontwait;
register struct vcache *avc;
struct AFS_UCRED *acred;
afs_size_t asparm0, asparm1;
void *apparm0;
struct brequest *afs_BQueue(register short aopcode, register struct vcache *avc,
afs_int32 dontwait, afs_int32 ause, struct AFS_UCRED *acred,
afs_size_t asparm0, afs_size_t asparm1, void *apparm0)
{
register int i;
register struct brequest *tb;
@ -562,7 +551,7 @@ struct brequest *afs_BQueue(aopcode, avc, dontwait, ause, acred, asparm0, asparm
}
if (dontwait) {
MReleaseWriteLock(&afs_xbrs);
return (struct brequest *)0;
return NULL;
}
/* no free buffers, sleep a while */
afs_brsWaiters++;
@ -611,7 +600,7 @@ afs_int32 afs_biodcnt = 0;
Simple_lock afs_asyncbuf_lock;
/*static*/ struct buf *afs_get_bioreq()
{
struct buf *bp = (struct buf *) 0;
struct buf *bp = NULL;
struct buf *bestbp;
struct buf **bestlbpP, **lbpP;
int bestage, stop;
@ -719,8 +708,7 @@ Simple_lock afs_asyncbuf_lock;
*/
static int afs_initbiod = 0; /* this is self-initializing code */
int DOvmlock = 0;
afs_BioDaemon (nbiods)
afs_int32 nbiods;
int afs_BioDaemon (afs_int32 nbiods)
{
afs_int32 code, s, pflg = 0;
label_t jmpbuf;
@ -898,7 +886,7 @@ afs_int32 afs_biodcnt = 0;
struct afs_bioqueue *self; /* address on which to sleep */
{
struct buf *bp = (struct buf *) 0;
struct buf *bp = NULL;
struct buf *bestbp;
struct buf **bestlbpP, **lbpP;
int bestage, stop;
@ -1192,10 +1180,10 @@ if (DOvmlock)
int afs_nbrs = 0;
void afs_BackgroundDaemon() {
void afs_BackgroundDaemon(void)
{
struct brequest *tb;
int i, foundAny;
afs_int32 pid;
AFS_STATCNT(afs_BackgroundDaemon);
/* initialize subsystem */
@ -1242,7 +1230,7 @@ void afs_BackgroundDaemon() {
}
}
}
if (tb = min_tb) {
if ((tb = min_tb)) {
/* claim and process this request */
tb->flags |= BSTARTED;
MReleaseWriteLock(&afs_xbrs);
@ -1262,7 +1250,7 @@ void afs_BackgroundDaemon() {
#else
AFS_RELE((struct vnode *)(tb->vnode)); /* MUST call vnode layer or could lose vnodes */
#endif
tb->vnode = (struct vcache *) 0;
tb->vnode = NULL;
}
if (tb->cred) {
crfree(tb->cred);
@ -1283,12 +1271,8 @@ void afs_BackgroundDaemon() {
}
void shutdown_daemons()
void shutdown_daemons(void)
{
extern int afs_cold_shutdown;
register int i;
register struct brequest *tb;
AFS_STATCNT(shutdown_daemons);
if (afs_cold_shutdown) {
afs_brsDaemons = brsInit = 0;
@ -1325,8 +1309,7 @@ SV_TYPE afs_sgibkwait;
lock_t afs_sgibklock;
struct dcache *afs_sgibklist;
int
afs_sgidaemon(void)
int afs_sgidaemon(void)
{
int s;
struct dcache *tdc;

View File

@ -27,13 +27,6 @@ static void afs_FreeDiscardedDCache(void);
static void afs_DiscardDCache(struct dcache *);
static void afs_FreeDCache(struct dcache *);
/* Imported variables */
extern afs_rwlock_t afs_xvcache;
extern afs_rwlock_t afs_xcbhash;
extern afs_int32 afs_mariner;
extern afs_int32 cacheInfoModTime; /*Last time cache info modified*/
/*
* --------------------- Exported definitions ---------------------
*/
@ -95,8 +88,8 @@ extern struct dcache *afs_UFSGetDSlot();
extern struct volume *afs_UFSGetVolSlot();
extern int osi_UFSTruncate(), afs_osi_Read(), afs_osi_Write(), osi_UFSClose();
extern int afs_UFSRead(), afs_UFSWrite();
static int afs_UFSCacheFetchProc(), afs_UFSCacheStoreProc();
extern int afs_UFSHandleLink();
static int afs_UFSCacheFetchProc(), afs_UFSCacheStoreProc();
struct afs_cacheOps afs_UfsCacheOps = {
osi_UFSOpen,
osi_UFSTruncate,
@ -112,12 +105,6 @@ struct afs_cacheOps afs_UfsCacheOps = {
afs_UFSHandleLink,
};
extern void *afs_MemCacheOpen();
extern struct dcache *afs_MemGetDSlot();
extern struct volume *afs_MemGetVolSlot();
extern int afs_MemCacheTruncate(), afs_MemReadBlk(), afs_MemWriteBlk(), afs_MemCacheClose();
extern int afs_MemRead(), afs_MemWrite(), afs_MemCacheFetchProc(), afs_MemCacheStoreProc();
extern int afs_MemHandleLink();
struct afs_cacheOps afs_MemCacheOps = {
afs_MemCacheOpen,
afs_MemCacheTruncate,
@ -156,14 +143,8 @@ struct afs_cacheOps *afs_cacheType;
* Call this from close call when vnodeops is RCS unlocked.
*/
void
afs_StoreWarn(acode, avolume, aflags)
register afs_int32 acode;
afs_int32 avolume;
register afs_int32 aflags;
{ /*afs_StoreWarn*/
void afs_StoreWarn(register afs_int32 acode, afs_int32 avolume, register afs_int32 aflags)
{
static char problem_fmt[] =
"afs: failed to store file in volume %d (%s)\n";
static char problem_fmt_w_error[] =
@ -171,7 +152,6 @@ afs_StoreWarn(acode, avolume, aflags)
static char netproblems[] = "network problems";
static char partfull[] = "partition full";
static char overquota[] = "over quota";
static char unknownerr[] = "unknown error";
AFS_STATCNT(afs_StoreWarn);
if (acode < 0) {
@ -219,21 +199,22 @@ afs_StoreWarn(acode, avolume, aflags)
}
} /*afs_StoreWarn*/
void afs_MaybeWakeupTruncateDaemon() {
void afs_MaybeWakeupTruncateDaemon(void)
{
if (!afs_CacheTooFull && afs_CacheIsTooFull()) {
afs_CacheTooFull = 1;
if (!afs_TruncateDaemonRunning)
afs_osi_Wakeup((char *)afs_CacheTruncateDaemon);
afs_osi_Wakeup((int *)afs_CacheTruncateDaemon);
} else if (!afs_TruncateDaemonRunning &&
afs_blocksDiscarded > CM_MAXDISCARDEDCHUNKS) {
afs_osi_Wakeup((char *)afs_CacheTruncateDaemon);
afs_osi_Wakeup((int *)afs_CacheTruncateDaemon);
}
}
/* Keep statistics on run time for afs_CacheTruncateDaemon. This is a
* struct so we need only export one symbol for AIX.
*/
struct CTD_stats {
static struct CTD_stats {
osi_timeval_t CTD_beforeSleep;
osi_timeval_t CTD_afterSleep;
osi_timeval_t CTD_sleepTime;
@ -242,7 +223,8 @@ struct CTD_stats {
} CTD_stats;
u_int afs_min_cache = 0;
void afs_CacheTruncateDaemon() {
void afs_CacheTruncateDaemon(void)
{
osi_timeval_t CTD_tmpTime;
u_int counter;
u_int cb_lowat;
@ -308,7 +290,7 @@ void afs_CacheTruncateDaemon() {
afs_stats_AddTo(CTD_stats.CTD_runTime, CTD_tmpTime);
afs_TruncateDaemonRunning = 0;
afs_osi_Sleep((char *)afs_CacheTruncateDaemon);
afs_osi_Sleep((int *)afs_CacheTruncateDaemon);
afs_TruncateDaemonRunning = 1;
osi_GetuTime(&CTD_stats.CTD_afterSleep);
@ -345,13 +327,8 @@ void afs_CacheTruncateDaemon() {
* anewsize : New size desired.
*/
void
afs_AdjustSize(adc, newSize)
register struct dcache *adc;
register afs_int32 newSize;
{ /*afs_AdjustSize*/
void afs_AdjustSize(register struct dcache *adc, register afs_int32 newSize)
{
register afs_int32 oldSize;
AFS_STATCNT(afs_AdjustSize);
@ -366,11 +343,7 @@ afs_AdjustSize(adc, newSize)
}
afs_blocksUsed += (newSize - oldSize);
afs_stats_cmperf.cacheBlocksInUse = afs_blocksUsed; /* XXX */
} /*afs_AdjustSize*/
}
/*
@ -521,7 +494,7 @@ static void afs_GetDownD(int anumber, int *aneedSpace)
/* xdcache is lower than the xvcache lock */
MReleaseWriteLock(&afs_xdcache);
MObtainReadLock(&afs_xvcache);
tvc = afs_FindVCache(afid, 0,0, 0, 0 /* no stats, no vlru */ );
tvc = afs_FindVCache(afid, 0, 0 /* no stats, no vlru */ );
MReleaseReadLock(&afs_xvcache);
MObtainWriteLock(&afs_xdcache, 527);
skip = 0;
@ -691,11 +664,8 @@ endmultipage:
*
* Locks: Must have the afs_xdcache lock write-locked to call this function.
*/
afs_HashOutDCache(adc)
struct dcache *adc;
{ /*afs_HashOutDCache*/
int afs_HashOutDCache(struct dcache *adc)
{
int i, us;
#ifndef AFS_DEC_ENV
@ -774,11 +744,8 @@ afs_HashOutDCache(adc)
* (in write mode)
*/
void
afs_FlushDCache(adc)
register struct dcache *adc;
{ /*afs_FlushDCache*/
void afs_FlushDCache(register struct dcache *adc)
{
AFS_STATCNT(afs_FlushDCache);
/*
* Bump the number of cache files flushed.
@ -819,8 +786,7 @@ register struct dcache *adc;
*
* Environment: called with afs_xdcache lock write-locked.
*/
static void afs_FreeDCache(adc)
register struct dcache *adc;
static void afs_FreeDCache(register struct dcache *adc)
{
/* Thread on free list, update free list count and mark entry as
* freed in its indexFlags element. Also, ensure DCache entry gets
@ -862,12 +828,8 @@ static void afs_FreeDCache(adc)
* Must be called with afs_xdcache write-locked.
*/
static void
afs_DiscardDCache(adc)
register struct dcache *adc;
{ /*afs_DiscardDCache*/
static void afs_DiscardDCache(register struct dcache *adc)
{
register afs_int32 size;
AFS_STATCNT(afs_DiscardDCache);
@ -902,8 +864,7 @@ afs_DiscardDCache(adc)
* Description:
* Free the next element on the list of discarded cache elements.
*/
static void
afs_FreeDiscardedDCache()
static void afs_FreeDiscardedDCache(void)
{
register struct dcache *tdc;
register struct osi_file *tfile;
@ -963,7 +924,7 @@ afs_FreeDiscardedDCache()
* Parameters:
* None
*/
afs_MaybeFreeDiscardedDCache()
int afs_MaybeFreeDiscardedDCache(void)
{
AFS_STATCNT(afs_MaybeFreeDiscardedDCache);
@ -987,19 +948,8 @@ afs_MaybeFreeDiscardedDCache()
* Environment:
* Must be called with afs_xdcache write-locked.
*/
#if defined(AFS_SGI_ENV) && defined(AFS_SGI_SHORTSTACK)
extern SV_TYPE afs_sgibksync;
extern SV_TYPE afs_sgibkwait;
extern lock_t afs_sgibklock;
extern struct dcache *afs_sgibklist;
#endif
static void
afs_GetDownDSlot(anumber)
int anumber;
{ /*afs_GetDownDSlot*/
static void afs_GetDownDSlot(int anumber)
{
struct afs_q *tq, *nq;
struct dcache *tdc;
int ix;
@ -1065,7 +1015,7 @@ afs_GetDownDSlot(anumber)
/* finally put the entry in the free list */
afs_indexTable[ix] = (struct dcache *) 0;
afs_indexTable[ix] = NULL;
afs_indexFlags[ix] &= ~IFEverUsed;
tdc->index = NULLIDX;
tdc->lruq.next = (struct afs_q *) afs_freeDSList;
@ -1091,8 +1041,7 @@ afs_GetDownDSlot(anumber)
* Environment:
* Nothing interesting.
*/
afs_RefDCache(adc)
struct dcache *adc;
int afs_RefDCache(struct dcache *adc)
{
ObtainWriteLock(&adc->tlock, 627);
if (adc->refCount < 0)
@ -1115,10 +1064,8 @@ afs_RefDCache(adc)
* Environment:
* Nothing interesting.
*/
afs_PutDCache(adc)
register struct dcache *adc;
{ /*afs_PutDCache*/
int afs_PutDCache(register struct dcache *adc)
{
AFS_STATCNT(afs_PutDCache);
ObtainWriteLock(&adc->tlock, 276);
if (adc->refCount <= 0)
@ -1126,8 +1073,7 @@ afs_PutDCache(adc)
--adc->refCount;
ReleaseWriteLock(&adc->tlock);
return 0;
} /*afs_PutDCache*/
}
/*
@ -1143,13 +1089,9 @@ afs_PutDCache(adc)
* Environment:
* Both pvnLock and lock are write held.
*/
void
afs_TryToSmush(avc, acred, sync)
register struct vcache *avc;
struct AFS_UCRED *acred;
int sync;
{ /*afs_TryToSmush*/
void afs_TryToSmush(register struct vcache *avc, struct AFS_UCRED *acred,
int sync)
{
register struct dcache *tdc;
register int index;
register int i;
@ -1176,7 +1118,7 @@ afs_TryToSmush(avc, acred, sync)
i = afs_dvnextTbl[index]; /* next pointer this hash table */
if (afs_indexUnique[index] == avc->fid.Fid.Unique) {
int releaseTlock = 1;
tdc = afs_GetDSlot(index, (struct dcache *)0);
tdc = afs_GetDSlot(index, NULL);
if (!FidCmp(&tdc->f.fid, &avc->fid)) {
if (sync) {
if ((afs_indexFlags[index] & IFDataMod) == 0 &&
@ -1206,7 +1148,7 @@ afs_TryToSmush(avc, acred, sync)
* trytoSmush occured during the lookup call
*/
afs_allCBs++;
} /*afs_TryToSmush*/
}
/*
* afs_FindDCache
@ -1228,12 +1170,8 @@ afs_TryToSmush(avc, acred, sync)
* The vcache entry is held upon entry.
*/
struct dcache *afs_FindDCache(avc, abyte)
register struct vcache *avc;
afs_size_t abyte;
{ /*afs_FindDCache*/
struct dcache *afs_FindDCache(register struct vcache *avc, afs_size_t abyte)
{
afs_int32 chunk;
register afs_int32 i, index;
register struct dcache *tdc;
@ -1249,7 +1187,7 @@ struct dcache *afs_FindDCache(avc, abyte)
MObtainWriteLock(&afs_xdcache,278);
for(index = afs_dchashTbl[i]; index != NULLIDX;) {
if (afs_indexUnique[index] == avc->fid.Fid.Unique) {
tdc = afs_GetDSlot(index, (struct dcache *)0);
tdc = afs_GetDSlot(index, NULL);
ReleaseReadLock(&tdc->tlock);
if (!FidCmp(&tdc->f.fid, &avc->fid) && chunk == tdc->f.chunk) {
break; /* leaving refCount high for caller */
@ -1265,7 +1203,7 @@ struct dcache *afs_FindDCache(avc, abyte)
return tdc;
}
else
return(struct dcache *) 0;
return NULL;
} /*afs_FindDCache*/
@ -1292,17 +1230,10 @@ struct dcache *afs_FindDCache(avc, abyte)
* Environment:
* Nothing interesting.
*/
static int afs_UFSCacheStoreProc(acall, afile, alen, avc, shouldWake,
abytesToXferP, abytesXferredP)
register struct rx_call *acall;
struct osi_file *afile;
register afs_int32 alen;
afs_size_t *abytesToXferP;
afs_size_t *abytesXferredP;
struct vcache *avc;
int *shouldWake;
{ /* afs_UFSCacheStoreProc*/
static int afs_UFSCacheStoreProc(register struct rx_call *acall,
struct osi_file *afile, register afs_int32 alen, struct vcache *avc,
int *shouldWake, afs_size_t *abytesToXferP, afs_size_t *abytesXferredP)
{
afs_int32 code, got;
register char *tbuffer;
register int tlen;
@ -1391,17 +1322,11 @@ static int afs_UFSCacheStoreProc(acall, afile, alen, avc, shouldWake,
* Nothing interesting.
*/
static int afs_UFSCacheFetchProc(acall, afile, abase, adc, avc,
abytesToXferP, abytesXferredP, lengthFound)
register struct rx_call *acall;
afs_size_t abase;
afs_size_t *abytesToXferP;
afs_size_t *abytesXferredP;
struct dcache *adc;
struct vcache *avc;
struct osi_file *afile;
afs_int32 lengthFound;
{ /*UFS_CacheFetchProc*/
static int afs_UFSCacheFetchProc(register struct rx_call *acall,
struct osi_file *afile, afs_size_t abase, struct dcache *adc,
struct vcache *avc, afs_size_t *abytesToXferP,
afs_size_t *abytesXferredP, afs_int32 lengthFound)
{
afs_int32 length;
register afs_int32 code;
register char *tbuffer;
@ -1524,7 +1449,8 @@ struct tlocal1 {
* Update the vnode-to-dcache hint if we can get the vnode lock
* right away. Assumes dcache entry is at least read-locked.
*/
void updateV2DC(int lockVc, struct vcache *v, struct dcache *d, int src) {
void updateV2DC(int lockVc, struct vcache *v, struct dcache *d, int src)
{
if (!lockVc || 0 == NBObtainWriteLock(&v->lock,src)) {
if (hsame(v->m.DataVersion, d->f.versionNo) && v->callback) {
v->quick.dc = d;
@ -1538,15 +1464,11 @@ void updateV2DC(int lockVc, struct vcache *v, struct dcache *d, int src) {
}
}
struct dcache *afs_GetDCache(avc, abyte, areq, aoffset, alen, aflags)
register struct vcache *avc; /* Write-locked unless aflags & 1 */
afs_size_t abyte;
afs_size_t *aoffset, *alen;
int aflags;
register struct vrequest *areq;
{ /*afs_GetDCache*/
/* avc - Write-locked unless aflags & 1 */
struct dcache *afs_GetDCache(register struct vcache *avc, afs_size_t abyte,
register struct vrequest *areq, afs_size_t *aoffset, afs_size_t *alen,
int aflags)
{
register afs_int32 i, code, code1, shortcut , adjustsize=0;
int setLocks;
afs_int32 index;
@ -1625,7 +1547,7 @@ RetryGetDCache:
shortcut = 0;
/* check hints first! (might could use bcmp or some such...) */
if (tdc = avc->h1.dchint) {
if ((tdc = avc->h1.dchint)) {
int dcLocked;
/*
@ -1706,7 +1628,7 @@ RetryLookup:
us = NULLIDX;
for (index = afs_dchashTbl[i]; index != NULLIDX; ) {
if (afs_indexUnique[index] == avc->fid.Fid.Unique) {
tdc = afs_GetDSlot(index, (struct dcache *)0);
tdc = afs_GetDSlot(index, NULL);
ReleaseReadLock(&tdc->tlock);
/*
* Locks held:
@ -2349,7 +2271,7 @@ RetryLookup:
ObtainWriteLock(&afs_xcbhash, 453);
afs_DequeueCallback(avc);
avc->states &= ~(CStatd | CUnique);
avc->callback = (struct server *)0;
avc->callback = NULL;
ReleaseWriteLock(&afs_xcbhash);
if (avc->fid.Fid.Vnode & 1 || (vType(avc) == VDIR))
osi_dnlc_purgedp(avc);
@ -2374,7 +2296,7 @@ RetryLookup:
} while
(afs_Analyze(tc, code, &avc->fid, areq,
AFS_STATS_FS_RPCIDX_FETCHDATA,
SHARED_LOCK, (struct cell *)0));
SHARED_LOCK, NULL));
/*
* Locks held:
@ -2430,7 +2352,7 @@ RetryLookup:
* avc->lock(W); assert(!setLocks || slowPass)
*/
osi_Assert(!setLocks || slowPass);
tdc = (struct dcache *) 0;
tdc = NULL;
goto done;
}
@ -2572,11 +2494,8 @@ done:
* Environment:
* The afs_xdcache is write-locked through this whole affair.
*/
void
afs_WriteThroughDSlots()
{ /*afs_WriteThroughDSlots*/
void afs_WriteThroughDSlots(void)
{
register struct dcache *tdc;
register afs_int32 i, touchedit=0;
struct dcache **ents;
@ -2651,8 +2570,7 @@ afs_WriteThroughDSlots()
afs_osi_Write(afs_cacheInodep, 0, &theader, sizeof(theader));
}
MReleaseWriteLock(&afs_xdcache);
} /*afs_WriteThroughDSlots*/
}
/*
* afs_MemGetDSlot
@ -2669,12 +2587,8 @@ afs_WriteThroughDSlots()
* Must be called with afs_xdcache write-locked.
*/
struct dcache *afs_MemGetDSlot(aslot, tmpdc)
register afs_int32 aslot;
register struct dcache *tmpdc;
{ /*afs_MemGetDSlot*/
struct dcache *afs_MemGetDSlot(register afs_int32 aslot, register struct dcache *tmpdc)
{
register afs_int32 code;
register struct dcache *tdc;
register char *tfile;
@ -2693,7 +2607,7 @@ struct dcache *afs_MemGetDSlot(aslot, tmpdc)
ConvertWToRLock(&tdc->tlock);
return tdc;
}
if (tmpdc == (struct dcache *)0) {
if (tmpdc == NULL) {
if (!afs_freeDSList) afs_GetDownDSlot(4);
if (!afs_freeDSList) {
/* none free, making one is better than a panic */
@ -2739,7 +2653,7 @@ struct dcache *afs_MemGetDSlot(aslot, tmpdc)
RWLOCK_INIT(&tdc->mflock, "dcache flock");
ObtainReadLock(&tdc->tlock);
if (tmpdc == (struct dcache *)0)
if (tmpdc == NULL)
afs_indexTable[aslot] = tdc;
return tdc;
@ -2761,12 +2675,8 @@ unsigned int last_error = 0, lasterrtime = 0;
* Environment:
* afs_xdcache lock write-locked.
*/
struct dcache *afs_UFSGetDSlot(aslot, tmpdc)
register afs_int32 aslot;
register struct dcache *tmpdc;
{ /*afs_UFSGetDSlot*/
struct dcache *afs_UFSGetDSlot(register afs_int32 aslot, register struct dcache *tmpdc)
{
register afs_int32 code;
register struct dcache *tdc;
int existing = 0;
@ -2789,7 +2699,7 @@ struct dcache *afs_UFSGetDSlot(aslot, tmpdc)
* If we weren't passed an in-memory region to place the file info,
* we have to allocate one.
*/
if (tmpdc == (struct dcache *)0) {
if (tmpdc == NULL) {
if (!afs_freeDSList) afs_GetDownDSlot(4);
if (!afs_freeDSList) {
/* none free, making one is better than a panic */
@ -2849,7 +2759,7 @@ struct dcache *afs_UFSGetDSlot(aslot, tmpdc)
* If we didn't read into a temporary dcache region, update the
* slot pointer table.
*/
if (tmpdc == (struct dcache *)0)
if (tmpdc == NULL)
afs_indexTable[aslot] = tdc;
return tdc;
@ -2874,12 +2784,8 @@ struct dcache *afs_UFSGetDSlot(aslot, tmpdc)
* The reference count is not changed.
*/
afs_WriteDCache(adc, atime)
int atime;
register struct dcache *adc;
{ /*afs_WriteDCache*/
int afs_WriteDCache(register struct dcache *adc, int atime)
{
register struct osi_file *tfile;
register afs_int32 code;
@ -2894,8 +2800,7 @@ afs_WriteDCache(adc, atime)
(char *)(&adc->f), sizeof(struct fcache));
if (code != sizeof(struct fcache)) return EIO;
return 0;
} /*afs_WriteDCache*/
}
@ -2913,11 +2818,8 @@ afs_WriteDCache(adc, atime)
* Nothing interesting.
*/
afs_wakeup(avc)
register struct vcache *avc;
{ /*afs_wakeup*/
int afs_wakeup(register struct vcache *avc)
{
register int i;
register struct brequest *tb;
tb = afs_brs;
@ -2947,8 +2849,7 @@ afs_wakeup(avc)
}
}
return 0;
} /*afs_wakeup*/
}
/*
@ -2967,12 +2868,8 @@ afs_wakeup(avc)
* This function is called only during initialization.
*/
int afs_InitCacheFile(afile, ainode)
ino_t ainode;
char *afile;
{ /*afs_InitCacheFile*/
int afs_InitCacheFile(char *afile, ino_t ainode)
{
register afs_int32 code;
#if defined(AFS_LINUX22_ENV)
struct dentry *filevp;
@ -2990,7 +2887,7 @@ int afs_InitCacheFile(afile, ainode)
if (index >= afs_cacheFiles) return EINVAL;
MObtainWriteLock(&afs_xdcache,282);
tdc = afs_GetDSlot(index, (struct dcache *)0);
tdc = afs_GetDSlot(index, NULL);
ReleaseReadLock(&tdc->tlock);
MReleaseWriteLock(&afs_xdcache);
@ -3000,7 +2897,7 @@ int afs_InitCacheFile(afile, ainode)
code = gop_lookupname(afile,
AFS_UIOSYS,
0,
(struct vnode **) 0,
NULL,
&filevp);
if (code) {
ReleaseWriteLock(&afs_xdcache);
@ -3101,8 +2998,7 @@ int afs_InitCacheFile(afile, ainode)
afs_PutDCache(tdc);
afs_stats_cmperf.cacheNumEntries++;
return 0;
} /*afs_InitCacheFile*/
}
/*Max # of struct dcache's resident at any time*/
@ -3128,7 +3024,7 @@ void afs_dcacheInit(int afiles, int ablocks, int aDentries, int achunk,
afs_freeDCList = NULLIDX;
afs_discardDCList = NULLIDX;
afs_freeDCCount = 0;
afs_freeDSList = (struct dcache *)0;
afs_freeDSList = NULL;
hzero(afs_indexCounter);
LOCK_INIT(&afs_xdcache, "afs_xdcache");

View File

@ -86,14 +86,10 @@ static struct afs_dynSymlink *afs_dynSymlinkBase = NULL;
static int afs_dynSymlinkIndex = 0;
/* End of variables protected by afs_dynSymlinkLock */
extern afs_int32 afs_cellindex;
extern afs_rwlock_t afs_xvcache;
/*
* Returns non-zero iff fid corresponds to the top of the dynroot volume.
*/
int
afs_IsDynrootFid(struct VenusFid *fid)
int afs_IsDynrootFid(struct VenusFid *fid)
{
return
(afs_dynrootEnable &&
@ -106,8 +102,7 @@ afs_IsDynrootFid(struct VenusFid *fid)
/*
* Obtain the magic dynroot volume Fid.
*/
void
afs_GetDynrootFid(struct VenusFid *fid)
void afs_GetDynrootFid(struct VenusFid *fid)
{
fid->Cell = AFS_DYNROOT_CELL;
fid->Fid.Volume = AFS_DYNROOT_VOLUME;
@ -118,9 +113,7 @@ afs_GetDynrootFid(struct VenusFid *fid)
/*
* Returns non-zero iff avc is a pointer to the dynroot /afs vnode.
*/
int
afs_IsDynroot(avc)
struct vcache *avc;
int afs_IsDynroot(struct vcache *avc)
{
return afs_IsDynrootFid(&avc->fid);
}
@ -130,13 +123,8 @@ afs_IsDynroot(avc)
* caller has allocated the directory to be large enough to hold
* the necessary entry.
*/
static void
afs_dynroot_addDirEnt(dirHeader, curPageP, curChunkP, name, vnode)
struct DirHeader *dirHeader;
int *curPageP;
int *curChunkP;
char *name;
int vnode;
static void afs_dynroot_addDirEnt(struct DirHeader *dirHeader,
int *curPageP, int *curChunkP, char *name, int vnode)
{
char *dirBase = (char *) dirHeader;
struct PageHeader *pageHeader;
@ -201,8 +189,7 @@ afs_dynroot_addDirEnt(dirHeader, curPageP, curChunkP, name, vnode)
* cells. Useful when the list of cells has changed due to
* an AFSDB lookup, for instance.
*/
void
afs_RefreshDynroot()
void afs_RefreshDynroot(void)
{
int cellidx, maxcellidx, i;
struct cell *c;
@ -210,8 +197,6 @@ afs_RefreshDynroot()
int dirSize, sizeOfCurEntry;
char *newDir, *dotCell;
struct DirHeader *dirHeader;
struct PageHeader *pageHeader;
struct DirEntry *dirEntry;
int doFlush = 0;
int linkCount = 0;
struct afs_dynSymlink *ts;
@ -349,7 +334,7 @@ afs_RefreshDynroot()
do {
retry = 0;
ObtainReadLock(&afs_xvcache);
tvc = afs_FindVCache(&tfid, 0, 0, &retry, 0);
tvc = afs_FindVCache(&tfid, &retry, 0);
ReleaseReadLock(&afs_xvcache);
} while (retry);
if (tvc) {
@ -364,11 +349,7 @@ afs_RefreshDynroot()
* Returns a pointer to the base of the dynroot directory in memory,
* length thereof, and a FetchStatus.
*/
void
afs_GetDynroot(dynrootDir, dynrootLen, status)
char **dynrootDir;
int *dynrootLen;
struct AFSFetchStatus *status;
void afs_GetDynroot(char **dynrootDir, int *dynrootLen, struct AFSFetchStatus *status)
{
ObtainReadLock(&afs_dynrootDirLock);
if (!afs_dynrootDir) {
@ -398,8 +379,7 @@ afs_GetDynroot(dynrootDir, dynrootLen, status)
/*
* Puts back the dynroot read lock.
*/
void
afs_PutDynroot()
void afs_PutDynroot(void)
{
ReleaseReadLock(&afs_dynrootDirLock);
}
@ -409,10 +389,7 @@ afs_PutDynroot()
* is non-zero if this vnode is handled by dynroot, in which case
* FetchStatus will be filled in.
*/
int
afs_DynrootNewVnode(avc, status)
struct vcache *avc;
struct AFSFetchStatus *status;
int afs_DynrootNewVnode(struct vcache *avc, struct AFSFetchStatus *status)
{
if (!afs_dynrootEnable) return 0;
@ -528,9 +505,7 @@ afs_DynrootNewVnode(avc, status)
/*
* Enable or disable dynroot. Returns 0 if successful.
*/
int
afs_SetDynrootEnable(enable)
int enable;
int afs_SetDynrootEnable(int enable)
{
afs_dynrootEnable = enable;
return 0;
@ -539,8 +514,7 @@ afs_SetDynrootEnable(enable)
/*
* Check if dynroot support is enabled.
*/
int
afs_GetDynrootEnable()
int afs_GetDynrootEnable(void)
{
return afs_dynrootEnable;
}
@ -548,11 +522,7 @@ afs_GetDynrootEnable()
/*
* Remove a temporary symlink entry from /afs.
*/
int
afs_DynrootVOPRemove(avc, acred, aname)
struct vcache *avc;
struct AFS_UCRED *acred;
char *aname;
int afs_DynrootVOPRemove(struct vcache *avc, struct AFS_UCRED *acred, char *aname)
{
struct afs_dynSymlink **tpps;
struct afs_dynSymlink *tps;
@ -596,12 +566,8 @@ afs_DynrootVOPRemove(avc, acred, aname)
/*
* Create a temporary symlink entry in /afs.
*/
int
afs_DynrootVOPSymlink(avc, acred, aname, atargetName)
struct vcache *avc;
struct AFS_UCRED *acred;
char *aname;
char *atargetName;
int afs_DynrootVOPSymlink(struct vcache *avc, struct AFS_UCRED *acred,
char *aname, char *atargetName)
{
struct afs_dynSymlink *tps;
struct cell *c;

View File

@ -22,10 +22,9 @@ afs_lock_t afs_xexp;
/* Add a new "afs exporter" entry to the table of exporters. The default initial values of the entry are passed in as parameters. */
static afs_int32 init_xexported = 0;
struct afs_exporter *exporter_add(size, ops, state, type, data)
afs_int32 size, state, type;
struct exporterops *ops;
char *data;
struct afs_exporter *exporter_add(afs_int32 size, struct exporterops *ops, afs_int32 state,
afs_int32 type, char *data)
{
struct afs_exporter *ex, *op;
afs_int32 length;
@ -58,8 +57,7 @@ char *data;
/* Returns the "afs exporter" structure of type, "type". NULL is returned if not found */
struct afs_exporter *exporter_find(type)
int type;
struct afs_exporter *exporter_find(int type)
{
struct afs_exporter *op;
@ -76,7 +74,7 @@ int type;
}
shutdown_exporter()
void shutdown_exporter(void)
{
struct afs_exporter *ex, *op;

View File

@ -23,82 +23,6 @@ RCSID("$Header$");
#include "../afs/afsincludes.h" /* Afs-based standard headers */
#include "../afs/afs_stats.h" /* afs statistics */
/* Imported variables */
extern afs_int32 afs_waitForever;
extern short afs_waitForeverCount;
extern afs_int32 afs_FVIndex;
extern struct server *afs_setTimeHost;
extern struct server *afs_servers[NSERVERS];
extern struct unixuser *afs_users[NUSERS];
extern struct volume *afs_freeVolList;
extern struct volume *afs_volumes[NVOLS];
extern afs_int32 afs_volCounter;
extern afs_rwlock_t afs_xaxs;
extern afs_rwlock_t afs_xvolume;
extern afs_rwlock_t afs_xuser;
extern afs_rwlock_t afs_xserver;
#ifndef AFS_AIX41_ENV
extern afs_lock_t osi_fsplock;
#endif
extern afs_lock_t osi_flplock;
extern afs_int32 fvTable[NFENTRIES];
/* afs_cell.c */
extern afs_rwlock_t afs_xcell;
extern struct afs_q CellLRU;
extern afs_int32 afs_cellindex;
extern afs_int32 afs_nextCellNum;
/* afs_conn.c */
extern afs_rwlock_t afs_xconn;
extern afs_rwlock_t afs_xinterface;
/* afs_mariner.c */
extern struct rx_service *afs_server;
/* afs_mariner.c */
extern afs_int32 afs_mariner;
extern afs_int32 afs_marinerHost;
/* afs_volume.c */
extern ino_t volumeInode;
/* afs_osi_pag.c */
extern afs_uint32 pag_epoch;
/* afs_dcache.c */
extern afs_rwlock_t afs_xdcache;
extern int cacheDiskType;
extern afs_int32 afs_fsfragsize;
extern ino_t cacheInode;
extern struct osi_file *afs_cacheInodep;
extern afs_int32 afs_freeDCList; /*Free list for disk cache entries*/
/* afs_vcache.c */
extern afs_rwlock_t afs_xvcache;
extern afs_rwlock_t afs_xvcb;
/* VNOPS/afs_vnop_read.c */
extern afs_int32 maxIHint;
extern afs_int32 nihints; /* # of above actually in-use */
extern afs_int32 usedihint;
/* afs_server.c */
extern afs_int32 afs_setTime;
/* Imported functions. */
extern struct rx_securityClass *rxnull_NewServerSecurityObject();
extern int RXAFSCB_ExecuteRequest();
extern int RXSTATS_ExecuteRequest();
/* afs_osi.c */
extern afs_lock_t afs_ftf;
/* Exported variables */
struct osi_dev cacheDev; /*Cache device*/
afs_int32 cacheInfoModTime; /*Last time cache info modified*/
@ -117,9 +41,6 @@ int afs_sysnamecount = 0;
struct volume *Initialafs_freeVolList;
int afs_memvolumes = 0;
/* Local variables */
/*
* Initialization order is important. Must first call afs_CacheInit,
* then cache file and volume file initialization routines. Next, the
@ -153,15 +74,10 @@ int afs_memvolumes = 0;
struct cm_initparams cm_initParams;
static int afs_cacheinit_flag = 0;
int
afs_CacheInit(astatSize, afiles, ablocks, aDentries, aVolumes, achunk, aflags,
ninodes, nusers)
afs_int32 afiles;
afs_int32 astatSize, ablocks;
afs_int32 achunk, aflags, ninodes, nusers;
afs_int32 aDentries;
{ /*afs_CacheInit*/
extern int afs_memvolumes;
int afs_CacheInit(afs_int32 astatSize, afs_int32 afiles, afs_int32
ablocks, afs_int32 aDentries, afs_int32 aVolumes, afs_int32 achunk,
afs_int32 aflags, afs_int32 ninodes, afs_int32 nusers)
{
register afs_int32 i, preallocs;
register struct volume *tv;
long code;
@ -215,7 +131,7 @@ afs_CacheInit(astatSize, afiles, ablocks, aDentries, aVolumes, achunk, aflags,
tv = (struct volume *) afs_osi_Alloc(aVolumes * sizeof(struct volume));
for (i=0;i<aVolumes-1;i++)
tv[i].next = &tv[i+1];
tv[aVolumes-1].next = (struct volume *) 0;
tv[aVolumes-1].next = NULL;
afs_freeVolList = Initialafs_freeVolList = tv;
afs_memvolumes = aVolumes;
@ -264,11 +180,8 @@ afs_CacheInit(astatSize, afiles, ablocks, aDentries, aVolumes, achunk, aflags,
* None.
*/
void
afs_ComputeCacheParms()
{ /*afs_ComputeCacheParms*/
void afs_ComputeCacheParms(void)
{
register afs_int32 i;
afs_int32 afs_maxCacheDirty;
@ -315,11 +228,8 @@ afs_ComputeCacheParms()
* WARNING: Data will be written to this file over time by AFS.
*/
afs_InitVolumeInfo(afile)
register char *afile;
{ /*afs_InitVolumeInfo*/
int afs_InitVolumeInfo(register char *afile)
{
afs_int32 code;
struct osi_file *tfile;
struct vnode *filevp;
@ -329,13 +239,13 @@ afs_InitVolumeInfo(afile)
#ifdef AFS_LINUX22_ENV
{
struct dentry *dp;
code = gop_lookupname(afile, AFS_UIOSYS, 0, (struct vnode **) 0, &dp);
code = gop_lookupname(afile, AFS_UIOSYS, 0, NULL, &dp);
if (code) return ENOENT;
fce.inode = volumeInode = dp->d_inode->i_ino;
dput(dp);
}
#else
code = gop_lookupname(afile, AFS_UIOSYS, 0, (struct vnode **) 0, &filevp);
code = gop_lookupname(afile, AFS_UIOSYS, 0, NULL, &filevp);
if (code) return ENOENT;
fce.inode = volumeInode = afs_vnodeToInumber(filevp);
#ifdef AFS_DEC_ENV
@ -348,8 +258,7 @@ afs_InitVolumeInfo(afile)
afs_CFileTruncate(tfile, 0);
afs_CFileClose(tfile);
return 0;
} /*afs_InitVolumeInfo*/
}
/*
* afs_InitCacheInfo
@ -374,11 +283,8 @@ afs_InitVolumeInfo(afile)
* code.
*
*/
afs_InitCacheInfo(afile)
register char *afile;
{ /*afs_InitCacheInfo*/
int afs_InitCacheInfo(register char *afile)
{
register afs_int32 code;
struct osi_stat tstat;
register struct osi_file *tfile;
@ -393,7 +299,7 @@ afs_InitCacheInfo(afile)
code = osi_InitCacheInfo(afile);
if (code) return code;
#else
code = gop_lookupname(afile, AFS_UIOSYS, 0, (struct vnode **) 0, &filevp);
code = gop_lookupname(afile, AFS_UIOSYS, 0, NULL, &filevp);
if (code || !filevp) return ENOENT;
{
#if defined(AFS_SUN56_ENV)
@ -416,10 +322,10 @@ afs_InitCacheInfo(afile)
#if defined(AFS_SGI_ENV)
#ifdef AFS_SGI65_ENV
VFS_STATVFS(filevp->v_vfsp, &st, (struct vnode *)0, code);
VFS_STATVFS(filevp->v_vfsp, &st, NULL, code);
if (!code)
#else
if (!VFS_STATFS(filevp->v_vfsp, &st, (struct vnode *)0))
if (!VFS_STATFS(filevp->v_vfsp, &st, NULL))
#endif /* AFS_SGI65_ENV */
#else /* AFS_SGI_ENV */
#if defined(AFS_SUN5_ENV) || defined(AFS_HPUX100_ENV)
@ -511,12 +417,10 @@ afs_InitCacheInfo(afile)
*/
afs_cacheInodep = (struct osi_file *)tfile;
return 0;
} /*afs_InitCacheInfo*/
}
int afs_resourceinit_flag = 0;
afs_ResourceInit(preallocs)
int preallocs;
int afs_ResourceInit(int preallocs)
{
register afs_int32 i;
static struct rx_securityClass *secobj;
@ -547,7 +451,7 @@ afs_ResourceInit(preallocs)
afs_sysnamecount = 1;
QInit(&CellLRU);
#if defined(AFS_AIX32_ENV) || defined(AFS_HPUX_ENV)
{ extern afs_int32 afs_preallocs;
{
if ((preallocs > 256) && (preallocs < 3600))
afs_preallocs = preallocs;
@ -611,8 +515,7 @@ afs_ResourceInit(preallocs)
* support features that require knowing the size of struct proc.
*/
static void
afs_procsize_init(void)
static void afs_procsize_init(void)
{
struct proc *p0; /* pointer to process 0 */
struct proc *pN; /* pointer to process 0's first child */
@ -678,13 +581,9 @@ afs_procsize_init(void)
* Environment:
* Nothing interesting.
*/
void
shutdown_cache()
{ /*shutdown_cache*/
void shutdown_cache(void)
{
register struct afs_cbr *tsp, *nsp;
extern int afs_cold_shutdown;
extern int pagCounter;
int i;
AFS_STATCNT(shutdown_cache);
@ -711,15 +610,8 @@ shutdown_cache()
} /*shutdown_cache*/
void shutdown_vnodeops()
void shutdown_vnodeops(void)
{
extern int afs_cold_shutdown;
#ifndef AFS_LINUX20_ENV
extern int afs_rd_stash_i;
#endif
#ifndef AFS_SUN5_ENV
extern int lastWarnTime;
#endif
#if !defined(AFS_SGI_ENV) && !defined(AFS_SUN_ENV) && !defined(AFS_SUN5_ENV)
struct buf *afs_bread_freebp = 0;
#endif
@ -741,12 +633,10 @@ void shutdown_vnodeops()
}
void shutdown_AFS()
void shutdown_AFS(void)
{
int i;
register struct srvAddr *sa;
extern int afs_cold_shutdown;
AFS_STATCNT(shutdown_AFS);
if (afs_cold_shutdown) {
@ -861,7 +751,7 @@ void shutdown_AFS()
afs_sysnamecount = 0;
afs_marinerHost = 0;
QInit(&CellLRU);
afs_setTimeHost = (struct server *)0;
afs_setTimeHost = NULL;
afs_volCounter = 1;
afs_waitForever = afs_waitForeverCount = 0;
afs_cellindex = 0;
@ -876,5 +766,4 @@ void shutdown_AFS()
RWLOCK_INIT(&afs_xserver, "afs_xserver");
LOCK_INIT(&afs_puttofileLock, "afs_puttofileLock");
}
} /*shutdown_AFS*/
}

View File

@ -31,22 +31,14 @@ RCSID("$Header$");
#include "../afs/afsincludes.h" /* Afs-based standard headers */
#include "../afs/afs_stats.h" /* afs statistics */
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
/* probably needed if lock_trace is enabled - should ifdef */
int afs_trclock=0;
void Lock_Obtain();
void Lock_ReleaseR();
void Lock_ReleaseW();
void Lock_Init(lock)
register struct afs_lock *lock;
void Lock_Init(register struct afs_lock *lock)
{
AFS_STATCNT(Lock_Init);
@ -63,10 +55,8 @@ void Lock_Init(lock)
lock->time_waiting.tv_usec = 0;
}
void ObtainLock(lock, how, src_indicator)
register struct afs_lock *lock;
int how;
unsigned int src_indicator;
void ObtainLock(register struct afs_lock *lock, int how,
unsigned int src_indicator)
{
switch (how) {
case READ_LOCK:
@ -101,9 +91,7 @@ void ObtainLock(lock, how, src_indicator)
}
}
void ReleaseLock(lock, how)
register struct afs_lock *lock;
int how;
void ReleaseLock(register struct afs_lock *lock, int how)
{
if (how == READ_LOCK) {
if (!--lock->readers_reading && lock->wait_states)
@ -129,9 +117,7 @@ void ReleaseLock(lock, how)
}
}
Afs_Lock_Obtain(lock, how)
register struct afs_lock *lock;
int how;
void Afs_Lock_Obtain(register struct afs_lock *lock, int how)
{
osi_timeval_t tt1, tt2, et;
@ -192,8 +178,7 @@ Afs_Lock_Obtain(lock, how)
}
/* release a lock, giving preference to new readers */
Afs_Lock_ReleaseR(lock)
register struct afs_lock *lock;
void Afs_Lock_ReleaseR(register struct afs_lock *lock)
{
AFS_STATCNT(Lock_ReleaseR);
AFS_ASSERT_GLOCK();
@ -208,8 +193,7 @@ Afs_Lock_ReleaseR(lock)
}
/* release a lock, giving preference to new writers */
Afs_Lock_ReleaseW(lock)
register struct afs_lock *lock;
void Afs_Lock_ReleaseW(register struct afs_lock *lock)
{
AFS_STATCNT(Lock_ReleaseW);
AFS_ASSERT_GLOCK();
@ -225,8 +209,8 @@ Afs_Lock_ReleaseW(lock)
/*
Wait for some change in the lock status.
Lock_Wait(lock)
register struct afs_lock *lock; {
void Lock_Wait(register struct afs_lock *lock)
{
AFS_STATCNT(Lock_Wait);
if (lock->readers_reading || lock->excl_locked) return 1;
lock->wait_states |= READ_LOCK;
@ -240,27 +224,24 @@ Lock_Wait(lock)
*/
/* release a write lock and sleep on an address, atomically */
afs_osi_SleepR(addr, alock)
register char *addr;
register struct afs_lock *alock; {
void afs_osi_SleepR(register char *addr, register struct afs_lock *alock)
{
AFS_STATCNT(osi_SleepR);
ReleaseReadLock(alock);
afs_osi_Sleep(addr);
}
/* release a write lock and sleep on an address, atomically */
afs_osi_SleepW(addr, alock)
register char *addr;
register struct afs_lock *alock; {
void afs_osi_SleepW(register char *addr, register struct afs_lock *alock)
{
AFS_STATCNT(osi_SleepW);
ReleaseWriteLock(alock);
afs_osi_Sleep(addr);
}
/* release a write lock and sleep on an address, atomically */
afs_osi_SleepS(addr, alock)
register char *addr;
register struct afs_lock *alock; {
void afs_osi_SleepS(register char *addr, register struct afs_lock *alock)
{
AFS_STATCNT(osi_SleepS);
ReleaseSharedLock(alock);
afs_osi_Sleep(addr);
@ -271,9 +252,8 @@ register struct afs_lock *alock; {
/* operations on locks that don't mind if we lock the same thing twice. I'd like to dedicate
this function to Sun Microsystems' Version 4.0 virtual memory system, without
which this wouldn't have been necessary */
void afs_BozonLock(alock, avc)
struct vcache *avc;
struct afs_bozoLock *alock; {
void afs_BozonLock(struct afs_bozoLock *alock, struct vcache *avc)
{
AFS_STATCNT(afs_BozonLock);
while (1) {
if (alock->count == 0) {
@ -313,9 +293,8 @@ struct afs_bozoLock *alock; {
}
/* releasing the same type of lock as defined above */
void afs_BozonUnlock(alock, avc)
struct vcache *avc;
struct afs_bozoLock *alock; {
void afs_BozonUnlock(struct afs_bozoLock *alock, struct vcache *avc)
{
AFS_STATCNT(afs_BozonUnlock);
if (alock->count <= 0)
osi_Panic("BozoUnlock");
@ -327,25 +306,24 @@ struct afs_bozoLock *alock; {
}
}
void afs_BozonInit(alock, avc)
struct vcache *avc;
struct afs_bozoLock *alock; {
void afs_BozonInit(struct afs_bozoLock *alock, struct vcache *avc)
{
AFS_STATCNT(afs_BozonInit);
alock->count = 0;
alock->flags = 0;
alock->proc = (char *) 0;
alock->proc = NULL;
}
afs_CheckBozonLock(alock)
struct afs_bozoLock *alock; {
int afs_CheckBozonLock(struct afs_bozoLock *alock)
{
AFS_STATCNT(afs_CheckBozonLock);
if (alock->count || (alock->flags & AFS_BOZONWAITING))
return 1;
return 0;
}
afs_CheckBozonLockBlocking(alock)
struct afs_bozoLock *alock; {
int afs_CheckBozonLockBlocking(struct afs_bozoLock *alock)
{
AFS_STATCNT(afs_CheckBozonLockBlocking);
if (alock->count || (alock->flags & AFS_BOZONWAITING))
#ifdef AFS_SUN5_ENV
@ -363,12 +341,8 @@ struct afs_bozoLock *alock; {
}
#endif
Afs_Lock_Trace(op, alock, type, file, line)
int op;
struct afs_lock *alock;
int type;
char *file;
int line;
/* Not static - used conditionally if lock tracing is enabled */
int Afs_Lock_Trace(int op, struct afs_lock *alock, int type, char *file, int line)
{
int traceok;
struct afs_icl_log *tlp;

View File

@ -36,9 +36,8 @@ static int marinerPtr = 0; /* pointer to next mariner slot to use */
afs_int32 afs_mariner = 0;
afs_int32 afs_marinerHost = 0;
afs_AddMarinerName(aname, avc)
register char *aname;
register struct vcache *avc; {
int afs_AddMarinerName(register char *aname, register struct vcache *avc)
{
register int i;
register char *tp;
@ -55,8 +54,8 @@ afs_AddMarinerName(aname, avc)
return 0;
}
char *afs_GetMariner(avc)
register struct vcache *avc; {
char *afs_GetMariner(register struct vcache *avc)
{
register int i;
AFS_STATCNT(afs_GetMariner);
for(i=0; i<NMAR; i++) {
@ -67,9 +66,8 @@ char *afs_GetMariner(avc)
return "a file";
}
void afs_MarinerLogFetch(avc, off, bytes, idx)
register struct vcache *avc;
register afs_int32 off, bytes, idx;
void afs_MarinerLogFetch(register struct vcache *avc, register afs_int32 off,
register afs_int32 bytes, register afs_int32 idx)
{
struct sockaddr_in taddr;
register char *tp, *tp1, *tp2;
@ -102,9 +100,7 @@ void afs_MarinerLogFetch(avc, off, bytes, idx)
osi_FreeSmallSpace(tp1);
} /*afs_MarinerLogFetch*/
void afs_MarinerLog(astring, avc)
register struct vcache *avc;
register char *astring;
void afs_MarinerLog(register char *astring, register struct vcache *avc)
{
struct sockaddr_in taddr;
register char *tp, *tp1, *buf;

View File

@ -27,14 +27,6 @@ RCSID("$Header$");
#include "../afs/afs_stats.h" /* statistics */
/* memory cache routines */
struct memCacheEntry {
int size; /* # of valid bytes in this entry */
int dataSize; /* size of allocated data area */
afs_lock_t afs_memLock;
char *data; /* bytes */
};
static struct memCacheEntry *memCache;
static int memCacheBlkSize = 8192;
static int memMaxBlkNumber = 0;
@ -42,10 +34,7 @@ static int memAllocMaySleep = 0;
extern int cacheDiskType;
afs_InitMemCache(size, blkSize, flags)
int size;
int blkSize;
int flags;
int afs_InitMemCache(int size, int blkSize, int flags)
{
int index;
@ -92,8 +81,7 @@ nomem:
}
afs_MemCacheClose(file)
char *file;
int afs_MemCacheClose(char *file)
{
return 0;
}
@ -117,11 +105,7 @@ void *afs_MemCacheOpen(ino_t blkno)
/*
* this routine simulates a read in the Memory Cache
*/
afs_MemReadBlk(mceP, offset, dest, size)
int offset;
register struct memCacheEntry *mceP;
char *dest;
int size;
int afs_MemReadBlk(register struct memCacheEntry *mceP, int offset, char *dest, int size)
{
int bytesRead;
@ -150,12 +134,7 @@ afs_MemReadBlk(mceP, offset, dest, size)
/*
* this routine simulates a readv in the Memory Cache
*/
afs_MemReadvBlk(mceP, offset, iov, nio, size)
int offset;
register struct memCacheEntry *mceP;
struct iovec *iov;
int nio;
int size;
int afs_MemReadvBlk(register struct memCacheEntry *mceP, int offset, struct iovec *iov, int nio, int size)
{
int i;
int bytesRead;
@ -188,9 +167,7 @@ afs_MemReadvBlk(mceP, offset, iov, nio, size)
return bytesRead;
}
afs_MemReadUIO(blkno, uioP)
ino_t blkno;
struct uio *uioP;
int afs_MemReadUIO(ino_t blkno, struct uio *uioP)
{
register struct memCacheEntry *mceP = (struct memCacheEntry *)afs_MemCacheOpen(blkno);
int length = mceP->size - uioP->uio_offset;
@ -205,11 +182,7 @@ afs_MemReadUIO(blkno, uioP)
}
/*XXX: this extends a block arbitrarily to support big directories */
afs_MemWriteBlk(mceP, offset, src, size)
register struct memCacheEntry *mceP;
int offset;
char *src;
int size;
int afs_MemWriteBlk(register struct memCacheEntry *mceP, int offset, char *src, int size)
{
AFS_STATCNT(afs_MemWriteBlk);
MObtainWriteLock(&mceP->afs_memLock,560);
@ -250,12 +223,7 @@ afs_MemWriteBlk(mceP, offset, src, size)
}
/*XXX: this extends a block arbitrarily to support big directories */
afs_MemWritevBlk(mceP, offset, iov, nio, size)
register struct memCacheEntry *mceP;
int offset;
struct iovec *iov;
int nio;
int size;
int afs_MemWritevBlk(register struct memCacheEntry *mceP, int offset, struct iovec *iov, int nio, int size)
{
int i;
int bytesWritten;
@ -291,9 +259,7 @@ afs_MemWritevBlk(mceP, offset, iov, nio, size)
return bytesWritten;
}
afs_MemWriteUIO(blkno, uioP)
ino_t blkno;
struct uio *uioP;
int afs_MemWriteUIO(ino_t blkno, struct uio *uioP)
{
register struct memCacheEntry *mceP = (struct memCacheEntry *)afs_MemCacheOpen(blkno);
afs_int32 code;
@ -322,9 +288,7 @@ afs_MemWriteUIO(blkno, uioP)
return code;
}
afs_MemCacheTruncate(mceP, size)
register struct memCacheEntry *mceP;
int size;
int afs_MemCacheTruncate(register struct memCacheEntry *mceP, int size)
{
AFS_STATCNT(afs_MemCacheTruncate);
@ -343,16 +307,9 @@ afs_MemCacheTruncate(mceP, size)
return 0;
}
afs_MemCacheStoreProc(acall, mceP, alen, avc, shouldWake, abytesToXferP, abytesXferredP, length)
register struct memCacheEntry *mceP;
register struct rx_call *acall;
register afs_int32 alen;
struct vcache *avc;
int *shouldWake;
afs_size_t *abytesToXferP;
afs_size_t *abytesXferredP;
afs_int32 length;
int afs_MemCacheStoreProc(register struct rx_call *acall, register struct memCacheEntry *mceP,
register afs_int32 alen, struct vcache *avc, int *shouldWake, afs_size_t *abytesToXferP,
afs_size_t *abytesXferredP, afs_int32 length)
{
register afs_int32 code;
@ -429,15 +386,9 @@ afs_MemCacheStoreProc(acall, mceP, alen, avc, shouldWake, abytesToXferP, abytesX
return 0;
}
afs_MemCacheFetchProc(acall, mceP, abase, adc, avc, abytesToXferP, abytesXferredP, lengthFound)
register struct rx_call *acall;
afs_size_t abase;
afs_size_t *abytesToXferP;
afs_size_t *abytesXferredP;
struct dcache *adc;
struct vcache *avc;
register struct memCacheEntry *mceP;
afs_int32 lengthFound;
int afs_MemCacheFetchProc(register struct rx_call *acall, register struct memCacheEntry *mceP,
afs_size_t abase, struct dcache *adc, struct vcache *avc, afs_size_t *abytesToXferP,
afs_size_t *abytesXferredP, afs_int32 lengthFound)
{
register afs_int32 code;
afs_int32 length;
@ -525,7 +476,7 @@ afs_MemCacheFetchProc(acall, mceP, abase, adc, avc, abytesToXferP, abytesXferred
}
void shutdown_memcache()
void shutdown_memcache(void)
{
register int index;

View File

@ -134,7 +134,7 @@ register afs_int32 uid, host, pag;
}
}
MReleaseWriteLock(&afs_xnfspag);
return (struct nfsclientpag *) 0;
return NULL;
}
@ -152,7 +152,7 @@ afs_nfsclient_init() {
init_nfsexporter = 1;
LOCK_INIT(&afs_xnfspag, "afs_xnfspag");
afs_nfsexported = exporter_add(0, &nfs_exportops, EXP_EXPORTED, EXP_NFS, (char *)0);
afs_nfsexported = exporter_add(0, &nfs_exportops, EXP_EXPORTED, EXP_NFS, NULL);
}
}
@ -193,7 +193,7 @@ afs_int32 *pagparam;
if (!au->exporter) {
pag = NOPAG;
afs_PutUser(au, READ_LOCK);
au = (struct unixuser *)0;
au = NULL;
}
} else
pag = NOPAG; /* No unixuser struct so pag not trusted */

View File

@ -20,7 +20,6 @@ RCSID("$Header$");
#endif
static char memZero; /* address of 0 bytes for kmem_alloc */
extern int afs_osicred_initialized;
struct osimem {
struct osimem *next;
@ -40,7 +39,7 @@ lock_t afs_event_lock;
flid_t osi_flid;
#endif
void osi_Init()
void osi_Init(void)
{
static int once = 0;
if (once++ > 0) /* just in case */
@ -81,8 +80,8 @@ void osi_Init()
#endif
}
osi_Active(avc)
register struct vcache *avc; {
int osi_Active(register struct vcache *avc)
{
AFS_STATCNT(osi_Active);
#if defined(AFS_SUN_ENV) || defined(AFS_AIX_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SUN5_ENV) || (AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
if ((avc->opens > 0) || (avc->states & CMAPPED)) return 1; /* XXX: Warning, verify this XXX */
@ -110,9 +109,7 @@ register struct vcache *avc; {
avc->pvnLock is already held, avc->lock is guaranteed not to be held (by
us, of course).
*/
void osi_FlushPages(avc, credp)
register struct vcache *avc;
struct AFS_UCRED *credp;
void osi_FlushPages(register struct vcache *avc, struct AFS_UCRED *credp)
{
afs_hyper_t origDV;
ObtainReadLock(&avc->lock);
@ -166,8 +163,8 @@ afs_lock_t afs_ftf; /* flush text lock */
* shouldn't do anything that would discard newly written data before
* it is written to the file system. */
void osi_FlushText_really(vp)
register struct vcache *vp; {
void osi_FlushText_really(register struct vcache *vp)
{
afs_hyper_t fdv; /* version before which we'll flush */
AFS_STATCNT(osi_FlushText);
@ -234,9 +231,8 @@ void osi_FlushText_really(vp)
* cacheinval(). But they would panic. So it might be worth looking
* into some middle ground...
*/
static void
afs_gfs_FlushText(vp)
register struct vcache *vp; {
static void afs_gfs_FlushText(register struct vcache *vp)
{
afs_hyper_t fdv; /* version before which we'll flush */
register struct text *xp;
struct gnode * gp;
@ -260,7 +256,7 @@ afs_gfs_FlushText(vp)
return;
}
}
else xp = (struct text *) 0;
else xp = NULL;
if (gp->g_flag & GTEXT) {/* still has a text object? */
xinval(gp);
@ -281,28 +277,32 @@ afs_gfs_FlushText(vp)
#endif /* AFS_TEXT_ENV */
/* mask signals in afsds */
void afs_osi_MaskSignals(){
void afs_osi_MaskSignals(void)
{
#ifdef AFS_LINUX22_ENV
osi_linux_mask();
#endif
}
/* unmask signals in rxk listener */
void afs_osi_UnmaskRxkSignals(){
void afs_osi_UnmaskRxkSignals(void)
{
#ifdef AFS_LINUX22_ENV
osi_linux_unmask();
#endif
}
/* register rxk listener proc info */
void afs_osi_RxkRegister(){
void afs_osi_RxkRegister(void)
{
#ifdef AFS_LINUX22_ENV
osi_linux_rxkreg();
#endif
}
/* procedure for making our processes as invisible as we can */
void afs_osi_Invisible() {
void afs_osi_Invisible(void)
{
#ifdef AFS_LINUX22_ENV
afs_osi_MaskSignals();
#endif
@ -332,9 +332,8 @@ void afs_osi_Invisible() {
#ifndef AFS_LINUX20_ENV /* Linux version in osi_misc.c */
/* set the real time */
afs_osi_SetTime(atv)
register osi_timeval_t *atv; {
int afs_osi_SetTime(register osi_timeval_t *atv)
{
#ifdef AFS_AIX32_ENV
struct timestruc_t t;
@ -354,7 +353,6 @@ afs_osi_SetTime(atv)
struct stimea {
time_t time;
} sta;
extern int stime(struct stimea *time, rval_t *rvp);
sta.time = atv->tv_sec;
@ -364,7 +362,6 @@ afs_osi_SetTime(atv)
struct stimea {
sysarg_t time;
} sta;
extern int stime(struct stimea *time);
AFS_GUNLOCK();
sta.time = atv->tv_sec;
@ -375,7 +372,6 @@ afs_osi_SetTime(atv)
/* does not impliment security features of kern_time.c:settime() */
struct timespec ts;
struct timeval tv,delta;
extern void (*lease_updatetime)();
int s;
AFS_GUNLOCK();
s=splclock();
@ -508,9 +504,7 @@ void afs_osi_Free(void *x, size_t asize)
* correctly (or at least, not to introduce worse bugs than already exist)
*/
#ifdef notdef
int
osi_VMDirty_p(avc)
struct vcache *avc;
int osi_VMDirty_p(struct vcache *avc)
{
int dirtyPages;
@ -533,7 +527,6 @@ osi_VMDirty_p(avc)
if (avc->vmh) {
unsigned int pagef, pri, index, next;
extern struct vmkerdata vmker;
index = VMHASH(avc->vmh);
if (scb_valid(index)) { /* could almost be an ASSERT */
@ -582,10 +575,7 @@ return 0;
*
* Locking: the vcache entry lock is held. It is dropped and re-obtained.
*/
void
osi_ReleaseVM(avc, acred)
struct vcache *avc;
struct AFS_UCRED *acred;
void osi_ReleaseVM(struct vcache *avc, struct AFS_UCRED *acred)
{
#ifdef AFS_SUN5_ENV
AFS_GUNLOCK();
@ -601,18 +591,15 @@ osi_ReleaseVM(avc, acred)
}
void shutdown_osi()
void shutdown_osi(void)
{
extern int afs_cold_shutdown;
AFS_STATCNT(shutdown_osi);
if (afs_cold_shutdown) {
LOCK_INIT(&afs_ftf, "afs_ftf");
}
}
afs_osi_suser(credp)
void * credp;
int afs_osi_suser(void *credp)
{
#ifdef AFS_SUN5_ENV
return afs_suser(credp);
@ -628,7 +615,7 @@ afs_osi_suser(credp)
*/
#if defined(AFS_SUN5_ENV)
void afs_osi_TraverseProcTable()
void afs_osi_TraverseProcTable(void)
{
struct proc *prp;
for (prp = practive; prp != NULL; prp = prp->p_next) {
@ -650,7 +637,7 @@ void afs_osi_TraverseProcTable()
* changes. To be safe, we use both.
*/
void afs_osi_TraverseProcTable()
void afs_osi_TraverseProcTable(void)
{
register proc_t *p;
int endchain = 0;
@ -711,14 +698,14 @@ static int SGI_ProcScanFunc(proc_t *p, void *arg, int mode)
}
#endif /* AFS_SGI65_ENV */
void afs_osi_TraverseProcTable()
void afs_osi_TraverseProcTable(void)
{
procscan(SGI_ProcScanFunc, afs_GCPAGs_perproc_func);
}
#endif /* AFS_SGI_ENV */
#if defined(AFS_AIX_ENV)
void afs_osi_TraverseProcTable()
void afs_osi_TraverseProcTable(void)
{
struct proc *p;
int i;
@ -764,12 +751,10 @@ void afs_osi_TraverseProcTable()
#endif
#if defined(AFS_OSF_ENV)
void afs_osi_TraverseProcTable()
void afs_osi_TraverseProcTable(void)
{
struct pid_entry *pe;
#ifdef AFS_DUX50_ENV
extern struct pid_entry *pidtab;
extern int npid;
#define pidNPID (pidtab + npid)
#define PID_LOCK()
#define PID_UNLOCK()
@ -784,7 +769,7 @@ extern int npid;
#endif
#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
void afs_osi_TraverseProcTable()
void afs_osi_TraverseProcTable(void)
{
struct proc *p;
LIST_FOREACH(p, &allproc, p_list) {
@ -820,12 +805,12 @@ void afs_osi_TraverseProcTable()
*/
#if defined(AFS_SGI65_ENV)
const struct AFS_UCRED *afs_osi_proc2cred(AFS_PROC *pr)
const struct AFS_UCRED *afs_osi_proc2cred(AFS_PROC *p)
{
return NULL;
}
#elif defined(AFS_HPUX_ENV)
const struct AFS_UCRED *afs_osi_proc2cred(proc_t *p)
const struct AFS_UCRED *afs_osi_proc2cred(AFS_PROC *p)
{
if (!p)
return;
@ -842,9 +827,6 @@ const struct AFS_UCRED *afs_osi_proc2cred(proc_t *p)
/* GLOBAL DECLARATIONS */
extern int xmattach(); /* fills out cross memory descriptor */
extern int xmdetach(); /* decrements reference count to segment */
/*
* LOCKS: the caller must do
* simple_lock(&proc_tbl_lock);

View File

@ -53,7 +53,7 @@ struct osi_file {
#else
afs_int32 offset;
#endif
int (*proc)(); /* proc, which, if not null, is called on writes */
int (*proc)(struct osi_file *afile, afs_int32 code); /* proc, which, if not null, is called on writes */
char *rock; /* rock passed to proc */
ino_t inum; /* guarantee validity of hint */
#if defined(UKERNEL)
@ -88,23 +88,12 @@ struct afs_osi_WaitHandle {
#define osi_NPACKETS 20 /* number of cluster pkts to alloc */
extern struct osi_socket *osi_NewSocket();
/*
* Alloc declarations.
*/
extern void *afs_osi_Alloc(size_t size);
extern void afs_osi_Free(void *x, size_t size);
#define afs_osi_Alloc_NoSleep afs_osi_Alloc
extern void *osi_AllocSmallSpace(size_t size);
extern void osi_FreeSmallSpace(void *x);
extern void *osi_AllocMediumSpace(size_t size);
extern void osi_FreeMediumSpace(void *x);
extern void *osi_AllocLargeSpace(size_t size);
extern void osi_FreeLargeSpace(void *x);
/*
* Vnode related macros
*/
@ -189,9 +178,9 @@ typedef struct timeval osi_timeval_t;
#ifdef AFS_GLOBAL_SUNLOCK
#define AFS_ASSERT_GLOCK() \
(ISAFS_GLOCK() || (osi_Panic("afs global lock not held"), 0))
(ISAFS_GLOCK() || (osi_Panic("afs global lock not held at %s:%d\n", __FILE__, __LINE__), 0))
#define AFS_ASSERT_RXGLOCK() \
(ISAFS_RXGLOCK() || (osi_Panic("rx global lock not held"), 0))
(ISAFS_RXGLOCK() || (osi_Panic("rx global lock not held at %s:%d\n", __FILE__, __LINE__), 0))
#endif /* AFS_GLOBAL_SUNLOCK */
#ifdef RX_ENABLE_LOCKS
@ -372,24 +361,6 @@ typedef struct timeval osi_timeval_t;
#define AfsLargeFileUio(uio) 0
#define AfsLargeFileSize(pos, off) 0
/* VM function prototypes.
*/
#if defined(AFS_SUN5_ENV)
extern int osi_VM_GetDownD();
extern void osi_VM_PreTruncate();
#endif
#if defined(AFS_SGI_ENV)
extern void osi_VM_FSyncInval();
#endif
extern int osi_VM_FlushVCache();
extern void osi_VM_StoreAllSegments();
extern void osi_VM_TryToSmush();
extern void osi_VM_FlushPages();
extern void osi_VM_Truncate();
extern void osi_ReleaseVM();
/* Now include system specific OSI header file. It will redefine macros
* defined here as required by the OS.
*/

View File

@ -37,8 +37,7 @@ afs_lock_t osi_flplock;
afs_int32 afs_preallocs = 512; /* Reserve space for all small allocs! */
void osi_AllocMoreSSpace(preallocs)
register afs_int32 preallocs;
void osi_AllocMoreSSpace(register afs_int32 preallocs)
{
register int i;
char *p;
@ -62,8 +61,7 @@ void osi_AllocMoreSSpace(preallocs)
/* free space allocated by AllocLargeSpace. Also called by mclput when freeing
* a packet allocated by osi_NetReceive. */
void
osi_FreeLargeSpace(void *adata)
void osi_FreeLargeSpace(void *adata)
{
AFS_ASSERT_GLOCK();
@ -76,8 +74,7 @@ osi_FreeLargeSpace(void *adata)
MReleaseWriteLock(&osi_flplock);
}
void
osi_FreeSmallSpace(void *adata)
void osi_FreeSmallSpace(void *adata)
{
#if defined(AFS_AIX32_ENV)
@ -106,8 +103,7 @@ osi_FreeSmallSpace(void *adata)
}
#if defined(AFS_AIX32_ENV) || defined(AFS_HPUX_ENV)
osi_AllocMoreMSpace(preallocs)
register afs_int32 preallocs;
osi_AllocMoreMSpace(register afs_int32 preallocs)
{
register int i;
char *p;
@ -150,8 +146,7 @@ void *osi_AllocMediumSpace(size_t size)
return tp;
}
void
osi_FreeMediumSpace(void *adata)
void osi_FreeMediumSpace(void *adata)
{
#if defined(AFS_AIX32_ENV)
@ -208,9 +203,8 @@ void *osi_AllocLargeSpace(size_t size)
* XXX We could have used a macro around osi_AllocSmallSpace but it's
* probably better like this so that we can remove this at some point.
*/
char *osi_AllocSmall(size, morespace)
register afs_int32 morespace; /* 1 - means we called at splnet level */
register afs_int32 size;
/* morespace 1 - means we called at splnet level */
char *osi_AllocSmall(register afs_int32 size, register afs_int32 morespace)
{
register struct osi_packet *tp;
#if defined(AFS_AIX32_ENV)
@ -247,8 +241,8 @@ char *osi_AllocSmall(size, morespace)
return (char *) tp;
}
osi_FreeSmall(adata)
register struct osi_packet *adata; {
int osi_FreeSmall(register struct osi_packet *adata)
{
#if defined(AFS_AIX32_ENV)
int x;
#endif
@ -322,7 +316,7 @@ void *osi_AllocSmallSpace(size_t size)
void shutdown_osinet()
void shutdown_osinet(void)
{
extern int afs_cold_shutdown;
@ -330,7 +324,7 @@ void shutdown_osinet()
if (afs_cold_shutdown) {
struct osi_packet *tp;
while (tp = freePacketList) {
while ((tp = freePacketList)) {
freePacketList = tp->next;
afs_osi_Free(tp, AFS_LRALLOCSIZ);
#ifdef AFS_AIX32_ENV
@ -338,7 +332,7 @@ void shutdown_osinet()
#endif
}
while (tp = freeSmallList) {
while ((tp = freeSmallList)) {
freeSmallList = tp->next;
afs_osi_Free(tp, AFS_SMALLOCSIZ);
#ifdef AFS_AIX32_ENV

View File

@ -70,7 +70,8 @@ afs_uint32 pagCounter = 0;
* secure (although of course not absolutely secure).
*/
#if !defined(UKERNEL) || !defined(AFS_WEB_ENHANCEMENTS)
afs_uint32 genpag(void) {
afs_uint32 genpag(void)
{
AFS_STATCNT(genpag);
#ifdef AFS_LINUX20_ENV
/* Ensure unique PAG's (mod 200 days) when reloading the client. */
@ -80,7 +81,8 @@ afs_uint32 genpag(void) {
#endif /* AFS_LINUX20_ENV */
}
afs_uint32 getpag(void) {
afs_uint32 getpag(void)
{
AFS_STATCNT(getpag);
#ifdef AFS_LINUX20_ENV
/* Ensure unique PAG's (mod 200 days) when reloading the client. */
@ -95,7 +97,8 @@ afs_uint32 getpag(void) {
/* Web enhancement: we don't need to restrict pags to 41XXXXXX since
* we are not sharing the space with anyone. So we use the full 32 bits. */
afs_uint32 genpag(void) {
afs_uint32 genpag(void)
{
AFS_STATCNT(genpag);
#ifdef AFS_LINUX20_ENV
return (pag_epoch + pagCounter++);
@ -104,7 +107,8 @@ afs_uint32 genpag(void) {
#endif /* AFS_LINUX20_ENV */
}
afs_uint32 getpag(void) {
afs_uint32 getpag(void)
{
AFS_STATCNT(getpag);
#ifdef AFS_LINUX20_ENV
/* Ensure unique PAG's (mod 200 days) when reloading the client. */
@ -324,6 +328,7 @@ int afs_getpag_val()
#endif /* UKERNEL && AFS_WEB_ENHANCEMENTS */
/* Note - needs to be available on AIX, others can be static - rework this */
#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
int AddPag(struct proc *p, afs_int32 aval, struct AFS_UCRED **credpp)
#else /* AFS_OSF_ENV || AFS_FBSD_ENV */
@ -333,9 +338,9 @@ int AddPag(afs_int32 aval, struct AFS_UCRED **credpp)
afs_int32 newpag, code;
AFS_STATCNT(AddPag);
#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
if (code = setpag(p, credpp, aval, &newpag, 0))
if ((code = setpag(p, credpp, aval, &newpag, 0)))
#else /* AFS_OSF_ENV */
if (code = setpag(credpp, aval, &newpag, 0))
if ((code = setpag(credpp, aval, &newpag, 0)))
#endif
#if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
return (code);
@ -346,10 +351,8 @@ int AddPag(afs_int32 aval, struct AFS_UCRED **credpp)
}
afs_InitReq(av, acred)
register struct vrequest *av;
struct AFS_UCRED *acred; {
int afs_InitReq(register struct vrequest *av, struct AFS_UCRED *acred)
{
AFS_STATCNT(afs_InitReq);
if (afs_shuttingdown) return EIO;
av->uid = PagInCred(acred);

View File

@ -25,9 +25,9 @@ RCSID("$Header$");
*/
/* routine to make copy of uio structure in ainuio, using aoutvec for space */
afsio_copy(ainuio, aoutuio, aoutvec)
struct uio *ainuio, *aoutuio;
register struct iovec *aoutvec; {
int afsio_copy(struct uio *ainuio, struct uio *aoutuio,
register struct iovec *aoutvec)
{
register int i;
register struct iovec *tvec;
@ -45,9 +45,8 @@ register struct iovec *aoutvec; {
}
/* trim the uio structure to the specified size */
afsio_trim(auio, asize)
register struct uio *auio;
register afs_int32 asize; {
int afsio_trim(register struct uio *auio, register afs_int32 asize)
{
register int i;
register struct iovec *tv;
@ -75,9 +74,8 @@ register afs_int32 asize; {
}
/* skip asize bytes in the current uio structure */
afsio_skip(auio, asize)
register struct uio *auio;
register afs_int32 asize; {
int afsio_skip(register struct uio *auio, register afs_int32 asize)
{
register struct iovec *tv; /* pointer to current iovec */
register int cnt;

Some files were not shown because too many files have changed in this diff Show More