sam_devstat(3)

NAME
sam_devstat, sam_ndevstat - Gets device status

SYNOPSIS

cc [ flag ... ] file ... -L/opt/SUNWsamfs/lib -lsam [ library ... ]

#include "/opt/SUNWsamfs/include/devstat.h"

int sam_devstat(ushort_t eq, struct sam_devstat *buf, size_t bufsize);

int sam_ndevstat(ushort_t eq, struct sam_ndevstat *buf, size_t bufsize);

DESCRIPTION
sam_devstat() and sam_ndevstat() obtain information about the device identified by the equipment number, eq.

buf is a pointer to a sam_devstat() or sam_ndevstat() structure into which information is placed concerning the device.

bufsize is the length of the user's buffer to which buf points. This should be equal to or greater than sizeof(struct sam_devstat) or sizeof(struct sam_ndevstat).

The contents of the structure pointed to by buf include the following members for sam_devstat() :

    u_short	type;	/* Media type */
    char	name[32];	/* Device name */
    char	vsn[32];	/* VSN of mounted volume, 31 characters */
    dstate_t	state;	/* State - on/ro/idle/off/down */
    uint_t	status;	/* Device status */
    uint_t	space;	/* Space left on device */
    uint_t	capacity;	/* Capacity in blocks */
The contents of the structure pointed to by buf include the following members for sam_ndevstat() :

    u_short	type;	/* Media type */
    char	name[128];	/* Device name */
    char	vsn[32];	/* VSN of mounted volume, 31 characters */
    dstate_t	state;	/* State - on/ro/idle/off/down */
    uint_t	status;	/* Device status */
    uint_t	space;	/* Space left on device */
    uint_t	capacity;	/* Capacity in blocks */

type
    The type of the media. Masks for interpreting media type are defined in devstat.h.

name
    The name of the device, such as /dev/rmt/3cbn.

vsn The VSN of the mounted volume, if any. This is a null-terminated string with a maximum of 31 characters.

state
    The state of the device. This field is an enumerated type defined in devstat.h.

status
    The status of the device. Status bits are defined in the file devstat.h. Also, the library routine sam_devstr(3) is available to translate the numeric status field into a character string as displayed in the Sun StorageTek SAM-FS or Sun SAM-QFS graphical user interfaces and in the Sun StorageTek SAM-FS or Sun SAM-QFS administrative tool samu(1M).

space
    The space left on the device, in blocks.

capacity
    The capacity of the device, in blocks.

RETURN VALUES
Upon successful completion a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error.

ERRORS

sam_devstat() or sam_ndevsat() fail if one or more of the following are true:

ENODEV
    The equipment number supplied is not a valid number, or no device is configured with that equipment number.

EACCES
    The program does not have permission to access the Sun StorageTek SAM-FS or Sun SAM-QFS shared memory segment.

EINVAL
    The size of the Sun StorageTek SAM-FS or Sun SAM-QFS shared memory segment is incorrect. You may need to recompile your program with the current version of the Sun StorageTek SAM-FS or Sun SAM-QFS software.

ENOENT
    Access to the Sun StorageTek SAM-FS or Sun SAM-QFS shared memory segment has failed; possibly Sun StorageTek SAM-FS or Sun SAM-QFS is not running.

EMFILE
    The Sun StorageTek SAM-FS or Sun SAM-QFS shared memory segment could not be accessed because the number of shared memory segments attached to the calling process would exceed the system-imposed limit.

ENOMEM
    The available data space is not large enough to accommodate access to the Sun StorageTek SAM-FS or Sun SAM-QFS shared memory segment.

E2BIG
    For sam_devstat() only. The name field of the device was too long to fit in the name field of the sam_dev structure. Use sam_ndevstat().

SEE ALSO
samu(1M).

sam_devstr(3).