Miklos Szeredi wrote:
* create, mount, unmount, remove fuse mountpoints
mkdir, exec filesystem, exec fusermount -u, rmdir
I don't see what extra a library could do
i guess to integrate with GUI-applications (filemanagers, file-dialogs)
a standardized management API would make things more attractive... see
the attached "fusi.h" header file ... (it's sketchy - more a collection
of ideas... there is not much "libfusi" code behind this header file yet)
* password callbacks (needs support in libfuse or a second library
linked into fuse modules, because the current way of specifying
passwords as command line args is unsecure)
A nice model for this is ssh-askpass, no need to support anything in
libfuse for this to work.
i think the ssh-askpass model won't work for this. i need a way to pass
a password as mount parameter (to sshfs, cupsftpfs), which is not
visible in the command line (and in the process list). what about
setting a FUSE_MOUNT_PASSWORD envir variable? would that be safe?
btw: sshfs seems problematic, because it prompts the password in the
terminal, and i couldn't find a way to automatically answer this prompt
with a wrapper executable that controls stdin/stdout/stderr of the sshfs
executable...
smbfs: seems to be quite hard to fit in a gui-managed model (because
there is no feedback about successful server/share authentication...)
this is how a spec-file which describes a fuse-module currently looks
like (installed in /etc/fuse/module-specs):
-------------- cupsftpfs.fuse-module ----------------------
[fuse module spec]
name=cupsftpfs
scheme=ftp
description=Connects to ftp file servers
checkexec=cupsftpfs
[EMAIL PROTECTED]@/fusi-mount-cupsftpfs-helper
mount_property_list=host;user;port;password
[fuse module spec propertyscheme]
host_type=string
host_title=Hostname
host_required=true
user_type=string
user_title=Username
user_required=true
port_type=int
port_title=Port
port_required=false
password_type=password
password_title=Password
password_required=true
-------------------------------------------------------------------
and this is how a mountspec file (to remember network mounts) looks like
(the list of mount-specs resides in
$XDG_CONFIG_HOME/fuse/mount-spec/*.fuse-mount)
------------test_at_server.fuse-mount ----------
[fuse mount spec]
modulename=cupsftpfs
# id is the name of the mount directory under $HOME/network-servers/
id=test_at_server
[fuse mount spec properties]
host=ftp.server.org
user=test
--------------------------------------------------------------------
regards,
norbert
#include <glib.h>
#ifndef FUSI_H_
#define FUSI_H_
G_BEGIN_DECLS
/**
* the session object caches the list of mountpoints etc...
*/
typedef struct _FusiSession FusiSession;
/**
* represents fuse module (described in /etc/fuse/module-spec/*.fuse-module )
*/
typedef struct _FusiModuleInfo FusiModuleInfo;
/**
* represents a known or/and mounted network filesystem
* (stored in $XDG_CONFIG_HOME/fuse/mount-spec/*.fuse-mount)
*/
typedef struct _FusiMountPoint FusiMountPoint;
typedef enum {
FUSI_MOUNTPOINT_CREATED = 1,
FUSI_MOUNTPOINT_MOUNTED = 2,
FUSI_MOUNTPOINT_UNMOUNTED = 3,
FUSI_MOUNTPOINT_REMOVED = 4
} FusiEventType;
typedef void (*FusiEvent) (FusiSession * session, FusiEventType e,
char * mount_dir_name, gpointer userdata);
/* -------------- session ---------------- */
FusiSession * fusi_session_new(void);
FusiSession * fusi_session_new_with_mainloop(GMainContext * context);
void fusi_session_destroy(FusiSession * session);
FusiModuleInfo ** fusi_list_available_modules(FusiSession * session);
FusiModuleInfo * fusi_get_moduleinfo(FusiSession * session, char * name);
FusiMountPoint ** fusi_list_mountpoints(FusiSession * session);
// void fusi_register_mountpoint(FusiSession * session, FusiMountPoint *);
void fusi_register_eventHandler(FusiSession * session, FusiEvent handler, gpointer userdata);
/* -------------- modules ---------------- */
/* info about available fuse modules */
void fusi_moduleinfo_ref(FusiModuleInfo * module);
void fusi_moduleinfo_unref(FusiModuleInfo * module);
char * fusi_moduleinfo_get_name(FusiModuleInfo * module); /* ftpfs, sshfs,.. */
char * fusi_moduleinfo_get_scheme(FusiModuleInfo * module); /* ftp, ssh,.. */
char * fusi_moduleinfo_get_description(FusiModuleInfo * module);
/* ------------ mountpoints -------------- */
typedef enum
{
FUSI_MOUNTPOINT_STATE_NEW = 1,
FUSI_MOUNTPOINT_STATE_UNCHECKED = 2, /* not checked whether mounted or unmounted */
FUSI_MOUNTPOINT_STATE_UNMOUNTED = 3, /* mount-dir and config exists, but not mounted */
FUSI_MOUNTPOINT_STATE_MOUNTED = 4,
FUSI_MOUNTPOINT_STATE_INVALID = 999 /* mountpoint has been removed */
} FusiMountPointState;
typedef enum
{
FUSI_MOUNTRESULT_SUCCEEDED = 1,
FUSI_MOUNTRESULT_AUTH_FAILURE = 2,
FUSI_MOUNTRESULT_SERVICE_NOT_FOUND = 3,
FUSI_MOUNTRESULT_DIRNAME_REQUIRED = 4,
FUSI_MOUNTRESULT_DIRNAME_ALREADY_EXISTS = 5,
FUSI_MOUNTRESULT_CANNOT_UNREGISTER = 6,
FUSI_MOUNTRESULT_NOT_PERMITTED = 7,
FUSI_MOUNTRESULT_SPECFILE_ERROR = 8,
FUSI_MOUNTRESULT_OTHER_ERR = 999
} FusiMountResult;
typedef void (*FusiMountCallback) (FusiMountPoint * mpoint, FusiMountResult r, GError *error);
/** create a mountpoint from an uri (ftp://[EMAIL PROTECTED]) */
FusiMountPoint * fusi_mountpoint_new_from_uri(FusiSession * session, char * uri);
/** create a mountpoint with certain module */
FusiMountPoint * fusi_mountpoint_new(FusiSession * session, FusiModuleInfo * module);
void fusi_mountpoint_ref(FusiMountPoint * mpoint);
void fusi_mountpoint_unref(FusiMountPoint * mpoint);
/** register mountpoint/save changes */
FusiMountResult fusi_mountpoint_save(FusiMountPoint * mpoint, GError ** err);
FusiMountPointState fusi_mountpoint_get_state(FusiMountPoint * mpoint);
gboolean fusi_mountpoint_is_mounted(FusiMountPoint * mpoint);
gboolean fusi_mountpoint_is_valid(FusiMountPoint * mpoint);
char * fusi_mountpoint_get_path(FusiMountPoint * mpoint);
/** the dirname is the 'id' of the fuse-mount */
char * fusi_mountpoint_get_dirname(FusiMountPoint * mpoint);
/** user specified dir-name - only works for new mounts. returns FALSE if the name cannot be changed */
gboolean fusi_mountpoint_set_dirname(FusiMountPoint * mpoint, char * dirname);
FusiMountResult fusi_mountpoint_mount(FusiMountPoint * mpoint, GError ** err);
void fusi_mountpoint_async_mount(FusiMountPoint * mpoint, FusiMountCallback cb);
FusiMountResult fusi_mountpoint_umount(FusiMountPoint * mpoint, GError ** err);
void fusi_mountpoint_async_umount(FusiMountPoint * mpoint, FusiMountCallback cb);
FusiMountResult fusi_mountpoint_unregister(FusiMountPoint * mpoint, GError ** err);
FusiModuleInfo * fusi_mountpoint_get_module(FusiMountPoint * mpoint);
/* ---------- mountpoint properties ---------- */
/* model behind login- and mount-info-dialogs
properties will turn to read-only on successful mounts */
typedef enum
{
FUSI_MOUNTPPOINTPROPERTYTYPE_NOTEXISTS = 0,
FUSI_MOUNTPPOINTPROPERTYTYPE_STRING = 1,
FUSI_MOUNTPPOINTPROPERTYTYPE_INT = 2,
FUSI_MOUNTPPOINTPROPERTYTYPE_BOOL = 3,
FUSI_MOUNTPPOINTPROPERTYTYPE_PASSWD = 4
} FusiMountPointPropertyType;
/** list available properties for this mountpoint */
char ** fusi_mountpoint_list_property_names(FusiMountPoint * mpoint);
gboolean fusi_mountpoint_property_is_readonly(FusiMountPoint * mpoint, char * name);
gboolean fusi_mountpoint_property_is_required(FusiMountPoint * mpoint, char * name);
gboolean fusi_mountpoint_property_is_set(FusiMountPoint * mpoint, char * name);
// gboolean fusi_mountpoint_property_has_problem(FusiMountPoint * mpoint, char * name);
char * fusi_mountpoint_property_get_title(FusiMountPoint * mpoint, char * name);
char * fusi_mountpoint_property_get_str_value(FusiMountPoint * mpoint, char * name);
void fusi_mountpoint_property_set_str_value(FusiMountPoint * mpoint, char * name, char * value);
int fusi_mountpoint_property_get_int_value(FusiMountPoint * mpoint, char * name);
void fusi_mountpoint_property_set_int_value(FusiMountPoint * mpoint, char * name, int value);
gboolean fusi_mountpoint_property_get_bool_value(FusiMountPoint * mpoint, char * name);
void fusi_mountpoint_property_set_bool_value(FusiMountPoint * mpoint, char * name, gboolean value);
FusiMountPointPropertyType fusi_mountpoint_property_get_type(FusiMountPoint * mpoint, char * name);
/* ---------- path/uri utilities ---------- */
/*
fast operations to detemine information about filesystem paths (uses cached list of fuse mountpoints)
hint: the mainloop has to be active to pick up changes
*/
typedef enum
{
FUSI_CHKPATHRESULT_OTHER = 1,
FUSI_CHKPATHRESULT_FUSE_MOUNTED = 2,
FUSI_CHKPATHRESULT_FUSE_BUT_NOT_MOUNTED = 3 /* filemanagers should prevent writing in this case */
} FusiChkPathResult;
/** checks if the path is pointing to/below a fusi mountpoint */
FusiChkPathResult fusi_chk_path(FusiSession * session, char * path);
FusiMountPoint * fusi_get_mountpoint_for_path(FusiSession * session, char * path);
/** returns NULL if there is no known fuse-mount to handle this uri */
char * fusi_path_translate_from_uri(FusiSession * session, char * uri);
char * fusi_path_translate_to_uri(FusiSession * session, char * path);
gboolean fusi_path_is_fuse_mountpoint(FusiSession * session, char * path);
G_END_DECLS
#endif /* FUSI_H_*/
_______________________________________________
xdg mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/xdg