linux-ext3-adds-items-to-struct-inode-and-so-do-we-20010807
[openafs.git] / src / afs / exporter.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #ifndef __EXPORTER__
11 #define __EXPORTER__
12
13 #ifdef UID_NOBODY
14 #define NFS_NOBODY      UID_NOBODY
15 #endif
16 #ifndef NFS_NOBODY
17 #define NFS_NOBODY      -2      /* maps Nfs's "nobody" but since not declared by some systems (i.e. Ultrix) we use a constant  */
18 #endif
19 #define RMTUSER_REQ             0xabc
20
21 /**
22   * There is a limitation on the number of bytes that can be passed into
23   * the file handle that nfs passes into AFS.  The limit is 10 bytes.
24   * We pass in an array of long of size 2. On a 32 bit system this would be
25   * 8 bytes. But on a 64 bit system this would be 16 bytes. The first
26   * element of this array is a pointer so we cannot truncate that. But the
27   * second element is the AFS_XLATOR_MAGIC, which we can truncate.
28   * So on a 64 bit system the 10 bytes are used as below
29   * Bytes 1-8                   pointer to vnode
30   * Bytes 9 and 10              AFS_XLATOR_MAGIC
31   *
32   * And hence for 64 bit environments AFS_XLATOR_MAGIC is 8765 which takes
33   * up 2 bytes
34   */
35
36 #if defined(AFS_SUN57_64BIT_ENV) || defined(AFS_OSF_ENV) || (defined(AFS_SGI61_ENV) && (_MIPS_SZPTR==64)) || defined(AFS_LINUX_64BIT_KERNEL)
37 #define AFS_XLATOR_MAGIC        0x8765          /* XXX */
38 #else
39 #define AFS_XLATOR_MAGIC        0x87654321
40 #endif
41
42 #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
43 #define AFS_NFSXLATORREQ(cred) 0
44 #else
45 #ifdef  AFS_OSF_ENV
46 #define AFS_NFSXLATORREQ(cred)    ((cred)->cr_ruid == NFSXLATOR_CRED)
47 #else
48 #define AFS_NFSXLATORREQ(cred)    ((cred)->cr_rgid == NFSXLATOR_CRED)
49 #endif
50 #endif
51
52 struct  exporterops {
53     int     (*export_reqhandler)();
54     int     (*export_hold)();
55     int     (*export_rele)();
56     int     (*export_sysname)();
57     int     (*export_garbagecollect)();
58     int     (*export_statistics)();
59 };
60
61 struct exporterstats {
62     afs_int32 calls;                    /* # of calls to the exporter */
63     afs_int32 rejectedcalls;            /* # of afs rejected  calls */
64     afs_int32 nopag;                    /* # of unpagged remote calls */
65     afs_int32 invalidpag;               /* # of invalid pag calls */
66 };
67
68 struct afs_exporter {
69     struct  afs_exporter   *exp_next;
70     struct  exporterops     *exp_op;
71     afs_int32               exp_states;
72     afs_int32               exp_type;
73     struct  exporterstats   exp_stats;
74     char                    *exp_data;
75 };
76
77 /* exp_type values */
78 #define EXP_NULL    0       /* Undefined */
79 #define EXP_NFS     1       /* Nfs/Afs translator */
80
81 /* exp_states values */
82 #define EXP_EXPORTED    1
83 #define EXP_UNIXMODE    2
84 #define EXP_PWSYNC      4
85 #define EXP_SUBMOUNTS   8
86
87
88 #define AFS_NFSFULLFID  1
89
90 #define EXP_REQHANDLER(EXP, CRED, HOST, PAG, EXPP) \
91         (*(EXP)->exp_op->export_reqhandler)(EXP, CRED, HOST, PAG, EXPP)
92 #define EXP_HOLD(EXP)   \
93         (*(EXP)->exp_op->export_hold)(EXP)
94 #define EXP_RELE(EXP)   \
95         (*(EXP)->exp_op->export_rele)(EXP)
96 #define EXP_SYSNAME(EXP, INNAME, OUTNAME)   \
97         (*(EXP)->exp_op->export_sysname)(EXP, INNAME, OUTNAME)
98 #define EXP_GC(EXP, param)      \
99         (*(EXP)->exp_op->export_garbagecollect)(EXP, param)
100 #define EXP_STATISTICS(EXP)     \
101         (*(EXP)->exp_op->export_statistics)(EXP)
102
103 struct afs3_fid {
104     u_short len;
105     u_short padding;
106     afs_uint32 Cell;
107     afs_uint32 Volume;
108     afs_uint32 Vnode;
109     afs_uint32 Unique;
110 };
111
112 struct Sfid {
113     afs_uint32 padding;
114     afs_uint32 Cell;
115     afs_uint32 Volume;
116     afs_uint32 Vnode;
117     afs_uint32 Unique;
118 #ifdef  AFS_SUN5_ENV
119     struct cred *credp;
120 #endif
121 };
122
123
124 #endif /* __EXPORTER__ */