linux-mmap-antirecursion-20081020
[openafs.git] / src / afs / afs.h
index f3cb0c7..0aedd46 100644 (file)
@@ -86,11 +86,13 @@ extern int afs_shuttingdown;
 #define        AFS_NRXPACKETS  80
 #define        AFS_RXDEADTIME  50
 #define AFS_HARDDEADTIME       120
+#define        AFS_IDLEDEADTIME        50
 #define AFS_BLKBITS    12
 #define AFS_BLKSIZE    (1 << AFS_BLKBITS)
 
 extern afs_int32 afs_rx_deadtime;
 extern afs_int32 afs_rx_harddead;
+extern afs_int32 afs_rx_idledead;
 
 struct sysname_info {
     char *name;
@@ -119,6 +121,10 @@ struct sysname_info {
 #define        BOP_STORE       2       /* parm1 is chunk to store */
 #define        BOP_PATH        3       /* parm1 is path, parm2 is chunk to fetch */
 
+#if defined(AFS_CACHE_BYPASS)
+#define        BOP_FETCH_NOCACHE       4   /* parms are: vnode ptr, offset, segment ptr, addr, cred ptr */
+#endif
+
 #define        B_DONTWAIT      1       /* On failure return; don't wait */
 
 /* protocol is: refCount is incremented by user to take block out of free pool.
@@ -186,6 +192,9 @@ struct vrequest {
     char volumeError;          /* encountered a missing or busy volume */
     char networkError;         /* encountered network problems */
     char permWriteError;       /* fileserver returns permenent error. */
+    char tokenError;            /* a token error other than expired. */
+    char idleError;             /* the server idled too long */
+    char skipserver[MAXHOSTS];
 };
 #define VOLMISSING 1
 #define VOLBUSY 2
@@ -270,6 +279,9 @@ enum { AFS_GCPAGS_NOTCOMPILED = 0, AFS_GCPAGS_OK =
 extern afs_int32 afs_gcpags;
 extern afs_int32 afs_gcpags_procsize;
 extern afs_int32 afs_bkvolpref;
+extern char afs_cachebasedir[1024];
+extern afs_int32 afs_numcachefiles;
+extern afs_int32 afs_numfilesperdir;
 
 struct unixuser {
     struct unixuser *next;     /* next hash pointer */
@@ -550,7 +562,11 @@ struct SimpleLocks {
 #define CUnlinkedDel   0x00040000
 #define CVFlushed      0x00080000
 #define CCore1         0x00100000      /* osf1 core file; not same as CCore above */
+#ifdef AFS_LINUX22_ENV
+#define CPageWrite      0x00200000      /* to detect vm deadlock - linux */
+#else
 #define CWritingUFS    0x00200000      /* to detect vm deadlock - used by sgi */
+#endif
 #define CCreating      0x00400000      /* avoid needless store after open truncate */
 #define CPageHog       0x00800000      /* AIX - dumping large cores is a page hog. */
 #define CDCLock                0x02000000      /* Vnode lock held over call to GetDownD */
@@ -562,6 +578,43 @@ struct SimpleLocks {
 #define VRevokeWait   0x1
 #define VPageCleaning 0x2      /* Solaris - Cache Trunc Daemon sez keep out */
 
+#if defined(AFS_DISCON_ENV)
+
+/* Dirty disconnected vcache flags. */
+#define VDisconSetTime         0x00000001      /* set time. */
+#define VDisconSetMode         0x00000002      /* set mode. */
+/* XXX: to be continued ? */
+#define VDisconTrunc           0x00000020      /* truncate file. */
+#define VDisconSetAttrMask     0x0000003F      /* Masks for setattr ops. */
+#define VDisconWriteClose      0x00000400      /* Write op on file close. */
+#define VDisconWriteFlush      0x00000800      /* Write op on normal fsync/flush. */
+#define VDisconWriteOsiFlush   0x00001000      /* Write op on osi flush. */
+
+#define VDisconShadowed                0x00002000      /* Shadowed dir. */
+#define VDisconRemove          0x00004000      /* Remove vnop. */
+#define VDisconCreate          0x00008000      /* Create vnop. */
+#define VDisconRename          0x00010000      /* Rename vnop. */
+#define VDisconRenameSameDir   0x00020000      /* Rename in same dir. */
+
+/*... to be continued ...  */
+#endif
+
+#if defined(AFS_CACHE_BYPASS)
+/* vcache (file) cachingStates bits */
+#define FCSDesireBypass   0x1  /* This file should bypass the cache */
+#define FCSBypass         0x2  /* This file is currently NOT being cached */
+#define FCSManuallySet    0x4  /* The bypass flags were set, or reset, manually (via pioctl)
+                                                                  and should not be overridden by the file's name */
+
+/* Flag values used by the Transition routines */
+#define TRANSChangeDesiredBit          0x1     /* The Transition routine should set or 
+                                                                                * reset the FCSDesireBypass bit */
+#define TRANSVcacheIsLocked                    0x2     /* The Transition routine does not need to
+                                                                                * lock vcache (it's already locked) */
+#define TRANSSetManualBit              0x4     /* The Transition routine should set FCSManuallySet so that
+                                                                        * filename checking does not override pioctl requests */       
+#endif /* AFS_CACHE_BYPASS */
+
 #define        CPSIZE      2
 #if defined(AFS_XBSD_ENV) || defined(AFS_DARWIN_ENV)
 #define vrefCount   v->v_usecount
@@ -626,6 +679,20 @@ struct vcache {
 #endif
     struct vcache *hnext;      /* Hash next */
     struct afs_q vhashq;       /* Hashed per-volume list */
+
+#if defined(AFS_DISCON_ENV)
+    /*! Next element in afs_DDirtyVCList. Lock it with afs_DDirtyVCListLock. */
+    struct vcache *ddirty_next;
+    /*! Disconnected flags for this vcache element. */
+    uint32_t ddirty_flags;
+    /*! Shadow vnode + unique keep the shadow dir location. */
+    afs_uint32 shVnode;
+    afs_uint32 shUnique;
+    /*! The old parent FID for renamed vnodes. */
+    afs_uint32 oldVnode;
+    afs_uint32 oldUnique;
+#endif
+
     struct VenusFid fid;
     struct mstat {
        afs_size_t Length;
@@ -697,6 +764,17 @@ struct vcache {
                                 * this file. */
     short flockCount;          /* count of flock readers, or -1 if writer */
     char mvstat;               /* 0->normal, 1->mt pt, 2->root. */
+
+#if defined(AFS_CACHE_BYPASS)
+       char cachingStates;                     /* Caching policies for this file */
+       afs_uint32 cachingTransitions;          /* # of times file has flopped between caching and not */
+#if defined(AFS_LINUX24_ENV)
+       off_t next_seq_offset;  /* Next sequential offset (used by prefetch/readahead) */
+#else
+       off_t next_seq_blk_offset; /* accounted in blocks for Solaris & IRIX */
+#endif
+#endif         
+       
     afs_uint32 states;         /* state bits */
 #if    defined(AFS_SUN5_ENV)
     afs_uint32 vstates;                /* vstate bits */
@@ -920,6 +998,9 @@ struct afs_fheader {
 #endif
 #endif
 
+
+#ifdef KERNEL
+/* it does not compile outside kernel */
 struct buffer {
   afs_int32 fid;              /* is adc->index, the cache file number */
   afs_inode_t inode;          /* is adc->f.inode, the inode number of the cac\
@@ -947,6 +1028,7 @@ struct fcache {
     afs_int32 chunkBytes;      /* Num bytes in this chunk */
     char states;               /* Has this chunk been modified? */
 };
+#endif
 
 /* magic numbers to specify the cache type */
 
@@ -1225,5 +1307,4 @@ struct afs_fakestat_state {
 };
 
 extern int afs_fakestat_enable;
-
 #endif /* _AFS_H_ */