Filesys-SamFS

 view release on metacpan or  search on metacpan

SamFS.xs  view on Meta::CPAN

CODE:
	RETVAL = (status & CSP_CLEANING) != 0;
OUTPUT:
	RETVAL

int
sam_CS_BARCODE(status)
	int status;
CODE:
	RETVAL = (status & CSP_BAR_CODE) != 0;
OUTPUT:
	RETVAL

int
sam_CS_WRTPROT(status)
	int status;
CODE:
	RETVAL = (status & CSP_WRITEPROTECT) != 0;
OUTPUT:
	RETVAL

int
sam_CS_RDONLY(status)
	int status;
CODE:
	RETVAL = (status & CSP_READ_ONLY) != 0;
OUTPUT:
	RETVAL

int
sam_CS_RECYCLE(status)
	int status;
CODE:
	RETVAL = (status & CSP_RECYCLE) != 0;
OUTPUT:
	RETVAL

int
sam_CS_UNAVAIL(status)
	int status;
CODE:
	RETVAL = (status & CSP_UNAVAIL) != 0;
OUTPUT:
	RETVAL

int
sam_CS_EXPORT(status)
	int status;
CODE:
	RETVAL = (status & CSP_EXPORT) != 0;
OUTPUT:
	RETVAL

void
sam_stat(path)
	char *path
PREINIT:
	struct sam_stat statbuf;
	int retval;
	int i;
PPCODE:
	retval = sam_stat(path, &statbuf, sizeof statbuf);
	if (retval == 0) {
		EXTEND(SP, 22+MAX_ARCHIVE);
 /*  0 */	PUSHs(sv_2mortal(newSViv(statbuf.st_dev)));
 /*  1 */	PUSHs(sv_2mortal(newSViv(statbuf.st_ino)));
 /*  2 */	PUSHs(sv_2mortal(newSViv(statbuf.st_mode)));
 /*  3 */	PUSHs(sv_2mortal(newSViv(statbuf.st_nlink)));
 /*  4 */	PUSHs(sv_2mortal(newSViv(statbuf.st_uid)));
 /*  5 */	PUSHs(sv_2mortal(newSViv(statbuf.st_gid)));
 /*  6 */	PUSHs(sv_2mortal(newSViv(statbuf.rdev)));
 /*  7 */	PUSHs(sv_2mortal(newSVpv(ull2s(statbuf.st_size), 0)));
 /*  8 */	PUSHs(sv_2mortal(newSViv(statbuf.st_atime)));
 /*  9 */	PUSHs(sv_2mortal(newSViv(statbuf.st_mtime)));
 /* 10 */	PUSHs(sv_2mortal(newSViv(statbuf.st_ctime)));
 #ifdef OLD_SAMFS
 /* 11 */	PUSHs(&PL_sv_undef);    /* blksize */
 /* 12 */	PUSHs(&PL_sv_undef);    /* blocks */
 #else
 /* 11 */	PUSHs(sv_2mortal(newSViv(512)));	/* blksize */
 /* 12 */	PUSHs(sv_2mortal(newSVpv(ull2s(statbuf.st_blocks), 0)));
 #endif
 /* 13 */	PUSHs(sv_2mortal(newSViv(statbuf.attr)));
 /* 14 */	PUSHs(sv_2mortal(newSViv(statbuf.attribute_time)));
 /* 15 */	PUSHs(sv_2mortal(newSViv(statbuf.creation_time)));
 /* 16 */	PUSHs(sv_2mortal(newSViv(statbuf.residence_time)));
 /* 17 */	PUSHs(sv_2mortal(newSViv(statbuf.cs_algo)));
 /* 19 */	PUSHs(sv_2mortal(newSViv(statbuf.flags)));
 /* 20 */	PUSHs(sv_2mortal(newSViv(statbuf.gen)));
 /* 21 */	PUSHs(sv_2mortal(newSViv(statbuf.partial_size)));
		for (i=0; i<MAX_ARCHIVE; i++) {
			AV *av = newAV();
			av_extend(av, 7);
			PUSHs(sv_2mortal(newRV_noinc((SV*)av)));
			av_store(av, 0, newSViv(statbuf.copy[i].flags));
			av_store(av, 1, newSViv(statbuf.copy[i].n_vsns));
			av_store(av, 2, newSViv(statbuf.copy[i].creation_time));
			av_store(av, 3, newSVpv(ull2s(statbuf.copy[i].position), 0));
			av_store(av, 4, newSViv(statbuf.copy[i].offset));
			av_store(av, 5, newSVpv(statbuf.copy[i].media, 0));
			av_store(av, 6, newSVpv(statbuf.copy[i].vsn, 0));
		}
	}

