Skip to contentSkip to conversation

Lazy Newbie Question

DISCUSSION Kevin Buhr 3 participants 6 messages May 21, 2002 – May 22, 2002 1 message not in the archive

lore
Share & tools
lore

Kevin Buhr

author
#1 lore raw
In reply to a message not in the archive
Quoted 2 lines · Calin A. Culianu

int kcomedilib_main.c: comedi_t * comedi_open(const char *pathname).

Which version of Comedi are you using? In comedi-0.7.64 (the most recent that I can find), I see:

comedi-0.7.64/comedi/kcomedilib/kcomedilib_main.c:
int comedi_open(unsigned int minor)

In comedilib-0.7.18, I see:

  comedilib-0.7.18/include/comedilib.h:
        comedi_t *comedi_open(const char *fn);

but of course that version is meant to be called from user space.

I can't find the string "pathname" in any Comedi code anywhere.

Quoted 1 line

'nuff said.

On the contrary...

Signature · 1 line
Kevin Buhr <[email protected]>
#2 lore raw
Quoted 9 lines · Kevin Buhr
Quoted 2 lines · Calin A. Culianu

int kcomedilib_main.c: comedi_t * comedi_open(const char *pathname).

Which version of Comedi are you using? In comedi-0.7.64 (the most recent that I can find), I see:

comedi-0.7.64/comedi/kcomedilib/kcomedilib_main.c:
int comedi_open(unsigned int minor)

Get comedi-cvs.

Quoted 6 lines

In comedilib-0.7.18, I see:

  comedilib-0.7.18/include/comedilib.h:
        comedi_t *comedi_open(const char *fn);
Quoted 7 lines

but of course that version is meant to be called from user space.

I can't find the string "pathname" in any Comedi code anywhere.

Quoted 1 line

'nuff said.

On the contrary...

Yeah whatever.

Quoted 2 lines
author
#3 lore raw
Quoted 2 lines · Calin A. Culianu

Get comedi-cvs.

Thanks.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

'nuff said.

On the contrary...

Yeah whatever.

Well, as you can see from the implementation of "comedi_open" that's right in front of you, that code doesn't do anything with the filename except parse it as string of the form "/dev/comediNNN" to get the minor number "NNN". It looks like a cheesy hack to fake the kernel-mode interface to look like the user-mode interface, but that's all it is. So, as Richard said, we still haven't seen any evidence that Comedi requires manipulating files in kernel space.

It's quite strange how rude and evasive you're being when everyone who's replied has been polite and helpful. Perhaps if you lost the attitude and told us what it is you're really trying to do, we could help you more effectively.

I mean, either we're all too dim to understand your device driver hacking skills, in which case there's no point in you wasting your time here, or one of us has enough of a clue to help, in which case we'd all benefit from you explaining your problem as fully as you are able instead of demanding we show you how to do the impossible (i.e., stat a file without a process context).

