Initialize, set, clear or check bits in a SRV_MASK_ARRAY structure.
CS_RETCODE srv_mask(cmd, maskp, bit, infop)
CS_INT cmd; SRV_MASK_ARRAY *maskp; CS_INT bit; CS_BOOL *infop;
The action being performed. The following table summarizes the legal values for cmd:
Value |
Action |
---|---|
CS_SET |
Set the bit in the SRV_MASK_ARRAY in *maskp. |
CS_GET |
Find out whether the bit is currently set in the SRV_MASK_ARRAY in *maskp. If bit is set, *infop is set to CS_TRUE. Otherwise, it is set to CS_FALSE. |
CS_CLEAR |
Clear the bit in the SRV_MASK_ARRAY in *maskp. |
CS_ZERO |
Initialize the SRV_MASK_ARRAY in *maskp so that all the bits are off. When cmd is set to CS_ZERO, bit and infop are ignored. |
A pointer to a SRV_MASK_ARRAY structure.
The bit being initialized, set, cleared, or checked in the SRV_MASK_ARRAY. This must be an integer between 0 and SRV_MAXMASK_LENGTH. SRV_MAXMASK_LENGTH is defined in ospublic.h.
A pointer to a variable that will indicate whether or not bit is set. This parameter is ignored when cmd is CS_SET, CS_CLEAR, or CS_ZERO.
Returns |
To indicate |
---|---|
CS_SUCCEED |
The routine completed successfully. |
CS_FAIL |
The routine failed. |
#include <ospublic.h>
/*
** Local Prototype.
*/
CS_RETCODE ex_srv_mask PROTOTYPE((
SRV_MASK_ARRAY *maskptr,
CS_INT bit
));
/*
** EX_SRV_MASK
**
** Example routine to manipulate bits in a SRV_MASK_ARRAY
** structure.
**
** Arguments:
** maskptr A pointer to a mask array.
** bit The bit to examine.
**
** Returns:
**
** CS_SUCCEED
** CS_FAIL
*/
CS_RETCODE ex_srv_mask(maskptr, bit)
SRV_MASK_ARRAY *maskptr;
CS_INT bit;
{
CS_BOOL info = CS_TRUE;
if (srv_mask(CS_GET, maskptr, bit, &info) == CS_FAIL)
{
return(CS_FAIL);
}
else
{
/* Has the bit been set? */
if (info == CS_FALSE)
return(CS_FAIL);
else
return(CS_SUCCEED);
}
}
srv_mask is used to access and modify a SRV_MASK_ARRAY structure.