void
sam_lstat(path)
	char *path
PREINIT:
	struct sam_stat statbuf;
	int retval;
	int i;
PPCODE:
	retval = sam_lstat(path, &statbuf, sizeof statbuf);
	if (retval == 0) {
		EXTEND(SP, 22+MAX_ARCHIVE);
 /*  0 */	PUSHs(sv_2mortal(newSViv(statbuf.st_dev)));
 /*  1 */	PUSHs(sv_2mortal(newSViv(statbuf.st_ino)));
 /*  2 */	PUSHs(sv_2mortal(newSViv(statbuf.st_mode)));
 /*  3 */	PUSHs(sv_2mortal(newSViv(statbuf.st_nlink)));
 /*  4 */	PUSHs(sv_2mortal(newSViv(statbuf.st_uid)));
 /*  5 */	PUSHs(sv_2mortal(newSViv(statbuf.st_gid)));
 /*  6 */	PUSHs(sv_2mortal(newSViv(statbuf.rdev)));
 /*  7 */	PUSHs(sv_2mortal(newSVpv(ull2s(statbuf.st_size), 0)));
 /*  8 */	PUSHs(sv_2mortal(newSViv(statbuf.st_atime)));
 /*  9 */	PUSHs(sv_2mortal(newSViv(statbuf.st_mtime)));
 /* 10 */	PUSHs(sv_2mortal(newSViv(statbuf.st_ctime)));
 #ifdef OLD_SAMFS
 /* 11 */	PUSHs(&PL_sv_undef);    /* blksize */
 /* 12 */	PUSHs(&PL_sv_undef);    /* blocks */
 #else
 /* 11 */	PUSHs(sv_2mortal(newSViv(512)));	/* blksize */
 /* 12 */	PUSHs(sv_2mortal(newSVpv(ull2s(statbuf.st_blocks), 0)));
 #endif
 /* 13 */	PUSHs(sv_2mortal(newSViv(statbuf.attr)));
 /* 14 */	PUSHs(sv_2mortal(newSViv(statbuf.attribute_time)));
 /* 15 */	PUSHs(sv_2mortal(newSViv(statbuf.creation_time)));
 /* 16 */	PUSHs(sv_2mortal(newSViv(statbuf.residence_time)));
 /* 17 */	PUSHs(sv_2mortal(newSViv(statbuf.cs_algo)));
 /* 19 */	PUSHs(sv_2mortal(newSViv(statbuf.flags)));
 /* 20 */	PUSHs(sv_2mortal(newSViv(statbuf.gen)));
 /* 21 */	PUSHs(sv_2mortal(newSViv(statbuf.partial_size)));
		for (i=0; i<MAX_ARCHIVE; i++) {
			AV *av = newAV();
			av_extend(av, 7);
			PUSHs(sv_2mortal(newRV_noinc((SV*)av)));
			av_store(av, 0, newSViv(statbuf.copy[i].flags));
			av_store(av, 1, newSViv(statbuf.copy[i].n_vsns));
			av_store(av, 2, newSViv(statbuf.copy[i].creation_time));
			av_store(av, 3, newSVpv(ull2s(statbuf.copy[i].position), 0));
			av_store(av, 4, newSViv(statbuf.copy[i].offset));
			av_store(av, 5, newSVpv(statbuf.copy[i].media, 0));
			av_store(av, 6, newSVpv(statbuf.copy[i].vsn, 0));
		}
	}

 /*
  * New versions. These return a reference to the array of copies
  * instead of the individual elements. They are also meant to be extended
  * when Sun introduces even more elements into the sam_stat struct.
 */

