Fix new UKERNEL warnings on 64-bit
[openafs.git] / src / afs / afs.h
index 4f45c38..44f6679 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,
@@ -400,6 +406,10 @@ struct srvAddr {
 #define        SRVR_ISGONE                     0x80
 #define        SNO_INLINEBULK                  0x100
 #define SNO_64BIT                       0x200
+#define SCAPS_KNOWN                    0x400
+
+#define SRV_CAPABILITIES(ts) \
+{ if ( !(ts->flags & SCAPS_KNOWN)) afs_GetCapabilities(ts); ts->capabilities; }
 
 #define afs_serverSetNo64Bit(s) ((s)->srvr->server->flags |= SNO_64BIT)
 #define afs_serverHasNo64Bit(s) ((s)->srvr->server->flags & SNO_64BIT)
@@ -431,6 +441,7 @@ struct server {
     afs_int32 sumOfDowntimes;  /* Total downtime experienced, in seconds */
     struct srvAddr *addr;
     afs_uint32 flags;          /* Misc flags */
+    afs_int32 capabilities;
 };
 
 #define        afs_PutServer(servp, locktype)
@@ -514,8 +525,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 */
@@ -580,11 +591,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. */
@@ -1001,6 +1013,16 @@ typedef long iparmtype;
 #endif
 #endif
 
+#if SIZEOF_VOID_P == SIZEOF_UNSIGNED_INT
+# define uintptrsz unsigned int
+#elif SIZEOF_VOID_P == SIZEOF_UNSIGNED_LONG
+# define uintptrsz unsigned long
+#elif SIZEOF_VOID_P == SIZEOF_UNSIGNED_LONG_LONG
+# define uintptrsz unsigned long long
+#else
+# error "Unable to determine casting for pointers"
+#endif
+
 struct afs_ioctl {
     uparmtype in;              /* input buffer */
     uparmtype out;             /* output buffer */
@@ -1040,8 +1062,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.
@@ -1070,7 +1092,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 */
@@ -1083,9 +1104,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 */
 };
 
@@ -1099,7 +1117,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 */
 
@@ -1346,18 +1363,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(UKERNEL)
+#define afs_vnodeToDev(V) (VTOI(V) ? (VTOI(V)->i_dev) : (-1))
 #else
 #define afs_vnodeToDev(V) (VTOI(V)->i_dev)
 #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);
@@ -1369,6 +1396,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 {