afs.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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. typedef unsigned afs_volid_t;
  17. typedef unsigned afs_vnodeid_t;
  18. typedef unsigned long long afs_dataversion_t;
  19. typedef enum {
  20. AFSVL_RWVOL, /* read/write volume */
  21. AFSVL_ROVOL, /* read-only volume */
  22. AFSVL_BACKVOL, /* backup volume */
  23. } __attribute__((packed)) afs_voltype_t;
  24. typedef enum {
  25. AFS_FTYPE_INVALID = 0,
  26. AFS_FTYPE_FILE = 1,
  27. AFS_FTYPE_DIR = 2,
  28. AFS_FTYPE_SYMLINK = 3,
  29. } afs_file_type_t;
  30. /*
  31. * AFS file identifier
  32. */
  33. struct afs_fid {
  34. afs_volid_t vid; /* volume ID */
  35. afs_vnodeid_t vnode; /* file index within volume */
  36. unsigned unique; /* unique ID number (file index version) */
  37. };
  38. /*
  39. * AFS callback notification
  40. */
  41. typedef enum {
  42. AFSCM_CB_UNTYPED = 0, /* no type set on CB break */
  43. AFSCM_CB_EXCLUSIVE = 1, /* CB exclusive to CM [not implemented] */
  44. AFSCM_CB_SHARED = 2, /* CB shared by other CM's */
  45. AFSCM_CB_DROPPED = 3, /* CB promise cancelled by file server */
  46. } afs_callback_type_t;
  47. struct afs_callback {
  48. struct afs_fid fid; /* file identifier */
  49. unsigned version; /* callback version */
  50. unsigned expiry; /* time at which expires */
  51. afs_callback_type_t type; /* type of callback */
  52. };
  53. #define AFSCBMAX 50 /* maximum callbacks transferred per bulk op */
  54. /*
  55. * AFS volume information
  56. */
  57. struct afs_volume_info {
  58. afs_volid_t vid; /* volume ID */
  59. afs_voltype_t type; /* type of this volume */
  60. afs_volid_t type_vids[5]; /* volume ID's for possible types for this vol */
  61. /* list of fileservers serving this volume */
  62. size_t nservers; /* number of entries used in servers[] */
  63. struct {
  64. struct in_addr addr; /* fileserver address */
  65. } servers[8];
  66. };
  67. /*
  68. * AFS security ACE access mask
  69. */
  70. typedef u32 afs_access_t;
  71. #define AFS_ACE_READ 0x00000001U /* - permission to read a file/dir */
  72. #define AFS_ACE_WRITE 0x00000002U /* - permission to write/chmod a file */
  73. #define AFS_ACE_INSERT 0x00000004U /* - permission to create dirent in a dir */
  74. #define AFS_ACE_LOOKUP 0x00000008U /* - permission to lookup a file/dir in a dir */
  75. #define AFS_ACE_DELETE 0x00000010U /* - permission to delete a dirent from a dir */
  76. #define AFS_ACE_LOCK 0x00000020U /* - permission to lock a file */
  77. #define AFS_ACE_ADMINISTER 0x00000040U /* - permission to change ACL */
  78. #define AFS_ACE_USER_A 0x01000000U /* - 'A' user-defined permission */
  79. #define AFS_ACE_USER_B 0x02000000U /* - 'B' user-defined permission */
  80. #define AFS_ACE_USER_C 0x04000000U /* - 'C' user-defined permission */
  81. #define AFS_ACE_USER_D 0x08000000U /* - 'D' user-defined permission */
  82. #define AFS_ACE_USER_E 0x10000000U /* - 'E' user-defined permission */
  83. #define AFS_ACE_USER_F 0x20000000U /* - 'F' user-defined permission */
  84. #define AFS_ACE_USER_G 0x40000000U /* - 'G' user-defined permission */
  85. #define AFS_ACE_USER_H 0x80000000U /* - 'H' user-defined permission */
  86. /*
  87. * AFS file status information
  88. */
  89. struct afs_file_status {
  90. unsigned if_version; /* interface version */
  91. #define AFS_FSTATUS_VERSION 1
  92. afs_file_type_t type; /* file type */
  93. unsigned nlink; /* link count */
  94. u64 size; /* file size */
  95. afs_dataversion_t data_version; /* current data version */
  96. u32 author; /* author ID */
  97. u32 owner; /* owner ID */
  98. u32 group; /* group ID */
  99. afs_access_t caller_access; /* access rights for authenticated caller */
  100. afs_access_t anon_access; /* access rights for unauthenticated caller */
  101. umode_t mode; /* UNIX mode */
  102. struct afs_fid parent; /* parent dir ID for non-dirs only */
  103. time_t mtime_client; /* last time client changed data */
  104. time_t mtime_server; /* last time server changed data */
  105. };
  106. /*
  107. * AFS file status change request
  108. */
  109. struct afs_store_status {
  110. u32 mask; /* which bits of the struct are set */
  111. u32 mtime_client; /* last time client changed data */
  112. u32 owner; /* owner ID */
  113. u32 group; /* group ID */
  114. umode_t mode; /* UNIX mode */
  115. };
  116. #define AFS_SET_MTIME 0x01 /* set the mtime */
  117. #define AFS_SET_OWNER 0x02 /* set the owner ID */
  118. #define AFS_SET_GROUP 0x04 /* set the group ID (unsupported?) */
  119. #define AFS_SET_MODE 0x08 /* set the UNIX mode */
  120. #define AFS_SET_SEG_SIZE 0x10 /* set the segment size (unsupported) */
  121. /*
  122. * AFS volume synchronisation information
  123. */
  124. struct afs_volsync {
  125. time_t creation; /* volume creation time */
  126. };
  127. #endif /* AFS_H */