#include "fs_stats.h" /*File Server stats package */
-#ifdef AFS_PTHREAD_ENV
/*
* There are three locks in the host package.
* the global hash lock protects hash chains.
* precedence is host_listlock_mutex, host->mutex, host_glock_mutex.
*/
#include <rx/rx_globals.h>
-#include <assert.h>
#include <pthread.h>
extern pthread_mutex_t host_glock_mutex;
-#define H_LOCK \
- assert(pthread_mutex_lock(&host_glock_mutex) == 0)
-#define H_UNLOCK \
- assert(pthread_mutex_unlock(&host_glock_mutex) == 0)
+#define H_LOCK opr_mutex_enter(&host_glock_mutex)
+#define H_UNLOCK opr_mutex_exit(&host_glock_mutex)
extern pthread_key_t viced_uclient_key;
-#else /* AFS_PTHREAD_ENV */
-#define H_LOCK
-#define H_UNLOCK
-#endif /* AFS_PTHREAD_ENV */
#define h_MAXHOSTTABLEENTRIES 1000
#define h_HASHENTRIES 256 /* Power of 2 */
afs_uint16 port; /* port address of host */
char Console; /* XXXX This host is a console */
unsigned short hostFlags; /* bit map */
-#if FS_STATS_DETAILED
char InSameNetwork; /*Is host's addr in the same network as
* the File Server's? */
char dummy[3]; /* for padding */
-#endif /* FS_STATS_DETAILED */
char hcpsfailed; /* Retry the cps call next time */
prlist hcps; /* cps for hostip acls */
afs_uint32 LastCall; /* time of last call from host */
* the index fields isn't zeroed. XXX
*/
afs_uint32 index; /* Host table index, for vicecb.c */
+ unsigned int n_tmays; /* how many successful TellMeAboutYourself calls
+ * have we made against this host? */
+ /* cache of the result of the last successful TMAY call to this host */
+ struct interfaceAddr tmay_interf;
+ Capabilities tmay_caps;
+
struct Lock lock; /* Write lock for synchronization of
* VenusDown flag */
-#ifdef AFS_PTHREAD_ENV
pthread_cond_t cond; /* used to wait on hcpsValid */
-#endif /* AFS_PTHREAD_ENV */
};
/* * Don't zero the index, lock or condition varialbles */
* structure */
char authClass; /* auth type, RX-only */
char prfail; /* True if prserver couldn't be contacted */
-#if FS_STATS_DETAILED
char InSameNetwork; /* Is client's IP address in the same
* network as ours? */
-#else /* FS_STATS_DETAILED */
- char dummy; /* For padding */
-#endif /* FS_STATS_DETAILED */
struct Lock lock; /* lock to ensure CPS valid if entry
* on host's clients list. */
};
hostList ? (hostList->prev = (h)):0; \
hostList = (h); \
hostCount++;
-#define h_DeleteList_r(h) assert(hostCount>0); \
+#define h_DeleteList_r(h) opr_Assert(hostCount>0); \
hostCount--; \
(h)->next ? ((h)->next->prev = (h)->prev):0;\
(h)->prev ? ((h)->prev->next = (h)->next):0;\
extern void *ShutDown(void *);
extern void ShutDownAndCore(int dopanic);
-extern struct host *h_Alloc(struct rx_connection *r_con);
-extern struct host *h_Alloc_r(struct rx_connection *r_con);
extern int h_Lookup_r(afs_uint32 hostaddr, afs_uint16 hport,
struct host **hostp);
extern struct host *h_LookupUuid_r(afsUUID * uuidp);
-extern void h_Enumerate(int (*proc) (struct host *, int, void *), void *param);
-extern void h_Enumerate_r(int (*proc) (struct host *, int, void *), struct host *enumstart, void *param);
+extern void h_Enumerate(int (*proc) (struct host *, void *), void *param);
+extern void h_Enumerate_r(int (*proc) (struct host *, void *), struct host *enumstart, void *param);
extern struct host *h_GetHost_r(struct rx_connection *tcon);
-extern struct client *h_FindClient_r(struct rx_connection *tcon);
+extern struct client *h_FindClient_r(struct rx_connection *tcon, afs_int32 *viceid);
extern int h_ReleaseClient_r(struct client *client);
extern void h_TossStuff_r(struct host *host);
-extern struct client *h_ID2Client(afs_int32 vid);
+extern void h_EnumerateClients(VolumeId vid,
+ int (*proc)(struct client *client, void *rock),
+ void *arock);
extern int GetClient(struct rx_connection *tcon, struct client **cp);
extern int PutClient(struct client **cp);
extern void h_PrintStats(void);
afs_int32 * a_diffSubnetP, afs_int32 * a_diffNetworkP);
extern int h_NBLock_r(struct host *host);
extern void h_DumpHosts(void);
-extern void h_InitHostPackage(void);
+extern void h_InitHostPackage(int hquota);
extern void h_CheckHosts(void );
-extern int initInterfaceAddr_r(struct host *host, struct interfaceAddr *interf);
extern void h_AddHostToAddrHashTable_r(afs_uint32 addr, afs_uint16 port, struct host * host);
extern void h_AddHostToUuidHashTable_r(afsUUID * uuid, struct host * host);
extern int h_DeleteHostFromAddrHashTable_r(afs_uint32 addr, afs_uint16 port, struct host *host);
extern int h_DeleteHostFromUuidHashTable_r(struct host *host);
-extern int initInterfaceAddr_r(struct host *host, struct interfaceAddr *interf);
extern int addInterfaceAddr_r(struct host *host, afs_uint32 addr, afs_uint16 port);
extern int removeInterfaceAddr_r(struct host *host, afs_uint32 addr, afs_uint16 port);
extern afs_int32 hpr_Initialize(struct ubik_client **);
#define H_ENUMERATE_BAIL(flags) ((flags)|0x80000000)
#define H_ENUMERATE_ISSET_BAIL(flags) ((flags)&0x80000000)
-#define H_ENUMERATE_ISSET_HELD(flags) ((flags)&0x7FFFFFFF)
struct host *(hosttableptrs[h_MAXHOSTTABLES]); /* Used by h_itoh */
#define h_htoi(host) ((host)->index) /* index isn't zeroed, no need to lock */