linux-um archives
 help / color / mirror / Atom feed
From: Blaisorblade <blaisorblade@yahoo.it>
To: wang lianwei <lianwei.wang@gmail.com>, Jeff Dike <jdike@addtoit.com>
Cc: user-mode-linux-devel@lists.sourceforge.net
Subject: Re: [uml-devel] UML hostfs bugs
Date: Tue, 15 Aug 2006 19:47:54 +0200	[thread overview]
Message-ID: <200608151947.54925.blaisorblade@yahoo.it> (raw)
In-Reply-To: <39134b110608140407n718d0cf5rfed71f8295ea43e0@mail.gmail.com>

On Monday 14 August 2006 13:07, wang lianwei wrote:
> Answers:
>
> 1. I test it on ext3 filesystem.
>
> 2. You are right. Sometimes the pos telldir returned is not the next entry
> offset. just as your point out:
>       position 0 -> readdir "." -> you call telldir -> it _again_ says
> you're at 0.
>
> 3. I also try to resolve it by remove the seekdir(only use the
> sequence readdir call), It is also worked.

I can guess what the patch does but please generate with the additional -p 
option so it's easier to read (otherwise the recipient _has_ to read the 
source). Compliments for the solution, it's really simpler and better than my 
proposal.

Also, you have to regenerate it anyway for another (tiny) reason: it is not 
always safe to use "seekdir" in kernelspace code, you need (sadly) a new 
wrapper in hostfs_user.c and to call it instead of seekdir in hostfs_kern.c; 
almost surely you'll get an "undeclared function" warning but miscompilations 
in some rare cases are also possible, say for stat(): it is defined almost 
only as a static inline function, or for some structures having different 
definitions in userspace and kernelspace.

> --- linux-2.6.x/fs/hostfs/hostfs_kern.c 2006-04-12 15:12:51.000000000 +0800
> +++ linux-2.6.10-src/fs/hostfs/hostfs_kern.c      2006-08-14 18:25:
> 13.772237744 +0800
> @@ -338,6 +338,7 @@
>         kfree(name);
>         if(dir == NULL) return(-error);
>         next = file->f_pos;
> +       seekdir(dir,next);
>         while((name = read_dir(dir, &next, &ino, &len)) != NULL){
>                 error = (*filldir)(ent, name, len, file->f_pos,
>                                    ino, DT_UNKNOWN);
>
>
> --- linux-2.6.x/fs/hostfs/hostfs_user.c 2006-04-12 15:12:52.000000000 +0800
> +++ linux-2.6.10-src/fs/hostfs/hostfs_user.c      2006-08-14 18:36:
> 24.276305632 +0800
> @@ -122,7 +122,6 @@
>         DIR *dir = stream;
>         struct dirent *ent;
>
> -       seekdir(dir, *pos);
>         ent = readdir(dir);
>         if(ent == NULL) return(NULL);
>         *len_out = strlen(ent->d_name);

-- 
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade
http://www.user-mode-linux.org/~blaisorblade
Chiacchiera con i tuoi amici in tempo reale! 
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com 


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

  reply	other threads:[~2006-08-15 17:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-10 15:42 [uml-devel] UML hostfs bugs wang lianwei
2006-08-12 18:22 ` Blaisorblade
2006-08-12 20:10   ` Blaisorblade
2006-08-14 11:07   ` wang lianwei
2006-08-15 17:47     ` Blaisorblade [this message]
2006-08-16 10:19       ` wang lianwei

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=200608151947.54925.blaisorblade@yahoo.it \
    --to=blaisorblade@yahoo.it \
    --cc=jdike@addtoit.com \
    --cc=lianwei.wang@gmail.com \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /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