From: Simon Arlott <simon@arlott.org>
To: Duncan Sands <duncan.sands@math.u-psud.fr>
Cc: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] cxacru: Store all device status information and report it when atm_proc_read is called.
Date: Sun, 11 Feb 2007 17:10:21 +0000 [thread overview]
Message-ID: <45CF4DFD.7000703@simon.arlott.org.uk> (raw)
In-Reply-To: <200702011015.32238.duncan.sands@math.u-psud.fr>
[-- Attachment #1: Type: text/plain, Size: 2920 bytes --]
On 01/02/07 09:15, Duncan Sands wrote:
> On Thursday 1 February 2007 00:39:14 you wrote:
>> On Tue, 30 Jan 2007 21:30:29 +0000
>> Simon Arlott <simon@arlott.org> wrote:
>>
>>> +static int cxacru_proc_read(struct usbatm_data *usbatm_instance,
>>> + struct atm_dev *atm_dev, loff_t * pos, char *page)
>>> +{
>>> + struct cxacru_data *instance = usbatm_instance->driver_data;
>>> + u32 *cxinf = instance->cxinf_status;
>>> + int left = *pos;
>>> +
>>> + if (!left--)
>>> + return sprintf(page, "# %s\n", usbatm_instance->description);
>>> +
>>> + if (!left--) {
>>> + if (cxinf[CXINF_LINE_STATUS] == 5) {
>>> + return sprintf(page, "# UP %u/%u\n",
>>> + cxinf[CXINF_DOWNSTREAM_RATE],
>>> + cxinf[CXINF_UPSTREAM_RATE]);
>>> + } else {
>>> + return sprintf(page, "# DOWN\n");
>>> + }
>>> + }
>> hm, how well-tested was this proc interface? The pread() and lseek()
>> behaviour might be strange.
>>
>> I guess as long as it doesn't oops, hang or anything like that then it'll
>> be OK. Anyone who does anything apart from a single big-fat-read from a
>> procfile has a good chance of getting into trouble :(
Well, several reads of at least 172B... but that scenario works without any problems.
> All the ATM drivers seem to do it like this. That doesn't mean they are
> right of course! But I never saw anyone complain on the ATM mailing list.
I just copied it from usbatm; it looks like this could be done using seq_file instead.
> On the other hand, why does Simon want this? If he has written a user space
> tool that extracts bits from the proc file (eg: to tell users what's going
> on) then he could run into trouble, depending on how he implements it.
No special user space tool, I just want other people to be able to get the same useful line information from cxacru that most ADSL driver have. (I do have a small "cxacru-watch" program which execs "cmd.up" etc. on status changes, but that is just sent printks via syslog-ng).
It looks like the weird proc interface prevents my intention to allow ". /proc/net/atm/cxacru\:0" to work and set $LINE_STATUS etc., at least with bash:
open("/proc/net/atm/cxacru:0", O_RDONLY|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
read(3, "", 0) = 0
close(3) = 0
Does anyone have any thoughts on the output format? The standard usbatm output isn't going to be compatible with the above if a common MAC/AAL5 header were used.
When I have the time and can acquire another conexant usb modem for testing I'll fix the usbatm /proc interfaces. It would be also good if the module could reliably be reloaded - most (but not all) of the time it fails to initialise the device again.
There's still an issue with khubd going into a loop if the firmware doesn't exist or if the device is unplugged.
--
Simon Arlott
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 829 bytes --]
prev parent reply other threads:[~2007-02-11 17:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-30 21:30 [PATCH 3/3] cxacru: Store all device status information and report it when atm_proc_read is called Simon Arlott
2007-01-31 14:19 ` Duncan Sands
2007-01-31 23:39 ` Andrew Morton
2007-02-01 9:15 ` Duncan Sands
2007-02-11 17:10 ` Simon Arlott [this message]
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=45CF4DFD.7000703@simon.arlott.org.uk \
--to=simon@arlott.org \
--cc=643cc8da41fc265a9f1hgidx0007flhv@thunder.lp0.eu \
--cc=akpm@osdl.org \
--cc=duncan.sands@math.u-psud.fr \
--cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.