From: "Petr Vandrovec" <VANDROVE@vc.cvut.cz>
To: Patrick Mochel <mochel@osdl.org>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] read() from driverfs files can read more bytes
Date: Thu, 7 Feb 2002 19:15:24 +0100 [thread overview]
Message-ID: <1124DDDD7FF9@vcnet.vc.cvut.cz> (raw)
On 7 Feb 02 at 9:43, Patrick Mochel wrote:
> > And neither of driverfs_read_file nor driverfs_write_file supports
> > semantic we use with other filesystems: If at least one byte was
> > read/written, return byte count (even if error happens). Only if zero
> > bytes was written, return error code.
>
> I would think that you would want to return the error code. Say you did:
>
> echo "action parameter" > file
>
> and 'parameter' is an invalid parameter, as determined by the driver. It
> would require another arbitrary check to determine if the command
> succeeded or not if it returned the number of bytes written. Returning
> -EINVAL lets userspace know that it made a boo-boo. Is that not good?
If you want bidirectional communication, something like SOCK_SEQPACKET
or SOCK_DGRAM is better suitable. And if we learn open() to open
unix sockets, even 'echo' can be still used for configuring. I understand
that it is radical change, but why these configuration points should
look like real files if they are not ones? And you do not have troubles
with supporting lseek() on them - if contents of file is "minutes\n",
is it correct to do lseek(fd, 1, SEEK_SET); write(fd, "onths\n", 6);
or is it incorrect usage?
If you do not want to change these objects from files to sockets,
I agree with your explanation for write(). But I do not agree with this
semantic for read() - reading byte after byte, and reading in one big
chunk should not yield in different results on regular files, otherwise
couple of nasty surprises is hidding there.
Thanks,
Petr Vandrovec
vandrove@vc.cvut.cz
next reply other threads:[~2002-02-07 18:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-02-07 18:15 Petr Vandrovec [this message]
2002-02-07 18:27 ` Patrick Mochel
2002-02-08 19:18 ` Pavel Machek
-- strict thread matches above, loose matches on Subject: below --
2002-02-07 20:11 Petr Vandrovec
2002-02-07 20:21 ` Patrick Mochel
2002-02-07 20:26 ` Alexander Viro
2002-02-07 20:59 ` Patrick Mochel
2002-02-07 21:37 ` Alexander Viro
2002-02-07 18:11 Thomas Hood
2002-02-07 17:25 Petr Vandrovec
2002-02-07 17:43 ` Patrick Mochel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1124DDDD7FF9@vcnet.vc.cvut.cz \
--to=vandrove@vc.cvut.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=mochel@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®