David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 1 | /* AFS common types |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 3 | * Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 12 | #ifndef AFS_H |
| 13 | #define AFS_H |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 15 | #include <linux/in.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | |
David Howells | 00d3b7a | 2007-04-26 15:57:07 -0700 | [diff] [blame] | 17 | #define AFS_MAXCELLNAME 64 /* maximum length of a cell name */ |
| 18 | #define AFS_MAXVOLNAME 64 /* maximum length of a volume name */ |
| 19 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | /* |
| 38 | * AFS file identifier |
| 39 | */ |
David Howells | ec26815 | 2007-04-26 15:49:28 -0700 | [diff] [blame] | 40 | struct afs_fid { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
David Howells | ec26815 | 2007-04-26 15:49:28 -0700 | [diff] [blame] | 56 | struct afs_callback { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 63 | #define AFSCBMAX 50 /* maximum callbacks transferred per bulk op */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | /* |
| 66 | * AFS volume information |
| 67 | */ |
David Howells | ec26815 | 2007-04-26 15:49:28 -0700 | [diff] [blame] | 68 | struct afs_volume_info { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 */ |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 72 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | /* |
David Howells | 00d3b7a | 2007-04-26 15:57:07 -0700 | [diff] [blame] | 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 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | * AFS file status information |
| 102 | */ |
David Howells | ec26815 | 2007-04-26 15:49:28 -0700 | [diff] [blame] | 103 | struct afs_file_status { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 */ |
David Howells | 260a980 | 2007-04-26 15:59:35 -0700 | [diff] [blame^] | 109 | u64 size; /* file size */ |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 110 | afs_dataversion_t data_version; /* current data version */ |
David Howells | 260a980 | 2007-04-26 15:59:35 -0700 | [diff] [blame^] | 111 | u32 author; /* author ID */ |
| 112 | u32 owner; /* owner ID */ |
| 113 | u32 group; /* group ID */ |
David Howells | 00d3b7a | 2007-04-26 15:57:07 -0700 | [diff] [blame] | 114 | afs_access_t caller_access; /* access rights for authenticated caller */ |
| 115 | afs_access_t anon_access; /* access rights for unauthenticated caller */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | umode_t mode; /* UNIX mode */ |
David Howells | 260a980 | 2007-04-26 15:59:35 -0700 | [diff] [blame^] | 117 | struct afs_fid parent; /* parent dir ID for non-dirs only */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | time_t mtime_client; /* last time client changed data */ |
| 119 | time_t mtime_server; /* last time server changed data */ |
| 120 | }; |
| 121 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 122 | /* |
David Howells | 260a980 | 2007-04-26 15:59:35 -0700 | [diff] [blame^] | 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 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 140 | * AFS volume synchronisation information |
| 141 | */ |
David Howells | ec26815 | 2007-04-26 15:49:28 -0700 | [diff] [blame] | 142 | struct afs_volsync { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 143 | time_t creation; /* volume creation time */ |
| 144 | }; |
| 145 | |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 146 | #endif /* AFS_H */ |