/* SPDX-License-Identifier: GPL-2.0-or-later */1/* AFS Volume Location Service client interface2*3* Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved.4* Written by David Howells ([email protected])5*/67#ifndef AFS_VL_H8#define AFS_VL_H910#include "afs.h"1112#define AFS_VL_PORT 7003 /* volume location service port */13#define VL_SERVICE 52 /* RxRPC service ID for the Volume Location service */14#define YFS_VL_SERVICE 2503 /* Service ID for AuriStor upgraded VL service */15#define YFS_VL_MAXCELLNAME 256 /* Maximum length of a cell name in YFS protocol */1617enum AFSVL_Operations {18VLGETENTRYBYID = 503, /* AFS Get VLDB entry by ID */19VLGETENTRYBYNAME = 504, /* AFS Get VLDB entry by name */20VLPROBE = 514, /* AFS probe VL service */21VLGETENTRYBYIDU = 526, /* AFS Get VLDB entry by ID (UUID-variant) */22VLGETENTRYBYNAMEU = 527, /* AFS Get VLDB entry by name (UUID-variant) */23VLGETADDRSU = 533, /* AFS Get addrs for fileserver */24YVLGETENDPOINTS = 64002, /* YFS Get endpoints for file/volume server */25YVLGETCELLNAME = 64014, /* YFS Get actual cell name */26VLGETCAPABILITIES = 65537, /* AFS Get server capabilities */27};2829enum AFSVL_Errors {30AFSVL_IDEXIST = 363520, /* Volume Id entry exists in vl database */31AFSVL_IO = 363521, /* I/O related error */32AFSVL_NAMEEXIST = 363522, /* Volume name entry exists in vl database */33AFSVL_CREATEFAIL = 363523, /* Internal creation failure */34AFSVL_NOENT = 363524, /* No such entry */35AFSVL_EMPTY = 363525, /* Vl database is empty */36AFSVL_ENTDELETED = 363526, /* Entry is deleted (soft delete) */37AFSVL_BADNAME = 363527, /* Volume name is illegal */38AFSVL_BADINDEX = 363528, /* Index is out of range */39AFSVL_BADVOLTYPE = 363529, /* Bad volume type */40AFSVL_BADSERVER = 363530, /* Illegal server number (out of range) */41AFSVL_BADPARTITION = 363531, /* Bad partition number */42AFSVL_REPSFULL = 363532, /* Run out of space for Replication sites */43AFSVL_NOREPSERVER = 363533, /* No such Replication server site exists */44AFSVL_DUPREPSERVER = 363534, /* Replication site already exists */45AFSVL_RWNOTFOUND = 363535, /* Parent R/W entry not found */46AFSVL_BADREFCOUNT = 363536, /* Illegal Reference Count number */47AFSVL_SIZEEXCEEDED = 363537, /* Vl size for attributes exceeded */48AFSVL_BADENTRY = 363538, /* Bad incoming vl entry */49AFSVL_BADVOLIDBUMP = 363539, /* Illegal max volid increment */50AFSVL_IDALREADYHASHED = 363540, /* RO/BACK id already hashed */51AFSVL_ENTRYLOCKED = 363541, /* Vl entry is already locked */52AFSVL_BADVOLOPER = 363542, /* Bad volume operation code */53AFSVL_BADRELLOCKTYPE = 363543, /* Bad release lock type */54AFSVL_RERELEASE = 363544, /* Status report: last release was aborted */55AFSVL_BADSERVERFLAG = 363545, /* Invalid replication site server flag */56AFSVL_PERM = 363546, /* No permission access */57AFSVL_NOMEM = 363547, /* malloc/realloc failed to alloc enough memory */58};5960enum {61YFS_SERVER_INDEX = 0,62YFS_SERVER_UUID = 1,63YFS_SERVER_ENDPOINT = 2,64};6566enum {67YFS_ENDPOINT_IPV4 = 0,68YFS_ENDPOINT_IPV6 = 1,69};7071#define YFS_MAXENDPOINTS 167273/*74* maps to "struct vldbentry" in vvl-spec.pdf75*/76struct afs_vldbentry {77char name[65]; /* name of volume (with NUL char) */78afs_voltype_t type; /* volume type */79unsigned num_servers; /* num servers that hold instances of this vol */80unsigned clone_id; /* cloning ID */8182unsigned flags;83#define AFS_VLF_RWEXISTS 0x1000 /* R/W volume exists */84#define AFS_VLF_ROEXISTS 0x2000 /* R/O volume exists */85#define AFS_VLF_BACKEXISTS 0x4000 /* backup volume exists */8687afs_volid_t volume_ids[3]; /* volume IDs */8889struct {90struct in_addr addr; /* server address */91unsigned partition; /* partition ID on this server */92unsigned flags; /* server specific flags */93#define AFS_VLSF_NEWREPSITE 0x0001 /* Ignore all 'non-new' servers */94#define AFS_VLSF_ROVOL 0x0002 /* this server holds a R/O instance of the volume */95#define AFS_VLSF_RWVOL 0x0004 /* this server holds a R/W instance of the volume */96#define AFS_VLSF_BACKVOL 0x0008 /* this server holds a backup instance of the volume */97#define AFS_VLSF_UUID 0x0010 /* This server is referred to by its UUID */98#define AFS_VLSF_DONTUSE 0x0020 /* This server ref should be ignored */99} servers[8];100};101102#define AFS_VLDB_MAXNAMELEN 65103104105struct afs_ListAddrByAttributes__xdr {106__be32 Mask;107#define AFS_VLADDR_IPADDR 0x1 /* Match by ->ipaddr */108#define AFS_VLADDR_INDEX 0x2 /* Match by ->index */109#define AFS_VLADDR_UUID 0x4 /* Match by ->uuid */110__be32 ipaddr;111__be32 index;112__be32 spare;113struct afs_uuid__xdr uuid;114};115116struct afs_uvldbentry__xdr {117__be32 name[AFS_VLDB_MAXNAMELEN];118__be32 nServers;119struct afs_uuid__xdr serverNumber[AFS_NMAXNSERVERS];120__be32 serverUnique[AFS_NMAXNSERVERS];121__be32 serverPartition[AFS_NMAXNSERVERS];122__be32 serverFlags[AFS_NMAXNSERVERS];123__be32 volumeId[AFS_MAXTYPES];124__be32 cloneId;125__be32 flags;126__be32 spares1;127__be32 spares2;128__be32 spares3;129__be32 spares4;130__be32 spares5;131__be32 spares6;132__be32 spares7;133__be32 spares8;134__be32 spares9;135};136137#endif /* AFS_VL_H */138139140