if (pd->settings.size > PACKET_MAX_SECTORS) { printk("pktcdvd: packet size is too big\n"); return -ENXIO; } 
static int pkt_probe_settings(struct pktcdvd_device *pd){	struct packet_command cgc;	unsigned char buf[12];	disc_information di;	track_information ti;	int ret, track;	init_cdrom_command(&cgc, buf, sizeof(buf), CGC_DATA_READ);	cgc.cmd[0] = GPCMD_GET_CONFIGURATION;	cgc.cmd[8] = 8;	ret = pkt_generic_packet(pd, &cgc);	pd->mmc3_profile = ret ? 0xffff : buf[6] << 8 | buf[7];	memset(&di, 0, sizeof(disc_information));	memset(&ti, 0, sizeof(track_information));	if ((ret = pkt_get_disc_info(pd, &di))) {		printk("failed get_disc\n");		return ret;	}	if (pkt_good_disc(pd, &di))		return -ENXIO;	switch (pd->mmc3_profile) {		case 0x1a: /* DVD+RW */			printk("pktcdvd: inserted media is DVD+RW\n");			break;		case 0x13: /* DVD-RW */			printk("pktcdvd: inserted media is DVD-RW\n");			break;		case 0x12: /* DVD-RAM */			printk("pktcdvd: inserted media is DVD-RAM\n");			break;		default:			printk("pktcdvd: inserted media is CD-R%s\n", di.erasable ? "W" : "");			break;	}	pd->type = di.erasable ? PACKET_CDRW : PACKET_CDR;	track = 1; /* (di.last_track_msb << 8) | di.last_track_lsb; */	if ((ret = pkt_get_track_info(pd, track, 1, &ti))) {		printk("pktcdvd: failed get_track\n");		return ret;	}	if (pkt_good_track(&ti)) {		printk("pktcdvd: can't write to this track\n");		return -ENXIO;	}	/*	 * we keep packet size in 512 byte units, makes it easier to	 * deal with request calculations.	 */	pd->settings.size = be32_to_cpu(ti.fixed_packet_size) << 2;	if (pd->settings.size == 0) {		printk("pktcdvd: detected zero packet size!\n");		pd->settings.size = 128;	}	pd->settings.fp = ti.fp;	pd->offset = (be32_to_cpu(ti.track_start) << 2) & (pd->settings.size - 1);	if (ti.nwa_v) {		pd->nwa = be32_to_cpu(ti.next_writable);		set_bit(PACKET_NWA_VALID, &pd->flags);	}	/*	 * in theory we could use lra on -RW media as well and just zero	 * blocks that haven't been written yet, but in practice that	 * is just a no-go. we'll use that for -R, naturally.	 */	if (ti.lra_v) {		pd->lra = be32_to_cpu(ti.last_rec_address);		set_bit(PACKET_LRA_VALID, &pd->flags);	} else {		pd->lra = 0xffffffff;		set_bit(PACKET_LRA_VALID, &pd->flags);	}	/*	 * fine for now	 */	pd->settings.link_loss = 7;	pd->settings.write_type = 0;	/* packet */	pd->settings.track_mode = ti.track_mode;	/*	 * mode1 or mode2 disc	 */	switch (ti.data_mode) {		case PACKET_MODE1:			pd->settings.block_mode = PACKET_BLOCK_MODE1;			break;		case PACKET_MODE2:			pd->settings.block_mode = PACKET_BLOCK_MODE2;			break;		default:			printk("pktcdvd: unknown data mode\n");			return 1;	}	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/d0272e78eee4dc53c887fd132e9035daf037d423/pktcdvd.c/buggy/drivers/block/pktcdvd.c