vlclient.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /* vlclient.h: Volume Location Service client interface
  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_VLCLIENT_H
  12. #define _LINUX_AFS_VLCLIENT_H
  13. #include "types.h"
  14. enum AFSVL_Errors {
  15. AFSVL_IDEXIST = 363520, /* Volume Id entry exists in vl database */
  16. AFSVL_IO = 363521, /* I/O related error */
  17. AFSVL_NAMEEXIST = 363522, /* Volume name entry exists in vl database */
  18. AFSVL_CREATEFAIL = 363523, /* Internal creation failure */
  19. AFSVL_NOENT = 363524, /* No such entry */
  20. AFSVL_EMPTY = 363525, /* Vl database is empty */
  21. AFSVL_ENTDELETED = 363526, /* Entry is deleted (soft delete) */
  22. AFSVL_BADNAME = 363527, /* Volume name is illegal */
  23. AFSVL_BADINDEX = 363528, /* Index is out of range */
  24. AFSVL_BADVOLTYPE = 363529, /* Bad volume type */
  25. AFSVL_BADSERVER = 363530, /* Illegal server number (out of range) */
  26. AFSVL_BADPARTITION = 363531, /* Bad partition number */
  27. AFSVL_REPSFULL = 363532, /* Run out of space for Replication sites */
  28. AFSVL_NOREPSERVER = 363533, /* No such Replication server site exists */
  29. AFSVL_DUPREPSERVER = 363534, /* Replication site already exists */
  30. AFSVL_RWNOTFOUND = 363535, /* Parent R/W entry not found */
  31. AFSVL_BADREFCOUNT = 363536, /* Illegal Reference Count number */
  32. AFSVL_SIZEEXCEEDED = 363537, /* Vl size for attributes exceeded */
  33. AFSVL_BADENTRY = 363538, /* Bad incoming vl entry */
  34. AFSVL_BADVOLIDBUMP = 363539, /* Illegal max volid increment */
  35. AFSVL_IDALREADYHASHED = 363540, /* RO/BACK id already hashed */
  36. AFSVL_ENTRYLOCKED = 363541, /* Vl entry is already locked */
  37. AFSVL_BADVOLOPER = 363542, /* Bad volume operation code */
  38. AFSVL_BADRELLOCKTYPE = 363543, /* Bad release lock type */
  39. AFSVL_RERELEASE = 363544, /* Status report: last release was aborted */
  40. AFSVL_BADSERVERFLAG = 363545, /* Invalid replication site server °ag */
  41. AFSVL_PERM = 363546, /* No permission access */
  42. AFSVL_NOMEM = 363547, /* malloc/realloc failed to alloc enough memory */
  43. };
  44. /* maps to "struct vldbentry" in vvl-spec.pdf */
  45. struct afs_vldbentry {
  46. char name[65]; /* name of volume (including NUL char) */
  47. afs_voltype_t type; /* volume type */
  48. unsigned num_servers; /* num servers that hold instances of this vol */
  49. unsigned clone_id; /* cloning ID */
  50. unsigned flags;
  51. #define AFS_VLF_RWEXISTS 0x1000 /* R/W volume exists */
  52. #define AFS_VLF_ROEXISTS 0x2000 /* R/O volume exists */
  53. #define AFS_VLF_BACKEXISTS 0x4000 /* backup volume exists */
  54. afs_volid_t volume_ids[3]; /* volume IDs */
  55. struct {
  56. struct in_addr addr; /* server address */
  57. unsigned partition; /* partition ID on this server */
  58. unsigned flags; /* server specific flags */
  59. #define AFS_VLSF_NEWREPSITE 0x0001 /* unused */
  60. #define AFS_VLSF_ROVOL 0x0002 /* this server holds a R/O instance of the volume */
  61. #define AFS_VLSF_RWVOL 0x0004 /* this server holds a R/W instance of the volume */
  62. #define AFS_VLSF_BACKVOL 0x0008 /* this server holds a backup instance of the volume */
  63. } servers[8];
  64. };
  65. /* look up a volume location database entry by name */
  66. extern int afs_rxvl_get_entry_by_name(struct afs_server *server,
  67. const char *volname,
  68. unsigned volnamesz,
  69. struct afs_cache_vlocation *entry);
  70. /* look up a volume location database entry by ID */
  71. extern int afs_rxvl_get_entry_by_id(struct afs_server *server,
  72. afs_volid_t volid,
  73. afs_voltype_t voltype,
  74. struct afs_cache_vlocation *entry);
  75. extern int afs_rxvl_get_entry_by_id_async(struct afs_async_op *op,
  76. afs_volid_t volid,
  77. afs_voltype_t voltype);
  78. extern int afs_rxvl_get_entry_by_id_async2(struct afs_async_op *op,
  79. struct afs_cache_vlocation *entry);
  80. #endif /* _LINUX_AFS_VLCLIENT_H */