using (struct fuse_file_info *) in open()

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

using (struct fuse_file_info *) in open()

Filippo Giunchedi
Hi,
first thanks for fuse! it is really a great piece of software! I hope to see it
in linux mainline sooner or later.
I'm using fuse 2.2.1 and I get this while doing open():

Breakpoint 1, deadbeef_open (path=0x804c070 "/foo", info=0x8801) at
deadbeef.c:294
(gdb) p info
$1 = (struct fuse_file_info *) 0x8801

so info is (correctly) a pointer to struct fuse_file_info, however the address
is obviously out of the process' reachable space, in fact:

(gdb) p *info
Cannot access memory at address 0x8801

thus I fail to see how I can access fuse_file_info, or this is a bug? :)

thanks,
filippo

signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: using (struct fuse_file_info *) in open()

Frederik Deweerdt-3
Le 05/07/05 17:19 +0200, Filippo Giunchedi écrivit:
> Breakpoint 1, deadbeef_open (path=0x804c070 "/foo", info=0x8801) at
> deadbeef.c:294
> (gdb) p info
> $1 = (struct fuse_file_info *) 0x8801
>
Actually your deadbeef_open prototype should be:

int deadbeef_open (const char *path, int flags)

so what you're getting in info is not a pointer but the flags
passed to open().

Regards,
Frederik Deweerdt

--
o---------------------------------------------o
| http://open-news.net : l'info alternative   |
| Tech - Sciences - Politique - International |
o---------------------------------------------o


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=click">http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
fuse-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fuse-devel
Reply | Threaded
Open this post in threaded view
|

Re: using (struct fuse_file_info *) in open()

Filippo Giunchedi
On Tue, Jul 05, 2005 at 06:08:33PM +0200, Frederik Deweerdt wrote:
> Le 05/07/05 17:19 +0200, Filippo Giunchedi écrivit:
> > Breakpoint 1, deadbeef_open (path=0x804c070 "/foo", info=0x8801) at
> > deadbeef.c:294
> > (gdb) p info
> > $1 = (struct fuse_file_info *) 0x8801
> >
> Actually your deadbeef_open prototype should be:
>
> int deadbeef_open (const char *path, int flags)

right, thanks! I guess it goes the same for other functions, right?

However reading fuse.h I see:

    164     int (*open) (const char *, struct fuse_file_info *);

and indeed fusexmp.c uses

    194 static int xmp_open(const char *path, struct fuse_file_info *fi)

and it works! is there a reason for this discrepancy?

filippo

signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: using (struct fuse_file_info *) in open()

Frederik Deweerdt-3
Le 05/07/05 18:34 +0200, Filippo Giunchedi écrivit:

> On Tue, Jul 05, 2005 at 06:08:33PM +0200, Frederik Deweerdt wrote:
> > Le 05/07/05 17:19 +0200, Filippo Giunchedi écrivit:
> > > Breakpoint 1, deadbeef_open (path=0x804c070 "/foo", info=0x8801) at
> > > deadbeef.c:294
> > > (gdb) p info
> > > $1 = (struct fuse_file_info *) 0x8801
> > >
> > Actually your deadbeef_open prototype should be:
> >
> > int deadbeef_open (const char *path, int flags)
>
> right, thanks! I guess it goes the same for other functions, right?
>
Emm, I'm afraid I was wrong, sorry, looking at the sources, I guess that
you had it right for the first time... as why the pointer is not
allocated... Could you provide the operations you've done prior to that
open call?

Regards,
Frederik Deweerdt


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=click">http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
fuse-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fuse-devel
Reply | Threaded
Open this post in threaded view
|

Re: using (struct fuse_file_info *) in open()

Miklos Szeredi
In reply to this post by Filippo Giunchedi
> right, thanks! I guess it goes the same for other functions, right?
>
> However reading fuse.h I see:
>
>     164     int (*open) (const char *, struct fuse_file_info *);
>
> and indeed fusexmp.c uses
>
>     194 static int xmp_open(const char *path, struct fuse_file_info *fi)
>
> and it works! is there a reason for this discrepancy?

The confusion comes from backward compatibility with 2.1, in which
open() was passed an 'int' instead of 'struct fuse_file_info'.

To use the newer interface (recommended) define FUSE_USE_VERSION to 22
before including 'fuse.h'

Miklos


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
fuse-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fuse-devel
Reply | Threaded
Open this post in threaded view
|

Re: using (struct fuse_file_info *) in open()

Miklos Szeredi
In reply to this post by Frederik Deweerdt-3
> Emm, I'm afraid I was wrong,

You were right :)

0x8801 == 0104001 == O_WRONLY | O_NONBLOCK | O_LARGEFILE

It's not an unlikely flag combination.

Miklos


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
fuse-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fuse-devel
Reply | Threaded
Open this post in threaded view
|

Re: using (struct fuse_file_info *) in open()

Filippo Giunchedi
On Tue, Jul 05, 2005 at 08:00:23PM +0200, Miklos Szeredi wrote:
> > Emm, I'm afraid I was wrong,
>
> You were right :)
>
> 0x8801 == 0104001 == O_WRONLY | O_NONBLOCK | O_LARGEFILE
>
> It's not an unlikely flag combination.

indeed!
I tought that for 2.2 version the default FUSE_USE_VERSION was 22 (and I even
_printed_ fuse.h and it is written also "important" all caps, I must be blind...!)

after setting FUSE_USE_VERSION everthing is as it should be:

Breakpoint 1, deadbeef_open (path=0x804c070 "/foo", info=0xbffff360) at
deadbeef.c:295
295         printf("open(%s, %p) handle:\n", path, info);
(gdb) p info
$1 = (struct fuse_file_info *) 0xbffff360
(gdb) p *info
$2 = {flags = 34817, fh = 0, writepage = 0}

side note: Miklos, is it possible to mark somehow the functions/structures in
fuse.h when the change between version, something like:

@since x.y

(just to know without reading the whole changelog and/or release notes)


thanks,
filippo

signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: using (struct fuse_file_info *) in open()

Miklos Szeredi
> side note: Miklos, is it possible to mark somehow the functions/structures in
> fuse.h when the change between version, something like:
>
> @since x.y
>
> (just to know without reading the whole changelog and/or release notes)

Good point.  I'll add these notations.

Thanks,
Miklos


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
fuse-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fuse-devel