Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:lmich:SLE
cpio-2.6
cpio-2.6-eof-handling.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File cpio-2.6-eof-handling.patch of Package cpio-2.6
--- doc/cpio.1 +++ doc/cpio.1 @@ -54,6 +54,19 @@ hpbin@4GB@same as bin, but different device major/minor encoding hpodc@8GB@same as odc, but different device major/minor encoding .TE +.PP +.SH WRITING AND READING ARCHIVES ON MULTIPLE TAPES +.PP +When the end of the medium has been reached, cpio will ask the user +for to mount a new "tape" to continue the processing. +If the user specified the device name on the command line +(with the -I, -O, -F or --file options), then cpio can automatically +re-open the same device to use the next medium. If the user did not +specify the device name, then cpio will ask them which device to use. +.PP +Before re-opening the tape, cpio will prompt the user to switch +tapes. This message can be changed with the option -M MESSAGE or + --message=MESSAGE. .LP .SH DESCRIPTION GNU cpio is fully documented in the texinfo documentation. To access the --- doc/cpio.info +++ doc/cpio.info @@ -479,6 +479,14 @@ Sticking a floppy disk to a filing cabinet using a magnet is probably not a good idea. + Writing and reading archives on multiple tapes needs user's attention. +When the end of the medium has been reached, cpio will ask the user +for to mount a new "tape" to continue the processing. +If the user specified the device name on the command line +(with the -I, -O, -F or --file options), then cpio can automatically +re-open the same device to use the next medium. If the user did not +specify the device name, then cpio will ask them which device to use. + File: cpio.info, Node: Concept Index, Prev: Media, Up: Top --- src/util.c +++ src/util.c @@ -188,8 +188,15 @@ input_size = rmtread (in_des, input_buffer, num_bytes); if (input_size == 0 && input_is_special) { - get_next_reel (in_des); + if (!tape_eof (in_des)) + get_next_reel (in_des); input_size = rmtread (in_des, input_buffer, num_bytes); + if (input_size == 0) + { + if (tape_eod (in_des)) + get_next_reel (in_des); + input_size = rmtread (in_des, input_buffer, num_bytes); + } } if (input_size < 0) error (1, errno, _("read error")); @@ -354,8 +361,15 @@ { if (input_is_special) { - get_next_reel (in_des); + if (!tape_eof (in_des)) + get_next_reel (in_des); tmp_input_size = rmtread (in_des, append_buf, io_block_size); + if (tmp_input_size == 0) + { + if (tape_eod (in_des)) + get_next_reel (in_des); + tmp_input_size = rmtread (in_des, append_buf, io_block_size); + } } else break; @@ -828,6 +842,40 @@ #endif } +int +tape_eof( int tape_des) +{ + struct mtget status; + + if (rmtioctl (tape_des, MTIOCGET, (char*)&status) == -1) { + error (1, errno, "Cannot get tape status"); + return 0; + } + + if (GMT_EOF(status.mt_gstat)) { + return 1; + } + + return 0; +} + +int +tape_eod( int tape_des) +{ + struct mtget status; + + if (rmtioctl (tape_des, MTIOCGET, (char*)&status) == -1) { + error (1, errno, "Cannot get tape status"); + return 1; + } + + if (GMT_EOD(status.mt_gstat)) { + return 1; + } + + return 0; +} + /* The file on file descriptor TAPE_DES is assumed to be magnetic tape (or floppy disk or other device) and the end of the medium has been reached. Ask the user for to mount a new "tape" to continue
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor