Use AFS_CACHE_VNODE_PATH for UKERNEL
[openafs.git] / src / afs / afs.h
index 8e86273..1b2ab15 100644 (file)
  */
 #ifdef KDUMP_KERNEL
 #include <afs/afs_args.h>
+#include <afs/afs_consts.h>
 #else
 #include "afs/afs_args.h"
+#include "afs/afs_consts.h"
 #endif
 
 /*
@@ -69,9 +71,6 @@ extern int afs_shuttingdown;
 
 /* The basic defines for the Andrew file system
     better keep things powers of two so "& (foo-1)" hack works for masking bits */
-#define        MAXHOSTS        13      /* max hosts per single volume */
-#define        OMAXHOSTS        8      /* backwards compatibility */
-#define MAXCELLHOSTS    8      /* max vldb servers per cell */
 #define        NBRS            15      /* max number of queued daemon requests */
 #define        NUSERS          16      /* hash table size for unixuser table */
 #define        NSERVERS        16      /* hash table size for server table */
@@ -83,7 +82,7 @@ extern int afs_shuttingdown;
 #define        PIGGYSIZE       1350    /* max piggyback size */
 #define        MAXVOLS         128     /* max vols we can store */
 #define        MAXSYSNAME      128     /* max sysname (i.e. @sys) size */
-#define MAXNUMSYSNAMES 16      /* max that current constants allow */
+#define MAXNUMSYSNAMES 32      /* max that current constants allow */
 #define        NOTOKTIMEOUT    (2*3600)        /* time after which to timeout conns sans tokens */
 #define        NOPAG           0xffffffff
 #define AFS_NCBRS      300     /* max # of call back return entries */
