Re: updating to 2.1.6x

Martin von Loewis (martin@mira.isdn.cs.tu-berlin.de)
Sat, 1 Nov 1997 09:42:42 +0100


> Along the same lines as my last message (updating the PCMCIA modules to
> work with the new kernels) --- can someone summarize the changes to
> the {device}_read and {device}_write functions? The prototypes were
> changed at some point -- when, exactly? How do I need to update the code
> to conform to the new prototypes?

Too bad that the recent questions 'what changed' don't indicate
'compared to what'. Here is a the change list for Linux 2.1. For older
interface changes, please consult some RCS archives of the Linux kernel.

In Linux 2.1.0, the size parameter changed from int to unsigned long.
In Linux 2.1.60, the return type changed from int to ssize_t, the inode
parameter was dropped, the size parameter was change to size_t, and
an additional loff_t* parameter was introduced. See patch-2.1.60
for details, as well for the changed to write.

If you need the inode inside the read function, you can get it from the
file using file->f_dentry->d_inode.

If you have a seekable device, the read and write operations used to
update the f_pos field of the file. This should be changed to
updating the position through the new loff_t pointer. Also, the
current position should be retrieved from that pointer. The change
was needed to support the pread and pwrite system calls, which give an
explicit position and don't update the file's position. The VFS passes
a local variable in that case, making the position effectively
read-only.

Hope this helps,
Martin