comp.lang.ada
 help / color / mirror / Atom feed
* ZFS/BtrFS bindings
@ 2013-07-14  2:48 Dufr
  2013-07-14  9:47 ` Dirk Heinrichs
  0 siblings, 1 reply; 13+ messages in thread
From: Dufr @ 2013-07-14  2:48 UTC (permalink / raw)


Is there a way to access the ZFS filesystem from Ada?
I have tried to Google for Ada bindings for ZFS, but nothing came up...

Is it realistic to expect that someone will write one anytime soon?

What about Btrfs bindings, as an alternative?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ZFS/BtrFS bindings
  2013-07-14  2:48 ZFS/BtrFS bindings Dufr
@ 2013-07-14  9:47 ` Dirk Heinrichs
  2013-07-14  9:59   ` Dufr
  0 siblings, 1 reply; 13+ messages in thread
From: Dirk Heinrichs @ 2013-07-14  9:47 UTC (permalink / raw)


Dufr wrote:

> Is there a way to access the ZFS filesystem from Ada?
> I have tried to Google for Ada bindings for ZFS, but nothing came up...
> 
> Is it realistic to expect that someone will write one anytime soon?
> 
> What about Btrfs bindings, as an alternative?

There aren't any bindings, for any filesystem, for any language. Your 
application opens a file, reads from/writes to it, closes it when ready. 
That's all. What type of filesystem you're file is located on doesn't (and 
shouldn't) matter.

HTH...

	Dirk
-- 
Dirk Heinrichs <dirk.heinrichs@altum.de>
Tel: +49 (0)2471 209385 | Mobil: +49 (0)176 34473913
GPG Public Key C2E467BB | Jabber: dirk.heinrichs@altum.de



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ZFS/BtrFS bindings
  2013-07-14  9:47 ` Dirk Heinrichs
@ 2013-07-14  9:59   ` Dufr
  2013-07-16  0:31     ` Randy Brukardt
  2013-07-16 20:29     ` Dirk Heinrichs
  0 siblings, 2 replies; 13+ messages in thread
From: Dufr @ 2013-07-14  9:59 UTC (permalink / raw)


> There aren't any bindings, for any filesystem, for any language. Your 
> application opens a file, reads from/writes to it, closes it when ready. 
> That's all. What type of filesystem you're file is located on doesn't (and 
> shouldn't) matter.

Sorry, but it is not as simple as that! 
When we are talking about sophisticated file systems, such as ZFS, bindings are necessary, because the functions which are specific to the file system are not supported by the language. Of course, I am talking about functions that are beyond opening, reading and writing files.
For instance: extended attributes (xattr). Can I access and use them from Ada?
No, unless I have the bindings specific to that file system.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ZFS/BtrFS bindings
  2013-07-14  9:59   ` Dufr
@ 2013-07-16  0:31     ` Randy Brukardt
  2013-07-16  2:55       ` Dufr
  2013-07-16 20:29     ` Dirk Heinrichs
  1 sibling, 1 reply; 13+ messages in thread
From: Randy Brukardt @ 2013-07-16  0:31 UTC (permalink / raw)


"Dufr" <dufriz@gmail.com> wrote in message 
news:3b1b00b6-9799-4827-b51c-8e08d4dc6e91@googlegroups.com...
>> There aren't any bindings, for any filesystem, for any language. Your
>> application opens a file, reads from/writes to it, closes it when ready.
>> That's all. What type of filesystem you're file is located on doesn't 
>> (and
>> shouldn't) matter.
>
>Sorry, but it is not as simple as that!
>When we are talking about sophisticated file systems, such as ZFS, bindings
>are necessary, because the functions which are specific to the file system 
>are
>not supported by the language. Of course, I am talking about functions that
>are beyond opening, reading and writing files.
>For instance: extended attributes (xattr). Can I access and use them from 
>Ada?
>No, unless I have the bindings specific to that file system.

Such things are supposed to be made available as children of Ada.Directories 
in Ada.Directories.Information and the like. Of course, those packages are 
implementation-defined, and whether a particular compiler has access to 
anything in particular is up to that vendor. I think most vendors make 
OS-specific stuff available, but not necessarily anything below that.

I'd be dubious about depending on any particular file system, since that 
would prevent your program from working in any other environment in the 
future (and one thing we certainly know, whatever is being used this year 
will be replaced by something better in a few years).

Any I'm extremely dubious that a third-party "binding" would work. You could 
get some file attributes that way, but you wouldn't be able to use any of 
that information for I/O (that is, you couldn't open a file identified by 
the binding) because there is no Ada way to do such low-level access to I/O 
facilities. I think you'd have to get it from your Ada compiler vendor for 
it to be very useful.

                                   Randy.






^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ZFS/BtrFS bindings
  2013-07-16  0:31     ` Randy Brukardt
