Skip to content

Commit

Permalink
Added default options for llfuse.main.
Browse files Browse the repository at this point in the history
Fixes issue #49.

--HG--
extra : histedit_source : 5e2aa788db1d48a58883fae4c4a86bcb5f7965b0
  • Loading branch information
Nikratio committed Aug 28, 2015
1 parent 692cab9 commit 1d8c8e0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
8 changes: 8 additions & 0 deletions rst/data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
The inode of the root directory, i.e. the mount point of the file
system.

.. py:data:: default_options
This is a recommended set of options that should be passed to
`llfuse.init` to get reasonable behavior and
performance. Python-LLFUSE is compatible with any other combination
of options as well, but you should only deviate from the defaults
with good reason.

.. autoexception:: FUSEError

.. autoclass:: RequestContext
Expand Down
17 changes: 14 additions & 3 deletions src/llfuse/fuse_api.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,24 @@ def getxattr(path, name, int size_guess=128, namespace='user'):
finally:
stdlib.free(buf)

def init(ops, mountpoint, list args):
default_options = frozenset(('big_writes', 'nonempty', 'default_permissions',
'splice_read', 'splice_write', 'splice_move'))
def init(ops, mountpoint, options=default_options):
'''Initialize and mount FUSE file system
*ops* has to be an instance of the `Operations` class (or another
class defining the same methods).
*args* has to be a list of strings. Valid options are listed under ``struct
*args* has to be a set of strings. `default_options` provides some
reasonable defaults. It is recommended to use these options as a basis and
add or remove options as necessary. For example::
my_opts = set(llfuse.default_options)
my_opts.add('allow_other')
my_opts.discard('default_permissions')
llfuse.init(ops, mountpoint, my_apts)
Valid options are listed under ``struct
fuse_opt fuse_mount_opts[]``
(`mount.c:82 <http://fuse.git.sourceforge.net/git/gitweb.cgi?p=fuse/fuse;f=lib/mount.c;hb=HEAD#l82>`_)
and ``struct fuse_opt fuse_ll_opts[]``
Expand All @@ -246,7 +257,7 @@ def init(ops, mountpoint, list args):
# Initialize Python thread support
PyEval_InitThreads()

make_fuse_args(args, &f_args)
make_fuse_args(options, &f_args)
log.debug('Calling fuse_mount')
channel = fuse_mount(<char*>mountpoint_b, &f_args)
if not channel:
Expand Down
2 changes: 1 addition & 1 deletion src/llfuse/misc.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ cdef void init_fuse_ops():
fuse_ops.access = fuse_access
fuse_ops.create = fuse_create

cdef make_fuse_args(list args, fuse_args* f_args):
cdef make_fuse_args(args, fuse_args* f_args):
cdef char* arg
cdef int i
cdef ssize_t size
Expand Down

0 comments on commit 1d8c8e0

Please sign in to comment.