POE-Component-Fuse

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

            sub fuse_getdir : State {
                    my( $postback, $context, $path ) = @_[ ARG0 .. ARG2 ];

                    # somehow get our data, we fake it here for instructional reasons
                    $postback->( 'foo', 'bar', 0 );
                    return;
            }

    Again, pretty please read the Fuse documentation for all the events you
    can receive. Here's the list as of Fuse v0.09: getattr readlink getdir
    mknod mkdir unlink rmdir symlink rename link chmod chown truncate utime
    open read write statfs flush release fsync setxattr getxattr listxattr
    removexattr.

   CLOSED
    This is a special event sent to the session notifying it of component
    shutdown. As usual, it will be prefixed by the prefix set in the
    options.

    The event handler will get one argument, the error string. If you shut
    down the component, it will be "shutdown", otherwise it will contain

examples/fuse.pl  view on Meta::CPAN

		# successful update of mode!
		$postback->( 0 );
	} else {
		# path does not exist
		$postback->( -ENOENT() );
	}

	return;
}

sub fuse_chown : State {
	my( $postback, $context, $path, $uid, $gid ) = @_[ ARG0 .. ARG4 ];
	#print "CHOWN: '$path' - '$uid' - '$gid'\n";

	if ( exists $files{ $path } ) {
		# okay, update the ownerships!!
		$files{ $path }{'uid'} = $uid;
		$files{ $path }{'gid'} = $gid;

		# successful update of ownership!
		$postback->( 0 );

lib/POE/Component/Fuse.pm  view on Meta::CPAN


	sub fuse_getdir : State {
		my( $postback, $context, $path ) = @_[ ARG0 .. ARG2 ];

		# somehow get our data, we fake it here for instructional reasons
		$postback->( 'foo', 'bar', 0 );
		return;
	}

Again, pretty please read the L<Fuse> documentation for all the events you can receive. Here's the list
as of Fuse v0.09: getattr readlink getdir mknod mkdir unlink rmdir symlink rename link chmod chown truncate
utime open read write statfs flush release fsync setxattr getxattr listxattr removexattr.

=head3 CLOSED

This is a special event sent to the session notifying it of component shutdown. As usual, it will be prefixed by the
prefix set in the options.

The event handler will get one argument, the error string. If you shut down the component, it will be "shutdown",
otherwise it will contain some error string. A sample handler is below.

lib/POE/Component/Fuse/AsyncFsV.pm  view on Meta::CPAN

	return;
}

sub chmod {
	my ( $self, $context, $path, $modes ) = @_;

	$self->fsv->chmod( $path, $modes, $self->_cb( 'chmod' ) );
	return;
}

sub chown {
	my ( $self, $context, $path, $uid, $gid ) = @_;

	$self->fsv->chown( $path, $uid, $gid, $self->_cb( 'chown' ) );
	return;
}

sub utime {
	my ( $self, $context, $path, $atime, $mtime ) = @_;

	$self->fsv->utime( $path, $atime, $mtime, $self->_cb( 'utime' ) );
	return;
}

lib/POE/Component/Fuse/SubProcess.pm  view on Meta::CPAN

}

# initializes FUSE and enters the eventloop
sub start_fuse {
	my $mount = shift;
	my $opts = shift;

	# setup our callbacks
	my %callbacks;
	foreach my $cb ( qw( getattr readlink getdir mknod mkdir unlink rmdir symlink rename link chmod
		chown truncate utime open read write statfs flush release fsync
		setxattr getxattr listxattr removexattr ) ) {

		$callbacks{ $cb } = "POE::Component::Fuse::SubProcess::callback_" . $cb;

		# create the sub!
		eval "sub callback_$cb { return fuse_callback( \$cb, \@_ ) }";	## no critic ( ProhibitStringyEval )
		if ( $@ ) {
			die $@;
		}
	}

lib/POE/Component/Fuse/myFuse.pm  view on Meta::CPAN

# some more requirements
use Errno;
use Carp;
use Config;

# finally, load our XS file
bootstrap POE::Component::Fuse::myFuse $VERSION;

sub main {
	my @names = qw(getattr readlink getdir mknod mkdir unlink rmdir symlink
			rename link chmod chown truncate utime open read write statfs
			flush release fsync setxattr getxattr listxattr removexattr);
	my @subs = map {undef} @names;
	my @validOpts = qw(ro allow_other default_permissions fsname use_ino nonempty);
	my $tmp = 0;
	my %mapping = map { $_ => $tmp++ } @names;
	my %optmap  = map { $_ => 1 } @validOpts;
	my @otherargs = qw(debug threaded mountpoint mountopts);
	my %otherargs = (debug=>0, threaded=>0, mountpoint=>"", mountopts=>"");
	while(my $name = shift) {
		my ($subref) = shift;

lib/POE/Component/Fuse/myFuse.xs  view on Meta::CPAN

	else
		rv = 0;
	FREETMPS;
	LEAVE;
	PUTBACK;
	DEBUGf("chmod end: %i\n",rv);
	FUSE_CONTEXT_POST;
	return rv;
}

int _PLfuse_chown (const char *file, uid_t uid, gid_t gid) {
	int rv;
	FUSE_CONTEXT_PRE;
	DEBUGf("%s","chown begin\n");
	ENTER;
	SAVETMPS;
	PUSHMARK(SP);
	XPUSHs(sv_2mortal(newSVpv(file,0)));
	XPUSHs(sv_2mortal(newSViv(uid)));
	XPUSHs(sv_2mortal(newSViv(gid)));
	PUTBACK;
	rv = call_sv(_PLfuse_callbacks[11],G_SCALAR);
	SPAGAIN;
	if(rv)
		rv = POPi;
	else
		rv = 0;
	FREETMPS;
	LEAVE;
	PUTBACK;
	DEBUGf("chown end: %i\n",rv);
	FUSE_CONTEXT_POST;
	return rv;
}

int _PLfuse_truncate (const char *file, off_t off) {
	int rv;
	FUSE_CONTEXT_PRE;
	DEBUGf("%s","truncate begin\n");
	ENTER;
	SAVETMPS;

lib/POE/Component/Fuse/myFuse.xs  view on Meta::CPAN

readlink:		_PLfuse_readlink,
getdir:			_PLfuse_getdir,
mknod:			_PLfuse_mknod,
mkdir:			_PLfuse_mkdir,
unlink:			_PLfuse_unlink,
rmdir:			_PLfuse_rmdir,
symlink:		_PLfuse_symlink,
rename:			_PLfuse_rename,
link:			_PLfuse_link,
chmod:			_PLfuse_chmod,
chown:			_PLfuse_chown,
truncate:		_PLfuse_truncate,
utime:			_PLfuse_utime,
open:			_PLfuse_open,
read:			_PLfuse_read,
write:			_PLfuse_write,
statfs:			_PLfuse_statfs,
flush:			_PLfuse_flush,
release:		_PLfuse_release,
fsync:			_PLfuse_fsync,
setxattr:		_PLfuse_setxattr,



( run in 0.689 second using v1.01-cache-2.11-cpan-5511b514fd6 )