All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ozgur AKAN <akan@aiqa.com>
Cc: netfilter-devel@lists.netfilter.org
Subject: Re: size of a rule
Date: Mon, 26 Apr 2004 17:08:30 +0300	[thread overview]
Message-ID: <408D17DE.3050900@aiqa.com> (raw)
In-Reply-To: <408D1482.5030009@aiqa.com>

[-- Attachment #1: Type: text/plain, Size: 915 bytes --]

Actually when I print the address of ipt_entry and subtract it from the 
next ipt_entry I can get the size of the rule but I am not sure if I am 
doing something wrong or right.

I still can not understand ((type *)0)->member.

Ozgur AKAN wrote:

> Hi,
> I am trying to find the size of a rule in memory.
>
> const struct ipt_entry *e;
>
> sizeof (*e) is equal to 112 always. But the size of rule should be 
> different because we can give different parameters to each rule. (I 
> guess that this is the size of the header-like place)
>
> So I looked at the source of libiptc and found this in linux_list.h 
> while searching for the size value.
>
> #define list_entry(ptr, type, member) \
>         ((type *) ( (char *)(ptr)-(unsigned long)(&((type 
> *)0)->member) ) )
>
> What is the meaning of ((type *)0)->member ? I can not understand the 
> part with 0.  
>
>thanks,
>-- 
>Ozgur Akan
>  
>


-- 
Ozgur Akan


[-- Attachment #2: Type: text/html, Size: 1592 bytes --]

  reply	other threads:[~2004-04-26 14:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-26 13:54 size of a rule Ozgur AKAN
2004-04-26 14:08 ` Ozgur AKAN [this message]
2004-04-26 14:12 ` zhi wang
2004-04-26 14:24 ` Henrik Nordstrom
2004-04-27  8:41   ` Ozgur AKAN

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=408D17DE.3050900@aiqa.com \
    --to=akan@aiqa.com \
    --cc=netfilter-devel@lists.netfilter.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.