z2ram.c (4f2c0a4acffbec01079c28f839422e64ddeff004) | z2ram.c (d32e2bf83791727a84ad5d3e3d713e82f9adbe30) |
---|---|
1/* 2** z2ram - Amiga pseudo-driver to access 16bit-RAM in ZorroII space 3** as a block device, to be used as a RAM disk or swap space 4** 5** Copyright (C) 1994 by Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de) 6** 7** ++Geert: support for zorro_unused_z2ram, better range checking 8** ++roman: translate accesses via an array --- 126 unchanged lines hidden (view full) --- 135 } 136 137 z2ram_size++; 138 } 139 140 return; 141} 142 | 1/* 2** z2ram - Amiga pseudo-driver to access 16bit-RAM in ZorroII space 3** as a block device, to be used as a RAM disk or swap space 4** 5** Copyright (C) 1994 by Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de) 6** 7** ++Geert: support for zorro_unused_z2ram, better range checking 8** ++roman: translate accesses via an array --- 126 unchanged lines hidden (view full) --- 135 } 136 137 z2ram_size++; 138 } 139 140 return; 141} 142 |
143static int z2_open(struct block_device *bdev, fmode_t mode) | 143static int z2_open(struct gendisk *disk, fmode_t mode) |
144{ | 144{ |
145 int device; | 145 int device = disk->first_minor; |
146 int max_z2_map = (Z2RAM_SIZE / Z2RAM_CHUNKSIZE) * sizeof(z2ram_map[0]); 147 int max_chip_map = (amiga_chip_size / Z2RAM_CHUNKSIZE) * 148 sizeof(z2ram_map[0]); 149 int rc = -ENOMEM; 150 | 146 int max_z2_map = (Z2RAM_SIZE / Z2RAM_CHUNKSIZE) * sizeof(z2ram_map[0]); 147 int max_chip_map = (amiga_chip_size / Z2RAM_CHUNKSIZE) * 148 sizeof(z2ram_map[0]); 149 int rc = -ENOMEM; 150 |
151 device = MINOR(bdev->bd_dev); 152 | |
153 mutex_lock(&z2ram_mutex); 154 if (current_device != -1 && current_device != device) { 155 rc = -EBUSY; 156 goto err_out; 157 } 158 159 if (current_device == -1) { 160 z2_count = 0; --- 254 unchanged lines hidden --- | 151 mutex_lock(&z2ram_mutex); 152 if (current_device != -1 && current_device != device) { 153 rc = -EBUSY; 154 goto err_out; 155 } 156 157 if (current_device == -1) { 158 z2_count = 0; --- 254 unchanged lines hidden --- |