From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ozgur AKAN Subject: size of a rule Date: Mon, 26 Apr 2004 16:54:10 +0300 Sender: netfilter-devel-admin@lists.netfilter.org Message-ID: <408D1482.5030009@aiqa.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------020404040703050004020101" Return-path: To: netfilter-devel@lists.netfilter.org Errors-To: netfilter-devel-admin@lists.netfilter.org List-Help: List-Post: List-Subscribe: , List-Unsubscribe: , List-Archive: List-Id: netfilter-devel.vger.kernel.org This is a multi-part message in MIME format. --------------020404040703050004020101 Content-Type: text/plain; charset=ISO-8859-9; format=flowed Content-Transfer-Encoding: 7bit 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 --------------020404040703050004020101 Content-Type: text/html; charset=ISO-8859-9 Content-Transfer-Encoding: 8bit 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
--------------020404040703050004020101--