op_release.h \
op_getattr.c \
op_getattr.h \
+ op_mknod.c \
+ op_mknod.h \
+ op_unlink.c \
+ op_unlink.h \
+ op_mkdir.c \
+ op_mkdir.h \
+ op_rmdir.c \
+ op_rmdir.h \
+ op_chmod.c \
+ op_chmod.h \
+ op_truncate.c \
+ op_truncate.h \
+ op_write.c \
+ op_write.h \
+ op_rename.c \
+ op_rename.h \
+ op_utime.c \
+ op_utime.h \
gnomevfsresult.c \
gnomevfsresult.h \
gnomevfsfileinfo.c \
#include "op_read.h"
#include "op_release.h"
#include "op_getattr.h"
+#include "op_mknod.h"
+#include "op_unlink.h"
+#include "op_mkdir.h"
+#include "op_rmdir.h"
+#include "op_chmod.h"
+#include "op_truncate.h"
+#include "op_write.h"
+#include "op_rename.h"
+#include "op_utime.h"
CaptiveVfsObject *capfuse_captive_vfs_object;
read: op_read,
release: op_release,
getattr: op_getattr,
-#if 0
- flush: op_flush,
mknod: op_mknod,
- mkdir: op_mkdir,
unlink: op_unlink,
+ mkdir: op_mkdir,
rmdir: op_rmdir,
- rename: op_rename,
chmod: op_chmod,
truncate: op_truncate,
- utime: op_utime,
write: op_write,
-#endif
+ rename: op_rename,
+ utime: op_utime,
};
/* argv[0] expected as the program name. */
--- /dev/null
+/* $Id$
+ * Client fuse interface operation "chmod" for libcaptive
+ * Copyright (C) 2005 Jan Kratochvil <project-captive@jankratochvil.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; exactly version 2 of June 1991 is required
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include "config.h"
+
+#include <glib/gmessages.h>
+#include <fuse.h>
+#include <errno.h>
+#include <captive/client-file.h>
+#include <sys/stat.h>
+#include <captive/macros.h>
+
+#include "op_chmod.h" /* self */
+#include "main.h"
+#include "gnomevfsresult.h"
+#include "gnomevfsfileinfo.h"
+
+
+int op_chmod(const char *path,mode_t mode)
+{
+CaptiveFileObject *captive_file_object;
+GnomeVFSResult errvfsresult;
+GnomeVFSFileInfo file_info;
+
+ g_return_val_if_fail(path!=NULL,-EINVAL);
+
+ if (1
+ && !S_ISREG(mode)
+ && !S_ISDIR(mode))
+ return -EPERM;
+
+ /* Do not: GNOME_VFS_OPEN_WRITE
+ * as we would get EPERM for setting back: chmod u+w
+ */
+ if (GNOME_VFS_OK!=(errvfsresult=captive_file_new_open(&captive_file_object,capfuse_captive_vfs_object,path,0)))
+ return -gnomevfsresult_to_errno(errvfsresult);
+
+ file_info.valid_fields=0
+ |GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS
+ |GNOME_VFS_FILE_INFO_FIELDS_ACCESS;
+ file_info.permissions=mode;
+ errvfsresult=captive_file_file_info_set(captive_file_object,&file_info,GNOME_VFS_SET_FILE_INFO_PERMISSIONS);
+
+ g_object_unref(captive_file_object);
+ if (GNOME_VFS_OK!=errvfsresult)
+ return -gnomevfsresult_to_errno(errvfsresult);
+
+ return 0;
+}
--- /dev/null
+/* $Id$
+ * Include file for client fuse interface operation "chmod" for libcaptive
+ * Copyright (C) 2005 Jan Kratochvil <project-captive@jankratochvil.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; exactly version 2 of June 1991 is required
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#ifndef _CAPTIVE_CLIENT_FUSE_OP_CHMOD_H
+#define _CAPTIVE_CLIENT_FUSE_OP_CHMOD_H 1
+
+
+#include <fuse.h>
+#include <sys/stat.h>
+
+
+int op_chmod(const char *path,mode_t mode);
+
+
+#endif /* _CAPTIVE_CLIENT_FUSE_OP_CHMOD_H */
--- /dev/null
+/* $Id$
+ * Client fuse interface operation "mkdir" for libcaptive
+ * Copyright (C) 2005 Jan Kratochvil <project-captive@jankratochvil.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; exactly version 2 of June 1991 is required
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include "config.h"
+
+#include <glib/gmessages.h>
+#include <fuse.h>
+#include <errno.h>
+#include <captive/client-directory.h>
+#include <sys/stat.h>
+
+#include "op_mkdir.h" /* self */
+#include "main.h"
+#include "gnomevfsresult.h"
+
+
+int op_mkdir(const char *path,mode_t mode)
+{
+CaptiveDirectoryObject *captive_directory_object;
+GnomeVFSResult errvfsresult;
+
+ g_return_val_if_fail(path!=NULL,-EINVAL);
+
+ /* Do not: if (!S_ISDIR(mode))
+ * as FUSE does not set it.
+ */
+ if (mode&S_IFMT)
+ return -EPERM;
+
+ if (GNOME_VFS_OK!=(errvfsresult=captive_directory_new_make(&captive_directory_object,capfuse_captive_vfs_object,
+ path, /* pathname */
+ mode))) /* perm */
+ return -gnomevfsresult_to_errno(errvfsresult);
+
+ g_object_unref(captive_directory_object);
+
+ return 0;
+}
--- /dev/null
+/* $Id$
+ * Include file for client fuse interface operation "mkdir" for libcaptive
+ * Copyright (C) 2005 Jan Kratochvil <project-captive@jankratochvil.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; exactly version 2 of June 1991 is required
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#ifndef _CAPTIVE_CLIENT_FUSE_OP_MKDIR_H
+#define _CAPTIVE_CLIENT_FUSE_OP_MKDIR_H 1
+
+
+#include <fuse.h>
+#include <sys/stat.h>
+
+
+int op_mkdir(const char *path,mode_t mode);
+
+
+#endif /* _CAPTIVE_CLIENT_FUSE_OP_MKDIR_H */
--- /dev/null
+/* $Id$
+ * Client fuse interface operation "mknod" for libcaptive
+ * Copyright (C) 2005 Jan Kratochvil <project-captive@jankratochvil.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; exactly version 2 of June 1991 is required
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include "config.h"
+
+#include <glib/gmessages.h>
+#include <fuse.h>
+#include <errno.h>
+#include <captive/client-file.h>
+#include <sys/stat.h>
+
+#include "op_mknod.h" /* self */
+#include "main.h"
+#include "gnomevfsresult.h"
+
+
+int op_mknod(const char *path,mode_t mode,dev_t rdev)
+{
+CaptiveFileObject *captive_file_object;
+GnomeVFSResult errvfsresult;
+
+ g_return_val_if_fail(path!=NULL,-EINVAL);
+
+ if (!S_ISREG(mode))
+ return -EPERM;
+
+ if (GNOME_VFS_OK!=(errvfsresult=captive_file_new_create(&captive_file_object,capfuse_captive_vfs_object,
+ path, /* pathname */
+ 0, /* mode */
+ TRUE, /* exclusive */
+ mode))) /* perm */
+ return -gnomevfsresult_to_errno(errvfsresult);
+
+ g_object_unref(captive_file_object);
+
+ return 0;
+}
--- /dev/null
+/* $Id$
+ * Include file for client fuse interface operation "mknod" for libcaptive
+ * Copyright (C) 2005 Jan Kratochvil <project-captive@jankratochvil.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; exactly version 2 of June 1991 is required
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#ifndef _CAPTIVE_CLIENT_FUSE_OP_MKNOD_H
+#define _CAPTIVE_CLIENT_FUSE_OP_MKNOD_H 1
+
+
+#include <fuse.h>
+#include <sys/stat.h>
+
+
+int op_mknod(const char *path,mode_t mode,dev_t rdev);
+
+
+#endif /* _CAPTIVE_CLIENT_FUSE_OP_MKNOD_H */
--- /dev/null
+/* $Id$
+ * Client fuse interface operation "rename" for libcaptive
+ * Copyright (C) 2005 Jan Kratochvil <project-captive@jankratochvil.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; exactly version 2 of June 1991 is required
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include "config.h"
+
+#include <glib/gmessages.h>
+#include <fuse.h>
+#include <errno.h>
+#include <captive/client-file.h>
+#include <sys/stat.h>
+
+#include "op_rename.h" /* self */
+#include "main.h"
+#include "gnomevfsresult.h"
+
+
+int op_rename(const char *oldpath,const char *newpath)
+{
+CaptiveFileObject *captive_file_object;
+GnomeVFSResult errvfsresult;
+
+ g_return_val_if_fail(oldpath!=NULL,-EINVAL);
+ g_return_val_if_fail(newpath!=NULL,-EINVAL);
+
+ if (GNOME_VFS_OK!=(errvfsresult=captive_file_new_open(&captive_file_object,capfuse_captive_vfs_object,oldpath,
+ GNOME_VFS_OPEN_WRITE|GNOME_VFS_OPEN_RANDOM)))
+ return -gnomevfsresult_to_errno(errvfsresult);
+
+ /* Do not: FALSE==force_replace
+ * as it would really return EEXIST on mv(1) over an existing file.
+ */
+ errvfsresult=captive_file_move(
+ captive_file_object, /* captive_file_object_old */
+ newpath, /* pathname_new */
+ TRUE); /* force_replace */
+
+ g_object_unref(captive_file_object);
+ if (GNOME_VFS_OK!=errvfsresult)
+ return -gnomevfsresult_to_errno(errvfsresult);
+ return 0;
+}
--- /dev/null
+/* $Id$
+ * Include file for client fuse interface operation "rename" for libcaptive
+ * Copyright (C) 2005 Jan Kratochvil <project-captive@jankratochvil.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; exactly version 2 of June 1991 is required
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#ifndef _CAPTIVE_CLIENT_FUSE_OP_RENAME_H
+#define _CAPTIVE_CLIENT_FUSE_OP_RENAME_H 1
+
+
+#include <fuse.h>
+#include <sys/stat.h>
+
+
+int op_rename(const char *oldpath,const char *newpath);
+
+
+#endif /* _CAPTIVE_CLIENT_FUSE_OP_RENAME_H */
--- /dev/null
+/* $Id$
+ * Client fuse interface operation "rmdir" for libcaptive
+ * Copyright (C) 2005 Jan Kratochvil <project-captive@jankratochvil.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; exactly version 2 of June 1991 is required
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include "config.h"
+
+#include <glib/gmessages.h>
+#include <fuse.h>
+#include <errno.h>
+#include <captive/client-directory.h>
+#include <sys/stat.h>
+
+#include "op_rmdir.h" /* self */
+#include "main.h"
+#include "gnomevfsresult.h"
+
+
+int op_rmdir(const char *path)
+{
+CaptiveDirectoryObject *captive_directory_object;
+GnomeVFSResult errvfsresult;
+
+ g_return_val_if_fail(path!=NULL,-EINVAL);
+
+ if (GNOME_VFS_OK!=(errvfsresult=captive_directory_new_open(&captive_directory_object,capfuse_captive_vfs_object,path)))
+ return -gnomevfsresult_to_errno(errvfsresult);
+
+ errvfsresult=captive_directory_remove(captive_directory_object);
+ g_object_unref(captive_directory_object);
+ if (GNOME_VFS_OK!=errvfsresult)
+ return -gnomevfsresult_to_errno(errvfsresult);
+
+ return 0;
+}
--- /dev/null
+/* $Id$
+ * Include file for client fuse interface operation "rmdir" for libcaptive
+ * Copyright (C) 2005 Jan Kratochvil <project-captive@jankratochvil.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; exactly version 2 of June 1991 is required
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#ifndef _CAPTIVE_CLIENT_FUSE_OP_RMDIR_H
+#define _CAPTIVE_CLIENT_FUSE_OP_RMDIR_H 1
+
+
+#include <fuse.h>
+#include <sys/stat.h>
+
+
+int op_rmdir(const char *path);
+
+
+#endif /* _CAPTIVE_CLIENT_FUSE_OP_RMDIR_H */
--- /dev/null
+/* $Id$
+ * Client fuse interface operation "truncate" for libcaptive
+ * Copyright (C) 2005 Jan Kratochvil <project-captive@jankratochvil.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; exactly version 2 of June 1991 is required
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include "config.h"
+
+#include <glib/gmessages.h>
+#include <fuse.h>
+#include <errno.h>
+#include <captive/client-file.h>
+#include <sys/stat.h>
+#include <captive/macros.h>
+
+#include "op_truncate.h" /* self */
+#include "main.h"
+#include "gnomevfsresult.h"
+
+
+int op_truncate(const char *path,off_t size)
+{
+CaptiveFileObject *captive_file_object;
+GnomeVFSResult errvfsresult;
+
+ g_return_val_if_fail(path!=NULL,-EINVAL);
+ g_return_val_if_fail(size>=0,-EINVAL);
+
+ if (GNOME_VFS_OK!=(errvfsresult=captive_file_new_open(&captive_file_object,capfuse_captive_vfs_object,path,
+ GNOME_VFS_OPEN_WRITE|GNOME_VFS_OPEN_RANDOM)))
+ return -gnomevfsresult_to_errno(errvfsresult);
+
+ errvfsresult=captive_file_truncate(captive_file_object,size);
+ g_object_unref(captive_file_object);
+ if (GNOME_VFS_OK!=errvfsresult)
+ return -gnomevfsresult_to_errno(errvfsresult);
+
+ return 0;
+}
--- /dev/null
+/* $Id$
+ * Include file for client fuse interface operation "truncate" for libcaptive
+ * Copyright (C) 2005 Jan Kratochvil <project-captive@jankratochvil.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; exactly version 2 of June 1991 is required
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#ifndef _CAPTIVE_CLIENT_FUSE_OP_TRUNCATE_H
+#define _CAPTIVE_CLIENT_FUSE_OP_TRUNCATE_H 1
+
+
+#include <fuse.h>
+#include <sys/stat.h>
+
+
+int op_truncate(const char *path,off_t size);
+
+
+#endif /* _CAPTIVE_CLIENT_FUSE_OP_TRUNCATE_H */
--- /dev/null
+/* $Id$
+ * Client fuse interface operation "unlink" for libcaptive
+ * Copyright (C) 2005 Jan Kratochvil <project-captive@jankratochvil.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; exactly version 2 of June 1991 is required
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include "config.h"
+
+#include <glib/gmessages.h>
+#include <fuse.h>
+#include <errno.h>
+#include <captive/client-file.h>
+#include <captive/macros.h>
+
+#include "op_unlink.h" /* self */
+#include "main.h"
+#include "gnomevfsresult.h"
+
+
+int op_unlink(const char *path)
+{
+CaptiveFileObject *captive_file_object;
+GnomeVFSResult errvfsresult;
+
+ g_return_val_if_fail(path!=NULL,-EINVAL);
+
+ if (GNOME_VFS_OK!=(errvfsresult=captive_file_new_open(&captive_file_object,capfuse_captive_vfs_object,path,
+ GNOME_VFS_OPEN_WRITE|GNOME_VFS_OPEN_RANDOM)))
+ return -gnomevfsresult_to_errno(errvfsresult);
+
+ errvfsresult=captive_file_remove(captive_file_object);
+
+ g_object_unref(captive_file_object);
+
+ if (GNOME_VFS_OK!=errvfsresult)
+ return -gnomevfsresult_to_errno(errvfsresult);
+ return 0;
+}
--- /dev/null
+/* $Id$
+ * Include file for client fuse interface operation "unlink" for libcaptive
+ * Copyright (C) 2005 Jan Kratochvil <project-captive@jankratochvil.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; exactly version 2 of June 1991 is required
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#ifndef _CAPTIVE_CLIENT_FUSE_OP_UNLINK_H
+#define _CAPTIVE_CLIENT_FUSE_OP_UNLINK_H 1
+
+
+#include <fuse.h>
+#include <sys/stat.h>
+
+
+int op_unlink(const char *path);
+
+
+#endif /* _CAPTIVE_CLIENT_FUSE_OP_UNLINK_H */
--- /dev/null
+/* $Id$
+ * Client fuse interface operation "utime" for libcaptive
+ * Copyright (C) 2005 Jan Kratochvil <project-captive@jankratochvil.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; exactly version 2 of June 1991 is required
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include "config.h"
+
+#include <glib/gmessages.h>
+#include <fuse.h>
+#include <errno.h>
+#include <captive/client-file.h>
+#include <sys/stat.h>
+#include <captive/macros.h>
+
+#include "op_utime.h" /* self */
+#include "main.h"
+#include "gnomevfsresult.h"
+#include "gnomevfsfileinfo.h"
+
+
+int op_utime(const char *path,struct utimbuf *buf)
+{
+CaptiveFileObject *captive_file_object;
+GnomeVFSResult errvfsresult;
+GnomeVFSFileInfo file_info;
+
+ g_return_val_if_fail(path!=NULL,-EINVAL);
+ g_return_val_if_fail(buf!=NULL,-EINVAL);
+ g_return_val_if_fail(buf->actime!=0,-EINVAL);
+ g_return_val_if_fail(buf->modtime!=0,-EINVAL);
+
+ if (GNOME_VFS_OK!=(errvfsresult=captive_file_new_open(&captive_file_object,capfuse_captive_vfs_object,path,
+ GNOME_VFS_OPEN_WRITE|GNOME_VFS_OPEN_RANDOM)))
+ return -gnomevfsresult_to_errno(errvfsresult);
+
+ file_info.valid_fields=0
+ |GNOME_VFS_FILE_INFO_FIELDS_ATIME
+ |GNOME_VFS_FILE_INFO_FIELDS_MTIME;
+ file_info.atime=buf->actime;
+ file_info.mtime=buf->modtime;
+ /* It is probably not GnomeVFS compliant but still libcaptive compatible.
+ * GnomeVFS looks as assuming all the three fields set.
+ * GnomeVFS also does not check 'valid_fields' at all.
+ */
+ file_info.ctime=0; /* Just sanity for sure. */
+ errvfsresult=captive_file_file_info_set(captive_file_object,&file_info,GNOME_VFS_SET_FILE_INFO_TIME);
+
+ g_object_unref(captive_file_object);
+ if (GNOME_VFS_OK!=errvfsresult)
+ return -gnomevfsresult_to_errno(errvfsresult);
+
+ return 0;
+}
--- /dev/null
+/* $Id$
+ * Include file for client fuse interface operation "utime" for libcaptive
+ * Copyright (C) 2005 Jan Kratochvil <project-captive@jankratochvil.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; exactly version 2 of June 1991 is required
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#ifndef _CAPTIVE_CLIENT_FUSE_OP_UTIME_H
+#define _CAPTIVE_CLIENT_FUSE_OP_UTIME_H 1
+
+
+#include <fuse.h>
+#include <sys/stat.h>
+
+
+int op_utime(const char *path,struct utimbuf *buf);
+
+
+#endif /* _CAPTIVE_CLIENT_FUSE_OP_UTIME_H */
--- /dev/null
+/* $Id$
+ * Client fuse interface operation "write" for libcaptive
+ * Copyright (C) 2005 Jan Kratochvil <project-captive@jankratochvil.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; exactly version 2 of June 1991 is required
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include "config.h"
+
+#include <glib/gmessages.h>
+#include <fuse.h>
+#include <errno.h>
+#include <captive/client-file.h>
+
+#include "op_write.h" /* self */
+#include "main.h"
+#include "gnomevfsresult.h"
+
+
+int op_write(const char *path,const char *buf,size_t size,off_t off,struct fuse_file_info *fi)
+{
+CaptiveFileObject *captive_file_object;
+GnomeVFSResult errvfsresult;
+GnomeVFSFileSize bytes_written;
+
+ g_return_val_if_fail(path!=NULL,-EINVAL);
+ g_return_val_if_fail(buf!=NULL,-EINVAL);
+ g_return_val_if_fail(size>0,-EINVAL);
+ g_return_val_if_fail(off>=0,-EINVAL);
+ g_return_val_if_fail(fi!=NULL,-EINVAL);
+
+ captive_file_object=(gpointer)fi->fh;
+ g_return_val_if_fail(CAPTIVE_FILE_IS_OBJECT(captive_file_object),-EINVAL);
+
+ if (GNOME_VFS_OK!=(errvfsresult=captive_file_seek(captive_file_object,GNOME_VFS_SEEK_START,off)))
+ return -gnomevfsresult_to_errno(errvfsresult);
+
+ if (GNOME_VFS_OK!=(errvfsresult=captive_file_write(captive_file_object,buf,size,&bytes_written)))
+ return -gnomevfsresult_to_errno(errvfsresult);
+
+ return bytes_written;
+}
--- /dev/null
+/* $Id$
+ * Include file for client fuse interface operation "write" for libcaptive
+ * Copyright (C) 2005 Jan Kratochvil <project-captive@jankratochvil.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; exactly version 2 of June 1991 is required
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#ifndef _CAPTIVE_CLIENT_FUSE_OP_WRITE_H
+#define _CAPTIVE_CLIENT_FUSE_OP_WRITE_H 1
+
+
+#include <fuse.h>
+
+
+int op_write(const char *path,const char *buf,size_t size,off_t off,struct fuse_file_info *fi);
+
+
+#endif /* _CAPTIVE_CLIENT_FUSE_OP_WRITE_H */