dev_printk(KERN_INFO, &SDp->sdev_gendev, 
sdev_printk(KERN_INFO, &SDp, 
static int osst_probe(struct device *dev){	struct scsi_device * SDp = to_scsi_device(dev);	struct osst_tape   * tpnt;	struct st_modedef  * STm;	struct st_partstat * STps;	struct osst_buffer * buffer;	struct gendisk	   * drive;	int		     i, mode, dev_num;	if (SDp->type != TYPE_TAPE || !osst_supports(SDp))		return -ENODEV;	drive = alloc_disk(1);	if (!drive) {		printk(KERN_ERR "osst :E: Out of memory. Device not attached.\n");		return -ENODEV;	}	/* if this is the first attach, build the infrastructure */	write_lock(&os_scsi_tapes_lock);	if (os_scsi_tapes == NULL) {		os_scsi_tapes =			(struct osst_tape **)kmalloc(osst_max_dev * sizeof(struct osst_tape *),				   GFP_ATOMIC);		if (os_scsi_tapes == NULL) {			write_unlock(&os_scsi_tapes_lock);			printk(KERN_ERR "osst :E: Unable to allocate array for OnStream SCSI tapes.\n");			goto out_put_disk;		}		for (i=0; i < osst_max_dev; ++i) os_scsi_tapes[i] = NULL;	}		if (osst_nr_dev >= osst_max_dev) {		write_unlock(&os_scsi_tapes_lock);		printk(KERN_ERR "osst :E: Too many tape devices (max. %d).\n", osst_max_dev);		goto out_put_disk;	}	/* find a free minor number */	for (i=0; os_scsi_tapes[i] && i<osst_max_dev; i++);	if(i >= osst_max_dev) panic ("Scsi_devices corrupt (osst)");	dev_num = i;	/* allocate a struct osst_tape for this device */	tpnt = (struct osst_tape *)kmalloc(sizeof(struct osst_tape), GFP_ATOMIC);	if (tpnt == NULL) {		write_unlock(&os_scsi_tapes_lock);		printk(KERN_ERR "osst :E: Can't allocate device descriptor, device not attached.\n");		goto out_put_disk;	}	memset(tpnt, 0, sizeof(struct osst_tape));	/* allocate a buffer for this device */	i = SDp->host->sg_tablesize;	if (osst_max_sg_segs < i)		i = osst_max_sg_segs;	buffer = new_tape_buffer(1, SDp->host->unchecked_isa_dma, i);	if (buffer == NULL) {		write_unlock(&os_scsi_tapes_lock);		printk(KERN_ERR "osst :E: Unable to allocate a tape buffer, device not attached.\n");		kfree(tpnt);		goto out_put_disk;	}	os_scsi_tapes[dev_num] = tpnt;	tpnt->buffer = buffer;	tpnt->device = SDp;	drive->private_data = &tpnt->driver;	sprintf(drive->disk_name, "osst%d", dev_num);	tpnt->driver = &osst_template;	tpnt->drive = drive;	tpnt->in_use = 0;	tpnt->capacity = 0xfffff;	tpnt->dirty = 0;	tpnt->drv_buffer = 1;  /* Try buffering if no mode sense */	tpnt->restr_dma = (SDp->host)->unchecked_isa_dma;	tpnt->density = 0;	tpnt->do_auto_lock = OSST_AUTO_LOCK;	tpnt->can_bsr = OSST_IN_FILE_POS;	tpnt->can_partitions = 0;	tpnt->two_fm = OSST_TWO_FM;	tpnt->fast_mteom = OSST_FAST_MTEOM;	tpnt->scsi2_logical = OSST_SCSI2LOGICAL; /* FIXME */	tpnt->write_threshold = osst_write_threshold;	tpnt->default_drvbuffer = 0xff; /* No forced buffering */	tpnt->partition = 0;	tpnt->new_partition = 0;	tpnt->nbr_partitions = 0;	tpnt->min_block = 512;	tpnt->max_block = OS_DATA_SIZE;	tpnt->timeout = OSST_TIMEOUT;	tpnt->long_timeout = OSST_LONG_TIMEOUT;	/* Recognize OnStream tapes */	/* We don't need to test for OnStream, as this has been done in detect () */	tpnt->os_fw_rev = osst_parse_firmware_rev (SDp->rev);	tpnt->omit_blklims = 1;	tpnt->poll = (strncmp(SDp->model, "DI-", 3) == 0) || 		     (strncmp(SDp->model, "FW-", 3) == 0) || OSST_FW_NEED_POLL(tpnt->os_fw_rev,SDp);	tpnt->frame_in_buffer = 0;	tpnt->header_ok = 0;	tpnt->linux_media = 0;	tpnt->header_cache = NULL;	for (i=0; i < ST_NBR_MODES; i++) {		STm = &(tpnt->modes[i]);		STm->defined = 0;		STm->sysv = OSST_SYSV;		STm->defaults_for_writes = 0;		STm->do_async_writes = OSST_ASYNC_WRITES;		STm->do_buffer_writes = OSST_BUFFER_WRITES;		STm->do_read_ahead = OSST_READ_AHEAD;		STm->default_compression = ST_DONT_TOUCH;		STm->default_blksize = 512;		STm->default_density = (-1);  /* No forced density */	}	for (i=0; i < ST_NBR_PARTITIONS; i++) {		STps = &(tpnt->ps[i]);		STps->rw = ST_IDLE;		STps->eof = ST_NOEOF;		STps->at_sm = 0;		STps->last_block_valid = 0;		STps->drv_block = (-1);		STps->drv_file = (-1);	}	tpnt->current_mode = 0;	tpnt->modes[0].defined = 1;	tpnt->modes[2].defined = 1;	tpnt->density_changed = tpnt->compression_changed = tpnt->blksize_changed = 0;	init_MUTEX(&tpnt->lock);	osst_nr_dev++;	write_unlock(&os_scsi_tapes_lock);	{		char name[8];		/*  Rewind entry  */		osst_sysfs_add(MKDEV(OSST_MAJOR, dev_num), dev, tpnt, tape_name(tpnt));		/*  No-rewind entry  */		snprintf(name, 8, "%s%s", "n", tape_name(tpnt));		osst_sysfs_add(MKDEV(OSST_MAJOR, dev_num + 128), dev, tpnt, name);	}	for (mode = 0; mode < ST_NBR_MODES; ++mode) {		/*  Rewind entry  */		devfs_mk_cdev(MKDEV(OSST_MAJOR, dev_num + (mode << 5)),				S_IFCHR | S_IRUGO | S_IWUGO,				"%s/ot%s", SDp->devfs_name, osst_formats[mode]);		/*  No-rewind entry  */		devfs_mk_cdev(MKDEV(OSST_MAJOR, dev_num + (mode << 5) + 128),				S_IFCHR | S_IRUGO | S_IWUGO,				"%s/ot%sn", SDp->devfs_name, osst_formats[mode]);	}	drive->number = devfs_register_tape(SDp->devfs_name);	dev_printk(KERN_INFO, &SDp->sdev_gendev,		"osst :I: Attached OnStream %.5s tape as %s\n",		SDp->model, tape_name(tpnt));	return 0;out_put_disk:        put_disk(drive);        return -ENODEV;};
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/017560fca496f72ed9dd734ffde63ce39dfe0411/osst.c/clean/drivers/scsi/osst.c