windows-misc-fix-20061004
[openafs.git] / src / WINNT / afsd / cm_scache.h
index e111e18..6e034ae 100644 (file)
 #ifndef __CM_SCACHE_H_ENV__
 #define __CM_SCACHE_H_ENV__ 1
 
-#ifdef DJGPP
-#include "largeint95.h"
-#endif /* DJGPP */
-
 #define MOUNTPOINTLEN   1024
 
 typedef struct cm_fid {
@@ -23,14 +19,6 @@ typedef struct cm_fid {
         unsigned long unique;
 } cm_fid_t;
 
-#if 0
-typedef struct cm_accessCache {
-       osi_queue_t q;                  /* queue header */
-        struct cm_user *userp;         /* user having access rights */
-        unsigned long rights;          /* rights */
-} cm_accessCache_t;
-#endif
-
 /* 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;
@@ -94,49 +82,50 @@ typedef struct cm_prefetch {                /* last region scanned for prefetching */
 #define CM_SCACHE_MAGIC ('S' | 'C'<<8 | 'A'<<16 | 'C'<<24)
 
 typedef struct cm_scache {
-    osi_queue_t q;              /* lru queue; cm_scacheLock */
+    osi_queue_t q;                     /* lru queue; cm_scacheLock */
     afs_uint32      magic;
-    struct cm_scache *nextp;   /* next in hash; cm_scacheLock */
+    struct cm_scache *nextp;           /* next in hash; cm_scacheLock */
     cm_fid_t fid;
-    afs_uint32 flags;          /* flags; locked by mx */
+    afs_uint32 flags;                  /* flags; locked by mx */
 
     /* synchronization stuff */
-    osi_mutex_t mx;            /* mutex for this structure */
-    osi_rwlock_t bufCreateLock;        /* read-locked during buffer creation;
-                                * write-locked to prevent buffers from
-                                 * being created during a truncate op, etc.
-                                 */
+    osi_mutex_t mx;                    /* mutex for this structure */
+    osi_rwlock_t bufCreateLock;                /* read-locked during buffer creation;
+                                         * write-locked to prevent buffers from
+                                        * being created during a truncate op, etc.
+                                        */
     afs_uint32 refCount;               /* reference count; cm_scacheLock */
-    osi_queueData_t *bufReadsp;        /* queue of buffers being read */
+    osi_queueData_t *bufReadsp;                /* queue of buffers being read */
     osi_queueData_t *bufWritesp;       /* queue of buffers being written */
 
     /* parent info for ACLs */
     afs_uint32 parentVnode;            /* parent vnode for ACL callbacks */
-    afs_uint32 parentUnique;   /* for ACL callbacks */
+    afs_uint32 parentUnique;           /* for ACL callbacks */
 
     /* local modification stat */
-    afs_uint32 mask;           /* for clientModTime, length and
-                                 * truncPos */
+    afs_uint32 mask;                   /* for clientModTime, length and
+                                         * truncPos */
 
     /* file status */
     afs_uint32 fileType;               /* file type */
     time_t clientModTime;              /* mtime */
     time_t serverModTime;              /* at server, for concurrent call
                                          * comparisons */
-    osi_hyper_t length;                /* file length */
+    osi_hyper_t length;                        /* file length */
     cm_prefetch_t prefetch;            /* prefetch info structure */
-    afs_uint32 unixModeBits;   /* unix protection mode bits */
+    afs_uint32 unixModeBits;           /* unix protection mode bits */
     afs_uint32 linkCount;              /* link count */
     afs_uint32 dataVersion;            /* data version */
-    afs_uint32 owner;          /* file owner */
-    afs_uint32 group;          /* file owning group */
+    afs_uint32 owner;                  /* file owner */
+    afs_uint32 group;                  /* file owning group */
+    cm_user_t *creator;                        /* user, if new file */
 
     /* pseudo file status */
-    osi_hyper_t serverLength;  /* length known to server */
+    osi_hyper_t serverLength;          /* length known to server */
 
     /* aux file status */
-    osi_hyper_t truncPos;      /* file size to truncate to before
-                                 * storing data */
+    osi_hyper_t truncPos;              /* file size to truncate to before
+                                         * storing data */
 
     /* symlink and mount point info */
     char mountPointStringp[MOUNTPOINTLEN];     /* the string stored in a mount point;
@@ -188,7 +177,7 @@ typedef struct cm_scache {
                                   * include locks which have
                                   * CM_FILELOCK_FLAG_CLIENTONLY set.
                                   */
-       
+
     afs_uint32   clientLocks;   /* number of locks on ::fileLocks that
                                    have CM_FILELOCK_FLAG_CLIENTONLY
                                    set. */
@@ -252,6 +241,9 @@ typedef struct cm_scache {
 #define CM_SCACHEFLAG_ANYWATCH \
                        (CM_SCACHEFLAG_WATCHED | CM_SCACHEFLAG_WATCHEDSUBTREE)
 
+#define CM_SCACHEFLAG_EACCESS           0x200000 /* Bulk Stat returned EACCES */
+#define CM_SCACHEFLAG_RECYCLING                0x400000
+
 /* sync flags for calls to the server.  The CM_SCACHEFLAG_FETCHING,
  * CM_SCACHEFLAG_STORING and CM_SCACHEFLAG_SIZESTORING flags correspond to the
  * below, except for FETCHDATA and STOREDATA, which correspond to non-null
@@ -285,6 +277,11 @@ typedef struct cm_scache {
 #define CM_SCACHESYNC_BUFLOCKED                0x80000 /* the buffer is locked */
 #define CM_SCACHESYNC_NOWAIT           0x100000/* don't wait for the state,
                                                 * just fail */
+#define CM_SCACHESYNC_FORCECB          0x200000/* when calling cm_GetCallback()
+                                                 * set the force flag */
+
+/* flags for cm_RecycleSCache  */
+#define CM_SCACHE_RECYCLEFLAG_DESTROY_BUFFERS  0x1
 
 /* flags for cm_MergeStatus */
 #define CM_MERGEFLAG_FORCE             1       /* check mtime before merging;
@@ -317,12 +314,12 @@ extern cm_scache_t *cm_GetNewSCache(void);
 extern int cm_FidCmp(cm_fid_t *, cm_fid_t *);
 
 extern long cm_SyncOp(cm_scache_t *, struct cm_buf *, struct cm_user *,
-       struct cm_req *, long, long);
+       struct cm_req *, afs_uint32, afs_uint32);
 
-extern void cm_SyncOpDone(cm_scache_t *, struct cm_buf *, long);
+extern void cm_SyncOpDone(cm_scache_t *, struct cm_buf *, afs_uint32);
 
 extern void cm_MergeStatus(cm_scache_t *, struct AFSFetchStatus *, struct AFSVolSync *,
-       struct cm_user *, int flags);
+       struct cm_user *, afs_uint32 flags);
 
 extern void cm_AFSFidFromFid(struct AFSFid *, cm_fid_t *);
 
@@ -354,4 +351,6 @@ extern long cm_ValidateSCache(void);
 
 extern long cm_ShutdownSCache(void);
 
+extern long cm_RecycleSCache(cm_scache_t *scp, afs_int32 flags);
+
 #endif /*  __CM_SCACHE_H_ENV__ */