afs.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /* AFS common types
  2. *
  3. * Copyright (C) 2002, 2007 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 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. #ifndef AFS_H
  12. #define AFS_H
  13. #include <linux/in.h>
  14. #define AFS_MAXCELLNAME 64 /* maximum length of a cell name */
  15. #define AFS_MAXVOLNAME 64 /* maximum length of a volume name */
  16. #define AFSNAMEMAX 256 /* maximum length of a filename plus NUL */
  17. #define AFSPATHMAX 1024 /* maximum length of a pathname plus NUL */
  18. #define AFSOPAQUEMAX 1024 /* maximum length of an opaque field */
  19. typedef unsigned afs_volid_t;
  20. typedef unsigned afs_vnodeid_t;
  21. typedef unsigned long long afs_dataversion_t;
  22. typedef enum {
  23. AFSVL_RWVOL, /* read/write volume */
  24. AFSVL_ROVOL, /* read-only volume */
  25. AFSVL_BACKVOL, /* backup volume */
  26. } __attribute__((packed)) afs_voltype_t;
  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. /*
  34. * AFS file identifier
  35. */
  36. struct afs_fid {
  37. afs_volid_t vid; /* volume ID */
  38. afs_vnodeid_t vnode; /* file index within volume */
  39. unsigned unique; /* unique ID number (file index version) */
  40. };
  41. /*
  42. * AFS callback notification
  43. */
  44. typedef enum {
  45. AFSCM_CB_UNTYPED = 0, /* no type set on CB break */
  46. AFSCM_CB_EXCLUSIVE = 1, /* CB exclusive to CM [not implemented] */
  47. AFSCM_CB_SHARED = 2, /* CB shared by other CM's */
  48. AFSCM_CB_DROPPED = 3, /* CB promise cancelled by file server */
  49. } afs_callback_type_t;
  50. struct afs_callback {
  51. struct afs_fid fid; /* file identifier */
  52. unsigned version; /* callback version */
  53. unsigned expiry; /* time at which expires */
  54. afs_callback_type_t type; /* type of callback */
  55. };
  56. #define AFSCBMAX 50 /* maximum callbacks transferred per bulk op */
  57. /*
  58. * AFS volume information
  59. */
  60. struct afs_volume_info {
  61. afs_volid_t vid; /* volume ID */
  62. afs_voltype_t type; /* type of this volume */
  63. afs_volid_t type_vids[5]; /* volume ID's for possible types for this vol */
  64. /* list of fileservers serving this volume */
  65. size_t nservers; /* number of entries used in servers[] */
  66. struct {
  67. struct in_addr addr; /* fileserver address */
  68. } servers[8];
  69. };
  70. /*
  71. * AFS security ACE access mask
  72. */
  73. typedef u32 afs_access_t;
  74. #define AFS_ACE_READ 0x00000001U /* - permission to read a file/dir */
  75. #define AFS_ACE_WRITE 0x00000002U /* - permission to write/chmod a file */
  76. #define AFS_ACE_INSERT 0x00000004U /* - permission to create dirent in a dir */
  77. #define AFS_ACE_LOOKUP 0x00000008U /* - permission to lookup a file/dir in a dir */
  78. #define AFS_ACE_DELETE 0x00000010U /* - permission to delete a dirent from a dir */
  79. #define AFS_ACE_LOCK 0x00000020U /* - permission to lock a file */
  80. #define AFS_ACE_ADMINISTER 0x00000040U /* - permission to change ACL */
  81. #define AFS_ACE_USER_A 0x01000000U /* - 'A' user-defined permission */
  82. #define AFS_ACE_USER_B 0x02000000U /* - 'B' user-defined permission */
  83. #define AFS_ACE_USER_C 0x04000000U /* - 'C' user-defined permission */
  84. #define AFS_ACE_USER_D 0x08000000U /* - 'D' user-defined permission */
  85. #define AFS_ACE_USER_E 0x10000000U /* - 'E' user-defined permission */
  86. #define AFS_ACE_USER_F 0x20000000U /* - 'F' user-defined permission */
  87. #define AFS_ACE_USER_G 0x40000000U /* - 'G' user-defined permission */
  88. #define AFS_ACE_USER_H 0x80000000U /* - 'H' user-defined permission */
  89. /*
  90. * AFS file status information
  91. */
  92. struct afs_file_status {
  93. unsigned if_version; /* interface version */
  94. #define AFS_FSTATUS_VERSION 1
  95. afs_file_type_t type; /* file type */
  96. unsigned nlink; /* link count */
  97. u64 size; /* file size */
  98. afs_dataversion_t data_version; /* current data version */
  99. u32 author; /* author ID */
  100. u32 owner; /* owner ID */
  101. u32 group; /* group ID */
  102. afs_access_t caller_access; /* access rights for authenticated caller */
  103. afs_access_t anon_access; /* access rights for unauthenticated caller */
  104. umode_t mode; /* UNIX mode */
  105. struct afs_fid parent; /* parent dir ID for non-dirs only */
  106. time_t mtime_client; /* last time client changed data */
  107. time_t mtime_server; /* last time server changed data */
  108. };
  109. /*
  110. * AFS file status change request
  111. */
  112. struct afs_store_status {
  113. u32 mask; /* which bits of the struct are set */
  114. u32 mtime_client; /* last time client changed data */
  115. u32 owner; /* owner ID */
  116. u32 group; /* group ID */
  117. umode_t mode; /* UNIX mode */
  118. };
  119. #define AFS_SET_MTIME 0x01 /* set the mtime */
  120. #define AFS_SET_OWNER 0x02 /* set the owner ID */
  121. #define AFS_SET_GROUP 0x04 /* set the group ID (unsupported?) */
  122. #define AFS_SET_MODE 0x08 /* set the UNIX mode */
  123. #define AFS_SET_SEG_SIZE 0x10 /* set the segment size (unsupported) */
  124. /*
  125. * AFS volume synchronisation information
  126. */
  127. struct afs_volsync {
  128. time_t creation; /* volume creation time */
  129. };
  130. /*
  131. * AFS volume status record
  132. */
  133. struct afs_volume_status {
  134. u32 vid; /* volume ID */
  135. u32 parent_id; /* parent volume ID */
  136. u8 online; /* true if volume currently online and available */
  137. u8 in_service; /* true if volume currently in service */
  138. u8 blessed; /* same as in_service */
  139. u8 needs_salvage; /* true if consistency checking required */
  140. u32 type; /* volume type (afs_voltype_t) */
  141. u32 min_quota; /* minimum space set aside (blocks) */
  142. u32 max_quota; /* maximum space this volume may occupy (blocks) */
  143. u32 blocks_in_use; /* space this volume currently occupies (blocks) */
  144. u32 part_blocks_avail; /* space available in volume's partition */
  145. u32 part_max_blocks; /* size of volume's partition */
  146. };
  147. #define AFS_BLOCK_SIZE 1024
  148. #endif /* AFS_H */