@ 2013-07-16  2:55       ` Dufr
  2013-07-16  4:25         ` Jeffrey Carter
  0 siblings, 1 reply; 13+ messages in thread
From: Dufr @ 2013-07-16  2:55 UTC (permalink / raw)


> Any I'm extremely dubious that a third-party "binding" would work. You could 
> get some file attributes that way, but you wouldn't be able to use any of 
> that information for I/O (that is, you couldn't open a file identified by 
> the binding) because there is no Ada way to do such low-level access to I/O 
> facilities.

Do you mean that it is not even worth trying one's own bindings?

I am asking because I am fully aware is not a high-priority feature among users, so it is not likely to see it implemented by any vendors. It is only my guess, of course. 
The thing is that I won't hold my breath for some vendor to come along and implement Ada support for ZFS, because it may never happen...

So, my next question is: how much would a hired programmer need to write one-platform-only (say, Windows or Linux) Ada bindings for *some* ZFS functions?
I am saying "some" because what I actually need is only the support for extended attributes (xattr). Any guess? 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ZFS/BtrFS bindings
  2013-07-16  2:55       ` Dufr
@ 2013-07-16  4:25         ` Jeffrey Carter
  2013-07-16 22:18           ` Randy Brukardt
  0 siblings, 1 reply; 13+ messages in thread
From: Jeffrey Carter @ 2013-07-16  4:25 UTC (permalink / raw)


On 07/15/2013 07:55 PM, Dufr wrote:
>
> So, my next question is: how much would a hired programmer need to write
> one-platform-only (say, Windows or Linux) Ada bindings for *some* ZFS
> functions? I am saying "some" because what I actually need is only the
> support for extended attributes (xattr). Any guess?

That would depend on how screwed up the C that you're binding to is. I wouldn't 
think it would be very much of an effort, but C is often far more complicated 
than it needs to be.

-- 
Jeff Carter
"Don't knock masturbation. It's sex with someone I love."
Annie Hall
45

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ZFS/BtrFS bindings
  2013-07-14  9:59   ` Dufr
  2013-07-16  0:31     ` Randy Brukardt
@ 2013-07-16 20:29     ` Dirk Heinrichs
  2013-07-22 19:20       ` Per Sandberg
  2013-07-22 19:51       ` Per Sandberg
  1 sibling, 2 replies; 13+ messages in thread
From: Dirk Heinrichs @ 2013-07-16 20:29 UTC (permalink / raw)


Dufr wrote:

> For instance: extended attributes (xattr). Can I access and use them from
> Ada? No, unless I have the bindings specific to that file system.

This also is NOT a question of FS bindings, but of libattr/libacl bindings. 
The interface is usually common to all filesystems supporting it. That's the 
reason why the virtual filesystem (VFS) layer exists in Linux, it's an 
abstraction layer between user space and the different filesystems.

HTH...

	Dirk
