0001
0002
0003
0004
0005
0006
0007
0008 #ifndef XDR_FS_H
0009 #define XDR_FS_H
0010
0011 struct afs_xdr_AFSFetchStatus {
0012 __be32 if_version;
0013 #define AFS_FSTATUS_VERSION 1
0014 __be32 type;
0015 __be32 nlink;
0016 __be32 size_lo;
0017 __be32 data_version_lo;
0018 __be32 author;
0019 __be32 owner;
0020 __be32 caller_access;
0021 __be32 anon_access;
0022 __be32 mode;
0023 __be32 parent_vnode;
0024 __be32 parent_unique;
0025 __be32 seg_size;
0026 __be32 mtime_client;
0027 __be32 mtime_server;
0028 __be32 group;
0029 __be32 sync_counter;
0030 __be32 data_version_hi;
0031 __be32 lock_count;
0032 __be32 size_hi;
0033 __be32 abort_code;
0034 } __packed;
0035
0036 #define AFS_DIR_HASHTBL_SIZE 128
0037 #define AFS_DIR_DIRENT_SIZE 32
0038 #define AFS_DIR_SLOTS_PER_BLOCK 64
0039 #define AFS_DIR_BLOCK_SIZE 2048
0040 #define AFS_DIR_BLOCKS_PER_PAGE (PAGE_SIZE / AFS_DIR_BLOCK_SIZE)
0041 #define AFS_DIR_MAX_SLOTS 65536
0042 #define AFS_DIR_BLOCKS_WITH_CTR 128
0043 #define AFS_DIR_MAX_BLOCKS 1023
0044 #define AFS_DIR_RESV_BLOCKS 1
0045 #define AFS_DIR_RESV_BLOCKS0 13
0046
0047
0048
0049
0050 union afs_xdr_dirent {
0051 struct {
0052 u8 valid;
0053 u8 unused[1];
0054 __be16 hash_next;
0055 __be32 vnode;
0056 __be32 unique;
0057 u8 name[];
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067 } u;
0068 u8 extended_name[32];
0069 } __packed;
0070
0071
0072
0073
0074 struct afs_xdr_dir_hdr {
0075 __be16 npages;
0076 __be16 magic;
0077 #define AFS_DIR_MAGIC htons(1234)
0078 u8 reserved;
0079 u8 bitmap[8];
0080 u8 pad[19];
0081 } __packed;
0082
0083
0084
0085
0086 union afs_xdr_dir_block {
0087 struct afs_xdr_dir_hdr hdr;
0088
0089 struct {
0090 struct afs_xdr_dir_hdr hdr;
0091 u8 alloc_ctrs[AFS_DIR_MAX_BLOCKS];
0092 __be16 hashtable[AFS_DIR_HASHTBL_SIZE];
0093 } meta;
0094
0095 union afs_xdr_dirent dirents[AFS_DIR_SLOTS_PER_BLOCK];
0096 } __packed;
0097
0098
0099
0100
0101 struct afs_xdr_dir_page {
0102 union afs_xdr_dir_block blocks[AFS_DIR_BLOCKS_PER_PAGE];
0103 };
0104
0105
0106
0107
0108
0109
0110 static inline unsigned int afs_dir_calc_slots(size_t name_len)
0111 {
0112 name_len++;
0113 return 1 + ((name_len + 15) / AFS_DIR_DIRENT_SIZE);
0114 }
0115
0116 #endif