On 05/04/2011 04:34 PM, [email protected] wrote:
>> From: Gilles Chanteperdrix
>> [mailto:[email protected]] Sent: Wednesday, May 04,
>> 2011 8:41 AM
>>
>> What I suggest, is that you make a patch which removes the read
>> implementation and adds the readv implementation. In this case,
>> the kernel will use readv to implement read anyway, and there will
>> be no code duplication.
>
> Thank you for the clarification. However, in the (still used by us)
> Linux 2.4.25 kernel's function
>
> asmlinkage ssize_t sys_read(unsigned int fd, char * buf, size_t
> count) { ssize_t ret; struct file * file;
>
> ret = -EBADF; file = fget(fd); if (file) { if (file->f_mode &
> FMODE_READ) { ret = locks_verify_area(FLOCK_VERIFY_READ,
> file->f_dentry->d_inode, file, file->f_pos, count); if (!ret) {
> ssize_t (*read)(struct file *, char *, size_t, loff_t *); ret =
> -EINVAL; if (file->f_op && (read = file->f_op->read) != NULL) ret =
> read(file, buf, count, &file->f_pos); } } if (ret > 0)
> dnotify_parent(file->f_dentry, DN_ACCESS); fput(file); } return ret;
> }
>
> it doesn’t look like it would use readv to implement read, so I'm
> afraid that your otherwise good suggestion would not work with such
> old kernel versions.
Hi,
You can provide the readv implementation, and implement read in terms of
readv by passing an iovec with just one buffer. Please also try and make
the code a bit more readable than in the previous patch, with only one
statement and one "if" by line.
Thanks in advance.
--
Gilles.
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help