* PATCH: Make the SCAN_HWIF/UNREGISTER_HWIF stuff private
@ 2004-08-17 16:10 Alan Cox
0 siblings, 0 replies; only message in thread
From: Alan Cox @ 2004-08-17 16:10 UTC (permalink / raw)
To: linux-ide, linux-kernel
Until we can kill these off here is a simple change that removes the
pci_dev check and just stops users unloading interfaces not created by
SCAN_HWIF. That cleans up all the unloading of hotplug device corner
cases and stops users breaking things by killing live non generic devices.
Not sure what your current code looks like but a variant of the theory should
apply to any version of the code independantly.
--- include/linux/ide.h~ 2004-08-17 17:07:53.907433024 +0100
+++ include/linux/ide.h 2004-08-17 17:07:53.907433024 +0100
@@ -982,6 +982,7 @@
unsigned present : 1; /* this interface exists logically (ie users) */
unsigned configured : 1; /* this hwif exists and is set up (may not be "present") */
unsigned hold : 1; /* this interface is always present */
+ unsigned user_dev : 1; /* user ioctl created device */
unsigned serialized : 1; /* serialized all channel operation */
unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */
unsigned reset : 1; /* reset after probe */
--- drivers/ide/ide.c~ 2004-08-17 17:07:15.589258272 +0100
+++ drivers/ide/ide.c 2004-08-17 17:07:15.589258272 +0100
@@ -1796,6 +1796,7 @@
case HDIO_SCAN_HWIF:
{
hw_regs_t hw;
+ ide_hwif_t *hwif;
int args[3];
if (!capable(CAP_SYS_RAWIO)) return -EACCES;
if (copy_from_user(args, p, 3 * sizeof(int)))
@@ -1804,15 +1805,16 @@
ide_init_hwif_ports(&hw, (unsigned long) args[0],
(unsigned long) args[1], NULL);
hw.irq = args[2];
- if (ide_register_hw(&hw, NULL) == -1)
+ if (ide_register_hw(&hw, &hwif) == -1)
return -EIO;
+ hwif->user_dev = 1;
return 0;
}
case HDIO_UNREGISTER_HWIF:
if (!capable(CAP_SYS_RAWIO)) return -EACCES;
if(arg > MAX_HWIFS || arg < 0)
return -EINVAL;
- if(ide_hwifs[arg].pci_dev)
+ if(!ide_hwifs[arg].user_dev)
return -EINVAL;
return ide_unregister_hwif(&ide_hwifs[arg]);
case HDIO_SET_NICE:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-08-17 16:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-17 16:10 PATCH: Make the SCAN_HWIF/UNREGISTER_HWIF stuff private Alan Cox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).