Hi,
struct device contains a void * driver_data. It should certainly point to
a couple of bytes where the driver data was saved.
In line 288, we have this:
current_driverfs_dev->driver_data = (void *)__mkdev(hd->major, minor+part);
What kind of pointer should we get here? ;-)
Can the author please explain what was intented here?
Regards,
Thunder
--
(Use http://www.ebb.org/ungeek if you can't decode)
------BEGIN GEEK CODE BLOCK------
Version: 3.12
GCS/E/G/S/AT d- s++:-- a? C++$ ULAVHI++++$ P++$ L++++(+++++)$ E W-$
N--- o? K? w-- O- M V$ PS+ PE- Y- PGP+ t+ 5+ X+ R- !tv b++ DI? !D G
e++++ h* r--- y-
------END GEEK CODE BLOCK------
> struct device contains a void * driver_data. It should certainly point
> to a couple of bytes where the driver data was saved.
> In line 288, we have this:
> current_driverfs_dev->driver_data = (void *)__mkdev(hd->major,
> minor+part);
> What kind of pointer should we get here? ;-)
> Can the author please explain what was intented here?
This is transient code to save the device in the driver_data. It is later
picked back out at line 229. It conforms to the old programmer principle that
if you can always guarantee your data takes up less space than a pointer (on
all archs), then you might as well just cast the data into the pointer instead
of wasting a malloc for it.
The driverfs code is still in flux. However, partition handling (if it
belongs anywhere at all) will probably be in the unwritten class handlers and
greatly tidied up.
The idea behind this code is to get a quick and dirty view of what partitions
might be seen as in driverfs and thus to stimulate debate about how they
should be done.
James
Hi,
On Sat, 13 Jul 2002, James Bottomley wrote:
> This is transient code to save the device in the driver_data. It is
> later picked back out at line 229. It conforms to the old programmer
> principle that if you can always guarantee your data takes up less space
> than a pointer (on all archs), then you might as well just cast the data
> into the pointer instead of wasting a malloc for it.
However, it issues a warning.
Regards,
Thunder
--
(Use http://www.ebb.org/ungeek if you can't decode)
------BEGIN GEEK CODE BLOCK------
Version: 3.12
GCS/E/G/S/AT d- s++:-- a? C++$ ULAVHI++++$ P++$ L++++(+++++)$ E W-$
N--- o? K? w-- O- M V$ PS+ PE- Y- PGP+ t+ 5+ X+ R- !tv b++ DI? !D G
e++++ h* r--- y-
------END GEEK CODE BLOCK------