find my reply inline.
On Sun, Jul 12, 2009 at 11:44 PM, Greg KH <greg@xxxxxxxxx> wrote:
I am not passing a dev_t as a binary from userspace to kernel space.
Its a part of the structure.
E.g
struct device_info {
dev_t dev_num;
...
....
}
This is pretty much for a custom driver, where I perform the following.
1. Parse the information in user space from a XML file
2. Do a stat on the device,
3. extract the device number
4. Fill in the structure
5. Pass it to the kernel driver using ioctl.
Reference: OHSM : http://code.google.com/p/fscops/
Its just a part of my implementation. And I wanted to keep this uniform across the system.
But having such discrepancies really disappointed me.
But I still don't understand the philosophy behind having different sizes for dev_t in user and kernel space.
And most importantly, its not documented and it eventually leads to silent corruption. Which is real difficult to trace in complex systems.
On Sun, Jul 12, 2009 at 10:16:17PM +0530, SandeepKsinha wrote:Why would you be passing a dev_t from user to kernel space as a binary
> Hi,
> to my surprise,
> the sizeof dev_t differs in userspace and kernel.
> Its 8 bytes in userspace and 4bytes in kernel.
>
> I am working on a driver, where I include the headers in both user and
> kernel space.
> And I get wrong values due to the difference in sizes.
>
> How do I handle such a situation ?
value?
I am not passing a dev_t as a binary from userspace to kernel space.
Its a part of the structure.
E.g
struct device_info {
dev_t dev_num;
...
....
}
Why do you want to pass such a value across the boundry in the first
place?
This is pretty much for a custom driver, where I perform the following.
1. Parse the information in user space from a XML file
2. Do a stat on the device,
3. extract the device number
4. Fill in the structure
5. Pass it to the kernel driver using ioctl.
Reference: OHSM : http://code.google.com/p/fscops/
Could you describe what the problem is you are trying to sove by doing
this?
Its just a part of my implementation. And I wanted to keep this uniform across the system.
But having such discrepancies really disappointed me.
But I still don't understand the philosophy behind having different sizes for dev_t in user and kernel space.
And most importantly, its not documented and it eventually leads to silent corruption. Which is real difficult to trace in complex systems.
thanks,
greg k-h
Regards,
Sandeep.
“To learn is to change. Education is a process that changes the learner.”