@@ -132,6 +131,9 @@ struct sysname_info {
 #if defined(AFS_CACHE_BYPASS)
 #define        BOP_FETCH_NOCACHE       4   /* parms are: vnode ptr, offset, segment ptr, addr, cred ptr */
 #endif
+#ifdef AFS_DARWIN_ENV
+#define        BOP_MOVE        5        /* ptr1 afs_uspc_param ptr2 sname ptr3 dname */
+#endif
 
 #define        B_DONTWAIT      1       /* On failure return; don't wait */
 
@@ -240,7 +242,7 @@ struct vrequest {
     char permWriteError;       /* fileserver returns permenent error. */
     char tokenError;            /* a token error other than expired. */
     char idleError;             /* the server idled too long */
-    char skipserver[MAXHOSTS];
+    char skipserver[AFS_MAXHOSTS];
 };
 #define VOLMISSING 1
 #define VOLBUSY 2
@@ -273,7 +275,7 @@ struct cell {
     char *cellName;            /* char string name of cell */
     afs_int32 cellIndex;       /* sequence number */
     afs_int32 cellNum;         /* semi-permanent cell number */
-    struct server *cellHosts[MAXCELLHOSTS];    /* volume *location* hosts */
+    struct server *cellHosts[AFS_MAXCELLHOSTS];        /* volume *location* hosts */
     struct cell *lcellp;       /* Associated linked cell */
     u_short fsport;            /* file server port */
     u_short vlport;            /* volume server port */
@@ -314,6 +316,10 @@ struct cell_alias {
  */
 #define TMP_UPAGNotReferenced  128
 
+/* unixuser notify events */
+#define UTokensObtained 1
+#define UTokensDropped  2
+
 /* values for afs_gcpags */
 enum { AFS_GCPAGS_NOTCOMPILED = 0, AFS_GCPAGS_OK =
        1, AFS_GCPAGS_USERDISABLED, AFS_GCPAGS_EPROC0, AFS_GCPAGS_EPROCN,
@@ -514,8 +520,8 @@ struct volume {
     afs_rwlock_t lock;         /* the lock for this structure */
     afs_int32 volume;          /* This volume's ID number. */
     char *name;                        /* This volume's name, or 0 if unknown */
-    struct server *serverHost[MAXHOSTS];       /* servers serving this volume */
-    enum repstate status[MAXHOSTS];    /* busy, offline, etc */
+    struct server *serverHost[AFS_MAXHOSTS];   /* servers serving this volume */
+    enum repstate status[AFS_MAXHOSTS];        /* busy, offline, etc */
     struct VenusFid dotdot;    /* dir to access as .. */
     struct VenusFid mtpoint;   /* The mount point for this volume. */
     afs_int32 rootVnode, rootUnique;   /* Volume's root fid */
@@ -564,19 +570,15 @@ struct SimpleLocks {
 #define CNSHARE                0x00000100      /* support O_NSHARE semantics */
 #define CLied          0x00000200
 #define CTruth         0x00000400
-#ifdef AFS_OSF_ENV
-#define CWired         0x00000800      /* OSF hack only */
-#else
-#ifdef AFS_DARWIN80_ENV
+
+#if defined(AFS_DARWIN80_ENV)
 #define CDeadVnode        0x00000800
-#else
-#ifdef AFS_DARWIN_ENV
+#elif defined(AFS_DARWIN_ENV)
 #define CUBCinit        0x00000800
 #else
 #define CWRITE_IGN     0x00000800      /* Next OS hack only */
 #endif
-#endif
-#endif
+
 #define CUnique                0x00001000      /* vc's uniquifier - latest unifiquier for fid */
 #define CForeign       0x00002000      /* this is a non-afs vcache */
 #define CReadDir       0x00004000      /* readdir in progress */
@@ -584,11 +586,12 @@ struct SimpleLocks {
 #define CBulkStat      0x00020000      /* loaded by a bulk stat, and not ref'd since */
 #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
+#elif defined(AFS_SGI_ENV)
 #define CWritingUFS    0x00200000      /* to detect vm deadlock - used by sgi */
+#elif defined(AFS_DARWIN80_ENV)
+#define CEvent          0x00200000      /* to preclude deadlock when sending events */
 #endif
 #define CCreating      0x00400000      /* avoid needless store after open truncate */
 #define CPageHog       0x00800000      /* AIX - dumping large cores is a page hog. */
@@ -1044,8 +1047,8 @@ struct afs_fheader {
     afs_int32 otherCSize;
 };
 
-#if defined(AFS_CACHE_VNODE_PATH) || defined(UKERNEL)
-typedef afs_int32 afs_ufs_dcache_id_t;
+#if defined(AFS_CACHE_VNODE_PATH)
+typedef char *afs_ufs_dcache_id_t;
 #elif defined(AFS_SGI61_ENV) || defined(AFS_SUN57_64BIT_ENV)
 /* Using ino64_t here so that user level debugging programs compile
  * the size correctly.
@@ -1074,7 +1077,6 @@ typedef union {
     afs_mem_dcache_id_t mem;
 } afs_dcache_id_t;
 
-#ifdef KERNEL
 /* it does not compile outside kernel */
 struct buffer {
   afs_int32 fid;              /* is adc->index, the cache file number */
@@ -1087,9 +1089,6 @@ struct buffer {
   char lockers;
   char dirty;
   char hashIndex;
-#if defined(AFS_USEBUFFERS)
-  struct buf *bufp;
-#endif
   afs_rwlock_t lock;          /* the lock for this structure */
 };
 
@@ -1103,7 +1102,6 @@ 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 */
 
@@ -1342,11 +1340,7 @@ extern struct brequest afs_brs[NBRS];    /* request structures */
 #if defined(AFS_SGI62_ENV) || defined(AFS_HAVE_VXFS) || defined(AFS_DARWIN_ENV)
 #define afs_vnodeToInumber(V) VnodeToIno(V)
 #else
-#ifdef AFS_DECOSF_ENV
-#define afs_vnodeToInumber(V) osi_vnodeToInumber(V)
-#else
 #define afs_vnodeToInumber(V) (VTOI(V)->i_number)
-#endif /* AFS_DECOSF_ENV */
 #endif /* AFS_SGI62_ENV */
 #endif
 
@@ -1354,28 +1348,28 @@ extern struct brequest afs_brs[NBRS];   /* request structures */
 #ifndef afs_vnodeToDev
 #if defined(AFS_SGI62_ENV) || defined(AFS_HAVE_VXFS) || defined(AFS_DARWIN_ENV)
 #define afs_vnodeToDev(V) VnodeToDev(V)
-#elif defined(AFS_DECOSF_ENV)
-#define afs_vnodeToDev(V) osi_vnodeToDev(V)
+#elif defined(UKERNEL)
+#define afs_vnodeToDev(V) (VTOI(V) ? (VTOI(V)->i_dev) : (-1))
 #else
 #define afs_vnodeToDev(V) (VTOI(V)->i_dev)
 #endif
 #endif
 
-
-/* Note: this should agree with the definition in kdump.c */
-#if     defined(AFS_OSF_ENV)
-#if     !defined(UKERNEL)
-#define AFS_USEBUFFERS  1
-#endif
-#endif
-
-#if !defined(UKERNEL) && !defined(HAVE_STRUCT_BUF)
 /* declare something so that prototypes don't flip out */
 /* appears struct buf stuff is only actually passed around as a pointer, 
    except with libuafs, in which case it is actually defined */
 
 struct buf;
-#endif
+
+struct rxfs_storeVariables {
+    struct rx_call *call;
+    struct vcache *vcache;
+    char *tbuffer;
+    struct iovec *tiov;
+    afs_int32 tnio;
+    afs_int32 hasNo64bit;
+    struct AFSStoreStatus InStatus;
+};
 
 struct storeOps {
     int (*prepare)(void *rock, afs_uint32 size, afs_uint32 *bytestoxfer);
@@ -1387,6 +1381,8 @@ struct storeOps {
     int (*close)(void *rock, struct AFSFetchStatus *OutStatus,
         afs_int32 *doProcessFS);
     int (*destroy)(void **rock, afs_int32 error);
+    int (*storeproc)(struct storeOps *, void *, struct dcache *, int *,
+                    afs_size_t *);
 };
 
 struct fetchOps {
@@ -1417,4 +1413,32 @@ extern int afsd_dynamic_vcaches;
 #define afsd_dynamic_vcaches 0
 #endif
 
+/*
+ * Wrappers for access to credentials structure members
+ * Linux uses the kernel cred structure if available, with the
+ * wrappers defined in LINUX/osi_machdep.h
+ */
+#if !(defined(AFS_LINUX26_ENV) && defined(STRUCT_TASK_HAS_CRED))
+#define afs_cr_uid(cred) ((cred)->cr_uid)
+#define afs_cr_gid(cred) ((cred)->cr_gid)
+#define afs_cr_ruid(cred) ((cred)->cr_ruid)
+#define afs_cr_rgid(cred) ((cred)->cr_rgid)
+
+static_inline void
+afs_set_cr_uid(afs_ucred_t *cred, uid_t uid) {
+    cred->cr_uid = uid;
+}
+static_inline void
+afs_set_cr_gid(afs_ucred_t *cred, gid_t gid) {
+    cred->cr_gid = gid;
+}
+static_inline void
+afs_set_cr_ruid(afs_ucred_t *cred, uid_t uid) {
+    cred->cr_ruid = uid;
+}
+static_inline void
+afs_set_cr_rgid(afs_ucred_t *cred, gid_t gid) {
+    cred->cr_rgid = gid;
+}
+#endif
 #endif /* _AFS_H_ */