Merge tag 'fuse-update-5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi...
[linux-2.6-block.git] / fs / afs / afs.h
CommitLineData
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
91a90380
DH
17#define AFS_MAXCELLNAME 64 /* Maximum length of a cell name */
18#define AFS_MAXVOLNAME 64 /* Maximum length of a volume name */
19#define AFS_MAXNSERVERS 8 /* Maximum servers in a basic volume record */
20#define AFS_NMAXNSERVERS 13 /* Maximum servers in a N/U-class volume record */
21#define AFS_MAXTYPES 3 /* Maximum number of volume types */
22#define AFSNAMEMAX 256 /* Maximum length of a filename plus NUL */
23#define AFSPATHMAX 1024 /* Maximum length of a pathname plus NUL */
24#define AFSOPAQUEMAX 1024 /* Maximum length of an opaque field */
00d3b7a4 25
3b6492df
DH
26typedef u64 afs_volid_t;
27typedef u64 afs_vnodeid_t;
28typedef u64 afs_dataversion_t;
1da177e4
LT
29
30typedef enum {
31 AFSVL_RWVOL, /* read/write volume */
32 AFSVL_ROVOL, /* read-only volume */
33 AFSVL_BACKVOL, /* backup volume */
34} __attribute__((packed)) afs_voltype_t;
35
36typedef enum {
37 AFS_FTYPE_INVALID = 0,
38 AFS_FTYPE_FILE = 1,
39 AFS_FTYPE_DIR = 2,
40 AFS_FTYPE_SYMLINK = 3,
41} afs_file_type_t;
42
e8d6c554
DH
43typedef enum {
44 AFS_LOCK_READ = 0, /* read lock request */
45 AFS_LOCK_WRITE = 1, /* write lock request */
46} afs_lock_type_t;
47
48#define AFS_LOCKWAIT (5 * 60) /* time until a lock times out (seconds) */
49
1da177e4
LT
50/*
51 * AFS file identifier
52 */
ec26815a 53struct afs_fid {
1da177e4 54 afs_volid_t vid; /* volume ID */
3b6492df
DH
55 afs_vnodeid_t vnode; /* Lower 64-bits of file index within volume */
56 u32 vnode_hi; /* Upper 32-bits of file index */
57 u32 unique; /* unique ID number (file index version) */
1da177e4
LT
58};
59
1da177e4
LT
60/*
61 * AFS callback notification
62 */
63typedef enum {
64 AFSCM_CB_UNTYPED = 0, /* no type set on CB break */
65 AFSCM_CB_EXCLUSIVE = 1, /* CB exclusive to CM [not implemented] */
66 AFSCM_CB_SHARED = 2, /* CB shared by other CM's */
67 AFSCM_CB_DROPPED = 3, /* CB promise cancelled by file server */
68} afs_callback_type_t;
69
ec26815a 70struct afs_callback {
12d8e95a 71 time64_t expires_at; /* Time at which expires */
5cf9dd55 72 unsigned version; /* Callback version */
5cf9dd55
DH
73 afs_callback_type_t type; /* Type of callback */
74};
75
76struct afs_callback_break {
77 struct afs_fid fid; /* File identifier */
06aeb297 78 //struct afs_callback cb; /* Callback details */
1da177e4
LT
79};
80
08e0e7c8 81#define AFSCBMAX 50 /* maximum callbacks transferred per bulk op */
1da177e4 82
f044c884
DH
83struct afs_uuid {
84 __be32 time_low; /* low part of timestamp */
85 __be16 time_mid; /* mid part of timestamp */
86 __be16 time_hi_and_version; /* high part of timestamp and version */
03dc2cfc
DH
87 __s8 clock_seq_hi_and_reserved; /* clock seq hi and variant */
88 __s8 clock_seq_low; /* clock seq low */
89 __s8 node[6]; /* spatially unique node ID (MAC addr) */
f044c884
DH
90};
91
1da177e4
LT
92/*
93 * AFS volume information
94 */
ec26815a 95struct afs_volume_info {
1da177e4
LT
96 afs_volid_t vid; /* volume ID */
97 afs_voltype_t type; /* type of this volume */
98 afs_volid_t type_vids[5]; /* volume ID's for possible types for this vol */
08e0e7c8 99
1da177e4
LT
100 /* list of fileservers serving this volume */
101 size_t nservers; /* number of entries used in servers[] */
102 struct {
103 struct in_addr addr; /* fileserver address */
104 } servers[8];
105};
106
00d3b7a4
DH
107/*
108 * AFS security ACE access mask
109 */
110typedef u32 afs_access_t;
111#define AFS_ACE_READ 0x00000001U /* - permission to read a file/dir */
112#define AFS_ACE_WRITE 0x00000002U /* - permission to write/chmod a file */
113#define AFS_ACE_INSERT 0x00000004U /* - permission to create dirent in a dir */
114#define AFS_ACE_LOOKUP 0x00000008U /* - permission to lookup a file/dir in a dir */
115#define AFS_ACE_DELETE 0x00000010U /* - permission to delete a dirent from a dir */
116#define AFS_ACE_LOCK 0x00000020U /* - permission to lock a file */
117#define AFS_ACE_ADMINISTER 0x00000040U /* - permission to change ACL */
118#define AFS_ACE_USER_A 0x01000000U /* - 'A' user-defined permission */
119#define AFS_ACE_USER_B 0x02000000U /* - 'B' user-defined permission */
120#define AFS_ACE_USER_C 0x04000000U /* - 'C' user-defined permission */
121#define AFS_ACE_USER_D 0x08000000U /* - 'D' user-defined permission */
122#define AFS_ACE_USER_E 0x10000000U /* - 'E' user-defined permission */
123#define AFS_ACE_USER_F 0x20000000U /* - 'F' user-defined permission */
124#define AFS_ACE_USER_G 0x40000000U /* - 'G' user-defined permission */
125#define AFS_ACE_USER_H 0x80000000U /* - 'H' user-defined permission */
126
1da177e4
LT
127/*
128 * AFS file status information
129 */
ec26815a 130struct afs_file_status {
5cf9dd55
DH
131 u64 size; /* file size */
132 afs_dataversion_t data_version; /* current data version */
d4936803
DH
133 struct timespec64 mtime_client; /* Last time client changed data */
134 struct timespec64 mtime_server; /* Last time server changed data */
135 s64 author; /* author ID */
136 s64 owner; /* owner ID */
137 s64 group; /* group ID */
00d3b7a4
DH
138 afs_access_t caller_access; /* access rights for authenticated caller */
139 afs_access_t anon_access; /* access rights for unauthenticated caller */
1da177e4 140 umode_t mode; /* UNIX mode */
d4936803
DH
141 afs_file_type_t type; /* file type */
142 u32 nlink; /* link count */
e8d6c554 143 s32 lock_count; /* file lock count (0=UNLK -1=WRLCK +ve=#RDLCK */
d4936803 144 u32 abort_code; /* Abort if bulk-fetching this failed */
1da177e4
LT
145};
146
260a9803
DH
147/*
148 * AFS file status change request
149 */
260a9803
DH
150
151#define AFS_SET_MTIME 0x01 /* set the mtime */
152#define AFS_SET_OWNER 0x02 /* set the owner ID */
153#define AFS_SET_GROUP 0x04 /* set the group ID (unsupported?) */
154#define AFS_SET_MODE 0x08 /* set the UNIX mode */
155#define AFS_SET_SEG_SIZE 0x10 /* set the segment size (unsupported) */
156
1da177e4
LT
157/*
158 * AFS volume synchronisation information
159 */
ec26815a 160struct afs_volsync {
d4936803 161 time64_t creation; /* volume creation time */
1da177e4
LT
162};
163
45222b9e
DH
164/*
165 * AFS volume status record
166 */
167struct afs_volume_status {
d4936803
DH
168 afs_volid_t vid; /* volume ID */
169 afs_volid_t parent_id; /* parent volume ID */
45222b9e
DH
170 u8 online; /* true if volume currently online and available */
171 u8 in_service; /* true if volume currently in service */
172 u8 blessed; /* same as in_service */
173 u8 needs_salvage; /* true if consistency checking required */
174 u32 type; /* volume type (afs_voltype_t) */
d4936803
DH
175 u64 min_quota; /* minimum space set aside (blocks) */
176 u64 max_quota; /* maximum space this volume may occupy (blocks) */
177 u64 blocks_in_use; /* space this volume currently occupies (blocks) */
178 u64 part_blocks_avail; /* space available in volume's partition */
179 u64 part_max_blocks; /* size of volume's partition */
180 s64 vol_copy_date;
181 s64 vol_backup_date;
45222b9e
DH
182};
183
184#define AFS_BLOCK_SIZE 1024
185
91a90380
DH
186/*
187 * XDR encoding of UUID in AFS.
188 */
189struct afs_uuid__xdr {
190 __be32 time_low;
191 __be32 time_mid;
192 __be32 time_hi_and_version;
193 __be32 clock_seq_hi_and_reserved;
194 __be32 clock_seq_low;
195 __be32 node[6];
196};
197
08e0e7c8 198#endif /* AFS_H */