xdr_fs.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /* AFS fileserver XDR types
  2. *
  3. * Copyright (C) 2018 Red Hat, Inc. All Rights Reserved.
  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 Licence
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the Licence, or (at your option) any later version.
  10. */
  11. #ifndef XDR_FS_H
  12. #define XDR_FS_H
  13. struct afs_xdr_AFSFetchStatus {
  14. __be32 if_version;
  15. #define AFS_FSTATUS_VERSION 1
  16. __be32 type;
  17. __be32 nlink;
  18. __be32 size_lo;
  19. __be32 data_version_lo;
  20. __be32 author;
  21. __be32 owner;
  22. __be32 caller_access;
  23. __be32 anon_access;
  24. __be32 mode;
  25. __be32 parent_vnode;
  26. __be32 parent_unique;
  27. __be32 seg_size;
  28. __be32 mtime_client;
  29. __be32 mtime_server;
  30. __be32 group;
  31. __be32 sync_counter;
  32. __be32 data_version_hi;
  33. __be32 lock_count;
  34. __be32 size_hi;
  35. __be32 abort_code;
  36. } __packed;
  37. #define AFS_DIR_HASHTBL_SIZE 128
  38. #define AFS_DIR_DIRENT_SIZE 32
  39. #define AFS_DIR_SLOTS_PER_BLOCK 64
  40. #define AFS_DIR_BLOCK_SIZE 2048
  41. #define AFS_DIR_BLOCKS_PER_PAGE (PAGE_SIZE / AFS_DIR_BLOCK_SIZE)
  42. #define AFS_DIR_MAX_SLOTS 65536
  43. #define AFS_DIR_BLOCKS_WITH_CTR 128
  44. #define AFS_DIR_MAX_BLOCKS 1023
  45. #define AFS_DIR_RESV_BLOCKS 1
  46. #define AFS_DIR_RESV_BLOCKS0 13
  47. /*
  48. * Directory entry structure.
  49. */
  50. union afs_xdr_dirent {
  51. struct {
  52. u8 valid;
  53. u8 unused[1];
  54. __be16 hash_next;
  55. __be32 vnode;
  56. __be32 unique;
  57. u8 name[16];
  58. u8 overflow[4]; /* if any char of the name (inc
  59. * NUL) reaches here, consume
  60. * the next dirent too */
  61. } u;
  62. u8 extended_name[32];
  63. } __packed;
  64. /*
  65. * Directory block header (one at the beginning of every 2048-byte block).
  66. */
  67. struct afs_xdr_dir_hdr {
  68. __be16 npages;
  69. __be16 magic;
  70. #define AFS_DIR_MAGIC htons(1234)
  71. u8 reserved;
  72. u8 bitmap[8];
  73. u8 pad[19];
  74. } __packed;
  75. /*
  76. * Directory block layout
  77. */
  78. union afs_xdr_dir_block {
  79. struct afs_xdr_dir_hdr hdr;
  80. struct {
  81. struct afs_xdr_dir_hdr hdr;
  82. u8 alloc_ctrs[AFS_DIR_MAX_BLOCKS];
  83. __be16 hashtable[AFS_DIR_HASHTBL_SIZE];
  84. } meta;
  85. union afs_xdr_dirent dirents[AFS_DIR_SLOTS_PER_BLOCK];
  86. } __packed;
  87. /*
  88. * Directory layout on a linux VM page.
  89. */
  90. struct afs_xdr_dir_page {
  91. union afs_xdr_dir_block blocks[AFS_DIR_BLOCKS_PER_PAGE];
  92. };
  93. #endif /* XDR_FS_H */