#ifndef OLD_SAMFS
void
sam_stat_scalars(path)
	char *path
PREINIT:
	struct sam_stat statbuf;
	int retval;
	int i;
        AV *copies;
PPCODE:
	retval = sam_stat(path, &statbuf, sizeof statbuf);
	if (retval == 0) {
		EXTEND(SP, 29);
 /*  0 */	PUSHs(sv_2mortal(newSViv(statbuf.st_dev)));
 /*  1 */	PUSHs(sv_2mortal(newSViv(statbuf.st_ino)));
 /*  2 */	PUSHs(sv_2mortal(newSViv(statbuf.st_mode)));
 /*  3 */	PUSHs(sv_2mortal(newSViv(statbuf.st_nlink)));
 /*  4 */	PUSHs(sv_2mortal(newSViv(statbuf.st_uid)));
 /*  5 */	PUSHs(sv_2mortal(newSViv(statbuf.st_gid)));
 /*  6 */	PUSHs(sv_2mortal(newSViv(statbuf.rdev)));
 /*  7 */	PUSHs(sv_2mortal(newSVpv(ull2s(statbuf.st_size), 0)));
 /*  8 */	PUSHs(sv_2mortal(newSViv(statbuf.st_atime)));
 /*  9 */	PUSHs(sv_2mortal(newSViv(statbuf.st_mtime)));
 /* 10 */	PUSHs(sv_2mortal(newSViv(statbuf.st_ctime)));
 /* 11 */	PUSHs(sv_2mortal(newSViv(512)));	/* blksize */
 /* 12 */	PUSHs(sv_2mortal(newSVpv(ull2s(statbuf.st_blocks), 0)));
 /* 13 */	PUSHs(sv_2mortal(newSViv(statbuf.attr)));
 /* 14 */	PUSHs(sv_2mortal(newSViv(statbuf.attribute_time)));
 /* 15 */	PUSHs(sv_2mortal(newSViv(statbuf.creation_time)));
 /* 16 */	PUSHs(sv_2mortal(newSViv(statbuf.residence_time)));
 /* 17 */	PUSHs(sv_2mortal(newSViv(statbuf.cs_algo)));
 /* 18 */	PUSHs(sv_2mortal(newSViv(statbuf.flags)));
 /* 19 */	PUSHs(sv_2mortal(newSViv(statbuf.gen)));
 /* 20 */	PUSHs(sv_2mortal(newSViv(statbuf.partial_size)));
                copies = newAV();
                sv_2mortal((SV*)copies);
                av_extend(copies, MAX_ARCHIVE);
 /* 21 */	PUSHs(sv_2mortal(newRV_noinc((SV*)copies)));
		for (i=0; i<MAX_ARCHIVE; i++) {
			AV *av = newAV();
                        av_store(copies, i, newRV_noinc((SV*)av));
			av_extend(av, 7);
			av_store(av, 0, newSViv(statbuf.copy[i].flags));
			av_store(av, 1, newSViv(statbuf.copy[i].n_vsns));
			av_store(av, 2, newSViv(statbuf.copy[i].creation_time));
			av_store(av, 3, newSVpv(ull2s(statbuf.copy[i].position), 0));
			av_store(av, 4, newSViv(statbuf.copy[i].offset));
			av_store(av, 5, newSVpv(statbuf.copy[i].media, 0));
			av_store(av, 6, newSVpv(statbuf.copy[i].vsn, 0));
		}
 /* 22 */	PUSHs(sv_2mortal(newSViv(statbuf.stripe_width)));
 /* 23 */	PUSHs(sv_2mortal(newSViv(statbuf.stripe_group)));
 /* 24 */	PUSHs(sv_2mortal(newSViv(statbuf.segment_size)));
 /* 25 */	PUSHs(sv_2mortal(newSViv(statbuf.segment_number)));
 /* 26 */	PUSHs(sv_2mortal(newSViv(statbuf.stage_ahead)));
 /* 27 */	PUSHs(sv_2mortal(newSViv(statbuf.admin_id)));
 /* 28 */	PUSHs(sv_2mortal(newSViv(statbuf.allocahead)));
	}

