Re: New PECL package request: fuse
| From: | Arnaud Le Blanc | Date: | Tue, 18 Nov 2008 20:32:12 +0000 |
| Subject: | Re: New PECL package request: fuse | ||
| References: | 1 2 3 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-5902@lists.php.net to get a copy of this message | ||
On Tuesday 18 November 2008 19:46:12 Bob Carroll wrote:
>
> > What about using FuseOperations as an interface ? So that one just needs
to
> > implement it and pass an instance of it to the fuse functions:
> >
> >
>
> That's a good idea. But I'd need to make it an abstract class with
> default implementations for each member function. Otherwise you'd have
> to implement the whole interface. There are several more operations than
> what I implemented in the example
> (http://fuse.sourceforge.net/doxygen/structfuse__operations.html).
>
You can create a default method that returns "not implemented":
PHP_METHOD(FuseOperations, default_op) {
RETURN_LONG(not impl);
}
and add an alias for each operation:
static zend_function_entry foper_functions[] = {
PHP_MALIAS(FuseOperations, default_op, getattr, ...)
PHP_MALIAS(FuseOperations, default_op, readlink, ...)
...
};
Or just try to call the methods and return -ENOSYS if the call fail because
the method does not exists, as you do with properties (this is how user-space
stream wrappers and filters work).
Regards,
Arnaud