- else
-#endif /* HAVE_LINUX_ZFTAPE_H */
- errstr = tape_wrlabel(tapename, "X", label, tt_blocksize_kb * 1024);
- if(errstr != NULL) {
- putchar('\n');
- error(errstr);
- }
-
-#ifdef HAVE_LINUX_ZFTAPE_H
- if (isa_zftape) {
- tapefd_weof(fd, 1);
- }
-#endif /* HAVE_LINUX_ZFTAPE_H */
-
-#ifdef HAVE_LINUX_ZFTAPE_H
- if (isa_zftape) {
- errstr = tapefd_wrendmark(fd, "X", tt_blocksize_kb * 1024);
- if(errstr != NULL) {
- putchar('\n');
- error(errstr);
- }
- }
- else
-#endif /* HAVE_LINUX_ZFTAPE_H */
- errstr = tape_wrendmark(tapename, "X", tt_blocksize_kb * 1024);
- if(errstr != NULL) {
- putchar('\n');
- error(errstr);
- }
-
-#ifdef HAVE_LINUX_ZFTAPE_H
- if (isa_zftape) {
- tapefd_weof(fd, 1);
-
- printf(",\nrewinding"); fflush(stdout);
-
- if(tapefd_rewind(fd) == -1) {
- putchar('\n');
- error(strerror(errno));
- }
- close(fd);
-#ifdef HAVE_LIBVTBLC
- /* update volume table */
- printf(", updating volume table"); fflush(stdout);
-
- if ((fd = raw_tape_open(rawtapedev, O_RDWR)) == -1) {
- if(errno == EACCES) {
- errstr = newstralloc(errstr,
- "updating volume table: raw tape device is write protected");
- } else {
- errstr = newstralloc2(errstr,
- "updating volume table: ", strerror(errno));
- }
- putchar('\n');
- error(errstr);
- }
- /* read volume table */
- if ((num_volumes = read_vtbl(fd, volumes, vtbl_buffer,
- &first_seg, &last_seg)) == -1 ) {
- errstr = newstralloc2(errstr,
- "reading volume table: ", strerror(errno));
- putchar('\n');
- error(errstr);
- }
- /* set date and volume label for first entry */
- vtbl_no = 0;
- datestr = NULL;
- if (set_date(datestr, volumes, num_volumes, vtbl_no)){
- errstr = newstralloc2(errstr,
- "setting date for entry 1: ", strerror(errno));
- putchar('\n');
- error(errstr);
- }
- if(set_label(label, volumes, num_volumes, vtbl_no)){
- errstr = newstralloc2(errstr,
- "setting label for entry 1: ", strerror(errno));
- putchar('\n');
- error(errstr);
- }
- /* set date and volume label for last entry */
- vtbl_no = 1;
- datestr = NULL;
- if (set_date(datestr, volumes, num_volumes, vtbl_no)){
- errstr = newstralloc2(errstr,
- "setting date for entry 2: ", strerror(errno));
- putchar('\n');
- error(errstr);
- }
- if(set_label("AMANDA Tape End", volumes, num_volumes, vtbl_no)){
- errstr = newstralloc2(errstr,
- "setting label for entry 2: ", strerror(errno));
- putchar('\n');
- error(errstr);
- }
- /* write volume table back */
- if (write_vtbl(fd, volumes, vtbl_buffer, num_volumes, first_seg,
- op_mode == trunc)) {
- errstr = newstralloc2(errstr,
- "writing volume table: ", strerror(errno));
- putchar('\n');
- error(errstr);
- }
- close(fd);
-#endif /* HAVE_LIBVTBLC */
- }
-#endif /* HAVE_LINUX_ZFTAPE_H */
-
- if (tape_ok) {
- printf(", checking label"); fflush(stdout);