- record = 0;
- for (rec->state=0; !is_block_empty(rec); ) {
- if (!read_record_from_block(block, rec)) {
- Dmsg3(10, "!read-break. stat=%s blk=%d rem=%d\n", rec_state_to_str(rec),
- block->BlockNumber, rec->remainder);
- break;
- }
- Dmsg3(10, "read-OK. stat=%s blk=%d rem=%d\n", rec_state_to_str(rec),
- block->BlockNumber, rec->remainder);
- /*
- * At this point, we have at least a record header.
- * Now decide if we want this record or not, but remember
- * before accessing the record, we may need to read again to
- * get all the data.
- */
- record++;
- if (verbose) {
- Dmsg6(30, "recno=%d state=%s blk=%d SI=%d ST=%d FI=%d\n", record,
- rec_state_to_str(rec), block->BlockNumber,
- rec->VolSessionId, rec->VolSessionTime, rec->FileIndex);
- }
- if (debug_level >= 30) {
- Dmsg4(30, "VolSId=%ld FI=%s Strm=%s Size=%ld\n", rec->VolSessionId,
- FI_to_ascii(rec->FileIndex), stream_to_ascii(rec->Stream),
- rec->data_len);
- }
-
- /*
- * Check for End of File record (all zeros)
- * NOTE: this no longer exists
- */
- if (rec->VolSessionId == 0 && rec->VolSessionTime == 0) {
- Emsg0(M_ERROR_TERM, 0, "Zero VolSessionId and VolSessionTime. This shouldn't happen\n");
- }
-
- /*
- * Check for Start or End of Session Record
- *
- */
- if (rec->FileIndex < 0) {
- char *rtype;
- memset(&sessrec, 0, sizeof(sessrec));
- switch (rec->FileIndex) {
- case PRE_LABEL:
- rtype = "Fresh Volume Label";
- break;
- case VOL_LABEL:
- rtype = "Volume Label";
- unser_volume_label(dev, rec);
- break;
- case SOS_LABEL:
- rtype = "Begin Session";
- unser_session_label(&sessrec, rec);
- break;
- case EOS_LABEL:
- rtype = "End Session";
- break;
- case EOM_LABEL:
- rtype = "End of Media";
- break;
- default:
- rtype = "Unknown";
- break;
- }
- if (debug_level > 0) {
- printf("%s Record: VolSessionId=%d VolSessionTime=%d JobId=%d DataLen=%d\n",
- rtype, rec->VolSessionId, rec->VolSessionTime, rec->Stream, rec->data_len);
- }
-
- Dmsg1(40, "Got label = %d\n", rec->FileIndex);
- if (rec->FileIndex == EOM_LABEL) { /* end of tape? */
- Dmsg0(100, "EOM LABEL break\n");
- rec->remainder = 0;
- break; /* yes, get out */
- }
- rec->remainder = 0;
- continue; /* we don't want record, read next one */
- } /* end if label record */
-
- /*
- * Apply BSR filter
- */
- if (bsr && !match_bsr(bsr, rec, &dev->VolHdr, &sessrec)) {
- if (verbose) {
- Dmsg5(10, "BSR no match rec=%d block=%d SessId=%d SessTime=%d FI=%d\n",
- record, block->BlockNumber, rec->VolSessionId, rec->VolSessionTime,
- rec->FileIndex);
- }
- rec->remainder = 0;
- continue; /* we don't want record, read next one */
- }
- if (is_partial_record(rec)) {
- Dmsg6(10, "Partial, break. recno=%d state=%s blk=%d SI=%d ST=%d FI=%d\n", record,
- rec_state_to_str(rec), block->BlockNumber,
- rec->VolSessionId, rec->VolSessionTime, rec->FileIndex);
- break; /* read second part of record */
- }
-
- /* File Attributes stream */
- if (rec->Stream == STREAM_UNIX_ATTRIBUTES) {
- char *ap, *fp;
- sscanf(rec->data, "%ld %d", &record_file_index, &type);
- if (record_file_index != rec->FileIndex) {
- Emsg2(M_ERROR_TERM, 0, "Record header file index %ld not equal record index %ld\n",
- rec->FileIndex, record_file_index);
- }
- ap = rec->data;
-
- while (*ap++ != ' ') /* skip record file index */
- ;
- while (*ap++ != ' ') /* skip type */
- ;
- /* Save filename and position to attributes */
- fp = fname;
- while (*ap != 0) {
- *fp++ = *ap++;
- }
- *fp = *ap++; /* terminate filename & point to attribs */
-
- decode_stat(ap, &statp);
- /* Skip to link name */
- while (*ap++ != 0)
- ;
- print_ls_output(fname, ap, type, &statp);
- num_files++;
- }
+ attr->data_stream = decode_stat(attr->attr, &attr->statp, &attr->LinkFI);
+ build_attr_output_fnames(jcr, attr);
+
+ if (file_is_included(ff, attr->fname) && !file_is_excluded(ff, attr->fname)) {
+ if (verbose) {
+ Pmsg5(-1, _("FileIndex=%d VolSessionId=%d VolSessionTime=%d Stream=%d DataLen=%d\n"),
+ rec->FileIndex, rec->VolSessionId, rec->VolSessionTime, rec->Stream, rec->data_len);
+ }
+ print_ls_output(jcr, attr);
+ num_files++;
+ }
+ } else if (rec->Stream == STREAM_PLUGIN_NAME) {
+ if (strncmp("0 0", rec->data, 3) != 0) {
+ Pmsg1(000, "Plugin data: %s\n", rec->data);