void
sam_lstat_scalars(path)
	char *path
PREINIT:
	struct sam_stat statbuf;
	int retval;
	int i;
        AV *copies;
PPCODE:
	retval = sam_lstat(path, &statbuf, sizeof statbuf);
	if (retval == 0) {
		EXTEND(SP, 29);
 /*  0 */	PUSHs(sv_2mortal(newSViv(statbuf.st_dev)));
 /*  1 */	PUSHs(sv_2mortal(newSViv(statbuf.st_ino)));
 /*  2 */	PUSHs(sv_2mortal(newSViv(statbuf.st_mode)));
 /*  3 */	PUSHs(sv_2mortal(newSViv(statbuf.st_nlink)));
 /*  4 */	PUSHs(sv_2mortal(newSViv(statbuf.st_uid)));
 /*  5 */	PUSHs(sv_2mortal(newSViv(statbuf.st_gid)));
 /*  6 */	PUSHs(sv_2mortal(newSViv(statbuf.rdev)));
 /*  7 */	PUSHs(sv_2mortal(newSVpv(ull2s(statbuf.st_size), 0)));
 /*  8 */	PUSHs(sv_2mortal(newSViv(statbuf.st_atime)));
 /*  9 */	PUSHs(sv_2mortal(newSViv(statbuf.st_mtime)));
 /* 10 */	PUSHs(sv_2mortal(newSViv(statbuf.st_ctime)));
 /* 11 */	PUSHs(sv_2mortal(newSViv(512)));	/* blksize */
 /* 12 */	PUSHs(sv_2mortal(newSVpv(ull2s(statbuf.st_blocks), 0)));
 /* 13 */	PUSHs(sv_2mortal(newSViv(statbuf.attr)));
 /* 14 */	PUSHs(sv_2mortal(newSViv(statbuf.attribute_time)));
 /* 15 */	PUSHs(sv_2mortal(newSViv(statbuf.creation_time)));
 /* 16 */	PUSHs(sv_2mortal(newSViv(statbuf.residence_time)));
 /* 17 */	PUSHs(sv_2mortal(newSViv(statbuf.cs_algo)));
 /* 18 */	PUSHs(sv_2mortal(newSViv(statbuf.flags)));
 /* 19 */	PUSHs(sv_2mortal(newSViv(statbuf.gen)));
 /* 20 */	PUSHs(sv_2mortal(newSViv(statbuf.partial_size)));
                copies = newAV();
                sv_2mortal((SV*)copies);
                av_extend(copies, MAX_ARCHIVE);
 /* 21 */	PUSHs(sv_2mortal(newRV_noinc((SV*)copies)));
		for (i=0; i<MAX_ARCHIVE; i++) {
			AV *av = newAV();
                        av_store(copies, i, newRV_noinc((SV*)av));
			av_extend(av, 7);
			av_store(av, 0, newSViv(statbuf.copy[i].flags));
			av_store(av, 1, newSViv(statbuf.copy[i].n_vsns));
			av_store(av, 2, newSViv(statbuf.copy[i].creation_time));
			av_store(av, 3, newSVpv(ull2s(statbuf.copy[i].position), 0));
			av_store(av, 4, newSViv(statbuf.copy[i].offset));
			av_store(av, 5, newSVpv(statbuf.copy[i].media, 0));
			av_store(av, 6, newSVpv(statbuf.copy[i].vsn, 0));
		}
 /* 22 */	PUSHs(sv_2mortal(newSViv(statbuf.stripe_width)));
 /* 23 */	PUSHs(sv_2mortal(newSViv(statbuf.stripe_group)));
 /* 24 */	PUSHs(sv_2mortal(newSViv(statbuf.segment_size)));
 /* 25 */	PUSHs(sv_2mortal(newSViv(statbuf.segment_number)));
 /* 26 */	PUSHs(sv_2mortal(newSViv(statbuf.stage_ahead)));
 /* 27 */	PUSHs(sv_2mortal(newSViv(statbuf.admin_id)));
 /* 28 */	PUSHs(sv_2mortal(newSViv(statbuf.allocahead)));
	}

