Windows: AFSVolSync creationDate based readonly volume versioning
[openafs.git] / src / WINNT / afsd / cm_scache.h
index 8e704fc..2da484b 100644 (file)
@@ -23,7 +23,11 @@ typedef struct cm_fid {
 
 /* 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;
+typedef struct cm_key {
+    afs_offs_t process_id;      /* process IDs can be 64bit on 64bit environments */
+    afs_uint16 session_id;
+    afs_uint16 file_id;
+} cm_key_t;
 
 typedef struct cm_range {
     afs_int64 offset;
@@ -124,6 +128,9 @@ typedef struct cm_scache {
     afs_uint32 group;                  /* file owning group */
     cm_user_t *creator;                        /* user, if new file */
 
+    /* volume status */
+    time_t volumeCreationDate;          /* volume creation date from AFSVolSync */
+
     /* pseudo file status */
     osi_hyper_t serverLength;          /* length known to server */
 
@@ -185,6 +192,11 @@ typedef struct cm_scache {
     afs_uint32   clientLocks;   /* number of locks on ::fileLocks that
                                    have CM_FILELOCK_FLAG_CLIENTONLY
                                    set. */
+
+    afs_uint32   fsLockCount;   /* number of locks held as reported
+                                 * by the file server in the most
+                                 * recent fetch status.
+                                 */
        
     /* bulk stat progress */
     osi_hyper_t bulkStatProgress;      /* track bulk stats of large dirs */
@@ -213,12 +225,16 @@ typedef struct cm_scache {
     osi_queue_t * waitQueueT;       /* locked by cm_scacheLock */
 } cm_scache_t;
 
+/* dataVersion */
+#define CM_SCACHE_VERSION_BAD           0xFFFFFFFFFFFFFFFF
+
 /* mask field - tell what has been modified */
 #define CM_SCACHEMASK_CLIENTMODTIME    1       /* client mod time */
 #define CM_SCACHEMASK_LENGTH           2       /* length */
 #define CM_SCACHEMASK_TRUNCPOS         4       /* truncation position */
 
 /* fileType values */
+#define CM_SCACHETYPE_UNKNOWN           0       /* unknown */
 #define CM_SCACHETYPE_FILE             1       /* a file */
 #define CM_SCACHETYPE_DIRECTORY                2       /* a dir */
 #define CM_SCACHETYPE_SYMLINK          3       /* a symbolic link */
@@ -257,6 +273,7 @@ typedef struct cm_scache {
 
 #define CM_SCACHEFLAG_EACCESS           0x200000 /* Bulk Stat returned EACCES */
 #define CM_SCACHEFLAG_SMB_FID          0x400000
+#define CM_SCACHEFLAG_LOCAL             0x800000 /* Locally modified */
 
 /* sync flags for calls to the server.  The CM_SCACHEFLAG_FETCHING,
  * CM_SCACHEFLAG_STORING and CM_SCACHEFLAG_SIZESTORING flags correspond to the
@@ -354,6 +371,7 @@ extern void cm_MergeStatus(cm_scache_t * dscp, cm_scache_t * scp,
                           struct AFSFetchStatus * statusp, 
                           struct AFSVolSync * volsyncp,
                           struct cm_user *userp, 
+                           cm_req_t *reqp,
                           afs_uint32 flags);
 
 extern void cm_AFSFidFromFid(struct AFSFid *, cm_fid_t *);
@@ -405,4 +423,10 @@ extern void cm_SuspendSCache(void);
 extern long cm_RecycleSCache(cm_scache_t *scp, afs_int32 flags);
 
 extern void cm_RemoveSCacheFromHashTable(cm_scache_t *scp);
+
+extern void cm_AdjustScacheLRU(cm_scache_t *scp);
+
+extern int cm_DumpSCache(FILE *outputFile, char *cookie, int lock);
+
+extern void cm_ResetSCacheDirectory(cm_scache_t *scp, afs_int32 locked);
 #endif /*  __CM_SCACHE_H_ENV__ */