types.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /* types.h: AFS types
  2. *
  3. * Copyright (C) 2002 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 _LINUX_AFS_TYPES_H
  12. #define _LINUX_AFS_TYPES_H
  13. #ifdef __KERNEL__
  14. #include <rxrpc/types.h>
  15. #endif /* __KERNEL__ */
  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. #ifdef __KERNEL__
  31. struct afs_cell;
  32. struct afs_vnode;
  33. /*****************************************************************************/
  34. /*
  35. * AFS file identifier
  36. */
  37. struct afs_fid
  38. {
  39. afs_volid_t vid; /* volume ID */
  40. afs_vnodeid_t vnode; /* file index within volume */
  41. unsigned unique; /* unique ID number (file index version) */
  42. };
  43. /*****************************************************************************/
  44. /*
  45. * AFS callback notification
  46. */
  47. typedef enum {
  48. AFSCM_CB_UNTYPED = 0, /* no type set on CB break */
  49. AFSCM_CB_EXCLUSIVE = 1, /* CB exclusive to CM [not implemented] */
  50. AFSCM_CB_SHARED = 2, /* CB shared by other CM's */
  51. AFSCM_CB_DROPPED = 3, /* CB promise cancelled by file server */
  52. } afs_callback_type_t;
  53. struct afs_callback
  54. {
  55. struct afs_server *server; /* server that made the promise */
  56. struct afs_fid fid; /* file identifier */
  57. unsigned version; /* callback version */
  58. unsigned expiry; /* time at which expires */
  59. afs_callback_type_t type; /* type of callback */
  60. };
  61. #define AFSCBMAX 50
  62. /*****************************************************************************/
  63. /*
  64. * AFS volume information
  65. */
  66. struct afs_volume_info
  67. {
  68. afs_volid_t vid; /* volume ID */
  69. afs_voltype_t type; /* type of this volume */
  70. afs_volid_t type_vids[5]; /* volume ID's for possible types for this vol */
  71. /* list of fileservers serving this volume */
  72. size_t nservers; /* number of entries used in servers[] */
  73. struct {
  74. struct in_addr addr; /* fileserver address */
  75. } servers[8];
  76. };
  77. /*****************************************************************************/
  78. /*
  79. * AFS file status information
  80. */
  81. struct afs_file_status
  82. {
  83. unsigned if_version; /* interface version */
  84. #define AFS_FSTATUS_VERSION 1
  85. afs_file_type_t type; /* file type */
  86. unsigned nlink; /* link count */
  87. size_t size; /* file size */
  88. afs_dataversion_t version; /* current data version */
  89. unsigned author; /* author ID */
  90. unsigned owner; /* owner ID */
  91. unsigned caller_access; /* access rights for authenticated caller */
  92. unsigned anon_access; /* access rights for unauthenticated caller */
  93. umode_t mode; /* UNIX mode */
  94. struct afs_fid parent; /* parent file ID */
  95. time_t mtime_client; /* last time client changed data */
  96. time_t mtime_server; /* last time server changed data */
  97. };
  98. /*****************************************************************************/
  99. /*
  100. * AFS volume synchronisation information
  101. */
  102. struct afs_volsync
  103. {
  104. time_t creation; /* volume creation time */
  105. };
  106. #endif /* __KERNEL__ */
  107. #endif /* _LINUX_AFS_TYPES_H */