From 882146b0e671e008e1d599cd34213bf940410d33 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Wed, 11 Jun 2014 20:53:09 -0400 Subject: [PATCH] viced: kill CLIENT_TO_ZERO macro Move all struct client fields that are to be zeroed upon structure reuse to a new struct client_to_zero. Include the new structure within struct client and call memset() on that structure. Change-Id: I0f83f5f18b41bc0d4f8e1f7f8e04cd5508cbe4e1 Reviewed-on: http://gerrit.openafs.org/11288 Reviewed-by: Benjamin Kaduk Reviewed-by: D Brashear Tested-by: D Brashear --- src/viced/afsfileprocs.c | 304 +++++++++++++++++++-------------------- src/viced/host.c | 242 +++++++++++++++---------------- src/viced/host.h | 9 +- 3 files changed, 278 insertions(+), 277 deletions(-) diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index 7075e4258..c8025948c 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -375,8 +375,8 @@ CallPreamble(struct rx_call *acall, int activecall, struct AFSFid *Fid, LogClientError("CallPreamble: Couldn't get client", *tconn, viceid, Fid); return VBUSY; } - thost = tclient->host; - if (tclient->prfail == 1) { /* couldn't get the CPS */ + thost = tclient->z.host; + if (tclient->z.prfail == 1) { /* couldn't get the CPS */ if (!retry_flag) { h_ReleaseClient_r(tclient); h_Release_r(thost); @@ -412,13 +412,13 @@ CallPreamble(struct rx_call *acall, int activecall, struct AFSFid *Fid, return -1001; } - tclient->prfail = 2; /* Means re-eval client's cps */ + tclient->z.prfail = 2; /* Means re-eval client's cps */ h_ReleaseClient_r(tclient); h_Release_r(thost); goto retry; } - tclient->LastCall = thost->z.LastCall = time(NULL); + tclient->z.LastCall = thost->z.LastCall = time(NULL); if (activecall) /* For all but "GetTime", "GetStats", and "GetCaps" calls */ thost->z.ActiveCall = thost->z.LastCall; @@ -480,7 +480,7 @@ CallPostamble(struct rx_connection *aconn, afs_int32 ret, tclient = h_FindClient_r(aconn, NULL); if (!tclient) goto busyout; - thost = tclient->host; + thost = tclient->z.host; if (thost->z.hostFlags & HERRORTRANS) translate = 1; h_ReleaseClient_r(tclient); @@ -509,7 +509,7 @@ CallPostamble(struct rx_connection *aconn, afs_int32 ret, } /* return the reference taken in local h_FindClient_r--h_ReleaseClient_r - * does not decrement refcount on client->host */ + * does not decrement refcount on client->z.host */ h_Release_r(thost); busyout: @@ -717,9 +717,9 @@ client_CheckRights(struct client *client, struct acl_accessList *ACL, { *rights = 0; ObtainReadLock(&client->lock); - if (client->CPS.prlist_len > 0 && !client->deleted && - client->host && !(client->host->z.hostFlags & HOSTDELETED)) - acl_CheckRights(ACL, &client->CPS, rights); + if (client->z.CPS.prlist_len > 0 && !client->z.deleted && + client->z.host && !(client->z.host->z.hostFlags & HOSTDELETED)) + acl_CheckRights(ACL, &client->z.CPS, rights); ReleaseReadLock(&client->lock); } @@ -730,9 +730,9 @@ client_HasAsMember(struct client *client, afs_int32 id) afs_int32 code = 0; ObtainReadLock(&client->lock); - if (client->CPS.prlist_len > 0 && !client->deleted && - client->host && !(client->host->z.hostFlags & HOSTDELETED)) - code = acl_IsAMember(id, &client->CPS); + if (client->z.CPS.prlist_len > 0 && !client->z.deleted && + client->z.host && !(client->z.host->z.hostFlags & HOSTDELETED)) + code = acl_IsAMember(id, &client->z.CPS); ReleaseReadLock(&client->lock); return code; } @@ -759,20 +759,20 @@ GetRights(struct client *client, struct acl_accessList *ACL, /* wait if somebody else is already doing the getCPS call */ H_LOCK; - while (client->host->z.hostFlags & HCPS_INPROGRESS) { - client->host->z.hostFlags |= HCPS_WAITING; /* I am waiting */ - opr_cv_wait(&client->host->cond, &host_glock_mutex); + while (client->z.host->z.hostFlags & HCPS_INPROGRESS) { + client->z.host->z.hostFlags |= HCPS_WAITING; /* I am waiting */ + opr_cv_wait(&client->z.host->cond, &host_glock_mutex); } - if (!client->host->z.hcps.prlist_len || !client->host->z.hcps.prlist_val) { + if (!client->z.host->z.hcps.prlist_len || !client->z.host->z.hcps.prlist_val) { char hoststr[16]; ViceLog(5, ("CheckRights: len=%u, for host=%s:%d\n", - client->host->z.hcps.prlist_len, - afs_inet_ntoa_r(client->host->z.host, hoststr), - ntohs(client->host->z.port))); + client->z.host->z.hcps.prlist_len, + afs_inet_ntoa_r(client->z.host->z.host, hoststr), + ntohs(client->z.host->z.port))); } else - acl_CheckRights(ACL, &client->host->z.hcps, &hrights); + acl_CheckRights(ACL, &client->z.host->z.hcps, &hrights); H_UNLOCK; /* Allow system:admin the rights given with the -implicit option */ if (client_HasAsMember(client, SystemId)) @@ -885,7 +885,7 @@ GetVolumePackageWithCall(struct rx_call *acall, struct VCallByVol *cbv, /* ok, if this is not a dir, set the PRSFS_ADMINISTER bit iff we're the owner */ if ((*targetptr)->disk.type != vDirectory) { /* anyuser can't be owner, so only have to worry about rights, not anyrights */ - if ((*targetptr)->disk.owner == (*client)->ViceId) + if ((*targetptr)->disk.owner == (*client)->z.ViceId) (*rights) |= PRSFS_ADMINISTER; else (*rights) &= ~PRSFS_ADMINISTER; @@ -988,7 +988,7 @@ VolumeOwner(struct client *client, Vnode * targetptr) afs_int32 owner = V_owner(targetptr->volumePtr); /* get volume owner */ if (owner >= 0) - return (client->ViceId == owner); + return (client->z.ViceId == owner); else { /* * We don't have to check for host's cps since only regular @@ -1023,7 +1023,7 @@ Check_PermissionRights(Vnode * targetptr, struct client *client, AFSStoreStatus * InStatus) { Error errorCode = 0; -#define OWNSp(client, target) ((client)->ViceId == (target)->disk.owner) +#define OWNSp(client, target) ((client)->z.ViceId == (target)->disk.owner) #define CHOWN(i,t) (((i)->Mask & AFS_SETOWNER) &&((i)->Owner != (t)->disk.owner)) #define CHGRP(i,t) (((i)->Mask & AFS_SETGROUP) &&((i)->Group != (t)->disk.group)) @@ -1042,7 +1042,7 @@ Check_PermissionRights(Vnode * targetptr, struct client *client, /* must have read access, or be owner and have insert access */ if (!(rights & PRSFS_READ) && !((OWNSp(client, targetptr) && (rights & PRSFS_INSERT) - && (client->ViceId != AnonymousID)))) + && (client->z.ViceId != AnonymousID)))) return (EACCES); } if (CallingRoutine == CHK_FETCHDATA @@ -1064,7 +1064,7 @@ Check_PermissionRights(Vnode * targetptr, struct client *client, * reading of files created with no read permission. The owner * of the file is always allowed to read it. */ - if ((client->ViceId != targetptr->disk.owner) + if ((client->z.ViceId != targetptr->disk.owner) && VanillaUser(client)) errorCode = (((OWNERREAD | OWNEREXEC) & targetptr->disk. @@ -1073,7 +1073,7 @@ Check_PermissionRights(Vnode * targetptr, struct client *client, } else { /* !VanillaUser(client) && !FetchData */ osi_audit(PrivilegeEvent, 0, AUD_ID, - (client ? client->ViceId : 0), AUD_INT, CallingRoutine, + (client ? client->z.ViceId : 0), AUD_INT, CallingRoutine, AUD_END); } } else { /* a store operation */ @@ -1091,13 +1091,13 @@ Check_PermissionRights(Vnode * targetptr, struct client *client, return (EPERM); /* Was EACCES */ else osi_audit(PrivilegeEvent, 0, AUD_ID, - (client ? client->ViceId : 0), AUD_INT, + (client ? client->z.ViceId : 0), AUD_INT, CallingRoutine, AUD_END); } } else { if (CallingRoutine != CHK_STOREDATA && !VanillaUser(client)) { osi_audit(PrivilegeEvent, 0, AUD_ID, - (client ? client->ViceId : 0), AUD_INT, + (client ? client->z.ViceId : 0), AUD_INT, CallingRoutine, AUD_END); } else { if (readonlyServer) { @@ -1117,7 +1117,7 @@ Check_PermissionRights(Vnode * targetptr, struct client *client, return (EPERM); /* Was EACCES */ else osi_audit(PrivilegeEvent, 0, AUD_ID, - (client ? client->ViceId : 0), AUD_INT, + (client ? client->z.ViceId : 0), AUD_INT, CallingRoutine, AUD_END); } /* must be sysadmin to set suid/sgid bits */ @@ -1133,7 +1133,7 @@ Check_PermissionRights(Vnode * targetptr, struct client *client, return (EACCES); else osi_audit(PrivSetID, 0, AUD_ID, - (client ? client->ViceId : 0), AUD_INT, + (client ? client->z.ViceId : 0), AUD_INT, CallingRoutine, AUD_END); } if (CallingRoutine == CHK_STOREDATA) { @@ -1172,7 +1172,7 @@ Check_PermissionRights(Vnode * targetptr, struct client *client, return (EACCES); else osi_audit(PrivilegeEvent, 0, AUD_ID, - (client ? client->ViceId : 0), + (client ? client->z.ViceId : 0), AUD_INT, CallingRoutine, AUD_END); } } else { /* a status store */ @@ -1678,7 +1678,7 @@ Update_TargetVnodeStatus(Vnode * targetptr, afs_uint32 Caller, VN_SET_LEN(targetptr, length); /* targetptr->disk.group = 0; save some cycles */ targetptr->disk.modeBits = 0777; - targetptr->disk.owner = client->ViceId; + targetptr->disk.owner = client->z.ViceId; targetptr->disk.dataVersion = 0; /* consistent with the client */ targetptr->disk.linkCount = (Caller & TVS_MKDIR ? 2 : 1); /* the inode was created in Alloc_NewVnode() */ @@ -1688,12 +1688,12 @@ Update_TargetVnodeStatus(Vnode * targetptr, afs_uint32 Caller, * counter is located immediately after its associated ``distance'' * counter. */ - if (client->InSameNetwork) + if (client->z.InSameNetwork) writeIdx = VOL_STATS_SAME_NET; else writeIdx = VOL_STATS_DIFF_NET; V_stat_writes(volptr, writeIdx)++; - if (client->ViceId != AnonymousID) { + if (client->z.ViceId != AnonymousID) { V_stat_writes(volptr, writeIdx + 1)++; } @@ -1717,7 +1717,7 @@ Update_TargetVnodeStatus(Vnode * targetptr, afs_uint32 Caller, VOL_STATS_TIME_CAP_3 ? VOL_STATS_TIME_IDX_3 : currDate < VOL_STATS_TIME_CAP_4 ? VOL_STATS_TIME_IDX_4 : VOL_STATS_TIME_IDX_5); - if (targetptr->disk.author == client->ViceId) { + if (targetptr->disk.author == client->z.ViceId) { V_stat_fileSameAuthor(volptr, timeIdx)++; } else { V_stat_fileDiffAuthor(volptr, timeIdx)++; @@ -1725,7 +1725,7 @@ Update_TargetVnodeStatus(Vnode * targetptr, afs_uint32 Caller, } if (!(Caller & TVS_SSTATUS)) - targetptr->disk.author = client->ViceId; + targetptr->disk.author = client->z.ViceId; if (Caller & TVS_SDATA) { targetptr->disk.dataVersion++; if (!remote && VanillaUser(client)) { @@ -1776,12 +1776,12 @@ Update_TargetVnodeStatus(Vnode * targetptr, afs_uint32 Caller, targetptr->disk.modeBits = modebits; switch (Caller) { case TVS_SDATA: - osi_audit(PrivSetID, 0, AUD_ID, client->ViceId, AUD_INT, + osi_audit(PrivSetID, 0, AUD_ID, client->z.ViceId, AUD_INT, CHK_STOREDATA, AUD_END); break; case TVS_CFILE: case TVS_SSTATUS: - osi_audit(PrivSetID, 0, AUD_ID, client->ViceId, AUD_INT, + osi_audit(PrivSetID, 0, AUD_ID, client->z.ViceId, AUD_INT, CHK_STORESTATUS, AUD_END); break; default: @@ -2289,7 +2289,7 @@ common_FetchData64(struct rx_call *acall, struct AFSFid *Fid, ViceLog(5, ("SRXAFS_FetchData, Fid = %u.%u.%u, Host %s:%d, Id %d\n", Fid->Volume, Fid->Vnode, Fid->Unique, inet_ntoa(logHostAddr), - ntohs(rxr_PortOf(tcon)), t_client->ViceId)); + ntohs(rxr_PortOf(tcon)), t_client->z.ViceId)); queue_NodeInit(&tcbv); tcbv.call = acall; @@ -2311,12 +2311,12 @@ common_FetchData64(struct rx_call *acall, struct AFSFid *Fid, * Remember that another read operation was performed. */ FS_LOCK; - if (client->InSameNetwork) + if (client->z.InSameNetwork) readIdx = VOL_STATS_SAME_NET; else readIdx = VOL_STATS_DIFF_NET; V_stat_reads(volptr, readIdx)++; - if (client->ViceId != AnonymousID) { + if (client->z.ViceId != AnonymousID) { V_stat_reads(volptr, readIdx + 1)++; } FS_UNLOCK; @@ -2357,12 +2357,12 @@ common_FetchData64(struct rx_call *acall, struct AFSFid *Fid, /* if a r/w volume, promise a callback to the caller */ if (VolumeWriteable(volptr)) - SetCallBackStruct(AddCallBack(client->host, Fid), CallBack); + SetCallBackStruct(AddCallBack(client->z.host, Fid), CallBack); else { struct AFSFid myFid; memset(&myFid, 0, sizeof(struct AFSFid)); myFid.Volume = Fid->Volume; - SetCallBackStruct(AddVolCallBack(client->host, &myFid), CallBack); + SetCallBackStruct(AddVolCallBack(client->z.host, &myFid), CallBack); } Bad_FetchData: @@ -2375,8 +2375,8 @@ common_FetchData64(struct rx_call *acall, struct AFSFid *Fid, fsstats_FinishOp(&fsstats, errorCode); osi_auditU(acall, FetchDataEvent, errorCode, - AUD_ID, t_client ? t_client->ViceId : 0, - AUD_FID, Fid, AUD_END); + AUD_ID, t_client ? t_client->z.ViceId : 0, + AUD_FID, Fid, AUD_END); return (errorCode); } /*SRXAFS_FetchData */ @@ -2441,7 +2441,7 @@ SRXAFS_FetchACL(struct rx_call * acall, struct AFSFid * Fid, ViceLog(5, ("SAFS_FetchACL, Fid = %u.%u.%u, Host %s:%d, Id %d\n", Fid->Volume, Fid->Vnode, Fid->Unique, inet_ntoa(logHostAddr), - ntohs(rxr_PortOf(tcon)), t_client->ViceId)); + ntohs(rxr_PortOf(tcon)), t_client->z.ViceId)); AccessList->AFSOpaque_len = 0; AccessList->AFSOpaque_val = malloc(AFSOPAQUEMAX); @@ -2487,9 +2487,9 @@ SRXAFS_FetchACL(struct rx_call * acall, struct AFSFid * Fid, fsstats_FinishOp(&fsstats, errorCode); osi_auditU(acall, FetchACLEvent, errorCode, - AUD_ID, t_client ? t_client->ViceId : 0, - AUD_FID, Fid, - AUD_ACL, AccessList->AFSOpaque_val, AUD_END); + AUD_ID, t_client ? t_client->z.ViceId : 0, + AUD_FID, Fid, + AUD_ACL, AccessList->AFSOpaque_val, AUD_END); return errorCode; } /*SRXAFS_FetchACL */ @@ -2519,7 +2519,7 @@ SAFSS_FetchStatus(struct rx_call *acall, struct AFSFid *Fid, ViceLog(1, ("SAFS_FetchStatus, Fid = %u.%u.%u, Host %s:%d, Id %d\n", Fid->Volume, Fid->Vnode, Fid->Unique, inet_ntoa(logHostAddr), - ntohs(rxr_PortOf(tcon)), t_client->ViceId)); + ntohs(rxr_PortOf(tcon)), t_client->z.ViceId)); FS_LOCK; AFSCallStats.FetchStatus++, AFSCallStats.TotalCalls++; FS_UNLOCK; @@ -2555,12 +2555,12 @@ SAFSS_FetchStatus(struct rx_call *acall, struct AFSFid *Fid, /* If a r/w volume, also set the CallBack state */ if (VolumeWriteable(volptr)) - SetCallBackStruct(AddCallBack(client->host, Fid), CallBack); + SetCallBackStruct(AddCallBack(client->z.host, Fid), CallBack); else { struct AFSFid myFid; memset(&myFid, 0, sizeof(struct AFSFid)); myFid.Volume = Fid->Volume; - SetCallBackStruct(AddVolCallBack(client->host, &myFid), CallBack); + SetCallBackStruct(AddVolCallBack(client->z.host, &myFid), CallBack); } Bad_FetchStatus: @@ -2655,13 +2655,13 @@ SRXAFS_BulkStatus(struct rx_call * acall, struct AFSCBFids * Fids, /* If a r/w volume, also set the CallBack state */ if (VolumeWriteable(volptr)) - SetCallBackStruct(AddBulkCallBack(client->host, tfid), + SetCallBackStruct(AddBulkCallBack(client->z.host, tfid), &CallBacks->AFSCBs_val[i]); else { struct AFSFid myFid; memset(&myFid, 0, sizeof(struct AFSFid)); myFid.Volume = tfid->Volume; - SetCallBackStruct(AddVolCallBack(client->host, &myFid), + SetCallBackStruct(AddVolCallBack(client->z.host, &myFid), &CallBacks->AFSCBs_val[i]); } @@ -2687,8 +2687,8 @@ SRXAFS_BulkStatus(struct rx_call * acall, struct AFSCBFids * Fids, Audit_and_Return: ViceLog(2, ("SAFS_BulkStatus returns %d\n", errorCode)); osi_auditU(acall, BulkFetchStatusEvent, errorCode, - AUD_ID, t_client ? t_client->ViceId : 0, - AUD_FIDS, Fids, AUD_END); + AUD_ID, t_client ? t_client->z.ViceId : 0, + AUD_FIDS, Fids, AUD_END); return errorCode; } /*SRXAFS_BulkStatus */ @@ -2813,13 +2813,13 @@ SRXAFS_InlineBulkStatus(struct rx_call * acall, struct AFSCBFids * Fids, /* If a r/w volume, also set the CallBack state */ if (VolumeWriteable(volptr)) - SetCallBackStruct(AddBulkCallBack(client->host, tfid), + SetCallBackStruct(AddBulkCallBack(client->z.host, tfid), &CallBacks->AFSCBs_val[i]); else { struct AFSFid myFid; memset(&myFid, 0, sizeof(struct AFSFid)); myFid.Volume = tfid->Volume; - SetCallBackStruct(AddVolCallBack(client->host, &myFid), + SetCallBackStruct(AddVolCallBack(client->z.host, &myFid), &CallBacks->AFSCBs_val[i]); } @@ -2846,8 +2846,8 @@ SRXAFS_InlineBulkStatus(struct rx_call * acall, struct AFSCBFids * Fids, Audit_and_Return: ViceLog(2, ("SAFS_InlineBulkStatus returns %d\n", errorCode)); osi_auditU(acall, InlineBulkFetchStatusEvent, errorCode, - AUD_ID, t_client ? t_client->ViceId : 0, - AUD_FIDS, Fids, AUD_END); + AUD_ID, t_client ? t_client->z.ViceId : 0, + AUD_FIDS, Fids, AUD_END); return errorCode; } /*SRXAFS_InlineBulkStatus */ @@ -2879,8 +2879,8 @@ SRXAFS_FetchStatus(struct rx_call * acall, struct AFSFid * Fid, fsstats_FinishOp(&fsstats, code); osi_auditU(acall, FetchStatusEvent, code, - AUD_ID, t_client ? t_client->ViceId : 0, - AUD_FID, Fid, AUD_END); + AUD_ID, t_client ? t_client->z.ViceId : 0, + AUD_FID, Fid, AUD_END); return code; } /*SRXAFS_FetchStatus */ @@ -2927,7 +2927,7 @@ common_StoreData64(struct rx_call *acall, struct AFSFid *Fid, ViceLog(5, ("StoreData: Fid = %u.%u.%u, Host %s:%d, Id %d\n", Fid->Volume, Fid->Vnode, Fid->Unique, inet_ntoa(logHostAddr), - ntohs(rxr_PortOf(tcon)), t_client->ViceId)); + ntohs(rxr_PortOf(tcon)), t_client->z.ViceId)); /* * Get associated volume/vnode for the stored file; caller's rights @@ -3005,8 +3005,8 @@ common_StoreData64(struct rx_call *acall, struct AFSFid *Fid, fsstats_FinishOp(&fsstats, errorCode); osi_auditU(acall, StoreDataEvent, errorCode, - AUD_ID, t_client ? t_client->ViceId : 0, - AUD_FID, Fid, AUD_END); + AUD_ID, t_client ? t_client->z.ViceId : 0, + AUD_FID, Fid, AUD_END); return (errorCode); } /*common_StoreData64 */ @@ -3075,7 +3075,7 @@ SRXAFS_StoreACL(struct rx_call * acall, struct AFSFid * Fid, ViceLog(1, ("SAFS_StoreACL, Fid = %u.%u.%u, ACL=%s, Host %s:%d, Id %d\n", Fid->Volume, Fid->Vnode, Fid->Unique, AccessList->AFSOpaque_val, - inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->ViceId)); + inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->z.ViceId)); FS_LOCK; AFSCallStats.StoreACL++, AFSCallStats.TotalCalls++; FS_UNLOCK; @@ -3116,7 +3116,7 @@ SRXAFS_StoreACL(struct rx_call * acall, struct AFSFid * Fid, rx_KeepAliveOn(acall); /* break call backs on the directory */ - BreakCallBack(client->host, Fid, 0); + BreakCallBack(client->z.host, Fid, 0); /* Get the updated dir's status back to the caller */ GetStatus(targetptr, OutStatus, rights, anyrights, 0); @@ -3131,8 +3131,8 @@ SRXAFS_StoreACL(struct rx_call * acall, struct AFSFid * Fid, fsstats_FinishOp(&fsstats, errorCode); osi_auditU(acall, StoreACLEvent, errorCode, - AUD_ID, t_client ? t_client->ViceId : 0, - AUD_FID, Fid, AUD_ACL, AccessList->AFSOpaque_val, AUD_END); + AUD_ID, t_client ? t_client->z.ViceId : 0, + AUD_FID, Fid, AUD_ACL, AccessList->AFSOpaque_val, AUD_END); return errorCode; } /*SRXAFS_StoreACL */ @@ -3163,7 +3163,7 @@ SAFSS_StoreStatus(struct rx_call *acall, struct AFSFid *Fid, ViceLog(1, ("SAFS_StoreStatus, Fid = %u.%u.%u, Host %s:%d, Id %d\n", Fid->Volume, Fid->Vnode, Fid->Unique, inet_ntoa(logHostAddr), - ntohs(rxr_PortOf(tcon)), t_client->ViceId)); + ntohs(rxr_PortOf(tcon)), t_client->z.ViceId)); FS_LOCK; AFSCallStats.StoreStatus++, AFSCallStats.TotalCalls++; FS_UNLOCK; @@ -3208,7 +3208,7 @@ SAFSS_StoreStatus(struct rx_call *acall, struct AFSFid *Fid, opr_Assert(!errorCode || errorCode == VSALVAGE); /* Break call backs on Fid */ - BreakCallBack(client->host, Fid, 0); + BreakCallBack(client->z.host, Fid, 0); /* Return the updated status back to caller */ GetStatus(targetptr, OutStatus, rights, anyrights, @@ -3251,8 +3251,8 @@ SRXAFS_StoreStatus(struct rx_call * acall, struct AFSFid * Fid, fsstats_FinishOp(&fsstats, code); osi_auditU(acall, StoreStatusEvent, code, - AUD_ID, t_client ? t_client->ViceId : 0, - AUD_FID, Fid, AUD_END); + AUD_ID, t_client ? t_client->z.ViceId : 0, + AUD_FID, Fid, AUD_END); return code; } /*SRXAFS_StoreStatus */ @@ -3286,7 +3286,7 @@ SAFSS_RemoveFile(struct rx_call *acall, struct AFSFid *DirFid, char *Name, ViceLog(1, ("SAFS_RemoveFile %s, Did = %u.%u.%u, Host %s:%d, Id %d\n", Name, DirFid->Volume, DirFid->Vnode, DirFid->Unique, - inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->ViceId)); + inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->z.ViceId)); FS_LOCK; AFSCallStats.RemoveFile++, AFSCallStats.TotalCalls++; FS_UNLOCK; @@ -3316,9 +3316,9 @@ SAFSS_RemoveFile(struct rx_call *acall, struct AFSFid *DirFid, char *Name, } /* Update the vnode status of the parent dir */ - Update_ParentVnodeStatus(parentptr, volptr, &dir, client->ViceId, + Update_ParentVnodeStatus(parentptr, volptr, &dir, client->z.ViceId, parentptr->disk.linkCount, - client->InSameNetwork); + client->z.InSameNetwork); rx_KeepAliveOn(acall); @@ -3340,11 +3340,11 @@ SAFSS_RemoveFile(struct rx_call *acall, struct AFSFid *DirFid, char *Name, VVnodeWriteToRead(&errorCode, targetptr); opr_Assert(!errorCode || errorCode == VSALVAGE); /* tell all the file has changed */ - BreakCallBack(client->host, &fileFid, 1); + BreakCallBack(client->z.host, &fileFid, 1); } /* break call back on the directory */ - BreakCallBack(client->host, DirFid, 0); + BreakCallBack(client->z.host, DirFid, 0); Bad_RemoveFile: /* Update and store volume/vnode and parent vnodes back */ @@ -3383,8 +3383,8 @@ SRXAFS_RemoveFile(struct rx_call * acall, struct AFSFid * DirFid, char *Name, fsstats_FinishOp(&fsstats, code); osi_auditU(acall, RemoveFileEvent, code, - AUD_ID, t_client ? t_client->ViceId : 0, - AUD_FID, DirFid, AUD_STR, Name, AUD_END); + AUD_ID, t_client ? t_client->z.ViceId : 0, + AUD_FID, DirFid, AUD_STR, Name, AUD_END); return code; } /*SRXAFS_RemoveFile */ @@ -3421,7 +3421,7 @@ SAFSS_CreateFile(struct rx_call *acall, struct AFSFid *DirFid, char *Name, ViceLog(1, ("SAFS_CreateFile %s, Did = %u.%u.%u, Host %s:%d, Id %d\n", Name, DirFid->Volume, DirFid->Vnode, DirFid->Unique, - inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->ViceId)); + inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->z.ViceId)); FS_LOCK; AFSCallStats.CreateFile++, AFSCallStats.TotalCalls++; FS_UNLOCK; @@ -3456,9 +3456,9 @@ SAFSS_CreateFile(struct rx_call *acall, struct AFSFid *DirFid, char *Name, goto Bad_CreateFile; /* update the status of the parent vnode */ - Update_ParentVnodeStatus(parentptr, volptr, &dir, client->ViceId, + Update_ParentVnodeStatus(parentptr, volptr, &dir, client->z.ViceId, parentptr->disk.linkCount, - client->InSameNetwork); + client->z.InSameNetwork); /* update the status of the new file's vnode */ Update_TargetVnodeStatus(targetptr, TVS_CFILE, client, InStatus, @@ -3475,10 +3475,10 @@ SAFSS_CreateFile(struct rx_call *acall, struct AFSFid *DirFid, char *Name, opr_Assert(!errorCode || errorCode == VSALVAGE); /* break call back on parent dir */ - BreakCallBack(client->host, DirFid, 0); + BreakCallBack(client->z.host, DirFid, 0); /* Return a callback promise for the newly created file to the caller */ - SetCallBackStruct(AddCallBack(client->host, OutFid), CallBack); + SetCallBackStruct(AddCallBack(client->z.host, OutFid), CallBack); Bad_CreateFile: /* Update and store volume/vnode and parent vnodes back */ @@ -3523,8 +3523,8 @@ SRXAFS_CreateFile(struct rx_call * acall, struct AFSFid * DirFid, char *Name, fsstats_FinishOp(&fsstats, code); osi_auditU(acall, CreateFileEvent, code, - AUD_ID, t_client ? t_client->ViceId : 0, - AUD_FID, DirFid, AUD_STR, Name, AUD_FID, OutFid, AUD_END); + AUD_ID, t_client ? t_client->z.ViceId : 0, + AUD_FID, DirFid, AUD_STR, Name, AUD_FID, OutFid, AUD_END); return code; } /*SRXAFS_CreateFile */ @@ -3581,7 +3581,7 @@ SAFSS_Rename(struct rx_call *acall, struct AFSFid *OldDirFid, char *OldName, ("SAFS_Rename %s to %s, Fid = %u.%u.%u to %u.%u.%u, Host %s:%d, Id %d\n", OldName, NewName, OldDirFid->Volume, OldDirFid->Vnode, OldDirFid->Unique, NewDirFid->Volume, NewDirFid->Vnode, - NewDirFid->Unique, inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->ViceId)); + NewDirFid->Unique, inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->z.ViceId)); FS_LOCK; AFSCallStats.Rename++, AFSCallStats.TotalCalls++; FS_UNLOCK; @@ -3898,10 +3898,10 @@ SAFSS_Rename(struct rx_call *acall, struct AFSFid *OldDirFid, char *OldName, opr_Assert(afs_dir_Delete(&olddir, OldName) == 0); /* if the directory length changes, reflect it in the statistics */ - Update_ParentVnodeStatus(oldvptr, volptr, &olddir, client->ViceId, - oldvptr->disk.linkCount, client->InSameNetwork); - Update_ParentVnodeStatus(newvptr, volptr, &newdir, client->ViceId, - newvptr->disk.linkCount, client->InSameNetwork); + Update_ParentVnodeStatus(oldvptr, volptr, &olddir, client->z.ViceId, + oldvptr->disk.linkCount, client->z.InSameNetwork); + Update_ParentVnodeStatus(newvptr, volptr, &newdir, client->z.ViceId, + newvptr->disk.linkCount, client->z.InSameNetwork); if (oldvptr == newvptr) oldvptr->disk.dataVersion--; /* Since it was bumped by 2! */ @@ -3956,9 +3956,9 @@ SAFSS_Rename(struct rx_call *acall, struct AFSFid *OldDirFid, char *OldName, rx_KeepAliveOn(acall); /* break call back on NewDirFid, OldDirFid, NewDirFid and newFileFid */ - BreakCallBack(client->host, NewDirFid, 0); + BreakCallBack(client->z.host, NewDirFid, 0); if (oldvptr != newvptr) { - BreakCallBack(client->host, OldDirFid, 0); + BreakCallBack(client->z.host, OldDirFid, 0); } if (updatefile) { /* if a dir moved, .. changed */ @@ -3968,7 +3968,7 @@ SAFSS_Rename(struct rx_call *acall, struct AFSFid *OldDirFid, char *OldName, * enough to know that the callback could be broken implicitly, * but that may not be clear, and some client implementations * may not know to. */ - BreakCallBack(client->host, &fileFid, 1); + BreakCallBack(client->z.host, &fileFid, 1); } if (newfileptr) { /* Note: it is not necessary to break the callback */ @@ -3976,7 +3976,7 @@ SAFSS_Rename(struct rx_call *acall, struct AFSFid *OldDirFid, char *OldName, DeleteFileCallBacks(&newFileFid); /* no other references */ else /* other's still exist (with wrong link count) */ - BreakCallBack(client->host, &newFileFid, 1); + BreakCallBack(client->z.host, &newFileFid, 1); } Bad_Rename: @@ -4027,9 +4027,9 @@ SRXAFS_Rename(struct rx_call * acall, struct AFSFid * OldDirFid, fsstats_FinishOp(&fsstats, code); osi_auditU(acall, RenameFileEvent, code, - AUD_ID, t_client ? t_client->ViceId : 0, - AUD_FID, OldDirFid, AUD_STR, OldName, - AUD_FID, NewDirFid, AUD_STR, NewName, AUD_END); + AUD_ID, t_client ? t_client->z.ViceId : 0, + AUD_FID, OldDirFid, AUD_STR, OldName, + AUD_FID, NewDirFid, AUD_STR, NewName, AUD_END); return code; } /*SRXAFS_Rename */ @@ -4068,7 +4068,7 @@ SAFSS_Symlink(struct rx_call *acall, struct AFSFid *DirFid, char *Name, ViceLog(1, ("SAFS_Symlink %s to %s, Did = %u.%u.%u, Host %s:%d, Id %d\n", Name, LinkContents, DirFid->Volume, DirFid->Vnode, DirFid->Unique, - inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->ViceId)); + inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->z.ViceId)); FS_LOCK; AFSCallStats.Symlink++, AFSCallStats.TotalCalls++; FS_UNLOCK; @@ -4123,9 +4123,9 @@ SAFSS_Symlink(struct rx_call *acall, struct AFSFid *DirFid, char *Name, } /* update the status of the parent vnode */ - Update_ParentVnodeStatus(parentptr, volptr, &dir, client->ViceId, + Update_ParentVnodeStatus(parentptr, volptr, &dir, client->z.ViceId, parentptr->disk.linkCount, - client->InSameNetwork); + client->z.InSameNetwork); /* update the status of the new symbolic link file vnode */ Update_TargetVnodeStatus(targetptr, TVS_SLINK, client, InStatus, @@ -4160,7 +4160,7 @@ SAFSS_Symlink(struct rx_call *acall, struct AFSFid *DirFid, char *Name, rx_KeepAliveOn(acall); /* break call back on the parent dir */ - BreakCallBack(client->host, DirFid, 0); + BreakCallBack(client->z.host, DirFid, 0); Bad_SymLink: /* Write the all modified vnodes (parent, new files) and volume back */ @@ -4207,8 +4207,8 @@ SRXAFS_Symlink(struct rx_call *acall, /* Rx call */ fsstats_FinishOp(&fsstats, code); osi_auditU(acall, SymlinkEvent, code, - AUD_ID, t_client ? t_client->ViceId : 0, - AUD_FID, DirFid, AUD_STR, Name, + AUD_ID, t_client ? t_client->z.ViceId : 0, + AUD_FID, DirFid, AUD_STR, Name, AUD_FID, OutFid, AUD_STR, LinkContents, AUD_END); return code; @@ -4245,7 +4245,7 @@ SAFSS_Link(struct rx_call *acall, struct AFSFid *DirFid, char *Name, ("SAFS_Link %s, Did = %u.%u.%u, Fid = %u.%u.%u, Host %s:%d, Id %d\n", Name, DirFid->Volume, DirFid->Vnode, DirFid->Unique, ExistingFid->Volume, ExistingFid->Vnode, ExistingFid->Unique, - inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->ViceId)); + inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->z.ViceId)); FS_LOCK; AFSCallStats.Link++, AFSCallStats.TotalCalls++; FS_UNLOCK; @@ -4317,12 +4317,12 @@ SAFSS_Link(struct rx_call *acall, struct AFSFid *DirFid, char *Name, /* update the status in the parent vnode */ /**WARNING** --> disk.author SHOULDN'T be modified???? */ - Update_ParentVnodeStatus(parentptr, volptr, &dir, client->ViceId, + Update_ParentVnodeStatus(parentptr, volptr, &dir, client->z.ViceId, parentptr->disk.linkCount, - client->InSameNetwork); + client->z.InSameNetwork); targetptr->disk.linkCount++; - targetptr->disk.author = client->ViceId; + targetptr->disk.author = client->z.ViceId; targetptr->changed_newTime = 1; /* Status change of linked-to file */ /* set up return status */ @@ -4338,12 +4338,12 @@ SAFSS_Link(struct rx_call *acall, struct AFSFid *DirFid, char *Name, rx_KeepAliveOn(acall); /* break call back on DirFid */ - BreakCallBack(client->host, DirFid, 0); + BreakCallBack(client->z.host, DirFid, 0); /* * We also need to break the callback for the file that is hard-linked since part * of its status (like linkcount) is changed */ - BreakCallBack(client->host, ExistingFid, 0); + BreakCallBack(client->z.host, ExistingFid, 0); Bad_Link: /* Write the all modified vnodes (parent, new files) and volume back */ @@ -4384,8 +4384,8 @@ SRXAFS_Link(struct rx_call * acall, struct AFSFid * DirFid, char *Name, fsstats_FinishOp(&fsstats, code); osi_auditU(acall, LinkEvent, code, - AUD_ID, t_client ? t_client->ViceId : 0, - AUD_FID, DirFid, AUD_STR, Name, + AUD_ID, t_client ? t_client->z.ViceId : 0, + AUD_FID, DirFid, AUD_STR, Name, AUD_FID, ExistingFid, AUD_END); return code; @@ -4427,7 +4427,7 @@ SAFSS_MakeDir(struct rx_call *acall, struct AFSFid *DirFid, char *Name, ViceLog(1, ("SAFS_MakeDir %s, Did = %u.%u.%u, Host %s:%d, Id %d\n", Name, DirFid->Volume, DirFid->Vnode, DirFid->Unique, - inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->ViceId)); + inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->z.ViceId)); FS_LOCK; AFSCallStats.MakeDir++, AFSCallStats.TotalCalls++; FS_UNLOCK; @@ -4475,9 +4475,9 @@ SAFSS_MakeDir(struct rx_call *acall, struct AFSFid *DirFid, char *Name, } /* Update the status for the parent dir */ - Update_ParentVnodeStatus(parentptr, volptr, &parentdir, client->ViceId, + Update_ParentVnodeStatus(parentptr, volptr, &parentdir, client->z.ViceId, parentptr->disk.linkCount + 1, - client->InSameNetwork); + client->z.InSameNetwork); /* Point to target's ACL buffer and copy the parent's ACL contents to it */ opr_Verify((SetAccessList(&targetptr, &volptr, &newACL, &newACLSize, @@ -4507,10 +4507,10 @@ SAFSS_MakeDir(struct rx_call *acall, struct AFSFid *DirFid, char *Name, rx_KeepAliveOn(acall); /* break call back on DirFid */ - BreakCallBack(client->host, DirFid, 0); + BreakCallBack(client->z.host, DirFid, 0); /* Return a callback promise to caller */ - SetCallBackStruct(AddCallBack(client->host, OutFid), CallBack); + SetCallBackStruct(AddCallBack(client->z.host, OutFid), CallBack); Bad_MakeDir: /* Write the all modified vnodes (parent, new files) and volume back */ @@ -4554,8 +4554,8 @@ SRXAFS_MakeDir(struct rx_call * acall, struct AFSFid * DirFid, char *Name, fsstats_FinishOp(&fsstats, code); osi_auditU(acall, MakeDirEvent, code, - AUD_ID, t_client ? t_client->ViceId : 0, - AUD_FID, DirFid, AUD_STR, Name, + AUD_ID, t_client ? t_client->z.ViceId : 0, + AUD_FID, DirFid, AUD_STR, Name, AUD_FID, OutFid, AUD_END); return code; @@ -4591,7 +4591,7 @@ SAFSS_RemoveDir(struct rx_call *acall, struct AFSFid *DirFid, char *Name, ViceLog(1, ("SAFS_RemoveDir %s, Did = %u.%u.%u, Host %s:%d, Id %d\n", Name, DirFid->Volume, DirFid->Vnode, DirFid->Unique, - inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->ViceId)); + inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->z.ViceId)); FS_LOCK; AFSCallStats.RemoveDir++, AFSCallStats.TotalCalls++; FS_UNLOCK; @@ -4622,9 +4622,9 @@ SAFSS_RemoveDir(struct rx_call *acall, struct AFSFid *DirFid, char *Name, } /* Update the status for the parent dir; link count is also adjusted */ - Update_ParentVnodeStatus(parentptr, volptr, &dir, client->ViceId, + Update_ParentVnodeStatus(parentptr, volptr, &dir, client->z.ViceId, parentptr->disk.linkCount - 1, - client->InSameNetwork); + client->z.InSameNetwork); /* Return to the caller the updated parent dir status */ GetStatus(parentptr, OutDirStatus, rights, anyrights, NULL); @@ -4643,7 +4643,7 @@ SAFSS_RemoveDir(struct rx_call *acall, struct AFSFid *DirFid, char *Name, rx_KeepAliveOn(acall); /* break call back on DirFid and fileFid */ - BreakCallBack(client->host, DirFid, 0); + BreakCallBack(client->z.host, DirFid, 0); Bad_RemoveDir: /* Write the all modified vnodes (parent, new files) and volume back */ @@ -4682,8 +4682,8 @@ SRXAFS_RemoveDir(struct rx_call * acall, struct AFSFid * DirFid, char *Name, fsstats_FinishOp(&fsstats, code); osi_auditU(acall, RemoveDirEvent, code, - AUD_ID, t_client ? t_client->ViceId : 0, - AUD_FID, DirFid, AUD_STR, Name, AUD_END); + AUD_ID, t_client ? t_client->z.ViceId : 0, + AUD_FID, DirFid, AUD_STR, Name, AUD_END); return code; } /*SRXAFS_RemoveDir */ @@ -4718,7 +4718,7 @@ SAFSS_SetLock(struct rx_call *acall, struct AFSFid *Fid, ViceLockType type, ViceLog(1, ("SAFS_SetLock type = %s Fid = %u.%u.%u, Host %s:%d, Id %d\n", locktype[(int)type], Fid->Volume, Fid->Vnode, Fid->Unique, - inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->ViceId)); + inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->z.ViceId)); FS_LOCK; AFSCallStats.SetLock++, AFSCallStats.TotalCalls++; FS_UNLOCK; @@ -4786,8 +4786,8 @@ SRXAFS_SetLock(struct rx_call * acall, struct AFSFid * Fid, ViceLockType type, fsstats_FinishOp(&fsstats, code); osi_auditU(acall, SetLockEvent, code, - AUD_ID, t_client ? t_client->ViceId : 0, - AUD_FID, Fid, AUD_LONG, type, AUD_END); + AUD_ID, t_client ? t_client->z.ViceId : 0, + AUD_FID, Fid, AUD_LONG, type, AUD_END); return code; } /*SRXAFS_SetLock */ @@ -4816,7 +4816,7 @@ SAFSS_ExtendLock(struct rx_call *acall, struct AFSFid *Fid, ViceLog(1, ("SAFS_ExtendLock Fid = %u.%u.%u, Host %s:%d, Id %d\n", Fid->Volume, Fid->Vnode, Fid->Unique, inet_ntoa(logHostAddr), - ntohs(rxr_PortOf(tcon)), t_client->ViceId)); + ntohs(rxr_PortOf(tcon)), t_client->z.ViceId)); FS_LOCK; AFSCallStats.ExtendLock++, AFSCallStats.TotalCalls++; FS_UNLOCK; @@ -4884,8 +4884,8 @@ SRXAFS_ExtendLock(struct rx_call * acall, struct AFSFid * Fid, fsstats_FinishOp(&fsstats, code); osi_auditU(acall, ExtendLockEvent, code, - AUD_ID, t_client ? t_client->ViceId : 0, - AUD_FID, Fid, AUD_END); + AUD_ID, t_client ? t_client->z.ViceId : 0, + AUD_FID, Fid, AUD_END); return code; } /*SRXAFS_ExtendLock */ @@ -4915,7 +4915,7 @@ SAFSS_ReleaseLock(struct rx_call *acall, struct AFSFid *Fid, ViceLog(1, ("SAFS_ReleaseLock Fid = %u.%u.%u, Host %s:%d, Id %d\n", Fid->Volume, Fid->Vnode, Fid->Unique, inet_ntoa(logHostAddr), - ntohs(rxr_PortOf(tcon)), t_client->ViceId)); + ntohs(rxr_PortOf(tcon)), t_client->z.ViceId)); FS_LOCK; AFSCallStats.ReleaseLock++, AFSCallStats.TotalCalls++; FS_UNLOCK; @@ -4943,7 +4943,7 @@ SAFSS_ReleaseLock(struct rx_call *acall, struct AFSFid *Fid, /* convert the write lock to a read lock before breaking callbacks */ VVnodeWriteToRead(&errorCode, targetptr); opr_Assert(!errorCode || errorCode == VSALVAGE); - BreakCallBack(client->host, Fid, 0); + BreakCallBack(client->z.host, Fid, 0); } Bad_ReleaseLock: @@ -4993,8 +4993,8 @@ SRXAFS_ReleaseLock(struct rx_call * acall, struct AFSFid * Fid, fsstats_FinishOp(&fsstats, code); osi_auditU(acall, ReleaseLockEvent, code, - AUD_ID, t_client ? t_client->ViceId : 0, - AUD_FID, Fid, AUD_END); + AUD_ID, t_client ? t_client->z.ViceId : 0, + AUD_FID, Fid, AUD_END); return code; } /*SRXAFS_ReleaseLock */ @@ -5100,7 +5100,7 @@ SRXAFS_GetStatistics(struct rx_call *acall, struct ViceStatistics *Statistics) fsstats_FinishOp(&fsstats, code); osi_auditU(acall, GetStatisticsEvent, code, - AUD_ID, t_client ? t_client->ViceId : 0, AUD_END); + AUD_ID, t_client ? t_client->z.ViceId : 0, AUD_END); return code; } /*SRXAFS_GetStatistics */ @@ -5178,7 +5178,7 @@ SRXAFS_GetStatistics64(struct rx_call *acall, afs_int32 statsVersion, ViceStatis fsstats_FinishOp(&fsstats, code); osi_auditU(acall, GetStatisticsEvent, code, - AUD_ID, t_client ? t_client->ViceId : 0, AUD_END); + AUD_ID, t_client ? t_client->z.ViceId : 0, AUD_END); return code; } /*SRXAFS_GetStatistics */ @@ -5220,7 +5220,7 @@ SRXAFS_XStatsVersion(struct rx_call * a_call, afs_int32 * a_versionP) fsstats_FinishOp(&fsstats, 0); osi_auditU(a_call, XStatsVersionEvent, 0, - AUD_ID, t_client ? t_client->ViceId : 0, AUD_END); + AUD_ID, t_client ? t_client->z.ViceId : 0, AUD_END); return (0); } /*SRXAFS_XStatsVersion */ @@ -5567,7 +5567,7 @@ common_GiveUpCallBacks(struct rx_call *acall, struct AFSCBFids *FidArray, errorCode = GetClient(tcon, &client); if (!errorCode) { H_LOCK; - DeleteAllCallBacks_r(client->host, 1); + DeleteAllCallBacks_r(client->z.host, 1); H_UNLOCK; PutClient(&client); } @@ -5585,7 +5585,7 @@ common_GiveUpCallBacks(struct rx_call *acall, struct AFSCBFids *FidArray, if (!errorCode) { for (i = 0; i < FidArray->AFSCBFids_len; i++) { struct AFSFid *fid = &(FidArray->AFSCBFids_val[i]); - DeleteCallBack(client->host, fid); + DeleteCallBack(client->z.host, fid); } PutClient(&client); } @@ -5682,12 +5682,12 @@ FlushClientCPS(struct client *client, void *arock) { ObtainWriteLock(&client->lock); - client->prfail = 2; /* Means re-eval client's cps */ + client->z.prfail = 2; /* Means re-eval client's cps */ - if ((client->ViceId != ANONYMOUSID) && client->CPS.prlist_val) { - free(client->CPS.prlist_val); - client->CPS.prlist_val = NULL; - client->CPS.prlist_len = 0; + if ((client->z.ViceId != ANONYMOUSID) && client->z.CPS.prlist_val) { + free(client->z.CPS.prlist_val); + client->z.CPS.prlist_val = NULL; + client->z.CPS.prlist_len = 0; } ReleaseWriteLock(&client->lock); @@ -5962,8 +5962,8 @@ SRXAFS_GetVolumeStatus(struct rx_call * acall, afs_int32 avolid, fsstats_FinishOp(&fsstats, errorCode); osi_auditU(acall, GetVolumeStatusEvent, errorCode, - AUD_ID, t_client ? t_client->ViceId : 0, - AUD_LONG, avolid, AUD_STR, *Name, AUD_END); + AUD_ID, t_client ? t_client->z.ViceId : 0, + AUD_LONG, avolid, AUD_STR, *Name, AUD_END); return (errorCode); } /*SRXAFS_GetVolumeStatus */ @@ -6031,8 +6031,8 @@ SRXAFS_SetVolumeStatus(struct rx_call * acall, afs_int32 avolid, fsstats_FinishOp(&fsstats, errorCode); osi_auditU(acall, SetVolumeStatusEvent, errorCode, - AUD_ID, t_client ? t_client->ViceId : 0, - AUD_LONG, avolid, AUD_STR, Name, AUD_END); + AUD_ID, t_client ? t_client->z.ViceId : 0, + AUD_LONG, avolid, AUD_STR, Name, AUD_END); return (errorCode); } /*SRXAFS_SetVolumeStatus */ @@ -6431,7 +6431,7 @@ StoreData_RXStyle(Volume * volptr, Vnode * targetptr, struct AFSFid * Fid, * We break the callbacks here so that the following signal will not * leave a window. */ - BreakCallBack(client->host, Fid, 0); + BreakCallBack(client->z.host, Fid, 0); if (Pos == -1 || VN_GET_INO(targetptr) == 0) { /* the inode should have been created in Alloc_NewVnode */ @@ -6842,7 +6842,7 @@ SRXAFS_CallBackRxConnAddr (struct rx_call * acall, afs_int32 *addr) LogClientError("Client host too busy (CallBackRxConnAddr)", tcon, viceid, NULL); goto Bad_CallBackRxConnAddr; } - thost = tclient->host; + thost = tclient->z.host; /* nothing more can be done */ if ( !thost->z.interface ) diff --git a/src/viced/host.c b/src/viced/host.c index a5fe72c92..4154ef44a 100644 --- a/src/viced/host.c +++ b/src/viced/host.c @@ -124,9 +124,9 @@ GetCEBlock(void) for (i = 0; i < (CESPERBLOCK - 1); i++) { Lock_Init(&block->entry[i].lock); - block->entry[i].next = &(block->entry[i + 1]); + block->entry[i].z.next = &(block->entry[i + 1]); } - block->entry[CESPERBLOCK - 1].next = 0; + block->entry[CESPERBLOCK - 1].z.next = 0; Lock_Init(&block->entry[CESPERBLOCK - 1].lock); CEFree = (struct client *)block; CEBlocks++; @@ -148,9 +148,9 @@ GetCE(void) } entry = CEFree; - CEFree = entry->next; + CEFree = entry->z.next; CEs++; - memset(entry, 0, CLIENT_TO_ZERO(entry)); + memset(&entry->z, 0, sizeof(struct client_to_zero)); return (entry); } /*GetCE */ @@ -160,9 +160,9 @@ GetCE(void) static void FreeCE(struct client *entry) { - entry->VenusEpoch = 0; - entry->sid = 0; - entry->next = CEFree; + entry->z.VenusEpoch = 0; + entry->z.sid = 0; + entry->z.next = CEFree; CEFree = entry; CEs--; @@ -798,7 +798,7 @@ h_LookupUuid_r(afsUUID * uuidp) /* h_TossStuff_r: Toss anything in the host structure (the host or * clients marked for deletion. Called from h_Release_r ONLY. - * To be called, there must be no holds, and either host->deleted + * To be called, there must be no holds, and either host->z.deleted * or host->clientDeleted must be set. */ void @@ -852,7 +852,7 @@ h_TossStuff_r(struct host *host) /* ASSUMPTION: rxi_FreeConnection() does not yield */ for (cp = &host->z.FirstClient; (client = *cp);) { - if ((host->z.hostFlags & HOSTDELETED) || client->deleted) { + if ((host->z.hostFlags & HOSTDELETED) || client->z.deleted) { int code; ObtainWriteLockNoBlock(&client->lock, code); if (code < 0) { @@ -865,27 +865,27 @@ h_TossStuff_r(struct host *host) return; } - if (client->refCount) { + if (client->z.refCount) { char hoststr[16]; ViceLog(0, ("Warning: h_TossStuff_r failed: Host %p (%s:%d) " "client %p refcount %d.\n", host, afs_inet_ntoa_r(host->z.host, hoststr), - ntohs(host->z.port), client, client->refCount)); + ntohs(host->z.port), client, client->z.refCount)); /* This is the same thing we do if the host is locked */ ReleaseWriteLock(&client->lock); return; } - client->CPS.prlist_len = 0; - if ((client->ViceId != ANONYMOUSID) && client->CPS.prlist_val) - free(client->CPS.prlist_val); - client->CPS.prlist_val = NULL; + client->z.CPS.prlist_len = 0; + if ((client->z.ViceId != ANONYMOUSID) && client->z.CPS.prlist_val) + free(client->z.CPS.prlist_val); + client->z.CPS.prlist_val = NULL; CurrentConnections--; - *cp = client->next; + *cp = client->z.next; ReleaseWriteLock(&client->lock); FreeCE(client); } else - cp = &client->next; + cp = &client->z.next; } /* We've just cleaned out all the deleted clients; clear the flag */ @@ -2464,10 +2464,10 @@ PerHost_EnumerateClient(struct host *host, void *arock) struct client *client; int code; - for (client = host->z.FirstClient; client; client = client->next) { - if (!client->deleted && client->ViceId == args->vid) { + for (client = host->z.FirstClient; client; client = client->z.next) { + if (!client->z.deleted && client->z.ViceId == args->vid) { - client->refCount++; + client->z.refCount++; H_UNLOCK; code = (*args->proc)(client, args->rock); @@ -2602,8 +2602,8 @@ getPeerDetails(struct rx_connection *conn, * by one. The caller must call h_ReleaseClient_r when finished with * the client. * - * The refCount on client->host is returned incremented. h_ReleaseClient_r - * does not decrement the refCount on client->host. + * The refCount on client->z.host is returned incremented. h_ReleaseClient_r + * does not decrement the refCount on client->z.host. * * *a_viceid is set to the user's ViceId, even if we don't return a client * struct. @@ -2623,17 +2623,17 @@ h_FindClient_r(struct rx_connection *tcon, afs_int32 *a_viceid) int created = 0; client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key); - if (client && client->sid == rx_GetConnectionId(tcon) - && client->VenusEpoch == rx_GetConnectionEpoch(tcon) - && !(client->host->z.hostFlags & HOSTDELETED) - && !client->deleted) { + if (client && client->z.sid == rx_GetConnectionId(tcon) + && client->z.VenusEpoch == rx_GetConnectionEpoch(tcon) + && !(client->z.host->z.hostFlags & HOSTDELETED) + && !client->z.deleted) { if (a_viceid) { - *a_viceid = client->ViceId; + *a_viceid = client->z.ViceId; } - client->refCount++; - h_Hold_r(client->host); - if (client->prfail != 2) { + client->z.refCount++; + h_Hold_r(client->z.host); + if (client->z.prfail != 2) { /* Could add shared lock on client here */ /* note that we don't have to lock entry in this path to * ensure CPS is initialized, since we don't call rx_SetSpecific @@ -2667,10 +2667,10 @@ h_FindClient_r(struct rx_connection *tcon, afs_int32 *a_viceid) retryfirstclient: /* First try to find the client structure */ - for (client = host->z.FirstClient; client; client = client->next) { - if (!client->deleted && (client->sid == rx_GetConnectionId(tcon)) - && (client->VenusEpoch == rx_GetConnectionEpoch(tcon))) { - client->refCount++; + for (client = host->z.FirstClient; client; client = client->z.next) { + if (!client->z.deleted && (client->z.sid == rx_GetConnectionId(tcon)) + && (client->z.VenusEpoch == rx_GetConnectionEpoch(tcon))) { + client->z.refCount++; H_UNLOCK; ObtainWriteLock(&client->lock); H_LOCK; @@ -2687,9 +2687,9 @@ h_FindClient_r(struct rx_connection *tcon, afs_int32 *a_viceid) return NULL; } /* Retry to find the client structure */ - for (client = host->z.FirstClient; client; client = client->next) { - if (!client->deleted && (client->sid == rx_GetConnectionId(tcon)) - && (client->VenusEpoch == rx_GetConnectionEpoch(tcon))) { + for (client = host->z.FirstClient; client; client = client->z.next) { + if (!client->z.deleted && (client->z.sid == rx_GetConnectionId(tcon)) + && (client->z.VenusEpoch == rx_GetConnectionEpoch(tcon))) { h_Unlock_r(host); goto retryfirstclient; } @@ -2697,43 +2697,43 @@ h_FindClient_r(struct rx_connection *tcon, afs_int32 *a_viceid) created = 1; client = GetCE(); ObtainWriteLock(&client->lock); - client->refCount = 1; - client->host = host; - client->InSameNetwork = host->z.InSameNetwork; - client->ViceId = viceid; - client->expTime = expTime; /* rx only */ - client->authClass = authClass; /* rx only */ - client->sid = rx_GetConnectionId(tcon); - client->VenusEpoch = rx_GetConnectionEpoch(tcon); - client->CPS.prlist_val = NULL; - client->CPS.prlist_len = 0; + client->z.refCount = 1; + client->z.host = host; + client->z.InSameNetwork = host->z.InSameNetwork; + client->z.ViceId = viceid; + client->z.expTime = expTime; /* rx only */ + client->z.authClass = authClass; /* rx only */ + client->z.sid = rx_GetConnectionId(tcon); + client->z.VenusEpoch = rx_GetConnectionEpoch(tcon); + client->z.CPS.prlist_val = NULL; + client->z.CPS.prlist_len = 0; h_Unlock_r(host); } } - client->prfail = fail; + client->z.prfail = fail; - if (!(client->CPS.prlist_val) || (viceid != client->ViceId)) { - client->CPS.prlist_len = 0; - if (client->CPS.prlist_val && (client->ViceId != ANONYMOUSID)) - free(client->CPS.prlist_val); - client->CPS.prlist_val = NULL; - client->ViceId = viceid; - client->expTime = expTime; + if (!(client->z.CPS.prlist_val) || (viceid != client->z.ViceId)) { + client->z.CPS.prlist_len = 0; + if (client->z.CPS.prlist_val && (client->z.ViceId != ANONYMOUSID)) + free(client->z.CPS.prlist_val); + client->z.CPS.prlist_val = NULL; + client->z.ViceId = viceid; + client->z.expTime = expTime; if (viceid == ANONYMOUSID) { - client->CPS.prlist_len = AnonCPS.prlist_len; - client->CPS.prlist_val = AnonCPS.prlist_val; + client->z.CPS.prlist_len = AnonCPS.prlist_len; + client->z.CPS.prlist_val = AnonCPS.prlist_val; } else { H_UNLOCK; - code = hpr_GetCPS(viceid, &client->CPS); + code = hpr_GetCPS(viceid, &client->z.CPS); H_LOCK; if (code) { char hoststr[16]; ViceLog(0, ("pr_GetCPS failed(%d) for user %d, host %" AFS_PTR_FMT " (%s:%d)\n", - code, viceid, client->host, - afs_inet_ntoa_r(client->host->z.host,hoststr), - ntohs(client->host->z.port))); + code, viceid, client->z.host, + afs_inet_ntoa_r(client->z.host->z.host,hoststr), + ntohs(client->z.host->z.port))); /* Although ubik_Call (called by pr_GetCPS) traverses thru * all protection servers and reevaluates things if no @@ -2749,14 +2749,14 @@ h_FindClient_r(struct rx_connection *tcon, afs_int32 *a_viceid) * want to retry and we don't know the whole code list! */ if (code < 0 || code == UNOQUORUM || code == UNOTSYNC) - client->prfail = 1; + client->z.prfail = 1; } } /* the disabling of system:administrators is so iffy and has so many * possible failure modes that we will disable it again */ /* Turn off System:Administrator for safety - * if (AL_IsAMember(SystemId, client->CPS) == 0) - * osi_Assert(AL_DisableGroup(SystemId, client->CPS) == 0); */ + * if (AL_IsAMember(SystemId, client->z.CPS) == 0) + * osi_Assert(AL_DisableGroup(SystemId, client->z.CPS) == 0); */ } /* Now, tcon may already be set to a rock, since we blocked with no host @@ -2766,51 +2766,51 @@ h_FindClient_r(struct rx_connection *tcon, afs_int32 *a_viceid) */ oldClient = (struct client *)rx_GetSpecific(tcon, rxcon_client_key); if (oldClient && oldClient != client - && oldClient->sid == rx_GetConnectionId(tcon) - && oldClient->VenusEpoch == rx_GetConnectionEpoch(tcon) - && !(oldClient->host->z.hostFlags & HOSTDELETED)) { + && oldClient->z.sid == rx_GetConnectionId(tcon) + && oldClient->z.VenusEpoch == rx_GetConnectionEpoch(tcon) + && !(oldClient->z.host->z.hostFlags & HOSTDELETED)) { char hoststr[16]; - if (!oldClient->deleted) { + if (!oldClient->z.deleted) { /* if we didn't create it, it's not ours to put back */ if (created) { ViceLog(0, ("FindClient: stillborn client %p(%x); " "conn %p (host %s:%d) had client %p(%x)\n", - client, client->sid, tcon, + client, client->z.sid, tcon, afs_inet_ntoa_r(rxr_HostOf(tcon), hoststr), ntohs(rxr_PortOf(tcon)), - oldClient, oldClient->sid)); - if ((client->ViceId != ANONYMOUSID) && client->CPS.prlist_val) - free(client->CPS.prlist_val); - client->CPS.prlist_val = NULL; - client->CPS.prlist_len = 0; + oldClient, oldClient->z.sid)); + if ((client->z.ViceId != ANONYMOUSID) && client->z.CPS.prlist_val) + free(client->z.CPS.prlist_val); + client->z.CPS.prlist_val = NULL; + client->z.CPS.prlist_len = 0; } /* We should perhaps check for 0 here */ - client->refCount--; + client->z.refCount--; ReleaseWriteLock(&client->lock); if (created) { FreeCE(client); created = 0; } - oldClient->refCount++; + oldClient->z.refCount++; - h_Hold_r(oldClient->host); - h_Release_r(client->host); + h_Hold_r(oldClient->z.host); + h_Release_r(client->z.host); H_UNLOCK; ObtainWriteLock(&oldClient->lock); H_LOCK; client = oldClient; - host = oldClient->host; + host = oldClient->z.host; } else { ViceLog(0, ("FindClient: deleted client %p(%x ref %d host %p href " "%d) already had conn %p (host %s:%d, cid %x), stolen " "by client %p(%x, ref %d host %p href %d)\n", - oldClient, oldClient->sid, oldClient->refCount, - oldClient->host, oldClient->host->z.refCount, tcon, + oldClient, oldClient->z.sid, oldClient->z.refCount, + oldClient->z.host, oldClient->z.host->z.refCount, tcon, afs_inet_ntoa_r(rxr_HostOf(tcon), hoststr), ntohs(rxr_PortOf(tcon)), rx_GetConnectionId(tcon), - client, client->sid, client->refCount, - client->host, client->host->z.refCount)); + client, client->z.sid, client->z.refCount, + client->z.host, client->z.host->z.refCount)); /* rx_SetSpecific will be done immediately below */ } } @@ -2823,20 +2823,20 @@ h_FindClient_r(struct rx_connection *tcon, afs_int32 *a_viceid) h_Release_r(host); host = NULL; - client->host = NULL; + client->z.host = NULL; - if ((client->ViceId != ANONYMOUSID) && client->CPS.prlist_val) - free(client->CPS.prlist_val); - client->CPS.prlist_val = NULL; - client->CPS.prlist_len = 0; + if ((client->z.ViceId != ANONYMOUSID) && client->z.CPS.prlist_val) + free(client->z.CPS.prlist_val); + client->z.CPS.prlist_val = NULL; + client->z.CPS.prlist_len = 0; - client->refCount--; + client->z.refCount--; ReleaseWriteLock(&client->lock); FreeCE(client); return NULL; } - client->next = host->z.FirstClient; + client->z.next = host->z.FirstClient; host->z.FirstClient = client; h_Unlock_r(host); CurrentConnections++; /* increment number of connections */ @@ -2851,8 +2851,8 @@ h_FindClient_r(struct rx_connection *tcon, afs_int32 *a_viceid) int h_ReleaseClient_r(struct client *client) { - opr_Assert(client->refCount > 0); - client->refCount--; + opr_Assert(client->z.refCount > 0); + client->z.refCount--; return 0; } @@ -2881,34 +2881,34 @@ GetClient(struct rx_connection *tcon, struct client **cp) H_UNLOCK; return VBUSY; } - if (rx_GetConnectionId(tcon) != client->sid - || rx_GetConnectionEpoch(tcon) != client->VenusEpoch) { + if (rx_GetConnectionId(tcon) != client->z.sid + || rx_GetConnectionEpoch(tcon) != client->z.VenusEpoch) { ViceLog(0, ("GetClient: tcon %p tcon sid %d client sid %d\n", - tcon, rx_GetConnectionId(tcon), client->sid)); + tcon, rx_GetConnectionId(tcon), client->z.sid)); H_UNLOCK; return VBUSY; } - if (client && client->LastCall > client->expTime && client->expTime) { + if (client && client->z.LastCall > client->z.expTime && client->z.expTime) { ViceLog(1, ("Token for %s at %s:%d expired %d\n", h_UserName(client), - afs_inet_ntoa_r(client->host->z.host, hoststr), - ntohs(client->host->z.port), client->expTime)); + afs_inet_ntoa_r(client->z.host->z.host, hoststr), + ntohs(client->z.host->z.port), client->z.expTime)); H_UNLOCK; return VICETOKENDEAD; } - if (client->deleted) { + if (client->z.deleted) { ViceLog(0, ("GetClient: got deleted client, connection will appear " - "anonymous; tcon %p cid %x client %p ref %d host %p " - "(%s:%d) href %d ViceId %d\n", - tcon, rx_GetConnectionId(tcon), client, client->refCount, - client->host, - afs_inet_ntoa_r(client->host->z.host, hoststr), - (int)ntohs(client->host->z.port), client->host->z.refCount, - (int)client->ViceId)); + "anonymous; tcon %p cid %x client %p ref %d host %p " + "(%s:%d) href %d ViceId %d\n", + tcon, rx_GetConnectionId(tcon), client, client->z.refCount, + client->z.host, + afs_inet_ntoa_r(client->z.host->z.host, hoststr), + (int)ntohs(client->z.host->z.port), client->z.host->z.refCount, + (int)client->z.ViceId)); } - client->refCount++; + client->z.refCount++; *cp = client; H_UNLOCK; return 0; @@ -2943,7 +2943,7 @@ h_UserName(struct client *client) } lnames.namelist_len = 0; lnames.namelist_val = (prname *) 0; - lids.idlist_val[0] = client->ViceId; + lids.idlist_val[0] = client->z.ViceId; if (hpr_IdToName(&lids, &lnames)) { /* We need to free id we alloced above! */ free(lids.idlist_val); @@ -2991,25 +2991,25 @@ h_PrintClient(struct host *host, void *rock) ntohs(host->z.port), (host->z.hostFlags & VENUSDOWN), tbuffer); (void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file); - for (client = host->z.FirstClient; client; client = client->next) { - if (!client->deleted) { - expTime = client->expTime; + for (client = host->z.FirstClient; client; client = client->z.next) { + if (!client->z.deleted) { + expTime = client->z.expTime; strftime(tbuffer, sizeof(tbuffer), "%a %b %d %H:%M:%S %Y", localtime_r(&expTime, &tm)); snprintf(tmpStr, sizeof tmpStr, " user id=%d, name=%s, sl=%s till %s\n", - client->ViceId, h_UserName(client), - client->authClass ? "Authenticated" + client->z.ViceId, h_UserName(client), + client->z.authClass ? "Authenticated" : "Not authenticated", - client->authClass ? tbuffer : "No Limit"); + client->z.authClass ? tbuffer : "No Limit"); (void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file); snprintf(tmpStr, sizeof tmpStr, " CPS-%d is [", - client->CPS.prlist_len); + client->z.CPS.prlist_len); (void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file); - if (client->CPS.prlist_val) { - for (i = 0; i < client->CPS.prlist_len; i++) { + if (client->z.CPS.prlist_val) { + for (i = 0; i < client->z.CPS.prlist_len; i++) { snprintf(tmpStr, sizeof tmpStr, " %d", - client->CPS.prlist_val[i]); + client->z.CPS.prlist_val[i]); (void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file); } } @@ -4010,9 +4010,9 @@ CheckHost_r(struct host *host, void *dummy) #endif /* Host is held by h_Enumerate_r */ - for (client = host->z.FirstClient; client; client = client->next) { - if (client->refCount == 0 && client->LastCall < clientdeletetime) { - client->deleted = 1; + for (client = host->z.FirstClient; client; client = client->z.next) { + if (client->z.refCount == 0 && client->z.LastCall < clientdeletetime) { + client->z.deleted = 1; host->z.hostFlags |= CLIENTDELETED; } } diff --git a/src/viced/host.h b/src/viced/host.h index 3779fe3b9..ff5c604b9 100644 --- a/src/viced/host.h +++ b/src/viced/host.h @@ -104,7 +104,7 @@ struct h_UuidHashChain { struct h_UuidHashChain *next; }; -struct client { +struct client_to_zero { struct client *next; /* next client entry for host */ struct host *host; /* ptr to parent host entry */ afs_int32 sid; /* Connection number from this host */ @@ -124,13 +124,14 @@ struct client { char prfail; /* True if prserver couldn't be contacted */ char InSameNetwork; /* Is client's IP address in the same * network as ours? */ +}; + +struct client { + struct client_to_zero z; struct Lock lock; /* lock to ensure CPS valid if entry * on host's clients list. */ }; -/* Don't zero the lock */ -#define CLIENT_TO_ZERO(C) ((int)(((char *)(&((C)->lock))-(char *)(C)))) - /* * key for the client structure stored in connection specific data -- 2.39.5