Section 3.1: Introduction
- This chapter documents the API for the Volume Location Server facility, as defined by the vldbint.xg Rxgen interface file and the vldbint.h include file. Descriptions of all the constants, structures, macros, and interface functions available to the application programmer appear here.
- It is expected that Volume Location Server client programs run in user space, as does the associated vos volume utility. However, the kernel-resident Cache Manager agent also needs to call a subset of the Volume Location Server's RPC interface routines. Thus, a second Volume Location Server interface is available, built exclusively to satisfy the Cache Manager's limited needs. This subset interface is defined by the afsvlint.xg Rxgen interface file, and is examined in the final section of this chapter.
3.2: Constants
- This section covers the basic constant definitions of interest to the Volume Location Server application programmer. These definitions appear in the vldbint.h file, automatically generated from the vldbint.xg Rxgen interface file, and in vlserver.h.
- Each subsection is devoted to describing the constants falling into the following categories:
- Configuration and boundary quantities
- Update entry bits
- List-by-attribute bits
- Volume type indices
- States for struct vlentry
- States for struct vldbentry
- ReleaseType argument values
- Miscellaneous items
Section 3.2.1: Configuration and Boundary
Quantities
- These constants define some basic system values, including configuration information.
- Name
- MAXNAMELEN
- Value
- 65
- Description
- Maximum size of various character strings, including volume name fields in structures and host names.
- Name
- MAXNSERVERS
- Value
- 8
- Description
- Maximum number of replications sites for a volume.
- Name
- MAXTYPES
- Value
- 3
- Description
- Maximum number of volume types.
- Name
- VLDBVERSION
- Value
- 1
- Description
- VLDB database version number
- Name
- HASHSIZE
- Value
- 8,191
- Description
- Size of internal Volume Location Server volume name and volume ID hash tables. This must always be a prime number.
- Name
- NULLO
- Value
- 0
- Description
- Specifies a null pointer value.
- Name
- VLDBALLOCCOUNT
- Value
- 40
- Description
- Value used when allocating memory internally for VLDB entry records.
- Name
- BADSERVERID
- Value
- 255
- Description
- Illegal Volume Location Server host ID.
- Name
- MAXSERVERID
- Value
- 30
- Description
- Maximum number of servers appearing in the VLDB.
- Name
- MAXSERVERFLAG
- Value
- 0x80
- Description
- First unused flag value in such fields as serverFlags in struct vldbentry and RepsitesNewFlags in struct VldbUpdateEntry.
- Name
- MAXPARTITIONID
- Value
- 126
- Description
- Maximum number of AFS disk partitions for any one server.
- Name
- MAXBUMPCOUNT
- Value
- 0x7fffffff
- Description
- Maximum interval that the current high-watermark value for a volume ID can be increased in one operation.
- Name
- MAXLOCKTIME
- Value
- 0x7fffffff
- Description
- Maximum number of seconds that any VLDB entry can remain locked.
- Name
- SIZE
- Value
- 1,024
- Description
- Maximum size of the name field within a struct.
Section 3.2.2: Update Entry Bits
- These constants define bit values for the Mask field in the struct VldbUpdateEntry. Specifically, setting these bits is equivalent to declaring that the corresponding field within an object of type struct VldbUpdateEntry has been set. For example, setting the VLUPDATE VOLUMENAME flag in Mask indicates that the name field contains a valid value.
- Name
- VLUPDATE VOLUMENAME
- Value
- 0x0001
- Description
- If set, indicates that the name field is valid.
- Name
- VLUPDATE VOLUMETYPE
- Value
- 0x0002
- Description
- If set, indicates that the volumeType field is valid.
- Name
- VLUPDATE FLAGS
- Value
- 0x0004
- Description
- If set, indicates that the flags field is valid.
- Name
- VLUPDATE READONLYID
- Value
- 0x0008
- Description
- If set, indicates that the ReadOnlyId field is valid.
- Name
- VLUPDATE BACKUPID
- Value
- 0x0010
- Description
- If set, indicates that the BackupId field is valid.
- Name
- VLUPDATE REPSITES
- Value
- 0x0020
- Description
- If set, indicates that the nModifiedRepsites field is valid.
- Name
- VLUPDATE CLONEID
- Value
- 0x0080
- Description
- If set, indicates that the cloneId field is valid.
- Name
- VLUPDATE REPS DELETE
- Value
- 0x0100
- Description
- Is the replica being deleted?
- Name
- VLUPDATE REPS ADD
- Value
- 0x0200
- Description
- Is the replica being added?
- Name
- VLUPDATE REPS MODSERV
- Value
- 0x0400
- Description
- Is the server part of the replica location correct?
- Name
- VLUPDATE REPS MODPART
- Value
- 0x0800
- Description
- Is the partition part of the replica location correct?
- Name
- VLUPDATE REPS MODFLAG
- Value
- 0x1000
- Description
- Various modification flag values.
Section 3.2.3: List-By-Attribute Bits
- These constants define bit values for the Mask field in the struct VldbListByAttributes is to be used in a match. Specifically, setting these bits is equivalent to declaring that the corresponding field within an object of type struct VldbListByAttributes is set. For example, setting the VLLIST SERVER flag in Mask indicates that the server field contains a valid value.
- Name
- VLLIST SERVER
- Value
- 0x1
- Description
- If set, indicates that the server field is valid.
- Name
- VLLIST PARTITION
- Value
- 0x2
- Description
- If set, indicates that the partition field is valid.
- Name
- VLLIST VOLUMETYPE
- Value
- 0x4
- Description
- If set, indicates that the volumetype field is valid.
- Name
- VLLIST VOLUMEID
- Value
- 0x8
- Description
- If set, indicates that the volumeid field is valid.
- Name
- VLLIST FLAG
- Value
- 0x10
- Description
- If set, indicates that that flag field is valid.
Section 3.2.4: Volume Type Indices
- These constants specify the order of entries in the volumeid array in an object of type struct vldbentry. They also identify the three different types of volumes in AFS.
- Name
- RWVOL
- Value
- 0
- Description
- Read-write volume.
- Name
- ROVOL
- Value
- 1
- Description
- Read-only volume.
- Name
- BACKVOL
- Value
- 2
- Description
- Backup volume.
Section 3.2.5: States for struct vlentry
- The following constants appear in the flags field in objects of type struct vlentry. The first three values listed specify the state of the entry, while all the rest stamp the entry with the type of an ongoing volume operation, such as a move, clone, backup, deletion, and dump. These volume operations are the legal values to provide to the voloper parameter of the VL SetLock() interface routine.
- For convenience, the constant VLOP ALLOPERS is defined as the inclusive OR of the above values from VLOP MOVE through VLOP DUMP.
- Name
- VLFREE
- Value
- 0x1
- Description
- Entry is in the free list.
- Name
- VLDELETED
- Value
- 0x2
- Description
- Entry is soft-deleted.
- Name
- VLLOCKED
- Value
- 0x4
- Description
- Advisory lock held on the entry.
- Name
- VLOP MOVE
- Value
- 0x10
- Description
- The associated volume is being moved between servers.
- Name
- VLOP RELEASE
- Value
- 0x20
- Description
- The associated volume is being cloned to its replication sites.
- Name
- VLOP BACKUP
- Value
- 0x40
- Description
- A backup volume is being created for the associated volume.
- Name
- VLOP DELETE
- Value
- 0x80
- Description
- The associated volume is being deleted.
- Name
- VLOP DUMP
- Value
- 0x100
- Description
- A dump is being taken of the associated volume.
Section 3.2.6: States for struct vldbentry
- Of the following constants, the first three appear in the flags field within an object of type struct vldbentry, advising of the existence of the basic volume types for the given volume, and hence the validity of the entries in the volumeId array field. The rest of the values provided in this table appear in the serverFlags array field, and apply to the instances of the volume appearing in the various replication sites.
- This structure appears in numerous Volume Location Server interface calls, namely VL CreateEntry(), VL GetEntryByID(), VL GetEntryByName(), VL ReplaceEntry() and VL ListEntry().
- Name
- VLF RWEXISTS
- Value
- 0x1000
- Description
- The read-write volume ID is valid.
- Name
- VLF ROEXISTS
- Value
- 0x2000
- Description
- The read-only volume ID is valid.
- Name
- VLF BACKEXISTS
- Value
- 0x4000
- Description
- The backup volume ID is valid.
- Name
- VLSF NEWREPSITE
- Value
- 0x01
- Description
- Not used; originally intended to mark an entry as belonging to a partially-created volume instance.
- Name
- VLSF ROVOL
- Value
- 0x02
- Description
- A read-only version of the volume appears at this server.
- Name
- VLSF RWVOL
- Value
- 0x02
- Description
- A read-write version of the volume appears at this server.
- Name
- VLSF BACKVOL
- Value
- 0x08
- Description
- A backup version of the volume appears at this server.
Section 3.2.7: ReleaseType Argument Values
- The following values are used in the ReleaseType argument to various Volume Location Server interface routines, namely VL ReplaceEntry(), VL UpdateEntry() and VL ReleaseLock().
- Name
- LOCKREL TIMESTAMP
- Value
- 1
- Description
- Is the LockTimestamp field valid?
- Name
- LOCKREL OPCODE
- Value
- 2
- Description
- Are any of the bits valid in the flags field?
- Name
- LOCKREL AFSID
- Value
- 4
- Description
- Is the LockAfsId field valid?
Section 3.2.8: Miscellaneous
- Miscellaneous values.
- Name
- VLREPSITE NEW
- Value
- 1
- Description
- Has a replication site gotten a new release of a volume?
- A synonym for this constant is VLSF NEWREPSITE.
Section 3.3: Structures and Typedefs
- This section describes the major exported Volume Location Server data structures of interest to application programmers, along with the typedefs based upon those structures.
Section 3.3.1: struct vldbentry
- This structure represents an entry in the VLDB as made visible to Volume Location Server clients. It appears in numerous Volume Location Server interface calls, namely VL CreateEntry(), VL GetEntryByID(), VL GetEntryByName(), VL ReplaceEntry() and VL ListEntry().
Fields
- char name[] - The string name for the volume, with a maximum length of MAXNAMELEN (65) characters, including the trailing null.
- long volumeType - The volume type, one of RWVOL, ROVOL, or BACKVOL.
- long nServers - The number of servers that have an instance of this volume.
- long serverNumber[] - An array of indices into the table of servers, identifying the sites holding an instance of this volume. There are at most MAXNSERVERS (8) of these server sites allowed by the Volume Location Server.
- long serverPartition[] - An array of partition identifiers, corresponding directly to the serverNumber array, specifying the partition on which each of those volume instances is located. As with the serverNumber array, serverPartition has up to MAXNSERVERS (8) entries.
- long serverFlags[] - This array holds one flag value for each of the servers in the previous arrays. Again, there are MAXNSERVERS (8) slots in this array.
- u long volumeId[] - An array of volume IDs, one for each volume type. There are MAXTYPES slots in this array.
- long cloneId - This field is used during a cloning operation.
- long flags - Flags concerning the status of the fields within this structure; see Section 3.2.6 for the bit values that apply.
Section 3.3.2: struct vlentry
- This structure is used internally by the Volume Location Server to fully represent a VLDB entry. The client-visible struct vldbentry represents merely a subset of the information contained herein.
Fields
- u long volumeId[] - An array of volume IDs, one for each of the MAXTYPES of volume types.
- long flags - Flags concerning the status of the fields within this structure; see Section 3.2.6 for the bit values that apply.
- long LockAfsId - The individual who locked the entry. This feature has not yet been implemented.
- long LockTimestamp - Time stamp on the entry lock.
- long cloneId - This field is used during a cloning operation.
- long AssociatedChain - Pointer to the linked list of associated VLDB entries.
- long nextIdHash[] - Array of MAXTYPES next pointers for the ID hash table pointer, one for each related volume ID.
- long nextNameHash - Next pointer for the volume name hash table.
- long spares1[] - Two longword spare fields.
- char name[] - The volume's string name, with a maximum of MAXNAMELEN (65) characters, including the trailing null.
- u char volumeType - The volume's type, one of RWVOL, ROVOL, or BACKVOL.
- u char serverNumber[] - An array of indices into the table of servers, identifying the sites holding an instance of this volume. There are at most MAXNSERVERS (8) of these server sites allowed by the Volume Location Server.
- u char serverPartition[] - An array of partition identifiers, corresponding directly to the serverNumber array, specifying the partition on which each of those volume instances is located. As with the serverNumber array, serverPartition has up to MAXNSERVERS (8) entries.
- u char serverFlags[] - This array holds one flag value for each of the servers in the previous arrays. Again, there are MAXNSERVERS (8) slots in this array.
- u char RefCount - Only valid for read-write volumes, this field serves as a reference count, basically the number of dependent children volumes.
- char spares2[] - This field is used for 32-bit alignment.
Section 3.3.3: struct vital vlheader
- This structure defines the leading section of the VLDB header, of type struct vlheader. It contains frequently-used global variables and general statistics information.
Fields
- long vldbversion - The VLDB version number. This field must appear first in the structure.
- long headersize - The total number of bytes in the header.
- long freePtr - Pointer to the first free enry in the free list, if any.
- long eofPtr - Pointer to the first free byte in the header file.
- long allocs - The total number of calls to the internal AllocBlock() function directed at this file.
- long frees - The total number of calls to the internal FreeBlock() function directed at this file.
- long MaxVolumeId - The largest volume ID ever granted for this cell.
- long totalEntries[] - The total number of VLDB entries by volume type in the VLDB. This array has MAXTYPES slots, one for each volume type.
Section 3.3.4: struct vlheader
- This is the layout of the information stored in the VLDB header. Notice it includes an object of type struct vital vlheader described above (see Section 3.3.3) as the first field.
Fields
- struct vital vlheader vital header - Holds critical VLDB header information.
- u long IpMappedAddr[] - Keeps MAXSERVERID+1 mappings of IP addresses to relative ones.
- long VolnameHash[] - The volume name hash table, with HASHSIZE slots.
- long VolidHash[][] - The volume ID hash table. The first dimension in this array selects which of the MAXTYPES volume types is desired, and the second dimension actually implements the HASHSIZE hash table buckets for the given volume type.
Section 3.3.5: struct VldbUpdateEntry
- This structure is used as an argument to the VL UpdateEntry() routine (see Section 3.6.7). Please note that multiple entries can be updated at once by setting the appropriate Mask bits. The bit values for this purpose are defined in Section 3.2.2.
Fields
- u long Mask - Bit values determining which fields are to be affected by the update operation.
- char name[] - The volume name, up to MAXNAMELEN (65) characters including the trailing null.
- long volumeType - The volume type.
- long flags - This field is used in conjuction with Mask (in fact, one of the Mask bits determines if this field is valid) to choose the valid fields in this record.
- u long ReadOnlyId - The read-only ID.
- u long BackupId - The backup ID.
- long cloneId - The clone ID.
- long nModifiedRepsites - Number of replication sites whose entry is to be changed as below.
- u long RepsitesMask[] - Array of bit masks applying to the up to MAXNSERVERS (8) replication sites involved.
- long RepsitesTargetServer[] - Array of target servers for the operation, at most MAXNSERVERS (8) of them.
- long RepsitesTargetPart[] - Array of target server partitions for the operation, at most MAXNSERVERS (8) of them.
- long RepsitesNewServer[] - Array of new server sites, at most MAXNSERVERS (8) of them.
- long RepsitesNewPart[] - Array of new server partitions for the operation, at most MAXNSERVERS (8) of them.
- long RepsitesNewFlags[] - Flags applying to each of the new sites, at most MAXNSERVERS (8) of them.
Section 3.3.6: struct VldbListByAttributes
- This structure is used by the VL ListAttributes() routine (see Section 3.6.11).
Fields
- u long Mask - Bit mask used to select the following attribute fields on which to match.
- long server - The server address to match.
- long partition - The partition ID to match.
- long volumetype - The volume type to match.
- long volumeid - The volume ID to match.
- long flag - Flags concerning these values.
Section 3.3.7: struct single vldbentry
- This structure is used to construct the vldblist object (See Section 3.3.12), which basically generates a queueable (singly-linked) version of struct vldbentry.
Fields
- vldbentry VldbEntry - The VLDB entry to be queued.
- vldblist next vldb - The next pointer in the list.
Section 3.3.8: struct vldb list
- This structure defines the item returned in linked list form from the VL LinkedList() function (see Section 3.6.12). This same object is also returned in bulk form in calls to the VL ListAttributes() routine (see Section 3.6.11).
Fields
- vldblist node - The body of the first object in the linked list.
Section 3.3.9: struct vldstats
- This structure defines fields to record statistics on opcode hit frequency. The MAX NUMBER OPCODES constant has been defined as the maximum number of opcodes supported by this structure, and is set to 30.
Fields
- unsigned long start time - Clock time when opcode statistics were last cleared.
- long requests[] - Number of requests received for each of the MAX NUMBER OPCODES opcode types.
- long aborts[] - Number of aborts experienced for each of the MAX NUMBER OPCODES opcode types.
- long reserved[] - These five longword fields are reserved for future use.
Section 3.3.10: bulk
typedef opaque bulk<DEFAULTBULK>;
- This typedef may be used to transfer an uninterpreted set of bytes across the Volume Location Server interface. It may carry up to DEFAULTBULK (10,000) bytes.
Fields
- bulk len - The number of bytes contained within the data pointed to by the next field.
- bulk val - A pointer to a sequence of bulk len bytes.
Section 3.3.11: bulkentries
typedef vldbentry bulkentries<>;
- This typedef is used to transfer an unbounded number of struct vldbentry objects. It appears in the parameter list for the VL ListAttributes() interface function.
Fields
- bulkentries len - The number of vldbentry structures contained within the data pointed to by the next field.
- bulkentries val - A pointer to a sequence of bulkentries len vldbentry structures.
Section 3.3.12: vldblist
typedef struct single_vldbentry *vldblist;
- This typedef defines a queueable struct vldbentry object, referenced by the single vldbentry typedef as well as struct vldb list.
Section 3.3.13: vlheader
typedef struct vlheader vlheader;
- This typedef provides a short name for objects of type struct vlheader (see Section 3.3.4).
Section 3.3.14: vlentry
typedef struct vlentry vlentry;
- This typedef provides a short name for objects of type struct vlentry (see Section 3.3.2).
Section 3.4: Error Codes
- This section covers the set of error codes exported by the Volume Location Server, displaying the printable phrases with which they are associated.
- Name
- VL IDEXIST
- Value
- (363520L)
- Description
- Volume Id entry exists in vl database.
- Name
- VL IO
- Value
- (363521L)
- Description
- I/O related error.
- Name
- VL NAMEEXIST
- Value
- (363522L)
- Description
- Volume name entry exists in vl database.
- Name
- VL CREATEFAIL
- Value
- (363523L)
- Description
- Internal creation failure.
- Name
- VL NOENT
- Value
- (363524L)
- Description
- No such entry.
- Name
- VL EMPTY
- Value
- (363525L)
- Description
- Vl database is empty.
- Name
- VL ENTDELETED
- Value
- (363526L)
- Description
- Entry is deleted (soft delete).
- Name
- VL BADNAME
- Value
- (363527L)
- Description
- Volume name is illegal.
- Name
- VL BADINDEX
- Value
- (363528L)
- Description
- Index is out of range.
- Name
- VL BADVOLTYPE
- Value
- (363529L)
- Description
- Bad volume range.
- Name
- VL BADSERVER
- Value
- (363530L)
- Description
- Illegal server number (out of range).
- Name
- VL BADPARTITION
- Value
- (363531L)
- Description
- Bad partition number.
- Name
- VL REPSFULL
- Value
- (363532L)
- Description
- Run out of space for Replication sites.
- Name
- VL NOREPSERVER
- Value
- (363533L)
- Description
- No such Replication server site exists.
- Name
- VL DUPREPSERVER
- Value
- (363534L)
- Description
- Replication site already exists.
- Name
- RL RWNOTFOUND
- Value
- (363535L)
- Description
- Parent R/W entry not found.
- Name
- VL BADREFCOUNT
- Value
- (363536L)
- Description
- Illegal Reference Count number.
- Name
- VL SIZEEXCEEDED
- Value
- (363537L)
- Description
- Vl size for attributes exceeded.
- Name
- VL BADENTRY
- Value
- (363538L)
- Description
- Bad incoming vl entry.
- Name
- VL BADVOLIDBUMP
- Value
- (363539L)
- Description
- Illegal max volid increment.
- Name
- VL IDALREADYHASHED
- Value
- (363540L)
- Description
- RO/BACK id already hashed.
- Name
- VL ENTRYLOCKED
- Value
- (363541L)
- Description
- Vl entry is already locked.
- Name
- VL BADVOLOPER
- Value
- (363542L)
- Description
- Bad volume operation code.
- Name
- VL BADRELLOCKTYPE
- Value
- (363543L)
- Description
- Bad release lock type.
- Name
- VL RERELEASE
- Value
- (363544L)
- Description
- Status report: last release was aborted.
- Name
- VL BADSERVERFLAG
- Value
- (363545L)
- Description
- Invalid replication site server flag.
- Name
- VL PERM
- Value
- (363546L)
- Description
- No permission access.
- Name
- VL NOMEM
- Value
- (363547L)
- Description
- malloc(realloc) failed to alloc enough memory.
Section 3.5: Macros
- The Volume Location Server defines a small number of macros, as described in this section. They are used to update the internal statistics variables and to compute offsets into character strings. All of these macros really refer to internal operations, and strictly speaking should not be exposed in this interface.
Section 3.5.1: COUNT REQ()
#define COUNT_REQ(op)
static int this_op = op-VL_LOWEST_OPCODE;
dynamic_statistics.requests[this_op]++
- Bump the appropriate entry in the variable maintaining opcode usage statistics for the Volume Location Server. Note that a static variable is set up to record this op, namely the index into the opcode monitoring array. This static variable is used by the related COUNT ABO() macro defined below.
Section 3.5.2: COUNT ABO()
#define COUNT_ABO dynamic_statistics.aborts[this_op]++
- Bump the appropriate entry in the variable maintaining opcode abort statistics for the Volume Location Server. Note that this macro does not take any arguemnts. It expects to find a this op variable in its environment, and thus depends on its related macro, COUNT REQ() to define that variable.
Section 3.5.3: DOFFSET()
#define DOFFSET(abase, astr, aitem) ((abase)+(((char *)(aitem)) -((char
)(astr))))
- Compute the byte offset of charcter object aitem within the enclosing object astr, also expressed as a character-based object, then offset the resulting address by abase. This macro is used ot compute locations within the VLDB when actually writing out information.
Section 3.6: Functions
- This section covers the Volume Location Server RPC interface routines. The majority of them are generated from the vldbint.xg Rxgen file, and are meant to be used by user-space agents. There is also a subset interface definition provided in the afsvlint.xg Rxgen file. These routines, described in Section 3.7, are meant to be used by a kernel-space agent when dealing with the Volume Location Server; in particular, they are called by the Cache Manager.
Section 3.6.1: VL CreateEntry - Create a VLDB
entry
int VL CreateEntry(IN struct rx connection *z conn,
IN vldbentry *newentry)
- Description
- This function creates a new entry in the VLDB, as specified in the newentry argument. Both the name and numerical ID of the new volume must be unique (e.g., it must not already appear in the VLDB). For non-read-write entries, the read-write parent volume is accessed so that its reference count can be updated, and the new entry is added to the parent's chain of associated entries. The VLDB is write-locked for the duration of this operation.
- Error Codes
- VL PERM The caller is not authorized to execute this function. VL NAMEEXIST The volume name already appears in the VLDB. VL CREATEFAIL Space for the new entry cannot be allocated within the VLDB. VL BADNAME The volume name is invalid. VL BADVOLTYPE The volume type is invalid. VL BADSERVER The indicated server information is invalid. VL BADPARTITION The indicated partition information is invalid. VL BADSERVERFLAG The server flag field is invalid. VL IO An error occurred while writing to the VLDB.
Section 3.6.2: VL DeleteEntry - Delete a VLDB
entry
int VL DeleteEntry(IN struct rx connection *z conn,
IN long Volid,
IN long voltype)
- Description
- Delete the entry matching the given volume identifier and volume type as specified in the Volid and voltype arguments. For a read-write entry whose reference count is greater than 1, the entry is not actually deleted, since at least one child (read-only or backup) volume still depends on it. For cases of non-read-write volumes, the parent's reference count and associated chains are updated.
- If the associated VLDB entry is already marked as deleted (i.e., its flags field has the VLDELETED bit set), then no further action is taken, and VL ENTDELETED is returned. The VLDB is write-locked for the duration of this operation.
- Error Codes
- VL PERM The caller is not authorized to execute this function. VL BADVOLTYPE An illegal volume type has been specified by the voltype argument. VL NOENT This volume instance does not appear in the VLDB. VL ENTDELETED The given VLDB entry has already been marked as deleted. VL IO An error occurred while writing to the VLDB.
Section 3.6.3: VL GetEntryByID - Get VLDB entry by
volume ID/type
int VL GetEntryByID(IN struct rx connection *z conn, IN long Volid, IN long
voltype, OUT vldbentry *entry)
- Description
- Given a volume's numerical identifier (Volid) and type (voltype), return a pointer to the entry in the VLDB describing the given volume instance.
- The VLDB is read-locked for the duration of this operation.
- Error Codes
- VL BADVOLTYPE An illegal volume type has been specified by the voltype argument.
VL NOENT This volume instance does not appear in the VLDB.
VL ENTDELETED The given VLDB entry has already been marked as deleted.
Section 3.6.4: VL GetEntryByName - Get VLDB entry
by volume name
int VL GetEntryByName(IN struct rx connection *z conn,
IN char *volumename,
OUT vldbentry *entry)
- Description
- Given the volume name in the volumename parameter, return a pointer to the entry in the VLDB describing the given volume. The name in volumename may be no longer than MAXNAMELEN (65) characters, including the trailing null. Note that it is legal to use the volume's numerical identifier (in string form) as the volume name.
- The VLDB is read-locked for the duration of this operation.
- This function is closely related to the VL GetEntryByID() routine, as might be expected. In fact, the by-ID routine is called if the volume name provided in volumename is the string version of the volume's numerical identifier.
- Error Codes
- VL BADVOLTYPE An illegal volume type has been specified by the voltype argument.
VL NOENT This volume instance does not appear in the VLDB.
VL ENTDELETED The given VLDB entry has already been marked as deleted.
VL BADNAME The volume name is invalid.
Section 3.6.5: VL GetNewVolumeId - Generate a new
volume ID
int VL GetNewVolumeId(IN struct rx connection *z conn,
IN long bumpcount,
OUT long *newvolumid)
- Description
- Acquire bumpcount unused, consecutively-numbered volume identifiers from the Volume Location Server. The lowest-numbered of the newly-acquired set is placed in the newvolumid argument. The largest number of volume IDs that may be generated with any one call is bounded by the MAXBUMPCOUNT constant defined in Section 3.2.1. Currently, there is (effectively) no restriction on the number of volume identifiers that may thus be reserved in a single call.
- The VLDB is write-locked for the duration of this operation.
- Error Codes
- VL PERM The caller is not authorized to execute this function.
VL BADVOLIDBUMP The value of the bumpcount parameter exceeds the system limit of MAXBUMPCOUNT.
VL IO An error occurred while writing to the VLDB.
Section 3.6.6: VL ReplaceEntry - Replace entire
contents of VLDB entry
int VL ReplaceEntry(IN struct rx connection *z conn,
IN long Volid,
IN long voltype,
IN vldbentry *newentry,
IN long ReleaseType)
- Description
- Perform a wholesale replacement of the VLDB entry corresponding to the volume instance whose identifier is Volid and type voltype with the information contained in the newentry argument. Individual VLDB entry fields cannot be selectively changed while the others are preserved; VL UpdateEntry() should be used for this objective. The permissible values for the ReleaseType parameter are defined in Section 3.2.7.
- The VLDB is write-locked for the duration of this operation. All of the hash tables impacted are brought up to date to incorporate the new information.
- Error Codes
- VL PERM The caller is not authorized to execute this function.
VL BADVOLTYPE An illegal volume type has been specified by the voltype argument.
VL BADRELLOCKTYPE An illegal release lock has been specified by the ReleaseType argument.
VL NOENT This volume instance does not appear in the VLDB.
VL BADENTRY An attempt was made to change a read-write volume ID.
VL IO An error occurred while writing to the VLDB.
Section 3.6.7: VL UpdateEntry - Update contents of
VLDB entry
int VL UpdateEntry(IN struct rx connection *z conn,
IN long Volid,
IN long voltype,
IN VldbUpdateEntry *UpdateEntry,
IN long ReleaseType)
- Description
- Update the VLDB entry corresponding to the volume instance whose identifier is Volid and type voltype with the information contained in the UpdateEntry argument. Most of the entry's fields can be modified in a single call to VL UpdateEntry(). The Mask field within the UpdateEntry parameter selects the fields to update with the values stored within the other UpdateEntry fields. Permissible values for the ReleaseType parameter are defined in Section 3.2.7.
- The VLDB is write-locked for the duration of this operation.
- Error Codes
- VL PERM The caller is not authorized to execute this function.
VL BADVOLTYPE An illegal volume type has been specified by the voltype argument.
VL BADRELLOCKTYPE An illegal release lock has been specified by the ReleaseType argument.
VL NOENT This volume instance does not appear in the VLDB.
VL IO An error occurred while writing to the VLDB.
Section 3.6.8: VL SetLock - Lock VLDB entry
int VL SetLock(IN struct rx connection *z conn,
IN long Volid,
IN long voltype,
IN long voloper)
- Description
- Lock the VLDB entry matching the given volume ID (Volid) and type (voltype) for volume operation voloper (e.g., VLOP MOVE and VLOP RELEASE). If the entry is currently unlocked, then its LockTimestamp will be zero. If the lock is obtained, the given voloper is stamped into the flags field, and the LockTimestamp is set to the time of the call. When the caller attempts to lock the entry for a release operation, special care is taken to abort the operation if the entry has already been locked for this operation, and the existing lock has timed out. In this case, VL SetLock() returns VL RERELEASE.
- The VLDB is write-locked for the duration of this operation.
- Error Codes
- VL PERM The caller is not authorized to execute this function.
VL BADVOLTYPE An illegal volume type has been specified by the voltype argument.
VL BADVOLOPER An illegal volume operation was specified in the voloper argument. Legal values are defined in the latter part of the table in Section 3.2.5.
VL ENTDELETED The given VLDB entry has already been marked as deleted.
VL ENTRYLOCKED The given VLDB entry has already been locked (which has not yet timed out).
VL RERELEASE A VLDB entry locked for release has timed out, and the caller also wanted to perform a release operation on it.
VL IO An error was experienced while attempting to write to the VLDB.
Section 3.6.9: VL ReleaseLock - Unlock VLDB entry
int VL ReleaseLock(IN struct rx connection *z conn,
IN long Volid,
IN long voltype,
IN long ReleaseType)
- Description
- Unlock the VLDB entry matching the given volume ID (Volid) and type (voltype). The ReleaseType argument determines which VLDB entry fields from flags and LockAfsId will be cleared along with the lock timestamp in LockTimestamp. Permissible values for the ReleaseType parameter are defined in Section 3.2.7.
- The VLDB is write-locked for the duration of this operation.
- Error Codes
- VL PERM The caller is not authorized to execute this function.
VL BADVOLTYPE An illegal volume type has been specified by the voltype argument.
VL BADRELLOCKTYPE An illegal release lock has been specified by the ReleaseType argument.
VL NOENT This volume instance does not appear in the VLDB.
VL ENTDELETED The given VLDB entry has already been marked as deleted.
VL IO An error was experienced while attempting to write to the VLDB.
Section 3.6.10: VL ListEntry - Get contents of
VLDB via index
int VL ListEntry(IN struct rx connection *z conn,
IN long previous index,
OUT long *count,
OUT long *next index,
OUT vldbentry *entry)
- Description
- This function assists in the task of enumerating the contents of the VLDB. Given an index into the database, previous index, this call return the single VLDB entry at that offset, placing it in the entry argument. The number of VLDB entries left to list is placed in count, and the index of the next entry to request is returned in next index. If an illegal index is provided, count is set to -1.
- The VLDB is read-locked for the duration of this operation.
- Error Codes
- —None.
Section 3.6.11: VL ListAttributes - List all VLDB
entry matching given attributes, single return object
int VL ListAttributes(IN struct rx connection *z conn,
IN VldbListByAttributes *attributes,
OUT long *nentries,
OUT bulkentries *blkentries)
- Description
- Retrieve all the VLDB entries that match the attributes listed in the attributes parameter, placing them in the blkentries object. The number of matching entries is placed in nentries. Matching can be done by server number, partition, volume type, flag, or volume ID. The legal values to use in the attributes argument are listed in Section 3.2.3. Note that if the VLLIST VOLUMEID bit is set in attributes, all other bit values are ignored and the volume ID provided is the sole search criterion.
- The VLDB is read-locked for the duration of this operation.
- Note that VL ListAttributes() is a potentially expensive function, as sequential search through all of the VLDB entries is performed in most cases.
- Error Codes
- VL NOMEM Memory for the blkentries object could not be allocated.
VL NOENT This specified volume instance does not appear in the VLDB.
VL SIZEEXCEEDED Ran out of room in the blkentries object.
VL IO Error while reading from the VLDB.
Section 3.6.12: VL LinkedList - List all VLDB
entry matching given attributes, linked list return object
int VL LinkedList(IN struct rx connection *z conn,
IN VldbListByAttributes *attributes,
OUT long *nentries,
OUT vldb list *linkedentries)
- Description
- Retrieve all the VLDB entries that match the attributes listed in the attributes parameter, creating a linked list of entries based in the linkedentries object. The number of matching entries is placed in nentries. Matching can be done by server number, partition, volume type, flag, or volume ID. The legal values to use in the attributes argument are listed in Section 3.2.3. Note that if the VLLIST VOLUMEID bit is set in attributes, all other bit values are ignored and the volume ID provided is the sole search criterion.
- The VL LinkedList() function is identical to the VL ListAttributes(), except for the method of delivering the VLDB entries to the caller.
- The VLDB is read-locked for the duration of this operation.
- Error Codes
- VL NOMEM Memory for an entry in the list based at linkedentries object could not be allocated.
VL NOENT This specified volume instance does not appear in the VLDB.
VL SIZEEXCEEDED Ran out of room in the current list object.
VL IO Error while reading from the VLDB.
Section 3.6.13: VL GetStats - Get Volume Location
Server statistics
int VL GetStats(IN struct rx connection *z conn,
OUT vldstats *stats,
OUT vital vlheader *vital header)
- Description
- Collect the different types of VLDB statistics. Part of the VLDB header is returned in vital header, which includes such information as the number of allocations and frees performed, and the next volume ID to be allocated. The dynamic per-operation stats are returned in the stats argument, reporting the number and types of operations and aborts.
- The VLDB is read-locked for the duration of this operation.
- Error Codes
- VL PERM The caller is not authorized to execute this function.
Section 3.6.14: VL Probe - Verify Volume Location
Server connectivity/status
int VL Probe(IN struct rx connection *z conn)
- Description
- This routine serves a 'pinging' function to determine whether the Volume Location Server is still running. If this call succeeds, then the Volume Location Server is shown to be capable of responding to RPCs, thus confirming connectivity and basic operation.
- The VLDB is not locked for this operation.
- Error Codes
- —None.
Section 3.7: Kernel Interface Subset
- The interface described by this document so far applies to user-level clients, such as the vos utility. However, some volume location operations must be performed from within the kernel. Specifically, the Cache Manager must find out where volumes reside and otherwise gather information about them in order to conduct its business with the File Servers holding them. In order to support Volume Location Server interconnection for agents operating within the kernel, the afsvlint.xg Rxgen interface was built. It is a minimal subset of the user-level vldbint.xg definition. Within afsvlint.xg, there are duplicate definitions for such constants as MAXNAMELEN, MAXNSERVERS, MAXTYPES, VLF RWEXISTS, VLF ROEXISTS, VLF BACKEXISTS, VLSF NEWREPSITE, VLSF ROVOL, VLSF RWVOL, and VLSF BACKVOL. Since the only operations the Cache Manager must perform are volume location given a specific volume ID or name, and to find out about unresponsive Volume Location Servers, the following interface routines are duplicated in afsvlint.xg, along with the struct vldbentry declaration:
- VL GetEntryByID()
- VL GetEntryByName()
- VL Probe()
Section 5.1 Introduction
- This chapter documents the API for the Volume Server facility, as defined by the volint.xg Rxgen interface file and the volser.h include file. Descriptions of all the constants, structures, macros, and interface functions available to the application programmer appear here.
Section 5.2: Constants
- This section covers the basic constant definitions of interest to the Volume Server application programmer. These definitions appear in the volint.h file, automatically generated from the volint.xg Rxgen interface file, and in volser.h.
- Each subsection is devoted to describing the constants falling into the following categories:
- Configuration and boundary values
- Interface routine opcodes
- Transaction Flags
- Volume Types
- LWP State
- States for struct vldbentry
- Validity Checks
- Miscellaneous
Section 5.2.1: Configuration and Boundary Values
- These constants define some basic system configuration values, along with such things as maximum sizes of important arrays.
MyPort 5,003 The Rx UDP port on which the Volume Server service may be found.
- Name
- NameLen
- Value
- 80
- Description
- Used by the vos utility to define maximum lengths for internal filename variables.
- Name
- VLDB MAXSERVERS
- Value
- 10
- Description
- Maximum number of server agents implementing the AFS Volume Location Database (VLDB) for the cell.
- Name
- VOLSERVICE ID
- Value
- 4
- Description
- The Rx service number on the given UDP port (MyPort) above.
- Name
- INVALID BID
- Value
- 0
- Description
- Used as an invalid read-only or backup volume ID.
- Name
- VOLSER MAXVOLNAME
- Value
- 65
- Description
- The number of characters in the longest possible volume name, including the trailing null. Note: this is only used by the vos utility; the Volume Server uses the "old" value below.
- Name
- VOLSER OLDMAXVOLNAME
- Value
- 32
- Description
- The "old" maximum number of characters in an AFS volume name, including the trailing null. In reality, it is also the current maximum.
- Name
- VOLSER MAX REPSITES
- Value
- 7
- Description
- The maximum number of replication sites for a volume.
- Name
- VNAMESIZE
- Value
- 32
- Description
- Size in bytes of the name field in struct volintInfo (see Section 5.4.6).
Section 5.2.2: Interface Routine Opcodes
- These constants, appearing in the volint.xg Rxgen interface file for the Volume Server, define the opcodes for the RPC routines. Every Rx call on this interface contains this opcode, and the dispatcher uses it to select the proper code at the server site to carry out the call.
- Name
- VOLCREATEVOLUME
- Value
- 100
- Description
- Opcode for AFSVolCreateVolume()
- Name
- VOLDELETEVOLUME
- Value
- 101
- Description
- Opcode for AFSVolDeleteVolume()
- Name
- VOLRESTORE
- Value
- 102
- Description
- Opcode for AFSVolRestoreVolume()
- Name
- VOLFORWARD
- Value
- 103
- Description
- Opcode for AFSVolForward()
- Name
- VOLENDTRANS
- Value
- 104
- Description
- Opcode for AFSVolEndTrans()
- Name
- VOLCLONE
- Value
- 105
- Description
- Opcode for AFSVolClone() .
- Name
- VOLSETFLAGS
- Value
- 106
- Description
- Opcode for AFSVolSetFlags()
- Name
- VOLGETFLAGS
- Value
- 107
- Description
- Opcode for AFSVolGetFlags()
- Name
- VOLTRANSCREATE
- Value
- 108
- Description
- Opcode for AFSVolTransCreate()
- Name
- VOLDUMP
- Value
- 109
- Description
- Opcode for AFSVolDump()
- Name
- VOLGETNTHVOLUME
- Value
- 110
- Description
- Opcode for AFSVolGetNthVolume()
- Name
- VOLSETFORWARDING
- Value
- 111
- Description
- Opcode for AFSVolSetForwarding()
- Name
- VOLGETNAME
- Value
- 112
- Description
- Opcode for AFSVolGetName()
- Name
- VOLGETSTATUS
- Value
- 113
- Description
- Opcode for AFSVolGetStatus()
- Name
- VOLSIGRESTORE
- Value
- 114
- Description
- Opcode for AFSVolSignalRestore()
- Name
- VOLLISTPARTITIONS
- Value
- 115
- Description
- Opcode for AFSVolListPartitions()
- Name
- VOLLISTVOLS
- Value
- 116
- Description
- Opcode for AFSVolListVolumes()
- Name
- VOLSETIDSTYPES
- Value
- 117
- Description
- Opcode for AFSVolSetIdsTypes()
- Name
- VOLMONITOR
- Value
- 118
- Description
- Opcode for AFSVolMonitor()
- Name
- VOLDISKPART
- Value
- 119
- Description
- Opcode for AFSVolPartitionInfo()
- Name
- VOLRECLONE
- Value
- 120
- Description
- Opcode for AFSVolReClone()
- Name
- VOLLISTONEVOL
- Value
- 121
- Description
- Opcode for AFSVolListOneVolume()
- Name
- VOLNUKE
- Value
- 122
- Description
- Opcode for AFSVolNukeVolume()
- Name
- VOLSETDATE
- Value
- 123
- Description
- Opcode for AFSVolSetDate()
Section 5.2.3: Transaction Flags
- These constants define the various flags the Volume Server uses in assocation with volume transactions, keeping track of volumes upon which operations are currently proceeding. There are three sets of flag values, stored in three different fields within a struct volser trans: general volume state, attachment modes, and specific transaction states.
: Section 5.2.3.1 vflags
- These values are used to represent the general state of the associated volume. They appear in the vflags field within a struct volser trans.
- Name
- VTDeleteOnSalvage
- Value
- 1
- Description
- The volume should be deleted on next salvage.
- Name
- VTOutOfService
- Value
- 2
- Description
- This volume should never be put online.
- Name
- VTDeleted
- Value
- 4
- Description
- This volume has been deleted (via AFSVolDeleteVol¬ume() ), and thus should not be manipulated.
Section 5.2.3.2: iflags
- These constants represent the desired attachment mode for a volume at the start of a transaction. Once attached, the volume header is marked to reflect this mode. Attachment modes are useful in salvaging partitions, as they indicate whether the operations being performed on individual volumes at the time the crash occured could have introduced inconsistencies in their metadata descriptors. If a volume was attached in a read-only fashion, then the salvager may decide (taking other factors into consideration) that the volume doesn't need attention as a result of the crash.
- These values appear in the iflags field within a struct volser trans.
- Name
- ITOffline
- Value
- 0x1
- Description
- Volume offline on server (returns VOFFLINE).
- Name
- ITBusy
- Value
- 0x2
- Description
- Volume busy on server (returns VBUSY).
- Name
- ITReadOnly
- Value
- 0x8
- Description
- Volume is read-only on client, read-write on server -DO NOT USE.
- Name
- ITCreate
- Value
- 0x10
- Description
- Volume does not exist correctly yet.
- Name
- ITCreateVolID
- Value
- 0x1000
- Description
- Create volid.
Section 5.2.3.3: tflags
- This value is used to represent the transaction state of the associated volume, and appears in the tflags field within a struct volser trans.
- Name
- TTDeleted
- Value
- 1
- Description
- Delete transaction not yet freed due to high reference count.
Section 5.2.4: Volume Types
- The following constants may be supplied as values for the type argument to the AFSVol-CreateVolume() interface call. They are just synonyms for the three values RWVOL, ROVOL,
- Name
- volser RW
- Value
- 0
- Description
- Specifies a read-write volume type.
- Name
- volser RO
- Value
- 1
- Description
- Specifies a read-only volume type.
- Name
- volser BACK
- Value
- 2
- Description
- Specifies a backup volume type.
Section 5.2.5: LWP State
- This set of exported definitions refers to objects internal to the Volume Server, and strictly speaking should not be visible to other agents. Specifically, a busyFlags array keeps a set of flags referenced by the set of lightweight threads running within the Volume Server. These flags reflect and drive the state of each of these worker LWPs.
- Name
- VHIdle
- Value
- 1
- Description
- Volume Server LWP is idle, waiting for new work.
- Name
- VHRequest
- Value
- 2
- Description
- A work item has been queued.
Section 5.2.6: States for struct vldbentry
- The Volume Server defines a collection of synonyms for certain values defined by the Volume Location Server. These particular constants are used within the flags field in objects of type struct vldbentry. The equivalent Volume Location Server values are described in Section 3.2.6.
- Name
- RW EXISTS
- Value
- 0x1000
- Description
- Synonym for VLF RWEXISTS.
- Name
- RO EXISTS
- Value
- 0x2000
- Description
- Synonym for VLF ROEXISTS.
- Name
- BACK EXISTS
- Value
- 0x4000
- Description
- Synonym for VLF BACKEXISTS.
- Name
- NEW REPSITE
- Value
- 0x01
- Description
- Synonym for VLSF NEWREPSITE.
- Name
- ITSROVOL
- Value
- 0x02
- Description
- Synonym for VLFS ROVOL.
- Name
- ITSRWVOL
- Value
- 0x04
- Description
- Synonym for VLSF RWVOL.
- Name
- ITSBACKVOL
- Value
- 0x08
- Description
- Synonym for VLSF BACKVOL.
Section 5.2.7: Validity Checks
- These values are used for performing validity checks. The first one appears only within the partFlags field within objects of type partList (see Section 5.4.3). The rest (except VOK and VBUSY) appear in the volFlags field within an object of type struct volDescription. These latter defintions are used within the volFlags field to mark whether the rest of the fields within the struct volDescription are valid. Note that while several constants are defined, only some are actually used internally by the Volume Server code.
- Name
- PARTVALID
- Value
- 0x01
- Description
- The indicated partition is valid.
- Name
- CLONEVALID
- Value
- 0x02
- Description
- The indicated clone (field volCloneId) is a valid one.
- Name
- CLONEZAPPED
- Value
- 0x04
- Description
- The indicated clone volume (field volCloneId) has been deleted.
- Name
- IDVALID
- Value
- 0x08
- Description
- The indicated volume ID (field volId) is valid.
- Name
- NAMEVALID
- Value
- 0x10
- Description
- The indicted volume name (field volName) is valid. Not used internally by the Volume Server.
- Name
- SIZEVALID
- Value
- 0x20
- Description
- The indicated volume size (field volSize) is valid. Not used internally by the Volume Server.
- Name
- ENTRYVALID
- Value
- 0x40
- Description
- The struct volDescription refers to a valid volume.
- Name
- REUSECLONEID
- Value
- 0x80
- Description
- The indicated clone ID (field volCloneId) should be reused.
- Name
- VOK
- Value
- 0x02
- Description
- Used in the status field of struct volintInfo to show that everything is OK.
- Name
- VBUSY
- Value
- 110
- Description
- Used in the status field of struct volintInfo to show that the volume is currently busy.
Section 5.2.8: Miscellaneous
- This section covers the set of exported Volume Server definitions that don't easily fall into the above categories.
- Name
- SIZE
- Value
- 1,024
- Description
- Not used internally by the Volume Server; used as a maxi¬mum size for internal character arrays.
- Name
- MAXHELPERS
- Value
- 10
- Description
- Size of an internal Volume Server character array (busyFlags), it marks the maximum number of threads within the server.
- Name
- STDERR
- Value
- stderr
- Description
- Synonym for the unix standard input file descriptor.
- Name
- STDOUT
- Value
- stdout
- Description
- Synonym for the unix standard output file descriptor.
Section 5.3: Exported Variables
- This section describes the single variable that the Volume Server exports to its applications.
- The QI GlobalWriteTrans exported variable represents a pointer to the head of the global queue of transaction structures for operations being handled by a Volume Server. Each object in this list is of type struct volser trans (see Section 5.4.1 below).
Section 5.4: Structures and Typedefs
- This section describes the major exported Volume Server data structures of interest to application programmers, along with some of the the typedefs based on those structures. Please note that typedefs in shose definitions angle brackets appear are those fed through the Rxgen RPC stub generator. Rxgen uses these angle brackets to specify an array of indefinite size.
Section 5.4.1: struct volser trans
- This structure defines the transaction record for all volumes upon which an active operation is proceeding.
Fields
- struct volser trans *next - Pointer to the next transaction structure in the queue.
- long tid - Transaction ID.
- long time - The time this transaction was last active, for timeout purposes.
- This is the standard unix time format.
- long creationTime - The time a which this transaction started.
- long returnCode - The overall transaction error code.
- struct Volume *volume - Pointer to the low-level object describing the associated volume. This is included here for the use of lower-level support code.
- long volid - The associated volume's numerical ID.
- long partition - The partition on which the given volume resides.
- long dumpTransId - Not used.
- long dumpSeq - Not used.
- short refCount - Reference count on this structure.
- short iflags - Initial attach mode flags.
- char vflags - Current volume status flags.
- char tflags - Transaction flags.
- char incremental - If non-zero, indicates that an incremental restore operation should be performed.
- char lastProcName[] - Name of the last internal Volume Server procedure that used this transaction. This field may be up to 30 characters long, including the trailing null, and is intended for debugging purposes only.
- struct rx call *rxCallPtr - Pointer to latest associated rx call. This field is intended for debugging purposes only.
Section 5.4.2: struct volDescription
- This structure is used by the AFS backup system to group certain key fields of volume information.
Fields
- char volName[] -The name of the given volume; maximum length of this string is VOLSER MAXVOLNAME characters, including the trailing null.
- long volId -The volume's numerical ID.
- int volSize -The size of the volume, in bytes.
- long volFlags -Keeps validity information on the given volume and its clones. This field takes on values from the set defined in Section 5.2.7
- long volCloneId -The volume's current clone ID.
Section 5.4.3: struct partList
- This structure is used by the backup system and the vos tool to keep track of the state of the AFS disk partitions on a given server.
Fields
- long partId[] -Set of 26 partition IDs.
- long partFlags[] -Set to PARTVALID if the associated partition slot corresponds to a valid partition. There are 26 entries in this array.
Section 5.4.4: struct volser status
- This structure holds the status of a volume as it is known to the Volume Server, and is passed to clients through the AFSVolGetStatus() interface call.
- Two fields appearing in this structure, accessDate and updateDate, deserve a special note. In particular, it is important to observe that these fields are not kept in full synchrony with reality. When a File Server provides one of its client Cache Managers with a chunk of a file on which to operate, it is incapable of determining exactly when the data in that chunk is accessed, or exactly when it is updated. This is because the manipulations occur on the client machine, without any information on these accesses or updates passed back to the server. The only time these fields can be modified is when the chunk of a file resident within the given volume is delivered to a client (in the case of accessDate), or when a client writes back a dirty chunk to the File Server (in the case of updateDate).
Fields
- long volID - The volume's numerical ID, unique within the cell.
- long nextUnique - Next value to use for a vnode uniquifier within this volume.
- int type - Basic volume class, one of RWVOL, ROVOL, or BACKVOL.
- long parentID - Volume ID of the parent, if this volume is of type ROVOL or BACKVOL.
- long cloneID - ID of the latest read-only clone, valid iff the type field is set to RWVOL.
- long backupID - Volume ID of the latest backup of this read-write volume.
- long restoredFromID - The volume ID contained in the dump from which this volume was restored. This field is used to simply make sure that an incremental dump is not restored on top of something inappropriate. Note that this field itself is not dumped.
- long maxQuota - The volume's maximum quota, in 1Kbyte blocks.
- long minQuota - The volume's minimum quota, in 1Kbyte blocks.
- long owner - The user ID of the person responsible for this volume.
- long creationDate - For a volume of type RWVOL, this field marks its creation date. For the original copy of a clone, this field represents the cloning date.
- long accessDate - Last access time by a user for this volume. This value is expressed as a standard unix longword date quantity.
- long updateDate - Last modification time by a user for this volume. This value is expressed as a standard unix longword date quantity.
- long expirationDate - Expiration date for this volume. If the volume never expires, then this field is set to zero.
- long backupDate - The last time a backup clone was created for this volume.
- long copyDate - The time that this copy of this volume was created.
Section 5.4.5: struct destServer
- Used to specify the destination server in an AFSVolForward() invocation (see Section 5.7.7).
Fields
- long destHost - The IP address of the destination server.
- long destPort - The UDP port for the Volume Server Rx service there.
- long destSSID - Currently, this field is always set to 1.
Section 5.4.6: struct volintInfo
- This structure is used to communicate volume information to the Volume Server's RPC clients. It is used to build the volEntries object, which appears as a parameter to the AFSVolListVolumes() call.
- The comments in Section 5.4.4 concerning the accessDate and updateDate fields are equally valid for the analogue fields in this structure.
Fields
- char name[] - The null-terminated name for the volume, which can be no longer than VNAMESIZE (32) characters, including the trailing null.
- long volid - The volume's numerical ID.
- long type - The volume's basic class, one of RWVOL, ROVOL, or BACKVOL.
- long backupID - The latest backup volume's ID.
- long parentID - The parent volume's ID.
- long cloneID - The latest clone volume's ID.
- long status - Status of the volume; may be one of VOK or VBUSY.
- long copyDate - The time that this copy of this volume was created.
- unsigned char inUse - If non-zero, an indication that this volume is online.
- unsigned char needsSalvaged - If non-zero, an indication that this volume needs to be salvaged.
- unsigned char destroyMe - If non-zero, an indication that this volume should be destroyed.
- long creationDate - Creation date for a read/write volume; cloning date for the original copy of a read-only volume.
- long accessDate - Last access time by a user for this volume.
- long updateDate - Last modification time by a user for this volume.
- long backupDate - Last time a backup copy was made of this volume.
- int dayUse - Number of times this volume was accessed since midnight of the current day.
- int filecount - the number of file system objects contained within the volume.
- int maxquota - The upper limit on the number of 1-Kbyte disk blocks of storage that this volume may obtain.
- int size - Not known.
- long flags - Values used by the backup system are stored here.
- long spare1 -spare3 -Spare fields, reserved for future use.
Section 5.4.7: struct transDebugInfo
- This structure is provided for monitoring and debugging purposes. It is used to compose the transDebugEntries variable-sized object, which in turn appears as a parameter to the AFSVolMonitor() interface call.
Fields
- long tid - The transaction ID.
- long time - The time when the transaction was last active, for timeout purposes.
- long creationTime - The time the transaction started.
- long returnCode - The overall transaction error code.
- long volid - The open volume's ID.
- long partition - The open volume's partition.
- short iflags - Initial attach mode flags (IT*).
- char vflags - Current volume status flags (VT*).
- char tflags - Transaction flags (TT*).
- char lastProcName[] - The string name of the last procedure which used transaction. This field may be up to 30 characters long, including the trailing null, and is intended for debugging purposes only.
- int callValid - Flag which determines if the following fields are valid.
- long readNext - Sequence number of the next Rx packet to be read.
- long transmitNext - Sequence number of the next Rx packet to be transmitted.
- int lastSendTime - The last time anything was sent over the wire for this transaction.
- int lastReceiveTime - The last time anything was received over the wire for this transaction.
Section 5.4.8: struct pIDs
- Used by the AFSVolListPartitions() interface call, this structure is used to store information on all of the partitions on a given Volume Server.
Fields
- long partIds[] - One per letter of the alphabet (/vicepa through /vicepz). Filled with 0 for "/vicepa", 25 for "/vicepz". Invalid partition slots are filled in with a -1.
Section 5.4.9: struct diskPartition
- This structure contains information regarding an individual AFS disk partition. It is returned as a parameter to the AFSVolPartitionInfo() call.
Fields
- char name[] -Mounted partition name, up to 32 characters long including the trailing null.
- char devName[] -Device name on which the partition lives, up to 32 characters long including the trailing null.
- int lock fd -A lock used for mutual exclusion to the named partition. A value of -1 indicates the lock is not currently being held. Otherwise, it has the file descriptor resulting from the unix open() call on the file specified in the name field used to "acquire" the lock.
- int totalUsable - The number of blocks within the partition which are available.
- int free - The number of free blocks in the partition.
- int minFree - The minimum number of blocks that must remain free regardless of allocation requests.
Section 5.4.10: struct restoreCookie
- Used as a parameter to both AFSVolRestore() and AFSVolForward(),a restoreCookie keeps information that must be preserved between various Volume Server operations.
Fields
- char name[] - The volume name, up to 32 characters long including the trailing null.
- long type - The volume type, one of RWVOL, ROVOL, and BACKVOL.
- long clone - The current read-only clone ID for this volume.
- long parent - The parent ID for this volume.
Section 5.4.11: transDebugEntries
typedef transDebugInfo transDebugEntries<>;
- This typedef is used to generate a variable-length object which is passed as a parameter to the AFSVolMonitor() interface function. Thus, it may carry any number of descriptors for active transactions on the given Volume Server. Specifi, it causes a C structure of the same name to be defined with the following fields:
Fields
- u int transDebugEntries len - The number of struct transDebugInfo (see Section 5.4.7) objects appearing at the memory location pointed to by the transDebugEntries val field.
- transDebugInfo *transDebugEntries val - A pointer to a region of memory containing an array of transDebugEntries len objects of type struct transDebugInfo.
Section 5.4.12: volEntries
typedef volintInfo volEntries<>;
- This typedef is used to generate a variable-length object which is passed as a parameter to AFSVolListVolumes(). Thus, it may carry any number of descriptors for volumes on the given Volume Server. Specifically, it causes a C structure of the same name to be defined with the following fields:
Fields
- u int volEntries len - The number of struct volintInfo (see Section 5.4.6) objects appearing at the memory location pointed to by the volEntries val field.
- volintInfo *volEntries val -A pointer to a region of memory containing an array of volEntries len objects of type struct volintInfo.
Section 5.5: Error Codes
- The Volume Server advertises two groups of error codes. The first set consists of the standard error codes defined by the package. The second is a collection of lower-level return values which are exported here for convenience.
- Name
- VOLSERTRELE ERROR
- Value
- 1492325120L
- Description
- internal error releasing transaction.
- Name
- VOLSERNO OP
- Value
- 1492325121L
- Description
- unknown internal error.
- Name
- VOLSERREAD DUMPERROR
- Value
- 1492325122L
- Description
- badly formatted dump.
- Name
- VOLSERDUMPERROR
- Value
- 1492325123L
- Description
- badly formatted dump(2).
- Name
- VOLSERATTACH ERROR
- Value
- 1492325124L
- Description
- could not attach volume.
- Name
- VOLSERILLEGAL PARTITION
- Value
- 1492325125L
- Description
- illegal partition.
- Name
- VOLSERDETACH ERROR
- Value
- 1492325126L
- Description
- could not detach volume.
- Name
- VOLSERBAD ACCESS
- Value
- 1492325127L
- Description
- insufficient privilege for volume operation.
- Name
- VOLSERVLDB ERROR
- Value
- 1492325128L
- Description
- error from volume location database.
- Name
- VOLSERBADNAME
- Value
- 1492325129L
- Description
- bad volume name.
- Name
- VOLSERVOLMOVED
- Value
- 1492325130L
- Description
- volume moved.
- Name
- VOLSERBADOP
- Value
- 1492325131L
- Description
- illegal volume operation.
- Name
- VOLSERBADRELEASE
- Value
- 1492325132L
- Description
- volume release failed.
- Name
- VOLSERVOLBUSY
- Value
- 1492325133L
- Description
- volume still in use by volserver.
- Name
- VOLSERNO MEMORY
- Value
- 1492325134L
- Description
- out of virtual memory in volserver.
- Name
- VOLSERNOVOL
- Value
- 1492325135L
- Description
- no such volume.
- Name
- VOLSERMULTIRWVOL
- Value
- 1492325136L
- Description
- more than one read/write volume.
- Name
- VOLSERFAILEDOP
- Value
- 1492325137L
- Description
- failed volume server operation.
Section 5.5.1: Standard
- The error codes described in this section were defined by the Volume Server to describe exceptional conditions arising in the course of RPC call handling.
Section 5.5.2: Low-Level
- These error codes are duplicates of those defined from a package which is internal to the Volume Server. They are re-defined here to make them visible to Volume Server clients.
- Name
- VSALVAGE
- Value
- 101
- Description
- Volume needs to be salvaged.
- Name
- VNOVNODE
- Value
- 102
- Description
- Bad vnode number encountered.
- Name
- VNOVOL
- Value
- 103
- Description
- The given volume is either not attached, doesn't exist, or is not online.
- Name
- VVOLEXISTS
- Value
- 104
- Description
- The given volume already exists.
- Name
- VNOSERVICE
- Value
- 105
- Description
- The volume is currently not in service.
- Name
- VOFFLINE
- Value
- 106
- Description
- The specified volume is offline, for the reason given in the offline message field (a subfield within the volume field in struct volser trans).
- Name
- VONLINE
- Value
- 107
- Description
- Volume is already online.
- Name
- VDISKFULL
- Value
- 108
- Description
- The disk partition is full.
- Name
- VOVERQUOTA
- Value
- 109
- Description
- The given volume's maximum quota, as expressed in the maxQuota field of the struct volintInfo, has been exceeded.
- Name
- VBUSY
- Value
- 110
- Description
- The named volume is temporarily unavailable, and the client is encouraged to retry the operation shortly.
- Name
- VMOVED
- Value
- 111
- Description
- The given volume has moved to a new server.
- The VICE SPECIAL ERRORS constant is defined to be the lowest of these error codes.
Section 5.6: Macros
- The Volume Server defines a small number of macros, as described in this section.
Section 5.6.1: THOLD()
#define THOLD(tt) ((tt)->refCount++)
- This macro is used to increment the reference count field, refCount, in an object of type struct volser trans. Thus, the associated transaction is effectively "held" insuring it won't be garbage-collected. The counterpart to this operation, TRELE(), is implemented by the Volume Server as a function.
Section 5.6.2: ISNAMEVALID()
#define ISNAMEVALID(name) (strlen(name) < (VOLSER_OLDMAXVOLNAME -9))
- This macro checks to see if the given name argument is of legal length. It must be no more than the size of the container, which is at most VOLSER OLDMAXVOLNAME characters, minus the length of the longest standardized volume name postfix known to the system. That postfix is the 9-character .restored string, which is tacked on to the name of a volume that has been restored from a dump.
Section 5.7: Functions
- This section covers the Volume Server RPC interface routines, defined by and generated from the volint.xg Rxgen file. The following is a summary of the interface functions and their purpose:
- Fcn Name
- AFSVolCreateVolume
- Description
- Create a volume.
- Fcn Name
- AFSVolDeleteVolume
- Description
- Delete a volume.
- Fcn Name
- AFSVolNukeVolume
- Description
- Obliterate a volume completely.
- Fcn Name
- AFSVolDump
- Description
- Dump (i.e., save) the contents of a volume.
- Fcn Name
- AFSVolSignalRestore
- Description
- Show intention to call AFSVolRestore().
- Fcn Name
- AFSVolRestore
- Description
- Recreate a volume from a dump.
- Fcn Name
- AFSVolForward
- Description
- Dump a volume, then restore to a given server and volume.
- Fcn Name
- AFSVolClone
- Description
- Clone (and optionally purge) a volume.
- Fcn Name
- AFSVolReClone
- Description
- Re-clone a volume.
- Fcn Name
- AFSVolSetForwarding
- Description
- Set forwarding info for a moved volume.
- Fcn Name
- AFSVolTransCreate
- Description
- Create transaction for a [volume, partition].
- Fcn Name
- AFSVolEndTrans
- Description
- End a transaction.
- Fcn Name
- AFSVolGetFlags
- Description
- Get volume flags for a transaction.
- Fcn Name
- AFSVolSetFlags
- Description
- Set volume flags for a transaction.
- Fcn Name
- AFSVolGetName
- Description
- Get the volume name associated with a transaction.
- Fcn Name
- AFSVolGetStatus
- Description
- Get status of a transaction/volume.
- Fcn Name
- AFSVolSetIdsTypes
- Description
- Set header info for a volume.
- Fcn Name
- AFSVolSetDate
- Description
- Set creation date in a volume.
- Fcn Name
- AFSVolListPartitions
- Description
- Return a list of AFS partitions on a server.
- Fcn Name
- AFSVolPartitionInfo
- Description
- Get partition information.
- Fcn Name
- AFSVolListVolumes
- Description
- Return a list of volumes on the server.
- Fcn Name
- AFSVolListOneVolume
- Description
- Return header info for a single volume.
- Fcn Name
- AFSVolGetNthVolume
- Description
- Get volume header given its index.
- Fcn Name
- AFSVolMonitor
- Description
- Collect server transaction state.
- There are two general comments that apply to most of the Volume Server interface routines:
- 1. AFS partitions are identified by integers ranging from 0 to 25, corresponding to the letters "a" through "z". By convention, AFS partitions are named /vicepx, where x is any lower-case letter.
- 2. Legal volume types to pass as parameters are RWVOL, ROVOL, and BACKVOL, as defined in Section 3.2.4.
Section 5.7.1: AFSVolCreateVolume - Create a
volume
int AFSVolCreateVolume(IN struct rx connection *z conn,
IN long partition,
IN char *name,
IN long type,
IN long parent,
INOUT long *volid,
OUT long *trans)
- Description
- Create a volume named name, with numerical identifier volid, and of type type. The new volume is to be placed in the specified partition for the server machine as identified by the Rx connection information pointed to by z conn. If a value of 0 is provided for the parent argument, it will be set by the Volume Server to the value of volid itself. The trans parameter is set to the Volume Location Server transaction ID corresponding to the volume created by this call, if successful. The numerical volume identifier supplied in the volid parameter must be generated beforehand by calling VL GetNewVolumeID() (see Section 3.6.5). After AFSVolCreateVolume() completes correctly, the new volume is marked as offline. It must be explicitly brought online through a call to AFSVolSetFlags() (see Section 5.7.14) while passing the trans transaction ID generated by AFSVolCreateVolume(). The "hold" on the new volume guaranteed by the trans transaction may be "released" by calling AFSVolEnd-Trans(). Until then, no other process may operate on the volume. Upon creation, a volume's maximum quota (as specified in the maxquota field of a struct volintInfo) is set to 5,000 1-Kbyte blocks. Note that the AFSVolCreateVolume() routine is the only Volume Server function that manufactures its own transaction. All others must have already acquired a transaction ID via either a previous call to AFSVolCreateVolume() or AFSVolTransCreate().
- Error Codes
- VOLSERBADNAME The volume name parameter was longer than 31 characters plus the trailing null.
VOLSERBAD ACCESS The caller is not authorized to create a volume.
EINVAL The type parameter was illegal. E2BIG A value of 0 was provided in the volid parameter. VOLSERVOLBUSY A transaction could not be created, thus the given volume was busy.
EIO The new volume entry could not be created.
VOLSERTRELE ERROR The trans transaction's reference count could not be dropped to the proper level.
<misc> If the partition parameter is unintelligible, this routine will return a low-level unix error.
Section 5.7.2: AFSVolDeleteVolume - Delete a
volume
int AFSVolDeleteVolume(IN struct rx connection *z conn, IN long trans)
- Description
- Delete the volume associated with the open transaction ID specified within trans. All of the file system objects contained within the given volume are destroyed, and the on-disk volume metadata structures are reclaimed. In addition, the in-memory volume descriptor's vflags field is set to VTDeleted, indicating that it has been deleted.
- Under some circumstances, a volume should be deleted by calling AFSVolNukeVolume() instead of this routine. See Section 5.7.3 for more details.
- Error Codes
- VOLSERBAD ACCESS The caller is not authorized to delete a volume.
ENOENT The trans transaction was not found.
VOLSERTRELE ERROR The trans transaction's reference count could not be dropped to the proper level.
Section 5.7.3: AFSVolNukeVolume - Obliterate a
volume completely
int AFSVolNukeVolume(IN struct rx connection *z conn,
IN long partID,
IN long volID)
- Description
- Completely obliterate the volume living on partition partID whose ID is volID. This involves scanning all inodes on the given partition and removing those marked with the specified volID. If the volume is a read-only clone, only the header inodes are removed, since they are the only ones stamped with the read-only ID. To reclaim the space taken up by the actual data referenced through a read-only clone, this routine should be called on the read-write master. Note that calling AFSVolNukeVolume() on a read-write volume effectively destroys all the read-only volumes cloned from it, since everything except for their indicies to the (now-deleted) data will be gone.
- Under normal circumstances, it is preferable to use AFSVolDeleteVolume() instead of AFSVolNukeVolume() to delete a volume. The former is much more efficient, as it only touches those objects in the partition that belong to the named volume, walking the on-disk volume metadata structures. However, AFSVolNukeVolume() must be used in situations where the volume metadata structures are known to be damaged. Since a complete scan of all inodes in the partition is performed, all disconnected or unreferenced portions of the given volume will be reclaimed.
- Error Codes
- VOLSERBAD ACCESS The caller is not authorized to call this routine.
VOLSERNOVOL The partition specified by the partID argument is illegal.
Section 5.7.4: AFSVolDump - Dump (i.e., save) the
contents of a volume
int AFSVolDump(IN struct rx connection *z conn,
IN long fromTrans,
IN long fromDate)
- Description
- Generate a canonical dump of the contents of the volume associated with transaction fromTrans as of calendar time fromDate. If the given fromDate is zero, then a full dump will be carried out. Otherwise, the resulting dump will be an incremental one.
- This is specified as a split function within the volint.xg Rxgen interface file. This specifies that two routines are generated, namely StartAFSVolDump() and EndAFSVolDump(). The former is used to marshall the IN arguments, and the latter is used to unmarshall the return value of the overall operation. The actual dump data appears in the Rx stream for the call (see the section entitled Example Server and Client in the companion AFS-3 Programmer's Reference: Specification for the Rx Remote Procedure Call Facility document).
- Error Codes
- VOLSERBAD ACCESS The caller is not authorized to dump a volume.
ENOENT The fromTrans transaction was not found.
VOLSERTRELE ERROR The trans transaction's reference count could not be dropped to the proper level.
Section 5.7.5: AFSVolSignalRestore - Show
intention to call AFSVolRestore()
int AFSVolSignalRestore(IN struct rx connection *z conn,
IN char *name,
IN int type,
IN long pid,
IN long cloneid)
- Description
- Show an intention to the Volume Server that the client will soon call AFSVolRestore(). The parameters, namely the volume name, type, parent ID pid and clone ID cloneid are stored in a well-known set of global variables. These values are used to set the restored volume's header, overriding those values present in the dump from which the volume will be resurrected.
- Error Codes
- VOLSERBAD ACCESS The caller is not authorized to call this routine.
VOLSERBADNAME The volume name contained in name was longer than 31 characters plus the trailing null.
Section 5.7.6: AFSVolRestore - Recreate a volume
from a dump
int AFSVolRestore(IN struct rx connection *z conn,
IN long toTrans,
IN long flags,
IN struct restoreCookie *cookie)
- Description
- Interpret a canonical volume dump (generated as the result of calling AFSVolDumpVolume()), passing it to the volume specified by the toTrans transaction. Only the low bit in the flags argument is inspected. If this low bit is turned on, the dump will be restored as incremental; otherwise, a full restore will be carried out.
- All callbacks to the restored volume are broken.
- This is specified as a split function within the volint.xg Rxgen interface file. This specifies that two routines are generated, namely StartAFSVolRestore() and EndAFSVolRestore() . The former is used to marshall the IN arguments, and the latter is used to unmarshall the return value of the overall operation. The actual dump data flows over the Rx stream for the call (see the section entitled Example Server and Client in the companion AFS-3 Programmer's Reference: Specification for the Rx Remote Procedure Call Facility document).
- The AFSVolSignalRestore() routine (see Section 5.7.5) should be called before invoking this function in order to signal the intention to restore a particular volume.
- Error Codes
- VOLSERREAD DUMPERROR Dump data being restored is corrupt.
VOLSERBAD ACCESS The caller is not authorized to restore a volume.
ENOENT The fromTrans transaction was not found.
VOLSERTRELE ERROR The trans transaction's reference count could not be dropped to the proper level.
Section 5.7.7: AFSVolForward - Dump a volume, then
restore to given server and volume
int AFSVolForward(IN struct rx connection *z conn,
IN long fromTrans,
IN long fromDate,
IN struct destServer *destination,
IN long destTrans,
IN struct restoreCookie *cookie)
- Description
- Dumps the volume associated with transaction fromTrans from the given fromDate. The dump itself is sent to the server described by destination, where it is restored as the volume associated with transaction destTrans. In reality, an Rx connection is set up to the destServer, StartAFSVolRestore() directs writing to the Rx call's stream, and then EndAFSVolRestore() is used to deliver the dump for the volume corresponding to fromTrans. If a non-zero fromDate is provided, then the dump will be incremental from that date. Otherwise, a full dump will be delivered.
- The Rx connection set up for this task is always destroyed before the function returns. The destination volume should exist before carrying out this operation, and the invoking process should have started transactions on both participating volumes.
- Error Codes
- VOLSERBAD ACCESS The caller is not authorized to forward a volume.
ENOENT The fromTrans transaction was not found.
VOLSERTRELE ERROR The trans transaction's reference count could not be dropped to the proper level.
ENOTCONN An Rx connection to the destination server could not be established.
Section 5.7.8: AFSVolClone - Clone (and optionally
purge) a volume
int AFSVolClone(IN struct rx connection *z conn,
IN long trans,
IN long purgeVol,
IN long newType,
IN char *newName,
INOUT long *newVol)
- Description
- Make a clone of the read-write volume associated with transaction trans, giving the cloned volume a name of newName. The newType parameter specifies the type for the new clone, and may be either ROVOL or BACKVOL. If purgeVol is set to a non-zero value, then that volume will be purged during the clone operation. This may be more efficient that separate clone and purge calls when making backup volumes. The newVol parameter sets the new clone's ID. It is illegal to pass a zero in newVol.
- Error Codes
- VOLSERBADNAME The volume name contained in newName was longer than 31 characters plus the trailing null.
VOLSERBAD ACCESS The caller is not authorized to clone a volume.
ENOENT The fromTrans transaction was not found.
VOLSERTRELE ERROR The trans transaction's reference count could not be dropped to the proper level.
VBUSY The given transaction was already in use; indicating that someone else is currently manipulating the specified clone.
EROFS The volume associated with the given trans is read-only (either ROVOL or BACKVOL).
EXDEV The volume associated with the trans transaction and the one specified by purgeVol must be on the same disk device, and they must be cloned from the same parent volume.
EINVAL The purgeVol must be read-only, i.e. either type ROVOL or BACKVOL.
Section 5.7.9: AFSVolReClone - Re-clone a volume
int AFSVolReClone(IN struct rx connection *z conn,
IN long tid,
IN long cloneID)
- Description
- Recreate an existing clone, with identifier cloneID, from the volume associated with transaction tid.
- Error Codes
- VOLSERBAD ACCESS The caller is not authorized to clone a volume.
ENOENT The tid transaction was not found.
VOLSERTRELE ERROR The tid transaction's reference count could not be dropped to the proper level.
VBUSY The given transaction was already in use; indicating that someone else is currently manipulating the specified clone.
EROFS The volume to be cloned must be read-write (of type RWVOL).
EXDEV The volume to be cloned and the named clone itself must be on the same device. Also, cloneID must have been cloned from the volume associated with transaction tid.
EINVAL The target clone must be a read-only volume (i.e., of type ROVOL or BACKVOL).
Section 5.7.10: AFSVolSetForwarding - Set
forwarding info for a moved volume
int AFSVolSetForwarding(IN struct rx connection *z conn,
IN long tid,
IN long newsite)
- Description
- Record the IP address specified within newsite as the location of the host which now hosts the volume associated with transaction tid, formerly resident on the current host. This is intended to gently guide Cache Managers who have stale volume location cached to the volume's new site, ensuring the move is transparent to clients using that volume.
- Error Codes
- VOLSERBAD ACCESS The caller is not authorized to create a forwarding address.
ENOENT The trans transaction was not found.
Section 5.7.11: AFSVolTransCreate - Create
transaction for a [volume, partition]
int AFSVolTransCreate(IN struct rx connection *z conn,
IN long volume,
IN long partition,
IN long flags,
OUT long *trans)
- Description
- Create a new Volume Server transaction associated with volume ID volume on partition partition. The type of volume transaction is specified by the flags parameter. The values in flags specify whether the volume should be treated as busy (ITBusy), offline (ITOffline), or in shared read-only mode (ITReadOnly). The identifier for the new transaction built by this function is returned in trans.
- Creating a transaction serves as a signal to other agents that may be interested in accessing a volume that it is unavailable while the Volume Server is manipulating it. This prevents the corruption that could result from multiple simultaneous operations on a volume.
- Error Codes
- EINVAL Illegal value encountered in flags.
VOLSERVOLBUSY A transaction could not be created, thus the given [volume, partition] pair was busy.
VOLSERTRELE ERROR The trans transaction's reference count could not be dropped to the proper level after creation.
Section 5.7.12: AFSVolEndTrans - End a
transaction
int AFSVolEndTrans(IN struct rx connection *z conn,
IN long trans,
OUT long *rcode)
- Description
- End the transaction identified by trans, returning its final error code into rcode. This makes the associated [volume, partition] pair eligible for further Volume Server operations.
- Error Codes
- VOLSERBAD ACCESS The caller is not authorized to create a transaction.
ENOENT The trans transaction was not found.
Section 5.7.13: AFSVolGetFlags - Get volume flags
for a transaction
int AFSVolGetFlags(IN struct rx connection *z conn,
IN long trans,
OUT long *flags)
- Description
- Return the value of the vflags field of the struct volser trans object describing the transaction identified as trans. The set of values placed in the flags parameter is described in Section 5.2.3.1. Briefly, they indicate whether the volume has been deleted (VTDeleted), out of service (VTOutOfService), or marked delete-on-salvage (VTDeleteOnSalvage).
- Error Codes
- ENOENT The trans transaction was not found.
VOLSERTRELE ERROR The trans transaction's reference count could not be dropped to the proper level.
Section 5.7.14: AFSVolSetFlags - Set volume flags
for a transaction
int AFSVolSetFlags(IN struct rx connection *z conn,
IN long trans,
IN long flags)
- Description
- Set the value of the vflags field of the struct volser trans object describing the transaction identified as trans to the contents of flags. The set of legal values for the flags parameter is described in Section 5.2.3.1. Briefly, they indicate whether the volume has been deleted (VTDeleted), out of service (VTOutOfService), or marked delete-onsalvage (VTDeleteOnSalvage).
- Error Codes
- ENOENT The trans transaction was not found.
EROFS Updates to this volume are not allowed.
VOLSERTRELE ERROR The trans transaction's reference count could not be dropped to the proper level.
Section 5.7.15: AFSVolGetName - Get the volume
name associated with a transaction
int AFSVolGetName(IN struct rx connection *z conn,
IN long tid,
OUT char **tname)
- Description
- Given a transaction identifier tid, return the name of the volume associated with the given transaction. The tname parameter is set to point to the address of a string buffer of at most 256 chars containing the desired information, which is created for this purpose. Note: the caller is responsible for freeing the buffer pointed to by tname when its information is no longer needed.
- Error Codes
- ENOENT The tid transaction was not found, or a volume was not associated with it (VSrv internal error).
E2BIG The volume name was too big (greater than or equal to SIZE (1,024) characters.
VOLSERTRELE ERROR The trans transaction's reference count could not be dropped to the proper level.
Section 5.7.16: AFSVolGetStatus - Get status of a
transaction/volume
int AFSVolGetStatus(IN struct rx connection *z conn,
IN long tid,
OUT struct volser status *status)
- Description
- This routine fills the status structure passed as a parameter with status information for the volume identified by the transaction identified by tid, if it exists. Included in this status information are the volume's ID, its type, disk quotas, the IDs of its clones and backup volumes, and several other administrative details.
- Error Codes
- ENOENT The tid transaction was not found.
VOLSERTRELE ERROR The tid transaction's reference count could not be dropped to the proper level.
Section 5.7.17: AFSVolSetIdsTypes - Set header
info for a volume
int AFSVolSetIdsTypes(IN struct rx connection *z conn,
IN long tId
IN char *name,
IN long type,
IN long pId,
IN long cloneId,
IN long backupId)
- Description
- The transaction identifed by tId is located, and the values supplied for the volume name, volume type, parent ID pId, clone ID cloneId and backup ID backupId are recorded into the given transaction.
- Error Codes
- ENOENT The tId transaction was not found.
VOLSERBAD ACCESS The caller is not authorized to call this routine.
VOLSERBADNAME The volume name contained in name was longer than 31 characters plus the trailing null.
VOLSERTRELE ERROR The tId transaction's reference count could not be dropped to the proper level.
Section 5.7.18: AFSVolSetDate - Set creation date
in a volume
int AFSVolSetDate(IN struct rx connection *z conn,
IN long tid,
IN long newDate)
- Description
- Set the creationDate of the struct volintInfo describing the volume associated with transaction tid to newDate.
- Error Codes
- VOLSERBAD ACCESS The caller is not authorized to call this routine.
ENOENT The tId transaction was not found.
VOLSERTRELE ERROR The tid transaction's reference count could not be dropped to the proper level.
Section 5.7.19: AFSVolListPartitions - Return a
list of AFS partitions on a server
int AFSVolListPartitions(IN struct rx connection *z conn,
OUT struct pIDs *partIDs)
- Description
- Return a list of AFS partitions in use by the server processing this call. The output parameter is the fixed-length partIDs array, with one slot for each of 26 possible partitions. By convention, AFS partitions are named /vicepx, where x is any letter. The /vicepa partition is represented by a zero in this array, /vicepa bya1, andsoon. Unused partitions are represented by slots filled with a -1.
- Error Codes
- —None.
Section 5.7.20: AFSVolPartitionInfo - Get
partition information
int AFSVolPartitionInfo(IN struct rx connection *z conn,
IN char *name,
OUT struct diskPartition *partition)
- Description
- Collect information regarding the partition with the given character string name, and place it into the partition object provided.
- Error Codes
- VOLSERBAD ACCESS The caller is not authorized to call this routine.
VOLSERILLEGAL PARTITION An illegal partition was specified by name
Section 5.7.21: AFSVolListVolumes - Return a list
of volumes on the server
int AFSVolListVolumes(IN struct rx connection *z conn,
IN long partID,
IN long flags,
OUT volEntries *resultEntries)
- Description
- Sweep through all the volumes on the partition identified by partid, filling in consecutive records in the resultEntries object. If the flags parameter is set to a non-zero value, then full status information is gathered. Otherwise, just the volume ID field is written for each record. The fields for a volEntries object like the one pointed to by resultEntries are described in Section 5.4.6, which covers the struct volintInfo definition.
- Error Codes
- VOLSERILLEGAL PARTITION An illegal partition was specified by partID
VOLSERNO MEMORY Not enough memory was available to hold all the required entries within resultEntries.
Section 5.7.22: AFSVolListOneVolume - Return
header info for a single volume
int AFSVolListOneVolume(IN struct rx connection *z conn,
IN long partID,
IN long volid,
OUT volEntries *resultEntries)
- Description
- Find the information for the volume living on partition partID whose ID is volid, and place a single struct volintInfo entry within the variable-size resultEntries object.
- This is similar to the AFSVolListVolumes() call, which returns information on all volumes on the specified partition. The full volume information is always written into the returned entry (equivalent to setting the flags argument to AFSVolListVolumes() to a non-zero value).
- Error Codes
- VOLSERILLEGAL PARTITION An illegal partition was specified by partID
ENODEV The given volume was not found on the given partition.
header given its index
int AFSVolGetNthVolume(IN struct rx connection *z conn,
IN long index,
OUT long *volume,
OUT long *partition)
- Description
- Using index as a zero-based index into the set of volumes hosted by the server chosen by the z conn argument, return the volume ID and partition of residence for the given index. This functionality has not yet been implemented.
- Error Codes
- VOLSERNO OP Not implemented.
transaction state
int AFSVolMonitor(IN struct rx connection *z conn,
OUT transDebugEntries *result)
- Description
- This call allows the transaction state of a Volume Server to be monitored for debugging purposes. Anyone wishing to supervise this Volume Server state may call this routine, causing all active transactions to be recorded in the given result object.
- Error Codes
- —None.