All of lore.kernel.org
 help / color / mirror / Atom feed
From: FabF <fabian.frederick@skynet.be>
To: maneesh@in.ibm.com
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@osdl.org>
Subject: Re: [OFFTOPIC] f_pos ? [PATCH 2.6.7-mm6] ext2_readdir commenting
Date: Tue, 06 Jul 2004 22:38:51 +0200	[thread overview]
Message-ID: <1089146330.3691.35.camel@localhost.localdomain> (raw)
In-Reply-To: <20040706195816.GB3097@in.ibm.com>

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

On Tue, 2004-07-06 at 21:58, Maneesh Soni wrote:
> On Sun, Jul 04, 2004 at 07:31:29PM +0000, FabF wrote:
> > Hi,
> > 	
> > 	I try to understand how readdir process works and I can't understand
> > f_pos management :
> > 
> >         Having in mind things work that way :
> > 
> >         user : ls
> >         glibc : 
> >                 open (->sys_open)
> >                 getdentries64 (->sys_getdentries64)
> >                 
> >         kernel:
> >                 sys_getdentries64
> >                 ->vfs_readdir
> >                         ->ext2_readdir
> > 
> > At that point, I don't understand why ext2_readdir is playing with
> > filp->f_pos .... It should be 0 ...Why does it care about offset ?
> > 
> 
> I think it may not be 0 all the time. A seekdir() could change could change
> the offset to non-zero.
Thanks Maneesh :) Anton brightly explained me readdir : it can be called
more than once (buffering ...) so the reason for that offset.Action
taking place in filldir return.'over' in ext2 readdir could bring
confusion though....It's 'over' for kernel duty but the whole path is
not necessarily explored yet.

I think the trivial comment patch attached (against 2.6.7-mm6) could be
interesting for that issue.

Regards,
FabF

> 
> Thanks
> Maneesh

[-- Attachment #2: ext2readdir_comment.patch --]
[-- Type: text/x-patch, Size: 619 bytes --]

ext2_readdir commenting

Signed off by FabF
---


diff -puN fs/ext2/dir.c~ext2readdir_comment fs/ext2/dir.c
--- linux-2.6.7/fs/ext2/dir.c~ext2readdir_comment	2004-07-06 22:20:14.514980596 +0200
+++ linux-2.6.7-heatwave/fs/ext2/dir.c	2004-07-06 22:31:52.822458517 +0200
@@ -245,6 +245,12 @@ static inline void ext2_set_de_type(ext2
 		de->file_type = 0;
 }
 
+/*
+ *	ext2_readdir()
+ *
+ * copy directory entries to userland from its current offset (filp->f_pos)
+ * up to the end or when buffer is full (over=-EFAULT | -EINVAL)
+ */
 static int
 ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
 {
_

  reply	other threads:[~2004-07-06 20:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-04 19:18 [OFFTOPIC] f_pos ? FabF
2004-07-06 19:58 ` Maneesh Soni
2004-07-06 20:38   ` FabF [this message]
2004-07-06 20:51   ` FabF

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=1089146330.3691.35.camel@localhost.localdomain \
    --to=fabian.frederick@skynet.be \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maneesh@in.ibm.com \
    /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.