Odd write usage

View: New views
7 Messages — Rating Filter:   Alert me  

Odd write usage

by Daniel Benamy-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

In my filesystem, I don't pass the length of buf in size. Instead I specify
one of a couple of constants as the size which tells the fs what to do. Buf
is a shorter, null terminated string (shorter than the value passed as size).
This works correctly; valgrind doesn't show memory errors. Is this behavior
supported? Ie, should it continue to work or might it suddenly break in a
future version?

Thanks again,
Dan

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
fuse-devel mailing list
fuse-devel@...
https://lists.sourceforge.net/lists/listinfo/fuse-devel

Re: Odd write usage

by Miklos Szeredi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, 18 Jul 2008, Daniel Benamy wrote:
> In my filesystem, I don't pass the length of buf in size. Instead I
> specify one of a couple of constants as the size which tells the fs
> what to do. Buf is a shorter, null terminated string (shorter than
> the value passed as size).  This works correctly; valgrind doesn't
> show memory errors. Is this behavior supported? Ie, should it
> continue to work or might it suddenly break in a future version?

Sounds pretty weird.

Why not pass the "command" as the first few bytes of the buffer,
instead of encoding it in the length?

Miklos

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
fuse-devel mailing list
fuse-devel@...
https://lists.sourceforge.net/lists/listinfo/fuse-devel

Re: Odd write usage

by Daniel Benamy-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Saturday 19 July 2008 03:54:14 Miklos Szeredi wrote:

> On Fri, 18 Jul 2008, Daniel Benamy wrote:
> > In my filesystem, I don't pass the length of buf in size. Instead I
> > specify one of a couple of constants as the size which tells the fs
> > what to do. Buf is a shorter, null terminated string (shorter than
> > the value passed as size).  This works correctly; valgrind doesn't
> > show memory errors. Is this behavior supported? Ie, should it
> > continue to work or might it suddenly break in a future version?
>
> Sounds pretty weird.
>
> Why not pass the "command" as the first few bytes of the buffer,
> instead of encoding it in the length?

There's an existing kernel filesystem which has this interface (for some
reason unknown to me) and I'm trying to support the same interface.
Dan

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
fuse-devel mailing list
fuse-devel@...
https://lists.sourceforge.net/lists/listinfo/fuse-devel

Re: Odd write usage

by Miklos Szeredi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 22 Jul 2008, Daniel Benamy wrote:

> On Saturday 19 July 2008 03:54:14 Miklos Szeredi wrote:
> > On Fri, 18 Jul 2008, Daniel Benamy wrote:
> > > In my filesystem, I don't pass the length of buf in size. Instead I
> > > specify one of a couple of constants as the size which tells the fs
> > > what to do. Buf is a shorter, null terminated string (shorter than
> > > the value passed as size).  This works correctly; valgrind doesn't
> > > show memory errors. Is this behavior supported? Ie, should it
> > > continue to work or might it suddenly break in a future version?
> >
> > Sounds pretty weird.
> >
> > Why not pass the "command" as the first few bytes of the buffer,
> > instead of encoding it in the length?
>
> There's an existing kernel filesystem which has this interface

Curious, which one?

Miklos

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
fuse-devel mailing list
fuse-devel@...
https://lists.sourceforge.net/lists/listinfo/fuse-devel

Re: Odd write usage

by Daniel Benamy-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wednesday 23 July 2008 02:49:24 Miklos Szeredi wrote:

> On Tue, 22 Jul 2008, Daniel Benamy wrote:
> > On Saturday 19 July 2008 03:54:14 Miklos Szeredi wrote:
> > > On Fri, 18 Jul 2008, Daniel Benamy wrote:
> > > > In my filesystem, I don't pass the length of buf in size. Instead I
> > > > specify one of a couple of constants as the size which tells the fs
> > > > what to do. Buf is a shorter, null terminated string (shorter than
> > > > the value passed as size).  This works correctly; valgrind doesn't
> > > > show memory errors. Is this behavior supported? Ie, should it
> > > > continue to work or might it suddenly break in a future version?
> > >
> > > Sounds pretty weird.
> > >
> > > Why not pass the "command" as the first few bytes of the buffer,
> > > instead of encoding it in the length?
> >
> > There's an existing kernel filesystem which has this interface
>
> Curious, which one?

Sorry I wasn't clear. We have an existing linux kernel vmblock driver/fs which
uses this interface. If you're really interested, check out
http://sourceforge.net/project/showfiles.php?group_id=204462

Dan

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
fuse-devel mailing list
fuse-devel@...
https://lists.sourceforge.net/lists/listinfo/fuse-devel

Re: Odd write usage

by Miklos Szeredi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 23 Jul 2008, Daniel Benamy wrote:
> Sorry I wasn't clear. We have an existing linux kernel vmblock
> driver/fs which uses this interface. If you're really interested,
> check out
> http://sourceforge.net/project/showfiles.php?group_id=204462

Ah, I see.  Well, it might work most of the time with fuse, and the
comand constants being around 100 may make it even likely to work.
But in reality it will only work assuming that:

 a) the string will fit in that 98 or so bytes

 b) the unused bytes in that range happen to fall within mapped
 virtual memory

And b) isn't guaranteed at all, unless userspace is using specially
prepared buffers.  So, my advice is to migrate to a new, sane
interface as quickly as possible.

Miklos

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
fuse-devel mailing list
fuse-devel@...
https://lists.sourceforge.net/lists/listinfo/fuse-devel

Re: Odd write usage

by Daniel Benamy-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wednesday 23 July 2008 10:43:19 Miklos Szeredi wrote:

> On Wed, 23 Jul 2008, Daniel Benamy wrote:
> > Sorry I wasn't clear. We have an existing linux kernel vmblock
> > driver/fs which uses this interface. If you're really interested,
> > check out
> > http://sourceforge.net/project/showfiles.php?group_id=204462
>
> Ah, I see.  Well, it might work most of the time with fuse, and the
> comand constants being around 100 may make it even likely to work.
> But in reality it will only work assuming that:
>
>  a) the string will fit in that 98 or so bytes
>
>  b) the unused bytes in that range happen to fall within mapped
>  virtual memory
>
> And b) isn't guaranteed at all, unless userspace is using specially
> prepared buffers.  So, my advice is to migrate to a new, sane
> interface as quickly as possible.

Ok. Thanks a lot for taking a look!

Dan
       

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
fuse-devel mailing list
fuse-devel@...
https://lists.sourceforge.net/lists/listinfo/fuse-devel