From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eli Carter Subject: Re: file struct's dentry being null? Date: Wed, 02 Jul 2003 11:18:21 -0500 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <3F0305CD.40100@inet.com> References: <1057160991.7361.5.camel@zaphod> <16131.276.323954.605302@laputa.namesys.com> <1057161617.7361.10.camel@zaphod> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: Nikita Danilov , linux-fsdevel@vger.kernel.org Return-path: Received: from zeke.inet.com ([199.171.211.198]:11152 "EHLO zeke.inet.com") by vger.kernel.org with ESMTP id S265089AbTGBQED (ORCPT ); Wed, 2 Jul 2003 12:04:03 -0400 Received: from tex.inetint.com (tex [172.16.99.35]) by zeke.inet.com (INET SMTP Server) with ESMTP id h62GIR3U004641 for ; Wed, 2 Jul 2003 11:18:27 -0500 (CDT) Received: from harpo.inetint.com (localhost [127.0.0.1]) by tex.inetint.com (8.12.1/8.12.1) with ESMTP id h62GIOIC023062 for ; Wed, 2 Jul 2003 11:18:25 -0500 (CDT) To: Shaya Potter List-Id: linux-fsdevel.vger.kernel.org Shaya Potter wrote: > On Wed, 2003-07-02 at 11:58, Nikita Danilov wrote: > >>Shaya Potter writes: >> > I decided to do an experiment, in fput, I did a >> > >> > struct file * next; >> > next = (struct file *) file->f_list.next; >> >>->f_list.next points to the ->f_list member of next struct file rather >>than to the struct file itself. This is how it works for all struct >>list_head embedded into objects. > > > yes, I understand that, the idea being that it's the first entry in the > struct that you want to link list, so can get the next struct by just > dereferencing the list_head (as &list_head == &struct) No, his point was that &list_head != $struct, but rather &struct == &list_head - some_offset. So the code you'd need would look like: struct file *next; next = list_entry(
, file, f_list ); Eli --------------------. "If it ain't broke now, Eli Carter \ it will be soon." -- crypto-gram eli.carter(a)inet.com `-------------------------------------------------