afs.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. typedef unsigned afs_volid_t;
  15. typedef unsigned afs_vnodeid_t;
  16. typedef unsigned long long afs_dataversion_t;
  17. typedef enum {
  18. AFSVL_RWVOL, /* read/write volume */
  19. AFSVL_ROVOL, /* read-only volume */
  20. AFSVL_BACKVOL, /* backup volume */
  21. } __attribute__((packed)) afs_voltype_t;
  22. typedef enum {
  23. AFS_FTYPE_INVALID = 0,
  24. AFS_FTYPE_FILE = 1,
  25. AFS_FTYPE_DIR = 2,
  26. AFS_FTYPE_SYMLINK = 3,
  27. } afs_file_type_t;
  28. /*
  29. * AFS file identifier
  30. */
  31. struct afs_fid {
  32. afs_volid_t vid; /* volume ID */
  33. afs_vnodeid_t vnode; /* file index within volume */
  34. unsigned unique; /* unique ID number (file index version) */
  35. };
  36. /*
  37. * AFS callback notification
  38. */
  39. typedef enum {
  40. AFSCM_CB_UNTYPED = 0, /* no type set on CB break */
  41. AFSCM_CB_EXCLUSIVE = 1, /* CB exclusive to CM [not implemented] */
  42. AFSCM_CB_SHARED = 2, /* CB shared by other CM's */
  43. AFSCM_CB_DROPPED = 3, /* CB promise cancelled by file server */
  44. } afs_callback_type_t;
  45. struct afs_callback {
  46. struct afs_fid fid; /* file identifier */
  47. unsigned version; /* callback version */
  48. unsigned expiry; /* time at which expires */
  49. afs_callback_type_t type; /* type of callback */
  50. };
  51. #define AFSCBMAX 50 /* maximum callbacks transferred per bulk op */
  52. /*
  53. * AFS volume information
  54. */
  55. struct afs_volume_info {
  56. afs_volid_t vid; /* volume ID */
  57. afs_voltype_t type; /* type of this volume */
  58. afs_volid_t type_vids[5]; /* volume ID's for possible types for this vol */
  59. /* list of fileservers serving this volume */
  60. size_t nservers; /* number of entries used in servers[] */
  61. struct {
  62. struct in_addr addr; /* fileserver address */
  63. } servers[8];
  64. };
  65. /*
  66. * AFS file status information
  67. */
  68. struct afs_file_status {
  69. unsigned if_version; /* interface version */
  70. #define AFS_FSTATUS_VERSION 1
  71. afs_file_type_t type; /* file type */
  72. unsigned nlink; /* link count */
  73. size_t size; /* file size */
  74. afs_dataversion_t data_version; /* current data version */
  75. unsigned author; /* author ID */
  76. unsigned owner; /* owner ID */
  77. unsigned caller_access; /* access rights for authenticated caller */
  78. unsigned anon_access; /* access rights for unauthenticated caller */
  79. umode_t mode; /* UNIX mode */
  80. struct afs_fid parent; /* parent file ID */
  81. time_t mtime_client; /* last time client changed data */
  82. time_t mtime_server; /* last time server changed data */
  83. };
  84. /*
  85. * AFS volume synchronisation information
  86. */
  87. struct afs_volsync {
  88. time_t creation; /* volume creation time */
  89. };
  90. #endif /* AFS_H */