Re: question on fs/read_write.c modification from 2.6.7 to 2.6.8.1

From: Alan Cox
Date: Fri Sep 10 2004 - 06:06:19 EST


On Gwe, 2004-09-10 at 11:45, manjunathg.kondaiah@xxxxxxxxx wrote:
> and In the implementation, the driver would be interested in checking
> the sanity of pointers by doing a check like if (ppos != &(file->fpos)
> { printk( KERN_ERR "Pointers not matching\n");return -EPERM;}

It now has nonseekable_open() to call.

> 1. "so that the VFS layer is responsible for updating that offset
> rather than individual drivers." By not passing ppos as file->fops, the
> drivers should not try and do a (*ppos)++ anymore. Well the determined
> rogue driver can still do a file->fpos++ coz the file structure is still
> being exposed by the kernel to the driver (verified with printks). So
> this option does not sound logical!

This is the reason - plus better enforcement of pread/pwrite return
values. Any code touching file->f_pos in a driver is generally broken
anyway. It doesn't prevent such use but it makes the default behaviour
for a driver correct so makes it easier to write drivers correctly

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/