windows-buf-scache-interlock-20080222
[openafs.git] / src / WINNT / afsd / cm_scache.h
index 01aef07..b4b4b14 100644 (file)
 #define MOUNTPOINTLEN   1024    /* max path length for symlink; same as AFSPATHMAX */
 
 typedef struct cm_fid {
-       unsigned long cell;
-        unsigned long volume;
-        unsigned long vnode;
-        unsigned long unique;
+    afs_uint32 cell;
+    afs_uint32 volume;
+    afs_uint32 vnode;
+    afs_uint32 unique;
+    afs_uint32 hash;
 } cm_fid_t;
 
+
 /* Key used for byte range locking.  Each unique key identifies a
    unique client per cm_scache_t for the purpose of locking. */
 typedef afs_uint64 cm_key_t;
@@ -95,7 +97,7 @@ typedef struct cm_scache {
                                          * write-locked to prevent buffers from
                                         * being created during a truncate op, etc.
                                         */
-    afs_uint32 refCount;               /* reference count; cm_scacheLock */
+    afs_int32 refCount;                        /* reference count; cm_scacheLock */
     osi_queueData_t *bufReadsp;                /* queue of buffers being read */
     osi_queueData_t *bufWritesp;       /* queue of buffers being written */
 
@@ -303,6 +305,7 @@ typedef struct cm_scache {
                                                 * in old info.
                                                  */
 #define CM_MERGEFLAG_STOREDATA         2       /* Merge due to storedata op */
+#define CM_MERGEFLAG_DIROP              4       /* Merge due to directory op */ 
 
 /* hash define.  Must not include the cell, since the callback revocation code
  * doesn't necessarily know the cell in the case of a multihomed server
@@ -314,18 +317,18 @@ typedef struct cm_scache {
                                    (fidp)->unique))    \
                                        % cm_data.scacheHashTableSize)
 
+#include "cm_conn.h"
+#include "cm_buf.h"
+
 typedef struct cm_scache_waiter {
     osi_queue_t q;
     afs_int32   threadId;
 
     cm_scache_t *scp;
     afs_int32   flags;
-    void        *bufp;
+    cm_buf_t    *bufp;
 } cm_scache_waiter_t;
 
-#include "cm_conn.h"
-#include "cm_buf.h"
-
 extern void cm_InitSCache(int, long);
 
 #ifdef DEBUG_REFCOUNT
@@ -340,7 +343,9 @@ extern long cm_GetSCache(cm_fid_t *, cm_scache_t **, struct cm_user *,
 
 extern cm_scache_t *cm_GetNewSCache(void);
 
-extern int cm_FidCmp(cm_fid_t *, cm_fid_t *);
+extern __inline int cm_FidCmp(cm_fid_t *, cm_fid_t *);
+
+extern void cm_SetFid(cm_fid_t *, afs_uint32 cell, afs_uint32 volume, afs_uint32 vnode, afs_uint32 unique);
 
 extern long cm_SyncOp(cm_scache_t *, struct cm_buf *, struct cm_user *,
        struct cm_req *, afs_uint32, afs_uint32);