afs_vl.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /* AFS Volume Location Service client interface
  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_VL_H
  12. #define AFS_VL_H
  13. #include "afs.h"
  14. #define AFS_VL_PORT 7003 /* volume location service port */
  15. #define VL_SERVICE 52 /* RxRPC service ID for the Volume Location service */
  16. #define YFS_VL_SERVICE 2503 /* Service ID for AuriStor upgraded VL service */
  17. enum AFSVL_Operations {
  18. VLGETENTRYBYID = 503, /* AFS Get VLDB entry by ID */
  19. VLGETENTRYBYNAME = 504, /* AFS Get VLDB entry by name */
  20. VLPROBE = 514, /* AFS probe VL service */
  21. VLGETENTRYBYIDU = 526, /* AFS Get VLDB entry by ID (UUID-variant) */
  22. VLGETENTRYBYNAMEU = 527, /* AFS Get VLDB entry by name (UUID-variant) */
  23. VLGETADDRSU = 533, /* AFS Get addrs for fileserver */
  24. YVLGETENDPOINTS = 64002, /* YFS Get endpoints for file/volume server */
  25. VLGETCAPABILITIES = 65537, /* AFS Get server capabilities */
  26. };
  27. enum AFSVL_Errors {
  28. AFSVL_IDEXIST = 363520, /* Volume Id entry exists in vl database */
  29. AFSVL_IO = 363521, /* I/O related error */
  30. AFSVL_NAMEEXIST = 363522, /* Volume name entry exists in vl database */
  31. AFSVL_CREATEFAIL = 363523, /* Internal creation failure */
  32. AFSVL_NOENT = 363524, /* No such entry */
  33. AFSVL_EMPTY = 363525, /* Vl database is empty */
  34. AFSVL_ENTDELETED = 363526, /* Entry is deleted (soft delete) */
  35. AFSVL_BADNAME = 363527, /* Volume name is illegal */
  36. AFSVL_BADINDEX = 363528, /* Index is out of range */
  37. AFSVL_BADVOLTYPE = 363529, /* Bad volume type */
  38. AFSVL_BADSERVER = 363530, /* Illegal server number (out of range) */
  39. AFSVL_BADPARTITION = 363531, /* Bad partition number */
  40. AFSVL_REPSFULL = 363532, /* Run out of space for Replication sites */
  41. AFSVL_NOREPSERVER = 363533, /* No such Replication server site exists */
  42. AFSVL_DUPREPSERVER = 363534, /* Replication site already exists */
  43. AFSVL_RWNOTFOUND = 363535, /* Parent R/W entry not found */
  44. AFSVL_BADREFCOUNT = 363536, /* Illegal Reference Count number */
  45. AFSVL_SIZEEXCEEDED = 363537, /* Vl size for attributes exceeded */
  46. AFSVL_BADENTRY = 363538, /* Bad incoming vl entry */
  47. AFSVL_BADVOLIDBUMP = 363539, /* Illegal max volid increment */
  48. AFSVL_IDALREADYHASHED = 363540, /* RO/BACK id already hashed */
  49. AFSVL_ENTRYLOCKED = 363541, /* Vl entry is already locked */
  50. AFSVL_BADVOLOPER = 363542, /* Bad volume operation code */
  51. AFSVL_BADRELLOCKTYPE = 363543, /* Bad release lock type */
  52. AFSVL_RERELEASE = 363544, /* Status report: last release was aborted */
  53. AFSVL_BADSERVERFLAG = 363545, /* Invalid replication site server flag */
  54. AFSVL_PERM = 363546, /* No permission access */
  55. AFSVL_NOMEM = 363547, /* malloc/realloc failed to alloc enough memory */
  56. };
  57. enum {
  58. YFS_SERVER_INDEX = 0,
  59. YFS_SERVER_UUID = 1,
  60. YFS_SERVER_ENDPOINT = 2,
  61. };
  62. enum {
  63. YFS_ENDPOINT_IPV4 = 0,
  64. YFS_ENDPOINT_IPV6 = 1,
  65. };
  66. #define YFS_MAXENDPOINTS 16
  67. /*
  68. * maps to "struct vldbentry" in vvl-spec.pdf
  69. */
  70. struct afs_vldbentry {
  71. char name[65]; /* name of volume (with NUL char) */
  72. afs_voltype_t type; /* volume type */
  73. unsigned num_servers; /* num servers that hold instances of this vol */
  74. unsigned clone_id; /* cloning ID */
  75. unsigned flags;
  76. #define AFS_VLF_RWEXISTS 0x1000 /* R/W volume exists */
  77. #define AFS_VLF_ROEXISTS 0x2000 /* R/O volume exists */
  78. #define AFS_VLF_BACKEXISTS 0x4000 /* backup volume exists */
  79. afs_volid_t volume_ids[3]; /* volume IDs */
  80. struct {
  81. struct in_addr addr; /* server address */
  82. unsigned partition; /* partition ID on this server */
  83. unsigned flags; /* server specific flags */
  84. #define AFS_VLSF_NEWREPSITE 0x0001 /* Ignore all 'non-new' servers */
  85. #define AFS_VLSF_ROVOL 0x0002 /* this server holds a R/O instance of the volume */
  86. #define AFS_VLSF_RWVOL 0x0004 /* this server holds a R/W instance of the volume */
  87. #define AFS_VLSF_BACKVOL 0x0008 /* this server holds a backup instance of the volume */
  88. #define AFS_VLSF_UUID 0x0010 /* This server is referred to by its UUID */
  89. #define AFS_VLSF_DONTUSE 0x0020 /* This server ref should be ignored */
  90. } servers[8];
  91. };
  92. #define AFS_VLDB_MAXNAMELEN 65
  93. struct afs_ListAddrByAttributes__xdr {
  94. __be32 Mask;
  95. #define AFS_VLADDR_IPADDR 0x1 /* Match by ->ipaddr */
  96. #define AFS_VLADDR_INDEX 0x2 /* Match by ->index */
  97. #define AFS_VLADDR_UUID 0x4 /* Match by ->uuid */
  98. __be32 ipaddr;
  99. __be32 index;
  100. __be32 spare;
  101. struct afs_uuid__xdr uuid;
  102. };
  103. struct afs_uvldbentry__xdr {
  104. __be32 name[AFS_VLDB_MAXNAMELEN];
  105. __be32 nServers;
  106. struct afs_uuid__xdr serverNumber[AFS_NMAXNSERVERS];
  107. __be32 serverUnique[AFS_NMAXNSERVERS];
  108. __be32 serverPartition[AFS_NMAXNSERVERS];
  109. __be32 serverFlags[AFS_NMAXNSERVERS];
  110. __be32 volumeId[AFS_MAXTYPES];
  111. __be32 cloneId;
  112. __be32 flags;
  113. __be32 spares1;
  114. __be32 spares2;
  115. __be32 spares3;
  116. __be32 spares4;
  117. __be32 spares5;
  118. __be32 spares6;
  119. __be32 spares7;
  120. __be32 spares8;
  121. __be32 spares9;
  122. };
  123. struct afs_address_list {
  124. refcount_t usage;
  125. unsigned int version;
  126. unsigned int nr_addrs;
  127. struct sockaddr_rxrpc addrs[];
  128. };
  129. extern void afs_put_address_list(struct afs_address_list *alist);
  130. #endif /* AFS_VL_H */