Linux filesystem development
 help / color / mirror / Atom feed
From: Eli Carter <eli.carter@inet.com>
To: Shaya Potter <spotter@cs.columbia.edu>
Cc: Nikita Danilov <Nikita@Namesys.COM>, linux-fsdevel@vger.kernel.org
Subject: Re: file struct's dentry being null?
Date: Wed, 02 Jul 2003 11:18:21 -0500	[thread overview]
Message-ID: <3F0305CD.40100@inet.com> (raw)
In-Reply-To: 1057161617.7361.10.camel@zaphod

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( <address of the list_head>, file, f_list );

Eli
--------------------. "If it ain't broke now,
Eli Carter           \                  it will be soon." -- crypto-gram
eli.carter(a)inet.com `-------------------------------------------------


  reply	other threads:[~2003-07-02 16:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-02 15:49 file struct's dentry being null? Shaya Potter
2003-07-02 15:58 ` Nikita Danilov
2003-07-02 16:00   ` Shaya Potter
2003-07-02 16:18     ` Eli Carter [this message]
2003-07-02 16:26       ` Shaya Potter
2003-07-02 16:32       ` Shaya Potter

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=3F0305CD.40100@inet.com \
    --to=eli.carter@inet.com \
    --cc=Nikita@Namesys.COM \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=spotter@cs.columbia.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox