ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / fs / afs / types.h
1 /* types.h: AFS types
2  *
3  * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4  * Written by David Howells (dhowells@redhat.com)
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version
9  * 2 of the License, or (at your option) any later version.
10  */
11
12 #ifndef _LINUX_AFS_TYPES_H
13 #define _LINUX_AFS_TYPES_H
14
15 #ifdef __KERNEL__
16 #include <rxrpc/types.h>
17 #endif /* __KERNEL__ */
18
19 typedef unsigned                        afs_volid_t;
20 typedef unsigned                        afs_vnodeid_t;
21 typedef unsigned long long              afs_dataversion_t;
22
23 typedef enum {
24         AFSVL_RWVOL,                    /* read/write volume */
25         AFSVL_ROVOL,                    /* read-only volume */
26         AFSVL_BACKVOL,                  /* backup volume */
27 } __attribute__((packed)) afs_voltype_t;
28
29 extern const char *afs_voltypes[];
30
31 typedef enum {
32         AFS_FTYPE_INVALID       = 0,
33         AFS_FTYPE_FILE          = 1,
34         AFS_FTYPE_DIR           = 2,
35         AFS_FTYPE_SYMLINK       = 3,
36 } afs_file_type_t;
37
38 #ifdef __KERNEL__
39
40 struct afs_cell;
41 struct afs_vnode;
42
43 /*****************************************************************************/
44 /*
45  * AFS file identifier
46  */
47 struct afs_fid
48 {
49         afs_volid_t     vid;            /* volume ID */
50         afs_vnodeid_t   vnode;          /* file index within volume */
51         unsigned        unique;         /* unique ID number (file index version) */
52 };
53
54 /*****************************************************************************/
55 /*
56  * AFS callback notification
57  */
58 typedef enum {
59         AFSCM_CB_UNTYPED        = 0,    /* no type set on CB break */
60         AFSCM_CB_EXCLUSIVE      = 1,    /* CB exclusive to CM [not implemented] */
61         AFSCM_CB_SHARED         = 2,    /* CB shared by other CM's */
62         AFSCM_CB_DROPPED        = 3,    /* CB promise cancelled by file server */
63 } afs_callback_type_t;
64
65 struct afs_callback
66 {
67         struct afs_server       *server;        /* server that made the promise */
68         struct afs_fid          fid;            /* file identifier */
69         unsigned                version;        /* callback version */
70         unsigned                expiry;         /* time at which expires */
71         afs_callback_type_t     type;           /* type of callback */
72 };
73
74 #define AFSCBMAX 50
75
76 /*****************************************************************************/
77 /*
78  * AFS volume information
79  */
80 struct afs_volume_info
81 {
82         afs_volid_t             vid;            /* volume ID */
83         afs_voltype_t           type;           /* type of this volume */
84         afs_volid_t             type_vids[5];   /* volume ID's for possible types for this vol */
85         
86         /* list of fileservers serving this volume */
87         size_t                  nservers;       /* number of entries used in servers[] */
88         struct {
89                 struct in_addr  addr;           /* fileserver address */
90         } servers[8];
91 };
92
93 /*****************************************************************************/
94 /*
95  * AFS file status information
96  */
97 struct afs_file_status
98 {
99         unsigned                if_version;     /* interface version */
100 #define AFS_FSTATUS_VERSION     1
101
102         afs_file_type_t         type;           /* file type */
103         unsigned                nlink;          /* link count */
104         size_t                  size;           /* file size */
105         afs_dataversion_t       version;        /* current data version */
106         unsigned                author;         /* author ID */
107         unsigned                owner;          /* owner ID */
108         unsigned                caller_access;  /* access rights for authenticated caller */
109         unsigned                anon_access;    /* access rights for unauthenticated caller */
110         umode_t                 mode;           /* UNIX mode */
111         struct afs_fid          parent;         /* parent file ID */
112         time_t                  mtime_client;   /* last time client changed data */
113         time_t                  mtime_server;   /* last time server changed data */
114 };
115
116 /*****************************************************************************/
117 /*
118  * AFS volume synchronisation information
119  */
120 struct afs_volsync
121 {
122         time_t                  creation;       /* volume creation time */
123 };
124
125 #endif /* __KERNEL__ */
126
127 #endif /* _LINUX_AFS_TYPES_H */