cd->needs_sector_size = 0; 
static void get_sectorsize(struct scsi_cd *cd){	unsigned char cmd[10];	unsigned char *buffer;	int the_result, retries = 3;	int sector_size;	struct scsi_request *SRpnt = NULL;	request_queue_t *queue;	buffer = kmalloc(512, GFP_KERNEL | GFP_DMA);	if (!buffer)		goto Enomem;	SRpnt = scsi_allocate_request(cd->device, GFP_KERNEL);	if (!SRpnt)		goto Enomem;	do {		cmd[0] = READ_CAPACITY;		memset((void *) &cmd[1], 0, 9);		/* Mark as really busy */		SRpnt->sr_request->rq_status = RQ_SCSI_BUSY;		SRpnt->sr_cmd_len = 0;		memset(buffer, 0, 8);		/* Do the command and wait.. */		SRpnt->sr_data_direction = DMA_FROM_DEVICE;		scsi_wait_req(SRpnt, (void *) cmd, (void *) buffer,			      8, SR_TIMEOUT, MAX_RETRIES);		the_result = SRpnt->sr_result;		retries--;	} while (the_result && retries);	scsi_release_request(SRpnt);	SRpnt = NULL;	if (the_result) {		cd->capacity = 0x1fffff;		sector_size = 2048;	/* A guess, just in case */		cd->needs_sector_size = 1;	} else {#if 0		if (cdrom_get_last_written(&cd->cdi,					   &cd->capacity))#endif			cd->capacity = 1 + ((buffer[0] << 24) |						    (buffer[1] << 16) |						    (buffer[2] << 8) |						    buffer[3]);		sector_size = (buffer[4] << 24) |		    (buffer[5] << 16) | (buffer[6] << 8) | buffer[7];		switch (sector_size) {			/*			 * HP 4020i CD-Recorder reports 2340 byte sectors			 * Philips CD-Writers report 2352 byte sectors			 *			 * Use 2k sectors for them..			 */		case 0:		case 2340:		case 2352:			sector_size = 2048;			/* fall through */		case 2048:			cd->capacity *= 4;			/* fall through */		case 512:			break;		default:			printk("%s: unsupported sector size %d.\n",			       cd->cdi.name, sector_size);			cd->capacity = 0;			cd->needs_sector_size = 1;		}		cd->device->sector_size = sector_size;		/*		 * Add this so that we have the ability to correctly gauge		 * what the device is capable of.		 */		cd->needs_sector_size = 0;		set_capacity(cd->disk, cd->capacity);	}	queue = cd->device->request_queue;	blk_queue_hardsect_size(queue, sector_size);out:	kfree(buffer);	return;Enomem:	cd->capacity = 0x1fffff;	sector_size = 2048;	/* A guess, just in case */	cd->needs_sector_size = 1;	if (SRpnt)		scsi_release_request(SRpnt);	goto out;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/51490c89f95b8581782e9baa855da166441852be/sr.c/clean/drivers/scsi/sr.c