-- 
Dirk Heinrichs <dirk.heinrichs@altum.de>
Tel: +49 (0)2471 209385 | Mobil: +49 (0)176 34473913
GPG Public Key C2E467BB | Jabber: dirk.heinrichs@altum.de



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ZFS/BtrFS bindings
  2013-07-16  4:25         ` Jeffrey Carter
@ 2013-07-16 22:18           ` Randy Brukardt
  2013-07-18 12:47             ` Dufr
  0 siblings, 1 reply; 13+ messages in thread
From: Randy Brukardt @ 2013-07-16 22:18 UTC (permalink / raw)


"Jeffrey Carter" <spam.jrcarter.not@spam.not.acm.org> wrote in message 
news:ks2hka$94b$1@dont-email.me...
> On 07/15/2013 07:55 PM, Dufr wrote:
>>
>> So, my next question is: how much would a hired programmer need to write
>> one-platform-only (say, Windows or Linux) Ada bindings for *some* ZFS
>> functions? I am saying "some" because what I actually need is only the
>> support for extended attributes (xattr). Any guess?
>
> That would depend on how screwed up the C that you're binding to is. I 
> wouldn't think it would be very much of an effort, but C is often far more 
> complicated than it needs to be.

I'm presuming that you want to get xattr of files that are open in Ada. That 
means that you have to have some cooperation from your vendor, in that Ada 
does not make implementation artifacts like file handles available. Some 
implementations might have a way to get those, some might not.

The problem is much easier if you just want to get xattr based on file 
names, because then one could write a binding to do just that, and avoid any 
interaction with the Ada implementation.

                            Randy.




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ZFS/BtrFS bindings
  2013-07-16 22:18           ` Randy Brukardt
@ 2013-07-18 12:47             ` Dufr
  2013-07-19  4:56               ` Randy Brukardt
  0 siblings, 1 reply; 13+ messages in thread
From: Dufr @ 2013-07-18 12:47 UTC (permalink / raw)



> I'm presuming that you want to get xattr of files that are open in Ada. That 
> means that you have to have some cooperation from your vendor, in that Ada 
> does not make implementation artifacts like file handles available. Some 
> implementations might have a way to get those, some might not.
> 
> The problem is much easier if you just want to get xattr based on file 
> names, because then one could write a binding to do just that, and avoid any 
> interaction with the Ada implementation.

Sorry but I couldn't understand the difference between the two cases. Would you mind elaborating a bit on that?




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ZFS/BtrFS bindings
  2013-07-18 12:47             ` Dufr
@ 2013-07-19  4:56               ` Randy Brukardt
  0 siblings, 0 replies; 13+ messages in thread
From: Randy Brukardt @ 2013-07-19  4:56 UTC (permalink / raw)


"Dufr" <dufriz@gmail.com> wrote in message 
news:72a51d66-2ebf-4162-8df7-bcde8c6626cf@googlegroups.com...
>
>> I'm presuming that you want to get xattr of files that are open in Ada. 
>> That
>> means that you have to have some cooperation from your vendor, in that 
>> Ada
>> does not make implementation artifacts like file handles available. Some
>> implementations might have a way to get those, some might not.
>>
>> The problem is much easier if you just want to get xattr based on file
>> names, because then one could write a binding to do just that, and avoid 
>> any
>> interaction with the Ada implementation.
>
> Sorry but I couldn't understand the difference between the two cases. 
> Would you mind elaborating a bit on that?

Sure. If you need to get extended attributes of an open Ada file (that is, 
from an object of type File_Type), then you'd have to get some cooperation 
from your vendor, since the underlying file handles aren't usually available 
to bindings and the like. (And even if they are, that will work only with 
that specific compiler and probably target OS.)