#endif

#ifdef OLD_SAMFS

void
sam_vsn_stat(path, copy)
	char *	path
	int	copy
PREINIT:
#ifndef MAX_VSNS
 /* Make SamFS 3.3.1-15 backwards compatible */
#define MAX_VSNS MAX_VOLUMES
	struct sam_vsn_stat {
		struct sam_section section[MAX_VOLUMES];
	};
#define CAST (struct sam_section*)
#else
#define CAST
#endif
	struct sam_vsn_stat statbuf;
	int retval;
	int i;
PPCODE:
	retval = sam_vsn_stat(path, copy, CAST &statbuf, sizeof statbuf);
	if (retval == 0) {
		EXTEND(SP, MAX_VSNS);
		for (i=0; i<MAX_VSNS; i++) {
			AV *av = newAV();
			av_extend(av, 4);
			PUSHs(sv_2mortal(newRV_noinc((SV*)av)));
			av_store(av, 0, newSVpv(statbuf.section[i].vsn, 0));
			av_store(av, 1, newSVpv(ull2s(statbuf.section[i].length), 0));
			av_store(av, 2, newSVpv(ull2s(statbuf.section[i].position), 0));
			av_store(av, 3, newSVpv(ull2s(statbuf.section[i].offset), 0));
		}
	}

#else

void
sam_vsn_stat(path, copy)
	char *	path
	int	copy
PREINIT:
	struct sam_section statbuf;
	int retval;
	int i;
PPCODE:
	retval = sam_vsn_stat(path, copy, &statbuf, sizeof statbuf);
	if (retval == 0) {
		EXTEND(SP, 1);
		AV *av = newAV();
		av_extend(av, 4);
		PUSHs(sv_2mortal(newRV_noinc((SV*)av)));
		av_store(av, 0, newSVpv(statbuf.vsn, 0));
		av_store(av, 1, newSVpv(ull2s(statbuf.length), 0));
		av_store(av, 2, newSVpv(ull2s(statbuf.position), 0));
		av_store(av, 3, newSVpv(ull2s(statbuf.offset), 0));
	}

#endif

# The sam_segment_foo and sam_restore_foo functions have been
# introduced after I was cut off from any running SamFS
# installation. This code should be conditional on *something* to be
# compatible with old SamFS versions that don't have the functions. But
# conditional on *what*?!? So for now they are just wrapped in an
# #ifndef OLD_SAMFS.
# Because I have no way of testing this, the code will probably
# contain mistakes because of my misunderstandings of the terse
# documentation.

#ifndef OLD_SAMFS
int
sam_segment_vsn_stat(path, copy, segment_index)
	char *			path
	int			copy
	int			segment_index
PREINIT:
	struct sam_section statbuf;
	int retval;
	int i;
