* 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)
#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))
+#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
#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
#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 */
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
* !(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 */
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
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)
#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 */
#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 */
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:
*
/* 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 { \
extern int afs_fakestat_enable;
-struct buffer {
- ino_t fid[1]; /* Unique cache key + i/o addressing */
- 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)