diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-02-08 14:03:14 -0500 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2012-02-08 14:03:14 -0500 |
commit | cdccaa9467b982d57b139818d15e1e994feca372 (patch) | |
tree | 573e6aa79bce8105b3a2508a462d03368ac5214c /drivers | |
parent | 37b40adf2d1b4a5e51323be73ccf8ddcf3f15dd3 (diff) |
cdrom: move shared static to cdrom_device_info
The keeplocked variable in the cdrom driver is shared across multiple
drives, but set in per-device ioctls. Move it to the per-device struct,
avoiding that the setting on one drive affects the driver's behavior
when closing another.
[ Impact: limit udev's confusion to one drive when a CD burning program
unlocks the CD door at the end of burning. ]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/cdrom/cdrom.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index 8fefe59f52a7..d620b4495745 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c | |||
@@ -286,8 +286,6 @@ | |||
286 | 286 | ||
287 | /* used to tell the module to turn on full debugging messages */ | 287 | /* used to tell the module to turn on full debugging messages */ |
288 | static bool debug; | 288 | static bool debug; |
289 | /* used to keep tray locked at all times */ | ||
290 | static int keeplocked; | ||
291 | /* default compatibility mode */ | 289 | /* default compatibility mode */ |
292 | static bool autoclose=1; | 290 | static bool autoclose=1; |
293 | static bool autoeject; | 291 | static bool autoeject; |
@@ -1204,7 +1202,7 @@ void cdrom_release(struct cdrom_device_info *cdi, fmode_t mode) | |||
1204 | cdinfo(CD_CLOSE, "Use count for \"/dev/%s\" now zero\n", cdi->name); | 1202 | cdinfo(CD_CLOSE, "Use count for \"/dev/%s\" now zero\n", cdi->name); |
1205 | cdrom_dvd_rw_close_write(cdi); | 1203 | cdrom_dvd_rw_close_write(cdi); |
1206 | 1204 | ||
1207 | if ((cdo->capability & CDC_LOCK) && !keeplocked) { | 1205 | if ((cdo->capability & CDC_LOCK) && !cdi->keeplocked) { |
1208 | cdinfo(CD_CLOSE, "Unlocking door!\n"); | 1206 | cdinfo(CD_CLOSE, "Unlocking door!\n"); |
1209 | cdo->lock_door(cdi, 0); | 1207 | cdo->lock_door(cdi, 0); |
1210 | } | 1208 | } |
@@ -1371,7 +1369,7 @@ static int cdrom_select_disc(struct cdrom_device_info *cdi, int slot) | |||
1371 | curslot = info->hdr.curslot; | 1369 | curslot = info->hdr.curslot; |
1372 | kfree(info); | 1370 | kfree(info); |
1373 | 1371 | ||
1374 | if (cdi->use_count > 1 || keeplocked) { | 1372 | if (cdi->use_count > 1 || cdi->keeplocked) { |
1375 | if (slot == CDSL_CURRENT) { | 1373 | if (slot == CDSL_CURRENT) { |
1376 | return curslot; | 1374 | return curslot; |
1377 | } else { | 1375 | } else { |
@@ -2289,7 +2287,7 @@ static int cdrom_ioctl_eject(struct cdrom_device_info *cdi) | |||
2289 | 2287 | ||
2290 | if (!CDROM_CAN(CDC_OPEN_TRAY)) | 2288 | if (!CDROM_CAN(CDC_OPEN_TRAY)) |
2291 | return -ENOSYS; | 2289 | return -ENOSYS; |
2292 | if (cdi->use_count != 1 || keeplocked) | 2290 | if (cdi->use_count != 1 || cdi->keeplocked) |
2293 | return -EBUSY; | 2291 | return -EBUSY; |
2294 | if (CDROM_CAN(CDC_LOCK)) { | 2292 | if (CDROM_CAN(CDC_LOCK)) { |
2295 | int ret = cdi->ops->lock_door(cdi, 0); | 2293 | int ret = cdi->ops->lock_door(cdi, 0); |
@@ -2316,7 +2314,7 @@ static int cdrom_ioctl_eject_sw(struct cdrom_device_info *cdi, | |||
2316 | 2314 | ||
2317 | if (!CDROM_CAN(CDC_OPEN_TRAY)) | 2315 | if (!CDROM_CAN(CDC_OPEN_TRAY)) |
2318 | return -ENOSYS; | 2316 | return -ENOSYS; |
2319 | if (keeplocked) | 2317 | if (cdi->keeplocked) |
2320 | return -EBUSY; | 2318 | return -EBUSY; |
2321 | 2319 | ||
2322 | cdi->options &= ~(CDO_AUTO_CLOSE | CDO_AUTO_EJECT); | 2320 | cdi->options &= ~(CDO_AUTO_CLOSE | CDO_AUTO_EJECT); |
@@ -2447,7 +2445,7 @@ static int cdrom_ioctl_lock_door(struct cdrom_device_info *cdi, | |||
2447 | if (!CDROM_CAN(CDC_LOCK)) | 2445 | if (!CDROM_CAN(CDC_LOCK)) |
2448 | return -EDRIVE_CANT_DO_THIS; | 2446 | return -EDRIVE_CANT_DO_THIS; |
2449 | 2447 | ||
2450 | keeplocked = arg ? 1 : 0; | 2448 | cdi->keeplocked = arg ? 1 : 0; |
2451 | 2449 | ||
2452 | /* | 2450 | /* |
2453 | * Don't unlock the door on multiple opens by default, but allow | 2451 | * Don't unlock the door on multiple opens by default, but allow |