PPCODE:
	retval = sam_segment_vsn_stat(path, copy, segment_index, &statbuf, sizeof statbuf);
	if (retval == 0) {
		EXTEND(SP, 1);
		AV *av = newAV();
		av_extend(av, 4);
		PUSHs(sv_2mortal(newRV_noinc((SV*)av)));
		av_store(av, 0, newSVpv(statbuf.vsn, 0));
		av_store(av, 1, newSVpv(ull2s(statbuf.length), 0));
		av_store(av, 2, newSVpv(ull2s(statbuf.position), 0));
		av_store(av, 3, newSVpv(ull2s(statbuf.offset), 0));
	}

int
sam_segment_stat(path)
	char *			path
PREINIT:
	struct sam_stat file_info;
	struct sam_stat *data_seg_info_ptr;
	int number_of_data_segments;
	int retval;
	int i;
PPCODE:
	retval = sam_stat(path, &file_info, sizeof file_info);
	if (retval == 0) {
		if (SS_ISSEGMENT_F(file_info.attr)) {
	                number_of_data_segments = NUM_SEGS(&file_info);
                        Newxz(data_seg_info_ptr, number_of_data_segments,
                              struct sam_stat);
                	retval = sam_segment_stat(path, data_seg_info_ptr,
                                                  number_of_data_segments *
                                                  sizeof(struct sam_stat));
                        if (retval == 0) {
                		EXTEND(SP, number_of_data_segments);
                                for (i=0; i<number_of_data_segments; i++) {
                                        AV *av;
                                        av = newAV();
                                        sv_2mortal((SV*)av);
                                        av_extend(av, 30);
                                        PUSHs(sv_2mortal(newRV_noinc((SV*)av)));
                                        sam_stat2av(&file_info, av);
                                }
                        }
	                Safefree(data_seg_info_ptr);
                } else {
                        /* Not segmented, just return a list of one element,
                           from file_info. */
                        AV *av;
        		EXTEND(SP, 1);
                        av = newAV();
                        sv_2mortal((SV*)av);
                        av_extend(av, 30);
                        PUSHs(sv_2mortal(newRV_noinc((SV*)av)));
                        sam_stat2av(&file_info, av);
                }
        }

int
sam_segment_lstat(path)
	char *			path
PREINIT:
	struct sam_stat file_info;
	struct sam_stat *data_seg_info_ptr;
	int number_of_data_segments;
	int retval;
	int i;
PPCODE:
	retval = sam_lstat(path, &file_info, sizeof file_info);
	if (retval == 0) {
		if (SS_ISSEGMENT_F(file_info.attr)) {
	                number_of_data_segments = NUM_SEGS(&file_info);
                        Newxz(data_seg_info_ptr, number_of_data_segments,
                              struct sam_stat);
                	retval = sam_segment_lstat(path, data_seg_info_ptr,
                                                  number_of_data_segments *
                                                  sizeof(struct sam_stat));
                        if (retval == 0) {
                		EXTEND(SP, number_of_data_segments);
                                for (i=0; i<number_of_data_segments; i++) {
                                        AV *av;
                                        av = newAV();
                                        sv_2mortal((SV*)av);
                                        av_extend(av, 30);
                                        PUSHs(sv_2mortal(newRV_noinc((SV*)av)));
                                        sam_stat2av(&file_info, av);
                                }
                        }
	                Safefree(data_seg_info_ptr);
                } else {
                        /* Not segmented, just return a list of one element,
                           from file_info. */
                        AV *av;
        		EXTEND(SP, 1);
                        av = newAV();
                        sv_2mortal((SV*)av);
                        av_extend(av, 30);
                        PUSHs(sv_2mortal(newRV_noinc((SV*)av)));
                        sam_stat2av(&file_info, av);
                }
        }

int
sam_restore_file(path, st_mode, st_uid, st_gid, st_size, st_atime, st_ctime, st_mtime, copies)
	char *          path
	unsigned long	st_mode
	unsigned long	st_uid
	unsigned long	st_gid
	char *          st_size
	unsigned long	st_atime
	unsigned long	st_ctime
	unsigned long	st_mtime
        SV *            copies
