Skip Headers
Oracle Hierarchical Storage Manager and QFS Software Command Reference
Section 3: Introduction to Library Functions
Release 6.1.1
E70305-03

NAME

sam_restore_copy - Creates an archive copy for a StorageTek QFS or Oracle HSM file

SYNOPSIS

ccflag … ] file … -L∕opt∕SUNWsamfs∕lib -lsam library … ]

#include "∕opt∕SUNWsamfs∕include∕stat.h"

int sam_restore_copy(const char *path, int copy, struct sam_stat *buf, size_t bufsize, struct sam_section *vbuf, size_t vbufsize);

DESCRIPTION

The sam_restore_copy() library routine creates an archive copy for an existing StorageTek QFS or Oracle HSM file. The file must already exist and the archive copy must not exist. The sam_restore_copy() library routine creates an archive copy using information supplied by the user and obtained from a source such as the archiver.log. This library routine accepts the following arguments:

path

The path name to the file where the archive copy is being created. It may be an absolute or relative path name, but it must be no longer than PATH_MAX (see the ∕usr∕include∕limits.h file).

copy

The copy number (0, 1, 2, or 3) of the archive copy that is being created.

buf

A sam_stat structure. See sam_stat (3x).

bufsize

The size of the sam_stat structure. See sam_stat (3x).

vbuf

A sam_section structure for the array of VSNs if the archive copy overflowed volumes, that is, n_vsns 1. If n_vsns = 1, vbuf should be set to NULL. See sam_stat (3x).

vbufsize

The size of the sam_section structure. If n_vsns = 1, vbufsize should be set to 0. See sam_stat (3x).

The following members in the sam_stat structure must exist. All other fields are ignored.

Table: Required sam_stat Fields

.ta 9n 22n
Name      Type      Description
st_mode      ulong_t      "File mode (see mknod (2))"
st_uid       ulong_t      "User ID of the file's owner"
st_gid       ulong_t      "Group ID of the file's owner"
st_size      u_longlong_t "File size in bytes"
st_atime     ulong_t      "Time of last access"
st_ctime     ulong_t      "Time of last file status change"
st_mtime     ulong_t      "Time of last data modification"

The following members in the sam_copy_s structure must exist for the copy. All other fields are ignored.

Table: Required sam_copy_s Fields

.ta 9n 22n
position;    u_longlong_t "Position of the file on the media."
creation_time; time_t       "Time the archive copy was created"
offset;      uint_t       "Location of the copy in the archive file"
short        n_vsns;      "Number of volumes used by the archive"
Name    Type         Description
media[4];    char         "Two character media type."
vsn[32];     char         "Volume serial name of the media volume"

The preceding fields have the following meaning:

position

The position of the file recorded on the media.

creation_time

This is the time that the archive was made. If creation_time is zero, it is set to the value of time().

offset

The location of the copy in the archive file in units of 512 bytes.

n_vsns

The number of volumes that this copy spans.

vsn

The volume serial name of the cartridge where the file resides.

media

The two-character media type. For example, the media type for DLT tape is lt. See mcf (4).

RETURN VALUES

Upon succesful creation of a file, a value of 0 is returned. Otherwise, a negative value is returned and errno is set to indicate the error. The possible return values are: dl dt-1∕dt dd p user is not root ∕p ∕dd dt-2∕dt dd p invalid copy number ∕p ∕dd dt-3∕dt dd p invalid VSN ∕p ∕dd dt-4∕dt dd p file does not exist ∕p ∕dd dt-5∕dt dd p file open failed ∕p ∕dd dt-6∕dt dd p uid and gid do not match those for the existing file ∕p ∕dd dt-7∕dt dd p invalid VSN for this copy ∕p ∕dd dt-8∕dt dd p multiple copies but vbufsize incorrect ∕p ∕dd dt-9∕dt dd p media type invalid ∕p ∕dd dt-10∕dt dd p copy restore failed for some other reason ∕p ∕dd ∕dl

FILES

∕etc∕opt∕SUNWsamfs∕mcf

The configuration file for StorageTek QFS or Oracle HSM file systems.

SEE ALSO

sam_restore_file (3), sam_stat (3x).

mcf (4).