Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux...
[pandora-kernel.git] / fs / afs / afs.h
1 /* AFS common types
2  *
3  * Copyright (C) 2002, 2007 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 AFS_H
13 #define AFS_H
14
15 #include <linux/in.h>
16
17 #define AFS_MAXCELLNAME 64              /* maximum length of a cell name */
18 #define AFS_MAXVOLNAME  64              /* maximum length of a volume name */
19
20 typedef unsigned                        afs_volid_t;
21 typedef unsigned                        afs_vnodeid_t;
22 typedef unsigned long long              afs_dataversion_t;
23
24 typedef enum {
25         AFSVL_RWVOL,                    /* read/write volume */
26         AFSVL_ROVOL,                    /* read-only volume */
27         AFSVL_BACKVOL,                  /* backup volume */
28 } __attribute__((packed)) afs_voltype_t;
29
30 typedef enum {
31         AFS_FTYPE_INVALID       = 0,
32         AFS_FTYPE_FILE          = 1,
33         AFS_FTYPE_DIR           = 2,
34         AFS_FTYPE_SYMLINK       = 3,
35 } afs_file_type_t;
36
37 /*
38  * AFS file identifier
39  */
40 struct afs_fid {
41         afs_volid_t     vid;            /* volume ID */
42         afs_vnodeid_t   vnode;          /* file index within volume */
43         unsigned        unique;         /* unique ID number (file index version) */
44 };
45
46 /*
47  * AFS callback notification
48  */
49 typedef enum {
50         AFSCM_CB_UNTYPED        = 0,    /* no type set on CB break */
51         AFSCM_CB_EXCLUSIVE      = 1,    /* CB exclusive to CM [not implemented] */
52         AFSCM_CB_SHARED         = 2,    /* CB shared by other CM's */
53         AFSCM_CB_DROPPED        = 3,    /* CB promise cancelled by file server */
54 } afs_callback_type_t;
55
56 struct afs_callback {
57         struct afs_fid          fid;            /* file identifier */
58         unsigned                version;        /* callback version */
59         unsigned                expiry;         /* time at which expires */
60         afs_callback_type_t     type;           /* type of callback */
61 };
62
63 #define AFSCBMAX 50     /* maximum callbacks transferred per bulk op */
64
65 /*
66  * AFS volume information
67  */
68 struct afs_volume_info {
69         afs_volid_t             vid;            /* volume ID */
70         afs_voltype_t           type;           /* type of this volume */
71         afs_volid_t             type_vids[5];   /* volume ID's for possible types for this vol */
72
73         /* list of fileservers serving this volume */
74         size_t                  nservers;       /* number of entries used in servers[] */
75         struct {
76                 struct in_addr  addr;           /* fileserver address */
77         } servers[8];
78 };
79
80 /*
81  * AFS security ACE access mask
82  */
83 typedef u32 afs_access_t;
84 #define AFS_ACE_READ            0x00000001U     /* - permission to read a file/dir */
85 #define AFS_ACE_WRITE           0x00000002U     /* - permission to write/chmod a file */
86 #define AFS_ACE_INSERT          0x00000004U     /* - permission to create dirent in a dir */
87 #define AFS_ACE_LOOKUP          0x00000008U     /* - permission to lookup a file/dir in a dir */
88 #define AFS_ACE_DELETE          0x00000010U     /* - permission to delete a dirent from a dir */
89 #define AFS_ACE_LOCK            0x00000020U     /* - permission to lock a file */
90 #define AFS_ACE_ADMINISTER      0x00000040U     /* - permission to change ACL */
91 #define AFS_ACE_USER_A          0x01000000U     /* - 'A' user-defined permission */
92 #define AFS_ACE_USER_B          0x02000000U     /* - 'B' user-defined permission */
93 #define AFS_ACE_USER_C          0x04000000U     /* - 'C' user-defined permission */
94 #define AFS_ACE_USER_D          0x08000000U     /* - 'D' user-defined permission */
95 #define AFS_ACE_USER_E          0x10000000U     /* - 'E' user-defined permission */
96 #define AFS_ACE_USER_F          0x20000000U     /* - 'F' user-defined permission */
97 #define AFS_ACE_USER_G          0x40000000U     /* - 'G' user-defined permission */
98 #define AFS_ACE_USER_H          0x80000000U     /* - 'H' user-defined permission */
99
100 /*
101  * AFS file status information
102  */
103 struct afs_file_status {
104         unsigned                if_version;     /* interface version */
105 #define AFS_FSTATUS_VERSION     1
106
107         afs_file_type_t         type;           /* file type */
108         unsigned                nlink;          /* link count */
109         u64                     size;           /* file size */
110         afs_dataversion_t       data_version;   /* current data version */
111         u32                     author;         /* author ID */
112         u32                     owner;          /* owner ID */
113         u32                     group;          /* group ID */
114         afs_access_t            caller_access;  /* access rights for authenticated caller */
115         afs_access_t            anon_access;    /* access rights for unauthenticated caller */
116         umode_t                 mode;           /* UNIX mode */
117         struct afs_fid          parent;         /* parent dir ID for non-dirs only */
118         time_t                  mtime_client;   /* last time client changed data */
119         time_t                  mtime_server;   /* last time server changed data */
120 };
121
122 /*
123  * AFS file status change request
124  */
125 struct afs_store_status {
126         u32                     mask;           /* which bits of the struct are set */
127         u32                     mtime_client;   /* last time client changed data */
128         u32                     owner;          /* owner ID */
129         u32                     group;          /* group ID */
130         umode_t                 mode;           /* UNIX mode */
131 };
132
133 #define AFS_SET_MTIME           0x01            /* set the mtime */
134 #define AFS_SET_OWNER           0x02            /* set the owner ID */
135 #define AFS_SET_GROUP           0x04            /* set the group ID (unsupported?) */
136 #define AFS_SET_MODE            0x08            /* set the UNIX mode */
137 #define AFS_SET_SEG_SIZE        0x10            /* set the segment size (unsupported) */
138
139 /*
140  * AFS volume synchronisation information
141  */
142 struct afs_volsync {
143         time_t                  creation;       /* volume creation time */
144 };
145
146 #endif /* AFS_H */