INIT:
	struct sam_stat info;
        int i;
CODE:
        if ((!SvROK(copies)) || (SvTYPE(SvRV(copies)) != SVt_PVAV)) {
                croak("\"copies\" argument has wrong type - must be array ref");
        } else if (av_len((AV*)copies) != MAX_ARCHIVE) {
                croak("\"copies\" argument must have exactly %d elements",
                      MAX_ARCHIVE);
        }
        info.st_mode = st_mode;
        info.st_uid = st_uid;
        info.st_gid = st_gid;
        sscanf(st_size, "%llu", &info.st_size);
        info.st_atime = st_atime;

SamFS.xs  view on Meta::CPAN

           of sections supplied */
        info.copy[copy_no].n_vsns = 1;
        sinfo = (struct sam_section *)0;
        sinfosize = 0;
        if (items > 9) {
                /* sections array, check it */
                SV *sv = ST(9);
                if ((!SvROK(sv)) || (SvTYPE(SvRV(sv)) != SVt_PVAV)) {
                       croak("\"sections\" has wrong type - must be array ref");
                }
                av = (AV*)sv;
                info.copy[copy_no].n_vsns = av_len(av) + 1;
                Newxz(sinfo, av_len(av), struct sam_section);
                sinfosize = av_len(av) * sizeof(struct sam_section);
                for (i=0; i<av_len(av); i++) {
                        AV *av2;
                        char *vsn;
                        av2 = (AV*)*av_fetch((AV*)SvRV(av), i, 0);
                        if ((!SvROK(av2)) || (SvTYPE(SvRV(av2)) != SVt_PVAV)) {
                                croak("section %d has wrong type - must be array ref",
                                      i);
                        } else if (av_len((AV *)SvRV(copy_info)) != 4) {
                                croak("section must have exactly 4 elements");
                        }
                        vsn = SvPV(*av_fetch(av2, 0, 0), l);
                        if (l > 32) {
                                l = 32;
                        }
                        strncpy(sinfo[i].vsn, vsn, l);
                        sscanf(SvPV_nolen(*av_fetch(av2, 1, 0)), "%llu",
                               &sinfo[i].length);
                        sscanf(SvPV_nolen(*av_fetch(av2, 2, 0)), "%llu",
                               &sinfo[i].position);
                        sscanf(SvPV_nolen(*av_fetch(av2, 3, 0)), "%llu",
                               &sinfo[i].offset);
                }
        }

        RETVAL = sam_restore_copy(path, copy_no,
                                  &info, sizeof info,
                                  sinfo, sinfosize);
OUTPUT:
        RETVAL

#endif

char *
sam_attrtoa(attr)
	int	attr
CODE:
	RETVAL = sam_attrtoa(attr, NULL);
OUTPUT:
	RETVAL

void
sam_devstat(eq)
	int	eq
PREINIT:
	struct sam_devstat statbuf;
	int retval;
PPCODE:
	retval = sam_devstat(eq, &statbuf, sizeof statbuf);
	if (retval == 0) {
		EXTEND(SP, 7);
/* 0 */		PUSHs(sv_2mortal(newSViv(statbuf.type)));
/* 1 */		PUSHs(sv_2mortal(newSVpv(statbuf.name, 0)));
/* 2 */		PUSHs(sv_2mortal(newSVpv(statbuf.vsn, 0)));
/* 3 */		PUSHs(sv_2mortal(newSVpv(dev_state[statbuf.state], 0)));
/* 4 */		PUSHs(sv_2mortal(newSViv(statbuf.status)));
/* 5 */		PUSHs(sv_2mortal(newSViv(statbuf.space)));
/* 6 */		PUSHs(sv_2mortal(newSViv(statbuf.capacity)));
	}

void
sam_ndevstat(eq)
	int	eq
PREINIT:
	struct sam_ndevstat statbuf;
	int retval;
