blob: 2452579481404fe702aa852b39ab404254773c5b [file] [log] [blame]
David Howells08e0e7c2007-04-26 15:55:03 -07001/* AFS common types
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 *
David Howells08e0e7c2007-04-26 15:55:03 -07003 * Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved.
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 * 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
David Howells08e0e7c2007-04-26 15:55:03 -070012#ifndef AFS_H
13#define AFS_H
Linus Torvalds1da177e2005-04-16 15:20:36 -070014
David Howells08e0e7c2007-04-26 15:55:03 -070015#include <linux/in.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
David Howells00d3b7a2007-04-26 15:57:07 -070017#define AFS_MAXCELLNAME 64 /* maximum length of a cell name */
18#define AFS_MAXVOLNAME 64 /* maximum length of a volume name */
David Howells45222b92007-05-10 22:22:20 -070019#define AFSNAMEMAX 256 /* maximum length of a filename plus NUL */
20#define AFSPATHMAX 1024 /* maximum length of a pathname plus NUL */
21#define AFSOPAQUEMAX 1024 /* maximum length of an opaque field */
David Howells00d3b7a2007-04-26 15:57:07 -070022
Linus Torvalds1da177e2005-04-16 15:20:36 -070023typedef unsigned afs_volid_t;
24typedef unsigned afs_vnodeid_t;
25typedef unsigned long long afs_dataversion_t;
26
27typedef enum {
28 AFSVL_RWVOL, /* read/write volume */
29 AFSVL_ROVOL, /* read-only volume */
30 AFSVL_BACKVOL, /* backup volume */
31} __attribute__((packed)) afs_voltype_t;
32
33typedef enum {
34 AFS_FTYPE_INVALID = 0,
35 AFS_FTYPE_FILE = 1,
36 AFS_FTYPE_DIR = 2,
37 AFS_FTYPE_SYMLINK = 3,
38} afs_file_type_t;
39
Linus Torvalds1da177e2005-04-16 15:20:36 -070040/*
41 * AFS file identifier
42 */
David Howellsec268152007-04-26 15:49:28 -070043struct afs_fid {
Linus Torvalds1da177e2005-04-16 15:20:36 -070044 afs_volid_t vid; /* volume ID */
45 afs_vnodeid_t vnode; /* file index within volume */
46 unsigned unique; /* unique ID number (file index version) */
47};
48
Linus Torvalds1da177e2005-04-16 15:20:36 -070049/*
50 * AFS callback notification
51 */
52typedef enum {
53 AFSCM_CB_UNTYPED = 0, /* no type set on CB break */
54 AFSCM_CB_EXCLUSIVE = 1, /* CB exclusive to CM [not implemented] */
55 AFSCM_CB_SHARED = 2, /* CB shared by other CM's */
56 AFSCM_CB_DROPPED = 3, /* CB promise cancelled by file server */
57} afs_callback_type_t;
58
David Howellsec268152007-04-26 15:49:28 -070059struct afs_callback {
Linus Torvalds1da177e2005-04-16 15:20:36 -070060 struct afs_fid fid; /* file identifier */
61 unsigned version; /* callback version */
62 unsigned expiry; /* time at which expires */
63 afs_callback_type_t type; /* type of callback */
64};
65
David Howells08e0e7c2007-04-26 15:55:03 -070066#define AFSCBMAX 50 /* maximum callbacks transferred per bulk op */
Linus Torvalds1da177e2005-04-16 15:20:36 -070067
Linus Torvalds1da177e2005-04-16 15:20:36 -070068/*
69 * AFS volume information
70 */
David Howellsec268152007-04-26 15:49:28 -070071struct afs_volume_info {
Linus Torvalds1da177e2005-04-16 15:20:36 -070072 afs_volid_t vid; /* volume ID */
73 afs_voltype_t type; /* type of this volume */
74 afs_volid_t type_vids[5]; /* volume ID's for possible types for this vol */
David Howells08e0e7c2007-04-26 15:55:03 -070075
Linus Torvalds1da177e2005-04-16 15:20:36 -070076 /* list of fileservers serving this volume */
77 size_t nservers; /* number of entries used in servers[] */
78 struct {
79 struct in_addr addr; /* fileserver address */
80 } servers[8];
81};
82
Linus Torvalds1da177e2005-04-16 15:20:36 -070083/*
David Howells00d3b7a2007-04-26 15:57:07 -070084 * AFS security ACE access mask
85 */
86typedef u32 afs_access_t;
87#define AFS_ACE_READ 0x00000001U /* - permission to read a file/dir */
88#define AFS_ACE_WRITE 0x00000002U /* - permission to write/chmod a file */
89#define AFS_ACE_INSERT 0x00000004U /* - permission to create dirent in a dir */
90#define AFS_ACE_LOOKUP 0x00000008U /* - permission to lookup a file/dir in a dir */
91#define AFS_ACE_DELETE 0x00000010U /* - permission to delete a dirent from a dir */
92#define AFS_ACE_LOCK 0x00000020U /* - permission to lock a file */
93#define AFS_ACE_ADMINISTER 0x00000040U /* - permission to change ACL */
94#define AFS_ACE_USER_A 0x01000000U /* - 'A' user-defined permission */
95#define AFS_ACE_USER_B 0x02000000U /* - 'B' user-defined permission */
96#define AFS_ACE_USER_C 0x04000000U /* - 'C' user-defined permission */
97#define AFS_ACE_USER_D 0x08000000U /* - 'D' user-defined permission */
98#define AFS_ACE_USER_E 0x10000000U /* - 'E' user-defined permission */
99#define AFS_ACE_USER_F 0x20000000U /* - 'F' user-defined permission */
100#define AFS_ACE_USER_G 0x40000000U /* - 'G' user-defined permission */
101#define AFS_ACE_USER_H 0x80000000U /* - 'H' user-defined permission */
102
103/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104 * AFS file status information
105 */
David Howellsec268152007-04-26 15:49:28 -0700106struct afs_file_status {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107 unsigned if_version; /* interface version */
108#define AFS_FSTATUS_VERSION 1
109
110 afs_file_type_t type; /* file type */
111 unsigned nlink; /* link count */
David Howells260a9802007-04-26 15:59:35 -0700112 u64 size; /* file size */
David Howells08e0e7c2007-04-26 15:55:03 -0700113 afs_dataversion_t data_version; /* current data version */
David Howells260a9802007-04-26 15:59:35 -0700114 u32 author; /* author ID */
115 u32 owner; /* owner ID */
116 u32 group; /* group ID */
David Howells00d3b7a2007-04-26 15:57:07 -0700117 afs_access_t caller_access; /* access rights for authenticated caller */
118 afs_access_t anon_access; /* access rights for unauthenticated caller */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119 umode_t mode; /* UNIX mode */
David Howells260a9802007-04-26 15:59:35 -0700120 struct afs_fid parent; /* parent dir ID for non-dirs only */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121 time_t mtime_client; /* last time client changed data */
122 time_t mtime_server; /* last time server changed data */
123};
124
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125/*
David Howells260a9802007-04-26 15:59:35 -0700126 * AFS file status change request
127 */
128struct afs_store_status {
129 u32 mask; /* which bits of the struct are set */
130 u32 mtime_client; /* last time client changed data */
131 u32 owner; /* owner ID */
132 u32 group; /* group ID */
133 umode_t mode; /* UNIX mode */
134};
135
136#define AFS_SET_MTIME 0x01 /* set the mtime */
137#define AFS_SET_OWNER 0x02 /* set the owner ID */
138#define AFS_SET_GROUP 0x04 /* set the group ID (unsupported?) */
139#define AFS_SET_MODE 0x08 /* set the UNIX mode */
140#define AFS_SET_SEG_SIZE 0x10 /* set the segment size (unsupported) */
141
142/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143 * AFS volume synchronisation information
144 */
David Howellsec268152007-04-26 15:49:28 -0700145struct afs_volsync {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146 time_t creation; /* volume creation time */
147};
148
David Howells45222b92007-05-10 22:22:20 -0700149/*
150 * AFS volume status record
151 */
152struct afs_volume_status {
153 u32 vid; /* volume ID */
154 u32 parent_id; /* parent volume ID */
155 u8 online; /* true if volume currently online and available */
156 u8 in_service; /* true if volume currently in service */
157 u8 blessed; /* same as in_service */
158 u8 needs_salvage; /* true if consistency checking required */
159 u32 type; /* volume type (afs_voltype_t) */
160 u32 min_quota; /* minimum space set aside (blocks) */
161 u32 max_quota; /* maximum space this volume may occupy (blocks) */
162 u32 blocks_in_use; /* space this volume currently occupies (blocks) */
163 u32 part_blocks_avail; /* space available in volume's partition */
164 u32 part_max_blocks; /* size of volume's partition */
165};
166
167#define AFS_BLOCK_SIZE 1024
168
David Howells08e0e7c2007-04-26 15:55:03 -0700169#endif /* AFS_H */