viced: Avoid issuing redundant TMAY requests
[openafs.git] / src / viced / host.h
index d67f11b..d4a3a3e 100644 (file)
@@ -24,8 +24,8 @@
 #include <rx/rx_globals.h>
 #include <pthread.h>
 extern pthread_mutex_t host_glock_mutex;
-#define H_LOCK MUTEX_ENTER(&host_glock_mutex);
-#define H_UNLOCK MUTEX_EXIT(&host_glock_mutex);
+#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;
 
 #define h_MAXHOSTTABLEENTRIES 1000
@@ -80,6 +80,12 @@ struct 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 */
     pthread_cond_t cond;       /* used to wait on hcpsValid */
@@ -177,7 +183,7 @@ do { \
                                hostList ? (hostList->prev = (h)):0;    \
                                hostList = (h);                         \
                                hostCount++;
-#define h_DeleteList_r(h)      osi_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;\
@@ -207,10 +213,10 @@ extern struct host *h_LookupUuid_r(afsUUID * uuidp);
 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 void h_EnumerateClients(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);
@@ -225,14 +231,12 @@ extern void h_GetHostNetStats(afs_int32 * a_numHostsP, afs_int32 * a_sameNetOrSu
                  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 **);