By the way, in case you missed it---and it seems you did---Richard already gave you the right answer in the message you mistakenly dismissed as a flame. If you really need to stat a file from the kernel, you do this with a helper process in the form of a bona fide user process or a kernel thread. Because this is relatively complicated to get right (there's a damn good reason the code in "comedi_open" just fakes it), you don't want to do this unless you have to.

Signature · 1 line
Kevin Buhr <[email protected]>
#4 lore raw
Quoted 25 lines · Kevin Buhr
Quoted 2 lines · Calin A. Culianu

Get comedi-cvs.

Thanks.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

'nuff said.

On the contrary...

Yeah whatever.

Well, as you can see from the implementation of "comedi_open" that's right in front of you, that code doesn't do anything with the filename except parse it as string of the form "/dev/comediNNN" to get the minor number "NNN". It looks like a cheesy hack to fake the kernel-mode interface to look like the user-mode interface, but that's all it is. So, as Richard said, we still haven't seen any evidence that Comedi requires manipulating files in kernel space.

It's quite strange how rude and evasive you're being when everyone who's replied has been polite and helpful. Perhaps if you lost the attitude and told us what it is you're really trying to do, we could help you more effectively.

Quoted 6 lines

I mean, either we're all too dim to understand your device driver hacking skills, in which case there's no point in you wasting your time here, or one of us has enough of a clue to help, in which case we'd all benefit from you explaining your problem as fully as you are able instead of demanding we show you how to do the impossible (i.e., stat a file without a process context).

What the fuck is your problem? I was merely wondering how to use path_init/path_walk. I had to go to the newbie irc channel and they were much politer and must more helpful. None of this fucking attitude of "why do you want to do that that is evil never do that". Obviously i have a reason to do it and I don't need you lecturing me.

Quoted 8 lines

By the way, in case you missed it---and it seems you did---Richard already gave you the right answer in the message you mistakenly dismissed as a flame. If you really need to stat a file from the kernel, you do this with a helper process in the form of a bona fide user process or a kernel thread. Because this is relatively complicated to get right (there's a damn good reason the code in "comedi_open" just fakes it), you don't want to do this unless you have to.

Well I lack the knowledge to do that. Can you be a bit more specific as to code examples or whatnot? Just being vague and saying "you don't need to do that" is bad.

Anyway I am doing it from module_init() in a module I am writing, so the current thread context is pretty much a good one.

-Calin

#5 lore raw
Quoted 15 lines · Calin A. Culianu
Quoted 13 lines · Kevin Buhr

Well, as you can see from the implementation of "comedi_open" that's right in front of you, that code doesn't do anything with the filename except parse it as string of the form "/dev/comediNNN" to get the minor number "NNN". It looks like a cheesy hack to fake the kernel-mode interface to look like the user-mode interface, but that's all it is. So, as Richard said, we still haven't seen any evidence that Comedi requires manipulating files in kernel space.

It's quite strange how rude and evasive you're being when everyone who's replied has been polite and helpful. Perhaps if you lost the attitude and told us what it is you're really trying to do, we could help you more effectively.

Quoted 6 lines
Quoted 6 lines

I mean, either we're all too dim to understand your device driver hacking skills, in which case there's no point in you wasting your time here, or one of us has enough of a clue to help, in which case we'd all benefit from you explaining your problem as fully as you are able instead of demanding we show you how to do the impossible (i.e., stat a file without a process context).

I have a process context. This will be happening from module_init() in a module I am writing, which, last I checked, uses the process context of the process that did the system call.

Quoted 12 lines
Quoted 11 lines

By the way, in case you missed it---and it seems you did---Richard already gave you the right answer in the message you mistakenly dismissed as a flame. If you really need to stat a file from the kernel, you do this with a helper process in the form of a bona fide user process or a kernel thread. Because this is relatively complicated to get right (there's a damn good reason the code in "comedi_open" just fakes it), you don't want to do this unless you have to.

No, I understood what Richard was saying, but he was being kind of rude and lecturing. He could have been just factual, sans attitude.

Anyway, if you honestly want to help me, then please enlighten me, otherwise spare me the lectures.

And the thing that comedi does with /dev/comeiXX is a cheap hack that I wanted to do away with, which was *why* I was going to try and figure out the ACTUAL device minor on a vfs character device, in order to fool comedi_open().

-Calin

#6 lore raw
In reply to Calin A. Culianu
Quoted 5 lines · Calin A. Culianu

What the fuck is your problem? I was merely wondering how to use path_init/path_walk. I had to go to the newbie irc channel and they were much politer and must more helpful. None of this fucking attitude of "why do you want to do that that is evil never do that". Obviously i have a reason to do it and I don't need you lecturing me.

Wow, you didn't get along with the other kids did you? So far i see absolutely no reason why anybody should lend you a hand (no one gets paid for support here), perhaps instead of just blurting out insults at the kind folks trying to help you out, you may have tried putting forward additional questions as to why they consider the proposed methods evil, and wether there are more sane ways of achieving the same result.

Perhaps next time consider using another muscle apart from the one in your sphincter to convey your message...

Regards,
Zwane Mwaikambo

--
http://function.linuxpower.ca