Specifications
OpenVMS System Routines Called by OpenVMS AXP Device Drivers
IOC$ALLOC_CRAB
Return Values
SS$_BADPARAM Specified allocation granularity is larger than the
specified item count.
SS$_NORMAL The routine completed successfully.
SS$_INSFMEM Memory allocation request failed.
Description
A driver calls IOC$ALLOC_CRAB to allocate a counted resource allocation block
(CRAB) that describes a counted resource. A counted resources, such as a set of
map registers, has the following attributes:
• The resource consists of an ordered set of items.
• The allocator can request one or more items. When requesting multiple items,
the requester expects to receive a contiguous set of items. Thus, allocated
items can be described by a starting number and a count.
• Allocation and deallocation of the resource are common operations and, thus,
must be efficient and quick.
• A single deallocation may allow zero or more stalled allocation requests to
proceed.
IOC$ALLOC_CRAB computes the size of the CRAB as the sum of the fixed
portion of the CRAB, plus the maximum number of descriptors required in the
allocation array. It then calls EXE$ALONONPAGED to allocate the CRAB. If the
allocation request succeeds, IOC$ALLOC_CRAB initializes the CRAB as follows
and returns SS$_NORMAL to its caller:
Field Description
CRAB$W_SIZE Size of the CRAB in bytes
CRAB$B_TYPE DYN$C_MISC
CRAB$B_SUBTYPE DYN$C_CRAB
CRAB$L_WQFL CRAB$L_WQFL
CRAB$L_WQBL CRAB$L_WQFL
CRAB$L_TOTAL_ITEMS Contents of the item_cnt argument
CRAB$L_ALLOC_GRAN_
MASK
One less than the contents of the req_alloc_gran
argument (rounded up to the next highest power of
two if the value specified is not a power of two)
CRAB$L_VALID_DESC_
CNT
1
CRAB$L_SPINLOCK Address of dynamic spin lock used to synchronize
access to this CRAB. Currently, CRAB spin locks
are obtained at IPL$_IOLOCK11.
IOC$ALLOC_CRAB initializes the first descriptor in the allocation array to
indicate a set of item_cnt items of the resource, starting at item 0.
A–7