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 | |
| 17 | typedef unsigned afs_volid_t; |
| 18 | typedef unsigned afs_vnodeid_t; |
| 19 | typedef unsigned long long afs_dataversion_t; |
| 20 | |
| 21 | typedef enum { |
| 22 | AFSVL_RWVOL, /* read/write volume */ |
| 23 | AFSVL_ROVOL, /* read-only volume */ |
| 24 | AFSVL_BACKVOL, /* backup volume */ |
| 25 | } __attribute__((packed)) afs_voltype_t; |
| 26 | |
| 27 | typedef enum { |
| 28 | AFS_FTYPE_INVALID = 0, |
| 29 | AFS_FTYPE_FILE = 1, |
| 30 | AFS_FTYPE_DIR = 2, |
| 31 | AFS_FTYPE_SYMLINK = 3, |
| 32 | } afs_file_type_t; |
| 33 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | /* |
| 35 | * AFS file identifier |
| 36 | */ |
David Howells | ec26815 | 2007-04-26 15:49:28 -0700 | [diff] [blame] | 37 | struct afs_fid { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | afs_volid_t vid; /* volume ID */ |
| 39 | afs_vnodeid_t vnode; /* file index within volume */ |
| 40 | unsigned unique; /* unique ID number (file index version) */ |
| 41 | }; |
| 42 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | /* |
| 44 | * AFS callback notification |
| 45 | */ |
| 46 | typedef enum { |
| 47 | AFSCM_CB_UNTYPED = 0, /* no type set on CB break */ |
| 48 | AFSCM_CB_EXCLUSIVE = 1, /* CB exclusive to CM [not implemented] */ |
| 49 | AFSCM_CB_SHARED = 2, /* CB shared by other CM's */ |
| 50 | AFSCM_CB_DROPPED = 3, /* CB promise cancelled by file server */ |
| 51 | } afs_callback_type_t; |
| 52 | |
David Howells | ec26815 | 2007-04-26 15:49:28 -0700 | [diff] [blame] | 53 | struct afs_callback { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | struct afs_fid fid; /* file identifier */ |
| 55 | unsigned version; /* callback version */ |
| 56 | unsigned expiry; /* time at which expires */ |
| 57 | afs_callback_type_t type; /* type of callback */ |
| 58 | }; |
| 59 | |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame^] | 60 | #define AFSCBMAX 50 /* maximum callbacks transferred per bulk op */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | /* |
| 63 | * AFS volume information |
| 64 | */ |
David Howells | ec26815 | 2007-04-26 15:49:28 -0700 | [diff] [blame] | 65 | struct afs_volume_info { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | afs_volid_t vid; /* volume ID */ |
| 67 | afs_voltype_t type; /* type of this volume */ |
| 68 | 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^] | 69 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | /* list of fileservers serving this volume */ |
| 71 | size_t nservers; /* number of entries used in servers[] */ |
| 72 | struct { |
| 73 | struct in_addr addr; /* fileserver address */ |
| 74 | } servers[8]; |
| 75 | }; |
| 76 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | /* |
| 78 | * AFS file status information |
| 79 | */ |
David Howells | ec26815 | 2007-04-26 15:49:28 -0700 | [diff] [blame] | 80 | struct afs_file_status { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | unsigned if_version; /* interface version */ |
| 82 | #define AFS_FSTATUS_VERSION 1 |
| 83 | |
| 84 | afs_file_type_t type; /* file type */ |
| 85 | unsigned nlink; /* link count */ |
| 86 | size_t size; /* file size */ |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame^] | 87 | afs_dataversion_t data_version; /* current data version */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | unsigned author; /* author ID */ |
| 89 | unsigned owner; /* owner ID */ |
| 90 | unsigned caller_access; /* access rights for authenticated caller */ |
| 91 | unsigned anon_access; /* access rights for unauthenticated caller */ |
| 92 | umode_t mode; /* UNIX mode */ |
| 93 | struct afs_fid parent; /* parent file ID */ |
| 94 | time_t mtime_client; /* last time client changed data */ |
| 95 | time_t mtime_server; /* last time server changed data */ |
| 96 | }; |
| 97 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | /* |
| 99 | * AFS volume synchronisation information |
| 100 | */ |
David Howells | ec26815 | 2007-04-26 15:49:28 -0700 | [diff] [blame] | 101 | struct afs_volsync { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | time_t creation; /* volume creation time */ |
| 103 | }; |
| 104 | |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame^] | 105 | #endif /* AFS_H */ |