3.11 Reservation Class

This section covers the following topics:

The reservation class manages all the reservation objects. The reservation is a means of establishing access control for storage resources. A reservation object describes the relationship between an application object and an IO object.

An application must first reserve an IO object before IO can take place on the IO object. The MM_ReserveIOObject is used to establish the reservation, and create the reservation object.

There are two forms of IO, one for operations relative to the data being read or written, the other relative to the control of the storage device or media itself. As a result, there are two, mutually exclusive, modes of reservation, an IO mode and a control mode. In addition, there are modifiers to the reservation mode.

Mode

Modifier

MM_IO_MODE

MM_SHARED_READ_RESERVE

MM_CONTROL_MODE

MM_SHARED_RESERVE

 

MM_SHARED_PRIMARY_RESERVE

 

MM_RERESERVE

3.11.1 Shared Reservation

Three of the reservation mode modifiers indicate some form of shared reservation. Shared reservations are a way of allowing multiple applications shared IO access to an IO object. In order for a shared reservation to take place, the first application to make a reservation on an IO object must indicate that shared reservations will be considered by adding into the reservation mode one of the shared reservation modifiers. The first reservation then becomes the primary reservation.

When a subsequent reservation is attempted on the IO object, and the reservation mode and modifier is the same as the primary reservation, then the application possessing the primary reservation is notified, through the reservation alert routine, that a shared reservation is requested. The application then can either grant or deny the reservation request, based on the information passed to the alert routine.

The parameters passed to the alert routine for a shared reservation request are slightly different from other events. The eventType parameter is MM_ALERT_SHARED_RESERVE_REQUEST and the alertReason parameter is a pointer to the SharedReserveRequestDef structure. The information in the structure allows the application to make an intelligent decision whether to grant or deny the reservation request. If the application grants the shared request, it must return MM_SHARED_RESERVE_GRANTED from the alert routine; otherwise, it must return MM_SHARED_RESERVE_DENIED.

3.11.2 Secondary Reservation

When an application possessing a primary reservation grants a shared reservation, the granted reservation is considered a secondary reservation, except in the case of the MM_SHARED_PRIMARY_RESERVE modifier. When a primary reservation is released, all associated secondary reservations are also released.

If no shared reservation modifier is added to the mode, the reservation is considered exclusive, meaning that the reserved IO object cannot be shared with another application.

3.11.3 Reservation Modes

This section covers the following topics:

MM_IO_MODE

IO mode is used for reading and writing data to media. Only IO Function Operations can be submitted to the IO object while reserved in this mode.

MM_CONTROL_MODE

Control mode is used to manage media and/or devices. Only Control Function Operations can be submitted to the IO object while reserved in this mode.

3.11.4 Reservation Mode Modifier

This section covers the following topics:

MM_SHARED_READ_RESERVE

Indicates that only a shared read-only reservation will be considered by the application possessing the primary reservation.

MM_SHARED_RESERVE

Indicates that a read/write reservation will be considered by the application possessing the primary reservation.

MM_SHARED_PRIMARY_RESERVE

Indicates that ALL applications possessing a primary reservation on the desired IO object will consider allowing shared primary read/write reservations. Each application must consent to the reservation before it can be granted. A shared primary reservation is not released when the granting application releases its reservation.

MM_RERESERVE

A re-reserve changes the mode of the reservation without having to first release the reservation. Only the primary reservation holder can re-reserve an IO object. Re-reserving an IO object forces the release of all associated secondary reservations. This modifier can also be used to re- reserve an IO object in the same mode for the sole purpose of forcing the release of secondary reservations. Re-reserving an IO object does not register a new reservation object.