PPCODE:
	retval = sam_ndevstat(eq, &statbuf, sizeof statbuf);
	if (retval == 0) {
		EXTEND(SP, 7);
/* 0 */		PUSHs(sv_2mortal(newSViv(statbuf.type)));
/* 1 */		PUSHs(sv_2mortal(newSVpv(statbuf.name, 0)));
/* 2 */		PUSHs(sv_2mortal(newSVpv(statbuf.vsn, 0)));
/* 3 */		PUSHs(sv_2mortal(newSVpv(dev_state[statbuf.state], 0)));
/* 4 */		PUSHs(sv_2mortal(newSViv(statbuf.status)));
/* 5 */		PUSHs(sv_2mortal(newSViv(statbuf.space)));
/* 6 */		PUSHs(sv_2mortal(newSViv(statbuf.capacity)));
	}

char *
sam_devstr(status)
	int	status
CODE:
	RETVAL = sam_devstr(status);
OUTPUT:
	RETVAL

void
sam_opencat(path)
	char *	path
PREINIT:
	struct sam_cat_tbl catbuf;
	int retval;
PPCODE:
	retval = sam_opencat(path, &catbuf, sizeof catbuf);
	if (retval >= 0) {
		EXTEND(SP, 4);
/* 0 */		PUSHs(sv_2mortal(newSViv(retval)));
/* 1 */		PUSHs(sv_2mortal(newSViv(catbuf.audit_time)));
/* 2 */		PUSHs(sv_2mortal(newSViv(catbuf.version)));
/* 3 */		PUSHs(sv_2mortal(newSViv(catbuf.count)));
/* 4 */		PUSHs(sv_2mortal(newSVpv(catbuf.media, 0)));
	}

int
sam_closecat(cat_handle)
	int	cat_handle

void
sam_getcatalog(cat_handle, slot)
	int	cat_handle
	int	slot
PREINIT:
	struct sam_cat_ent	catbuf;
	int retval;
PPCODE:
	retval = sam_getcatalog(cat_handle, slot, slot, &catbuf, sizeof catbuf);
	if (retval >= 0) {
		EXTEND(SP, 11);
/* 0 */		PUSHs(sv_2mortal(newSViv(catbuf.type)));
/* 1 */		PUSHs(sv_2mortal(newSViv(catbuf.status)));
/* 2 */		PUSHs(sv_2mortal(newSVpv(catbuf.media, 0)));
/* 3 */		PUSHs(sv_2mortal(newSVpv(catbuf.vsn, 0)));
/* 4 */		PUSHs(sv_2mortal(newSViv(catbuf.access)));
/* 5 */		PUSHs(sv_2mortal(newSViv(catbuf.capacity)));
/* 6 */		PUSHs(sv_2mortal(newSViv(catbuf.space)));
/* 7 */		PUSHs(sv_2mortal(newSViv(catbuf.ptoc_fwa)));
/* 8 */		PUSHs(sv_2mortal(newSViv(catbuf.modification_time)));
/* 9 */		PUSHs(sv_2mortal(newSViv(catbuf.mount_time)));
/*10 */		PUSHs(sv_2mortal(newSVpv(catbuf.bar_code, 0)));
	}


int
sam_archive(name, opns)
	char *	name
	char *	opns

int
sam_cancelstage(name)
	char *	name

int
sam_release(name, opns)
	char *	name
	char *	opns

int
sam_ssum(name, opns)
	char *	name
	char *	opns

int
sam_stage(name, opns)
	char *	name
	char *	opns

int
sam_setfa(name, opns)
	char *	name
	char *	opns

int
sam_advise(fildes, opns)
	int	fildes
	char *	opns

# Not yet implemented.

#-# int
#-# sam_request(path, buf, bufsize)
#-# 	char *			path
#-# 	struct sam_rminfo *	buf
#-# 	size_t			bufsize

# Not documented



( run in 1.796 second using v1.01-cache-2.11-cpan-71847e10f99 )