* netfilter kernel modules question
@ 2009-12-14 15:20 Tobias Koeck
2009-12-14 20:17 ` Jan Engelhardt
0 siblings, 1 reply; 6+ messages in thread
From: Tobias Koeck @ 2009-12-14 15:20 UTC (permalink / raw)
To: netfilter-devel
I have two netfilter kernel modules (xt_RQS.c, xt_RQD.c, both include
a header file with a data structure in it).
Does both kernel modules use the same datastructures or do they use
seperate ones (in normal C programming I know that but I'm not sure
about the kernel scopes).
If I want to use one datastructure how can I do that (export? -
concurrency issues left aside)?
Greetings and thanks
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: netfilter kernel modules question
2009-12-14 15:20 netfilter kernel modules question Tobias Koeck
@ 2009-12-14 20:17 ` Jan Engelhardt
2009-12-14 20:28 ` Tobias Koeck
0 siblings, 1 reply; 6+ messages in thread
From: Jan Engelhardt @ 2009-12-14 20:17 UTC (permalink / raw)
To: Tobias Koeck; +Cc: netfilter-devel
On Monday 2009-12-14 16:20, Tobias Koeck wrote:
> I have two netfilter kernel modules (xt_RQS.c, xt_RQD.c, both include a header
> file with a data structure in it).
>
> Does both kernel modules use the same datastructures or do they use seperate
> ones (in normal C programming I know that but I'm not sure about the kernel
> scopes).
You decide whether they do. This does not change just because you are in
kernel space.
Jan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: netfilter kernel modules question
2009-12-14 20:17 ` Jan Engelhardt
@ 2009-12-14 20:28 ` Tobias Koeck
2009-12-14 20:32 ` Jan Engelhardt
0 siblings, 1 reply; 6+ messages in thread
From: Tobias Koeck @ 2009-12-14 20:28 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: netfilter-devel
On 12/14/2009 09:17 PM, Jan Engelhardt wrote:
> On Monday 2009-12-14 16:20, Tobias Koeck wrote:
>
>> I have two netfilter kernel modules (xt_RQS.c, xt_RQD.c, both include a header
>> file with a data structure in it).
>>
>> Does both kernel modules use the same datastructures or do they use seperate
>> ones (in normal C programming I know that but I'm not sure about the kernel
>> scopes).
>
> You decide whether they do. This does not change just because you are in
> kernel space.
Can you please give a short example how to to it?
Let's say you've got one data structure (int a) in the header file.
How can you access it in both c-files? Do you have to export it?
Is there a deeper information how the kernel scope is structured?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: netfilter kernel modules question
2009-12-14 20:28 ` Tobias Koeck
@ 2009-12-14 20:32 ` Jan Engelhardt
2009-12-14 20:48 ` Tobias Koeck
0 siblings, 1 reply; 6+ messages in thread
From: Jan Engelhardt @ 2009-12-14 20:32 UTC (permalink / raw)
To: Tobias Koeck; +Cc: netfilter-devel
On Monday 2009-12-14 21:28, Tobias Koeck wrote:
>>> I have two netfilter kernel modules (xt_RQS.c, xt_RQD.c, both include a
>>> header
>>> file with a data structure in it).
>>>
>>> Does both kernel modules use the same datastructures or do they use seperate
>>> ones (in normal C programming I know that but I'm not sure about the kernel
>>> scopes).
>>
>> You decide whether they do. This does not change just because you are in
>> kernel space.
>
> Can you please give a short example how to to it?
>
> Let's say you've got one data structure (int a) in the header file. How can you
> access it in both c-files? Do you have to export it?
You can argue what a data structure is or what it is not; a header
file should not include any definitions, only declarations. (And
perhaps static-inlines, but that's probably too expert for you at
this stage.) Various C-related forums or IRC channels can enlighten
you towards the reasoning for that.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: netfilter kernel modules question
2009-12-14 20:32 ` Jan Engelhardt
@ 2009-12-14 20:48 ` Tobias Koeck
2009-12-14 20:52 ` Jan Engelhardt
0 siblings, 1 reply; 6+ messages in thread
From: Tobias Koeck @ 2009-12-14 20:48 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: netfilter-devel
>
> You can argue what a data structure is or what it is not; a header
> file should not include any definitions, only declarations. (And
> perhaps static-inlines, but that's probably too expert for you at
> this stage.) Various C-related forums or IRC channels can enlighten
> you towards the reasoning for that.
'int a' is declaration (only used in a function it's a definition).
Does that mean if I define a (nonstatic) variable in a kernel module
and it's accessible in the whole kernel?
Don't worry - last kernel newbie question from myself ;=).
Greetings
tk
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: netfilter kernel modules question
2009-12-14 20:48 ` Tobias Koeck
@ 2009-12-14 20:52 ` Jan Engelhardt
0 siblings, 0 replies; 6+ messages in thread
From: Jan Engelhardt @ 2009-12-14 20:52 UTC (permalink / raw)
To: Tobias Koeck; +Cc: netfilter-devel
On Monday 2009-12-14 21:48, Tobias Koeck wrote:
>>
>> You can argue what a data structure is or what it is not; a header
>> file should not include any definitions, only declarations. (And
>> perhaps static-inlines, but that's probably too expert for you at
>> this stage.) Various C-related forums or IRC channels can enlighten
>> you towards the reasoning for that.
>
> 'int a' is declaration (only used in a function it's a definition).
"int a" is always a definition. Inside a function it makes for an
automatic variable, and outside a function it makes for one with static
linkage.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-12-14 20:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-14 15:20 netfilter kernel modules question Tobias Koeck
2009-12-14 20:17 ` Jan Engelhardt
2009-12-14 20:28 ` Tobias Koeck
2009-12-14 20:32 ` Jan Engelhardt
2009-12-14 20:48 ` Tobias Koeck
2009-12-14 20:52 ` Jan Engelhardt
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.