Lines Matching +full:out +full:- +full:volume +full:- +full:limit

1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
50 #define MAXFLT 10 /* default media read error limit */
54 * limit on blocking size is removed (though that will violate pax spec)
73 * 0 if ok, -1 if the user specified write block size violates pax spec
85 * open the first archive volume in wr_start()
88 wrblksz = frmt->bsz; in wr_start()
92 return(-1); in wr_start()
97 return(-1); in wr_start()
102 return(-1); in wr_start()
110 return(-1); in wr_start()
121 * 0 if ok, -1 otherwise
137 return(-1); in rd_start()
142 return(-1); in rd_start()
150 return(-1); in rd_start()
198 * 0 for success, -1 for failure
209 return(-1); in appnd_start()
213 * in the last archive volume read. (If a is set we still use rdblksz in appnd_start()
214 * until next volume, cannot shift sizes within a single volume). in appnd_start()
222 * make sure that this volume allows appends in appnd_start()
225 return(-1); in appnd_start()
233 skcnt += bufend - bufpt; in appnd_start()
237 goto out; in appnd_start()
244 if ((cnt -= skcnt) > 0) { in appnd_start()
246 * watch out for stupid tape drives. ar_rev() will set rdblksz in appnd_start()
255 goto out; in appnd_start()
258 if (ar_rev((off_t)(bufpt - buf)) < 0) in appnd_start()
259 goto out; in appnd_start()
270 rdcnt -= skcnt; in appnd_start()
280 return(-1); in appnd_start()
284 out: in appnd_start()
286 return(-1); in appnd_start()
291 * A read error occurred on this archive volume. Resync the buffer and
293 * trying to do this until we get a valid read, or we reach the limit on
295 * adjust the read error limit through a command line option.
297 * 0 on success, and -1 on failure
307 * if the user says bail out on first fault, we are out of here... in rd_sync()
310 return(-1); in rd_sync()
313 return(-1); in rd_sync()
321 return(-1); in rd_sync()
339 * if error limit reached, ditch. o.w. poke device to move past in rd_sync()
342 * volume. remember the goal on reads is to get the most we in rd_sync()
343 * can extract out of the archive. in rd_sync()
346 paxwarn(0,"Archive read error limit (%d) reached",maxflt); in rd_sync()
354 return(-1); in rd_sync()
371 bufpt -= cnt; in pback()
381 * 0 if ok, -1 failure, and 1 when EOF on the archive volume was detected.
399 res = MIN((bufend - bufpt), skcnt); in rd_skip()
401 skcnt -= res; in rd_skip()
421 return(-1); in rd_skip()
422 res += cnt - skipped; in rd_skip()
430 cnt = bufend - bufpt; in rd_skip()
435 return(-1); in rd_skip()
440 res -= cnt; in rd_skip()
447 * flush out any data (and pad if required) the last block. We always pad
457 memset(bufpt, 0, bufend - bufpt); in wr_fin()
471 * 0 if buffer was filled ok, -1 o.w. (buffer flush failure)
475 wr_rdbuf(char *out, int outcnt) in wr_rdbuf() argument
484 cnt = bufend - bufpt; in wr_rdbuf()
486 return(-1); in wr_rdbuf()
491 memcpy(bufpt, out, cnt); in wr_rdbuf()
493 out += cnt; in wr_rdbuf()
494 outcnt -= cnt; in wr_rdbuf()
506 * number of bytes copied to the buffer, 0 indicates EOF on archive volume,
507 * -1 is a read error
521 cnt = bufend - bufpt; in rd_wrbuf()
529 if ((res = cpcnt - incnt) > 0) in rd_wrbuf()
541 incnt -= cnt; in rd_wrbuf()
555 * 0 if ok, -1 if there was a buf_flush failure
567 cnt = bufend - bufpt; in wr_skip()
569 return(-1); in wr_skip()
573 skcnt -= cnt; in wr_skip()
592 * 0 ok, -1 if archive write failure. a short read of the file returns a
601 off_t size = arcn->sb.st_size; in wr_rdfile()
608 cnt = bufend - bufpt; in wr_rdfile()
611 return(-1); in wr_rdfile()
616 size -= res; in wr_rdfile()
625 syswarn(1, errno, "Read fault on %s", arcn->org_name); in wr_rdfile()
627 paxwarn(1, "File changed size during read %s", arcn->org_name); in wr_rdfile()
629 syswarn(1, errno, "Failed stat on %s", arcn->org_name); in wr_rdfile()
630 else if (arcn->sb.st_mtime != sb.st_mtime) in wr_rdfile()
632 arcn->org_name); in wr_rdfile()
653 * 0 ok, -1 if archive read failure. if we cannot write the entire file,
661 off_t size = arcn->sb.st_size; in rd_wrfile()
663 char *fnm = arcn->name; in rd_wrfile()
688 cnt = bufend - bufpt; in rd_wrfile()
707 while (--cnt >= 0) in rd_wrfile()
711 size -= res; in rd_wrfile()
720 if (isem && (arcn->sb.st_size > 0L)) in rd_wrfile()
727 return(-1); in rd_wrfile()
733 if (docrc && (size == 0L) && (arcn->crc != crc)) in rd_wrfile()
734 paxwarn(1,"Actual crc does not match expected crc %s",arcn->name); in rd_wrfile()
740 * copy the contents of one file to another. used during -rw phase of pax
751 char *fnm = arcn->name; in cp_file()
762 if (((off_t)(arcn->sb.st_blocks * BLKMULT)) >= arcn->sb.st_size) in cp_file()
796 arcn->org_name, arcn->name); in cp_file()
797 else if (cpcnt != arcn->sb.st_size) in cp_file()
799 arcn->org_name, arcn->name); in cp_file()
801 syswarn(1, errno, "Failed stat of %s", arcn->org_name); in cp_file()
802 else if (arcn->sb.st_mtime != sb.st_mtime) in cp_file()
804 arcn->org_name, arcn->name); in cp_file()
812 if (!no_hole && isem && (arcn->sb.st_size > 0L)) in cp_file()
820 * the archive volume.
822 * Number of bytes of data in the read buffer, -1 for read error, and
837 * try to fill the buffer. on error the next archive volume is in buf_fill()
862 return(-1); in buf_fill()
871 * 0 if all is ok, -1 when a write error occurs.
883 * volume, prompt for the next volume. (The non-standard -R flag). in buf_flush()
885 * at least one record. We always round limit UP to next blocksize. in buf_flush()
888 paxwarn(0, "User specified archive volume byte limit reached."); in buf_flush()
892 return(-1); in buf_flush()
897 * The new archive volume might have changed the size of the in buf_flush()
898 * write blocksize. if so we figure out if we need to write in buf_flush()
903 * if the block size has shrunk from a volume change. in buf_flush()
909 push = bufcnt - blksz; in buf_flush()
917 * write a block and check if it all went out ok in buf_flush()
934 push -= blksz; in buf_flush()
945 * the last record on this volume violates pax spec.... in buf_flush()
950 cnt = bufcnt - cnt; in buf_flush()
953 if (!frmt->blkalgn || ((cnt % frmt->blkalgn) == 0)) in buf_flush()
966 * The new archive volume might also have changed the block in buf_flush()
967 * size. if so, figure out if we have too much or too little in buf_flush()
974 push = bufcnt - blksz; in buf_flush()
981 return(-1); in buf_flush()