mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
Revert "ide: unexport DISK_EVENT_MEDIA_CHANGE for ide-gd and ide-cd"
This reverts commit 7eec77a181
.
Instead of leaving disk->events completely empty, we now export the
supported events again, and tell the block layer not to forward events
to user space by not setting DISK_EVENT_FLAG_UEVENT. This allows the
block layer to distinguish between devices that for which events should
be handled in kernel only, and devices which don't support any meda
change events at all.
Cc: Borislav Petkov <bp@alien8.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
c92e2f04b3
commit
3c12c8e94c
@ -1797,6 +1797,7 @@ static int ide_cd_probe(ide_drive_t *drive)
|
||||
ide_cd_read_toc(drive);
|
||||
g->fops = &idecd_ops;
|
||||
g->flags |= GENHD_FL_REMOVABLE | GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE;
|
||||
g->events = DISK_EVENT_MEDIA_CHANGE;
|
||||
device_add_disk(&drive->gendev, g, NULL);
|
||||
return 0;
|
||||
|
||||
|
@ -82,8 +82,9 @@ int ide_cdrom_drive_status(struct cdrom_device_info *cdi, int slot_nr)
|
||||
|
||||
/*
|
||||
* ide-cd always generates media changed event if media is missing, which
|
||||
* makes it impossible to use for proper event reporting, so disk->events
|
||||
* is cleared to 0 and the following function is used only to trigger
|
||||
* makes it impossible to use for proper event reporting, so
|
||||
* DISK_EVENT_FLAG_UEVENT is cleared in disk->event_flags
|
||||
* and the following function is used only to trigger
|
||||
* revalidation and never propagated to userland.
|
||||
*/
|
||||
unsigned int ide_cdrom_check_events_real(struct cdrom_device_info *cdi,
|
||||
|
@ -299,8 +299,9 @@ static unsigned int ide_gd_check_events(struct gendisk *disk,
|
||||
/*
|
||||
* The following is used to force revalidation on the first open on
|
||||
* removeable devices, and never gets reported to userland as
|
||||
* genhd->events is 0. This is intended as removeable ide disk
|
||||
* can't really detect MEDIA_CHANGE events.
|
||||
* DISK_EVENT_FLAG_UEVENT isn't set in genhd->event_flags.
|
||||
* This is intended as removable ide disk can't really detect
|
||||
* MEDIA_CHANGE events.
|
||||
*/
|
||||
ret = drive->dev_flags & IDE_DFLAG_MEDIA_CHANGED;
|
||||
drive->dev_flags &= ~IDE_DFLAG_MEDIA_CHANGED;
|
||||
@ -416,6 +417,7 @@ static int ide_gd_probe(ide_drive_t *drive)
|
||||
if (drive->dev_flags & IDE_DFLAG_REMOVABLE)
|
||||
g->flags = GENHD_FL_REMOVABLE;
|
||||
g->fops = &ide_gd_ops;
|
||||
g->events = DISK_EVENT_MEDIA_CHANGE;
|
||||
device_add_disk(&drive->gendev, g, NULL);
|
||||
return 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user