summaryrefslogtreecommitdiff
path: root/usr/src/cmd/cdrw
diff options
context:
space:
mode:
authorminht <none@none>2006-02-14 16:44:40 -0800
committerminht <none@none>2006-02-14 16:44:40 -0800
commit4077f1edd804bc43a73283bdb046664cef33586d (patch)
tree82e3205722f9d868bc654c6f7a6b5cfe42423dc3 /usr/src/cmd/cdrw
parent3ddd2818ac8897094b3a1e147b4788ccbe199a0f (diff)
downloadillumos-joyent-4077f1edd804bc43a73283bdb046664cef33586d.tar.gz
6374677 Unable to use cdrw -c option using DVD+RW media on Panasonic
6373496 Unable to use cdrw -c option using DVD+RW media on TEAC
Diffstat (limited to 'usr/src/cmd/cdrw')
-rw-r--r--usr/src/cmd/cdrw/copycd.c41
-rw-r--r--usr/src/cmd/cdrw/trackio.c4
-rw-r--r--usr/src/cmd/cdrw/util.c5
3 files changed, 41 insertions, 9 deletions
diff --git a/usr/src/cmd/cdrw/copycd.c b/usr/src/cmd/cdrw/copycd.c
index 0479e6ac12..396b4ac55f 100644
--- a/usr/src/cmd/cdrw/copycd.c
+++ b/usr/src/cmd/cdrw/copycd.c
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -137,6 +137,7 @@ ensure_media_space(uint32_t total_nblks, uchar_t end_tno)
{
off_t nblks_avail;
uint_t bsize;
+ uint_t leadin_size = 0;
get_media_type(target->d_fd);
@@ -156,6 +157,7 @@ ensure_media_space(uint32_t total_nblks, uchar_t end_tno)
"Cannot find out media capacity.\n"));
exit(1);
}
+ leadin_size = end_tno*300;
}
} else {
if (device_type == CD_RW) {
@@ -176,11 +178,11 @@ ensure_media_space(uint32_t total_nblks, uchar_t end_tno)
}
}
- if ((total_nblks + end_tno*300) > nblks_avail) {
+ if ((total_nblks + leadin_size) > nblks_avail) {
err_msg(gettext("Not enough space on the media.\n"));
if (debug) {
(void) printf("Need %u only found %u \n",
- (total_nblks + end_tno*300),
+ (total_nblks + leadin_size),
(uint32_t)nblks_avail);
}
@@ -267,8 +269,7 @@ copy_cd(void)
gettext("Copying multisession CD is not supported\n"));
exit(1);
}
- if ((ti->ti_flags & TI_PACKET_MODE) ||
- (ti->ti_flags & TI_BLANK_TRACK) ||
+ if ((ti->ti_flags & TI_BLANK_TRACK) ||
(ti->ti_flags & TI_DAMAGED_TRACK) ||
(data_cd && audio_cd) || (ti->ti_data_mode == 2)) {
@@ -375,6 +376,36 @@ copy_cd(void)
write_init(audio_cd ? TRACK_MODE_AUDIO : TRACK_MODE_DATA);
}
+ if (device_type == DVD_PLUS_W) {
+ /*
+ * DVD+RW requires that we format the media before
+ * writing.
+ */
+ (void) print_n_flush(gettext("Formatting media..."));
+ if (!format_media(target->d_fd)) {
+ (void) printf(gettext(
+ "Could not format media\n"));
+ exit(1);
+ } else {
+ int counter;
+ uchar_t *di;
+
+ /* poll until format is done */
+ di = (uchar_t *)my_zalloc(DISC_INFO_BLOCK_SIZE);
+ (void) sleep(10);
+ for (counter = 0; counter < 200; counter++) {
+ ret = read_disc_info(target->d_fd, di);
+ if ((SENSE_KEY(rqbuf) == 2) &&
+ (ASC(rqbuf) == 4)) {
+ (void) print_n_flush(".");
+ (void) sleep(5);
+ } else {
+ break;
+ }
+ }
+ }
+ }
+
/* for each track */
for (i = 0; i < end_tno; i++) {
/*
diff --git a/usr/src/cmd/cdrw/trackio.c b/usr/src/cmd/cdrw/trackio.c
index 7a3a541850..ae77436d80 100644
--- a/usr/src/cmd/cdrw/trackio.c
+++ b/usr/src/cmd/cdrw/trackio.c
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -62,7 +62,7 @@ static int tio_got_ctrl_c;
static mutex_t pcb_mutex;
static cond_t pcb_cond;
static uchar_t pcb_user_abort, pcb_done, pcb_synch_initialized;
-static uint_t pcb_completed_io_size;
+static int64_t pcb_completed_io_size;
static int (*pcb_cb)(int64_t, int64_t);
static int64_t pcb_arg;
diff --git a/usr/src/cmd/cdrw/util.c b/usr/src/cmd/cdrw/util.c
index 57eadb3c8d..34db0b0478 100644
--- a/usr/src/cmd/cdrw/util.c
+++ b/usr/src/cmd/cdrw/util.c
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -195,7 +195,8 @@ int
progress(int64_t arg, int64_t completed)
{
char s[BUFSIZE];
- uint64_t total = (uint64_t)arg & 0xffffffff;
+ uint64_t total = (uint64_t)arg;
+
if (completed == -1) {
/* Got ^C. Add 2 to progress pos to compensate for ^ and C */
progress_pos = str_print("(flushing ...)", progress_pos+2);