I'm trying to make fuse work in D[1]. I had some help from htod, but not 
everything was successful. And I'm not exactly sure how to properly convert 
strings and such.

What I currently have allows me to compile some fuse programs (hello for 
example[2]). But the result is a dead link (only seem to be able to fix it by 
rebooting). Anyway the specific questions I want to get out of the way are as 
follows.

hello_str = cast(char*) toStringz("Hello World!\n");

I stopped doing this, but I'm just wondering how you could get a modifiable C 
string if I needed one?

fuse.d:669 auto user_data = new ubyte[78];
fuse.d:670 return fuse_main_real(cast(int) argc, argv, op, (*(op)).sizeof, 
user_data.ptr);

[3]This is likely a big part of the problem, but I just didn't understand the 
C. It is a defined as:

#define fuse_main(argc, argv, op, user_data)                            \
        fuse_main_real(argc, argv, op, sizeof(*(op)), user_data)

But is called:

return fuse_main(argc, argv, &hello_oper);

And I can't find a three argument fuse_main. So I made one and just passed a 
block of storage (converting to a pointer so the compiler wouldn't complain of 
conversions and I didn't cast)

Then there is a structure which had some padding, and htod didn't fully convert 
it, leaving off two fields at the end[4]. Maybe I should move them to just 
after the bit field? I think it would be fine...

The last one is the node structure[5]. Which I found in fuse.c[6] but seems to 
be used a lot so I don't no why it isn't in a header. This used the is_hidden : 
1 notation so I created some bit fields, but it didn't have padding like the 
others, so I don't know if I did this correctly.

This is probably trivial bindings for those who know C better, but it has been 
fun. The links are below, and I was using the 2.8.4 header files.

1. https://github.com/he-the-great/Fused
2. http://fuse.sourceforge.net/helloworld.html
3. https://github.com/he-the-great/Fused/blob/master/fuse.d#L663
4. https://github.com/he-the-great/Fused/blob/master/fuse_common.d#L95
5. https://github.com/he-the-great/Fused/blob/master/fuse_helper.d#L54
6. https://github.com/he-the-great/Fused/blob/master/fuse.c#L113

Reply via email to