Commit | Line | Data |
---|---|---|
08e0e7c8 | 1 | /* AFS common types |
1da177e4 | 2 | * |
08e0e7c8 | 3 | * Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved. |
1da177e4 LT |
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 | ||
08e0e7c8 DH |
12 | #ifndef AFS_H |
13 | #define AFS_H | |
1da177e4 | 14 | |
08e0e7c8 | 15 | #include <linux/in.h> |
1da177e4 | 16 | |
00d3b7a4 DH |
17 | #define AFS_MAXCELLNAME 64 /* maximum length of a cell name */ |
18 | #define AFS_MAXVOLNAME 64 /* maximum length of a volume name */ | |
19 | ||
1da177e4 LT |
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 | ||
1da177e4 LT |
37 | /* |
38 | * AFS file identifier | |
39 | */ | |
ec26815a | 40 | struct afs_fid { |
1da177e4 LT |
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 | ||
1da177e4 LT |
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 | ||
ec26815a | 56 | struct afs_callback { |
1da177e4 LT |
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 | ||
08e0e7c8 | 63 | #define AFSCBMAX 50 /* maximum callbacks transferred per bulk op */ |
1da177e4 | 64 | |
1da177e4 LT |
65 | /* |
66 | * AFS volume information | |
67 | */ | |
ec26815a | 68 | struct afs_volume_info { |
1da177e4 LT |
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 */ | |
08e0e7c8 | 72 | |
1da177e4 LT |
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 | ||
00d3b7a4 DH |
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 | ||
1da177e4 LT |
100 | /* |
101 | * AFS file status information | |
102 | */ | |
ec26815a | 103 | struct afs_file_status { |
1da177e4 LT |
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 */ | |
260a9803 | 109 | u64 size; /* file size */ |
08e0e7c8 | 110 | afs_dataversion_t data_version; /* current data version */ |
260a9803 DH |
111 | u32 author; /* author ID */ |
112 | u32 owner; /* owner ID */ | |
113 | u32 group; /* group ID */ | |
00d3b7a4 DH |
114 | afs_access_t caller_access; /* access rights for authenticated caller */ |
115 | afs_access_t anon_access; /* access rights for unauthenticated caller */ | |
1da177e4 | 116 | umode_t mode; /* UNIX mode */ |
260a9803 | 117 | struct afs_fid parent; /* parent dir ID for non-dirs only */ |
1da177e4 LT |
118 | time_t mtime_client; /* last time client changed data */ |
119 | time_t mtime_server; /* last time server changed data */ | |
120 | }; | |
121 | ||
260a9803 DH |
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 | ||
1da177e4 LT |
139 | /* |
140 | * AFS volume synchronisation information | |
141 | */ | |
ec26815a | 142 | struct afs_volsync { |
1da177e4 LT |
143 | time_t creation; /* volume creation time */ |
144 | }; | |
145 | ||
08e0e7c8 | 146 | #endif /* AFS_H */ |