Commit bedbeab4 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] acsi per-disk gendisks

parent d572f1a5
...@@ -244,9 +244,10 @@ typedef union { ...@@ -244,9 +244,10 @@ typedef union {
char *acsi_buffer; char *acsi_buffer;
unsigned long phys_acsi_buffer; unsigned long phys_acsi_buffer;
static int NDevices = 0; static int NDevices;
static struct hd_struct acsi_part[MAX_DEV<<4] = { {0,0}, }; static struct hd_struct acsi_part[MAX_DEV<<4];
static int access_count[MAX_DEV] = { 0, }; static char acsi_names[MAX_DEV*4];
static int access_count[MAX_DEV];
static int CurrentNReq; static int CurrentNReq;
static int CurrentNSect; static int CurrentNSect;
...@@ -1345,13 +1346,7 @@ static int acsi_mode_sense( int target, int lun, SENSE_DATA *sd ) ...@@ -1345,13 +1346,7 @@ static int acsi_mode_sense( int target, int lun, SENSE_DATA *sd )
extern struct block_device_operations acsi_fops; extern struct block_device_operations acsi_fops;
static struct gendisk acsi_gendisk = { static struct gendisk acsi_gendisk[MAX_DEV];
major: MAJOR_NR,
major_name: "ad",
minor_shift: 4,
part: acsi_part,
fops: &acsi_fops,
};
#define MAX_SCSI_DEVICE_CODE 10 #define MAX_SCSI_DEVICE_CODE 10
...@@ -1700,12 +1695,22 @@ static void acsi_geninit(void) ...@@ -1700,12 +1695,22 @@ static void acsi_geninit(void)
NDevices, n_slm ); NDevices, n_slm );
#endif #endif
for( i = 0; i < NDevices; ++i ) for( i = 0; i < NDevices; ++i ) {
register_disk(&acsi_gendisk, mk_kdev(MAJOR_NR,i<<4), struct gendisk *disk = acsi_gendisk + i;
(acsi_info[i].type==HARDDISK)?1<<4:1, sprintf(acsi_names + 4*i, "ad%c", 'a'+i);
&acsi_fops, disk->major = MAJOR_NR;
disk->first_minor = i << 4;
disk->major_name = acsi_names + 4*i;
disk->minor_shift = (acsi_info[i].type==HARDDISK)?4:0;
disk->part = acsi_part + (i<<4);
disk->fops = &acsi_fops;
disk->nr_real = 1;
add_gendisk(disk);
register_disk(disk, mk_kdev(disk->major, disk->first_minor),
1<<disk->minor_shift,
disk->fops,
acsi_info[i].size); acsi_info[i].size);
acsi_gendisk.nr_real = NDevices; }
} }
#ifdef CONFIG_ATARI_SLM_MODULE #ifdef CONFIG_ATARI_SLM_MODULE
...@@ -1744,8 +1749,6 @@ int acsi_init( void ) ...@@ -1744,8 +1749,6 @@ int acsi_init( void )
STramMask = ATARIHW_PRESENT(EXTD_DMA) ? 0x00000000 : 0xff000000; STramMask = ATARIHW_PRESENT(EXTD_DMA) ? 0x00000000 : 0xff000000;
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_acsi_request, &acsi_lock); blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_acsi_request, &acsi_lock);
add_gendisk(&acsi_gendisk);
#ifdef CONFIG_ATARI_SLM #ifdef CONFIG_ATARI_SLM
err = slm_init(); err = slm_init();
#endif #endif
...@@ -1771,6 +1774,7 @@ int init_module(void) ...@@ -1771,6 +1774,7 @@ int init_module(void)
void cleanup_module(void) void cleanup_module(void)
{ {
int i;
del_timer( &acsi_timer ); del_timer( &acsi_timer );
blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR)); blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
atari_stram_free( acsi_buffer ); atari_stram_free( acsi_buffer );
...@@ -1778,7 +1782,8 @@ void cleanup_module(void) ...@@ -1778,7 +1782,8 @@ void cleanup_module(void)
if (unregister_blkdev( MAJOR_NR, "ad" ) != 0) if (unregister_blkdev( MAJOR_NR, "ad" ) != 0)
printk( KERN_ERR "acsi: cleanup_module failed\n"); printk( KERN_ERR "acsi: cleanup_module failed\n");
del_gendisk(&acsi_gendisk); for (i = 0; i < NDevices; i++)
del_gendisk(acsi_gendisk + i);
} }
#endif #endif
......
...@@ -137,7 +137,6 @@ char *disk_name (struct gendisk *hd, int minor, char *buf) ...@@ -137,7 +137,6 @@ char *disk_name (struct gendisk *hd, int minor, char *buf)
sprintf(s, "%s%d", "md", unit); sprintf(s, "%s%d", "md", unit);
maj = s; maj = s;
break; break;
case ACSI_MAJOR:
case I2O_MAJOR: case I2O_MAJOR:
case DASD_MAJOR: case DASD_MAJOR:
sprintf(s, "%s%c", hd->major_name, unit + 'a'); sprintf(s, "%s%c", hd->major_name, unit + 'a');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment