sparc64-linux26-20050508
[openafs.git] / src / afs / afs.h
index c5087c6..4818d6e 100644 (file)
@@ -29,7 +29,7 @@ extern int afs_shuttingdown;
  * Macros to uniquely identify the AFS vfs struct
  */
 #define        AFS_VFSMAGIC            0x1234
-#if    defined(AFS_SUN_ENV) || defined(AFS_HPUX90_ENV) || defined(AFS_LINUX20_ENV)
+#if defined(AFS_SUN5_ENV) || defined(AFS_HPUX90_ENV) || defined(AFS_LINUX20_ENV)
 #define        AFS_VFSFSID             99
 #else
 #if defined(AFS_SGI_ENV)
@@ -43,7 +43,7 @@ extern int afs_shuttingdown;
 #if     defined(AFS_HPUX102_ENV)
 #define AFS_FLOCK       k_flock
 #else
-#if     defined(AFS_SUN56_ENV) || (defined(AFS_LINUX24_ENV) && !defined(AFS_PPC64_LINUX26_ENV) && !defined(AFS_AMD64_LINUX26_ENV) && !defined(AFS_IA64_LINUX26_ENV))
+#if     defined(AFS_SUN56_ENV) || (defined(AFS_LINUX24_ENV) && !(defined(AFS_LINUX26_ENV) && defined(AFS_LINUX_64BIT_KERNEL)))
 #define AFS_FLOCK       flock64
 #else
 #define AFS_FLOCK       flock
@@ -551,7 +551,7 @@ struct SimpleLocks {
 #define VPageCleaning 0x2      /* Solaris - Cache Trunc Daemon sez keep out */
 
 #define        CPSIZE      2
-#if defined(AFS_XBSD_ENV)
+#if defined(AFS_XBSD_ENV) || defined(AFS_DARWIN_ENV)
 #define vrefCount   v->v_usecount
 #else
 #define vrefCount   v.v_count
@@ -562,19 +562,13 @@ struct SimpleLocks {
 #define VREFCOUNT_SET(v, c)    atomic_set(&((vnode_t *) v)->v_count, c)
 #define VREFCOUNT_DEC(v)       atomic_dec(&((vnode_t *) v)->v_count)
 #define VREFCOUNT_INC(v)       atomic_inc(&((vnode_t *) v)->v_count)
-#define DLOCK()      spin_lock(&dcache_lock)
-#define DUNLOCK()    spin_unlock(&dcache_lock)
-#define DGET(d)      dget_locked(d)
-#define DCOUNT(d)    atomic_read(&(d)->d_count)
 #else
 #define VREFCOUNT(v)           ((v)->vrefCount)
 #define VREFCOUNT_SET(v, c)    (v)->vrefCount = c;
 #define VREFCOUNT_DEC(v)       (v)->vrefCount--;
 #define VREFCOUNT_INC(v)       (v)->vrefCount++;
-#define DLOCK()
-#define DUNLOCK()
-#define DGET(d)      dget(d)
-#define DCOUNT(d)    ((d)->d_count)
+#define d_unhash(d) list_empty(&(d)->d_hash)
+#define dget_locked(d) dget(d)
 #endif
 
 #define        AFS_MAXDV   0x7fffffff  /* largest dataversion number */
@@ -600,7 +594,7 @@ struct vtodc {
 extern afs_uint32 afs_stampValue;      /* stamp for pair's usage */
 #define        MakeStamp()     (++afs_stampValue)
 
-#if defined(AFS_XBSD_ENV)
+#if defined(AFS_XBSD_ENV) || defined(AFS_DARWIN_ENV)
 #define VTOAFS(v) ((struct vcache *)(v)->v_data)
 #define AFSTOV(vc) ((vc)->v)
 #else
@@ -618,7 +612,7 @@ extern afs_uint32 afs_stampValue;   /* stamp for pair's usage */
  * !(avc->nextfree) && !avc->vlruq.next => (FreeVCList == avc->nextfree)
  */
 struct vcache {
-#if defined(AFS_XBSD_ENV)
+#if defined(AFS_XBSD_ENV)||defined(AFS_DARWIN_ENV)
     struct vnode *v;
 #else
     struct vnode v;            /* Has reference count in v.v_count */
@@ -647,7 +641,7 @@ struct vcache {
     krwlock_t rwlock;
     struct cred *credp;
 #endif
-#if defined(AFS_SUN_ENV) || defined(AFS_ALPHA_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#ifdef AFS_BOZONLOCK_ENV
     afs_bozoLock_t pvnLock;    /* see locks.x */
 #endif
 #ifdef AFS_AIX32_ENV
@@ -702,7 +696,6 @@ struct vcache {
        struct dcache *dchint;
     } h1;
 #ifdef AFS_LINUX22_ENV
-    u_short flushcnt;          /* Number of flushes which haven't released yet. */
     u_short mapcnt;            /* Number of mappings of this file. */
 #endif
 #if defined(AFS_SGI_ENV)
@@ -835,6 +828,9 @@ struct cm_initparams {
 
 #define        NULLIDX     (-1)        /* null index definition */
 /* struct dcache states bits */
+#define DRO         1
+#define DBackup     2
+#define DRW         4
 #define        DWriting    8           /* file being written (used for cache validation) */
 
 /* dcache data flags */
@@ -911,6 +907,23 @@ struct afs_fheader {
 #endif
 #endif
 
+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\
+                                he file */
+  afs_int32 page;
+  afs_int32 accesstime;
+  struct buffer *hashNext;
+  char *data;
+  char lockers;
+  char dirty;
+  char hashIndex;
+#if AFS_USEBUFFERS
+  struct buf *bufp;
+#endif
+  afs_rwlock_t lock;          /* the lock for this structure */
+};
+
 /* kept on disk and in dcache entries */
 struct fcache {
     struct VenusFid fid;       /* Fid for this file */
@@ -943,7 +956,7 @@ struct dcache {
     char mflags;               /* Meta flags */
     struct fcache f;           /* disk image */
     afs_int32 stamp;           /* used with vtodc struct for hints */
-
+    afs_int32 bucket;           /* which bucket these dcache entries are in */
     /*
      * Locking rules:
      *
@@ -978,6 +991,14 @@ struct dcache {
 /* this is obsolete and should be removed */
 #define ihint stamp
 
+/* afs_memcache.c */
+struct memCacheEntry {
+  int size;                   /* # of valid bytes in this entry */
+  int dataSize;               /* size of allocated data area */
+  afs_lock_t afs_memLock;
+  char *data;                 /* bytes */
+};
+
 /* macro to mark a dcache entry as bad */
 #define ZapDCE(x) \
     do { \
@@ -1194,29 +1215,6 @@ struct afs_fakestat_state {
 
 extern int afs_fakestat_enable;
 
-struct buffer {
-    struct dcache *fid;
-    afs_int32 page;
-    afs_int32 accesstime;
-    struct buffer *hashNext;
-    char *data;
-    char lockers;
-    char dirty;
-    char hashIndex;
-#if AFS_USEBUFFERS
-    struct buf *bufp;
-#endif
-    afs_rwlock_t lock;         /* the lock for this structure */
-};
-
-/* afs_memcache.c */
-struct memCacheEntry {
-    int size;                  /* # of valid bytes in this entry */
-    int dataSize;              /* size of allocated data area */
-    afs_lock_t afs_memLock;
-    char *data;                        /* bytes */
-};
-
 /* First 32 bits of capabilities */
 #define CAPABILITY_ERRORTRANS (1<<0)