OTOH, if you just need extended attributes of a file whose name you know, 
then you could have a binding that worked much like Ada.Directories and just 
takes the name of the file. The binding would then have to open it (or 
whatever is needed to get at the extended attributes), so that's likely to 
be slower -- but it probably wouldn't matter that much unless you had to 
grab xattrs thousands of times on the same file.

                                          Randy.




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ZFS/BtrFS bindings
  2013-07-16 20:29     ` Dirk Heinrichs
@ 2013-07-22 19:20       ` Per Sandberg
  2013-07-22 19:51       ` Per Sandberg
  1 sibling, 0 replies; 13+ messages in thread
From: Per Sandberg @ 2013-07-22 19:20 UTC (permalink / raw)


On Tue, 16 Jul 2013 22:29:48 +0200
Dirk Heinrichs <dirk.heinrichs@altum.de> wrote:

> Dufr wrote:
> 
> > For instance: extended attributes (xattr). Can I access and use
> > them from Ada? No, unless I have the bindings specific to that file
> > system.
> 
> This also is NOT a question of FS bindings, but of libattr/libacl
> bindings. The interface is usually common to all filesystems
> supporting it. That's the reason why the virtual filesystem (VFS)
> layer exists in Linux, it's an abstraction layer between user space
> and the different filesystems.
> 
> HTH...
> 
> 	Dirk
Well the simplest way to do it is with a fairly recent GCC and:
* create a file "name.h" containing the following two lines:
#include <attr/libattr.h>
#include <acl/libacl.h>

* then call 
   g++ -c name.h -fdump-ada-spec

* This will automagicly create the ada-specs corresponding to the
  headerfiles.
/Per





^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ZFS/BtrFS bindings
  2013-07-16 20:29     ` Dirk Heinrichs
  2013-07-22 19:20       ` Per Sandberg
@ 2013-07-22 19:51       ` Per Sandberg
  2013-08-04  6:46         ` Dirk Heinrichs
  1 sibling, 1 reply; 13+ messages in thread
From: Per Sandberg @ 2013-07-22 19:51 UTC (permalink / raw)


On Tue, 16 Jul 2013 22:29:48 +0200
Dirk Heinrichs <dirk.heinrichs@altum.de> wrote:

> Dufr wrote:
> 
> > For instance: extended attributes (xattr). Can I access and use
> > them from Ada? No, unless I have the bindings specific to that file
> > system.
> 
> This also is NOT a question of FS bindings, but of libattr/libacl
> bindings. The interface is usually common to all filesystems
> supporting it. That's the reason why the virtual filesystem (VFS)
> layer exists in Linux, it's an abstraction layer between user space
> and the different filesystems.
> 
> HTH...
> 
> 	Dirk
Well the simplest way to do it is with a fairly recent GCC and:
* create a file "name.h" containing the following two lines:
#include <attr/libattr.h>
#include <acl/libacl.h>

* then call 
   g++ -c name.h -fdump-ada-spec

* This will automagicly create the ada-specs corresponding to the
  headerfiles.
/Per





^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ZFS/BtrFS bindings
  2013-07-22 19:51       ` Per Sandberg
@ 2013-08-04  6:46         ` Dirk Heinrichs
  0 siblings, 0 replies; 13+ messages in thread
From: Dirk Heinrichs @ 2013-08-04  6:46 UTC (permalink / raw)


Per Sandberg wrote:

> Well the simplest way to do it is with a fairly recent GCC and:
> * create a file "name.h" containing the following two lines:
> #include <attr/libattr.h>
> #include <acl/libacl.h>
> 
> * then call
> g++ -c name.h -fdump-ada-spec
> 
> * This will automagicly create the ada-specs corresponding to the
> headerfiles.

Looks quite nice. Thanks.

Bye...

	Dirk
-- 
Dirk Heinrichs <dirk.heinrichs@altum.de>
Tel: +49 (0)2471 209385 | Mobil: +49 (0)176 34473913
GPG Public Key C2E467BB | Jabber: dirk.heinrichs@altum.de

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-08-04  6:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-14  2:48 ZFS/BtrFS bindings Dufr
2013-07-14  9:47 ` Dirk Heinrichs
2013-07-14  9:59   ` Dufr
2013-07-16  0:31     ` Randy Brukardt
2013-07-16  2:55       ` Dufr
2013-07-16  4:25         ` Jeffrey Carter
2013-07-16 22:18           ` Randy Brukardt
2013-07-18 12:47             ` Dufr
2013-07-19  4:56               ` Randy Brukardt
2013-07-16 20:29     ` Dirk Heinrichs
2013-07-22 19:20       ` Per Sandberg
2013-07-22 19:51       ` Per Sandberg
2013-08-04  6:46         ` Dirk Heinrichs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox