- It is the expected common filesystem default.
- Overridable by LUFS: fmode=666,dmode=777 or fmode
+LUFS mount option 'private' to get the former 0600/0700 mode.
#include "captivefs-attr.h" /* self */
#include <glib/gmessages.h>
#include <time.h>
+#include "captivefs-vfs.h"
-gboolean captivefs_GnomeVFSFileInfo_to_lufs_fattr(struct lufs_fattr *fattr,const GnomeVFSFileInfo *file_info)
+gboolean captivefs_GnomeVFSFileInfo_to_lufs_fattr
+ (struct captivefs_vfs *captivefs_vfs,struct lufs_fattr *fattr,const GnomeVFSFileInfo *file_info)
{
+ g_return_val_if_fail(captivefs_vfs_validate(captivefs_vfs),FALSE);
g_return_val_if_fail(fattr!=NULL,FALSE);
g_return_val_if_fail(file_info!=NULL,FALSE);
if (file_info->valid_fields&GNOME_VFS_FILE_INFO_FIELDS_TYPE)
switch (file_info->type) {
- case GNOME_VFS_FILE_TYPE_REGULAR: fattr->f_mode|=S_IFREG; break;
- case GNOME_VFS_FILE_TYPE_DIRECTORY: fattr->f_mode|=S_IFDIR; break;
+ case GNOME_VFS_FILE_TYPE_REGULAR:
+ fattr->f_mode|=S_IFREG;
+ /* 'fmode' kernel LUFS option only |= to our reported 'f_mode': */
+ if (!captivefs_vfs->private)
+ fattr->f_mode|=0444;
+ break;
+ case GNOME_VFS_FILE_TYPE_DIRECTORY:
+ fattr->f_mode|=S_IFDIR;
+ /* 'dmode' kernel LUFS option only |= to our reported 'f_mode': */
+ if (!captivefs_vfs->private)
+ fattr->f_mode|=0555;
+ break;
default:
g_warning("Unknown GnomeVFSFileInfo.type=%d of: %s",(int)file_info->type,file_info->name);
return FALSE;
#include <glib/gtypes.h>
#include <libgnomevfs/gnome-vfs-file-info.h>
+#include "captivefs-vfs.h"
#include <lufs/proto.h>
G_BEGIN_DECLS
-gboolean captivefs_GnomeVFSFileInfo_to_lufs_fattr(struct lufs_fattr *fattr,const GnomeVFSFileInfo *file_info);
+gboolean captivefs_GnomeVFSFileInfo_to_lufs_fattr
+ (struct captivefs_vfs *captivefs_vfs,struct lufs_fattr *fattr,const GnomeVFSFileInfo *file_info);
gboolean captivefs_lufs_fattr_to_GnomeVFSFileInfo(GnomeVFSFileInfo *file_info,const struct lufs_fattr *fattr);
G_END_DECLS
file_info.valid_fields=GNOME_VFS_FILE_INFO_FIELDS_TYPE;
file_info.type=GNOME_VFS_FILE_TYPE_DIRECTORY;
- if (!captivefs_GnomeVFSFileInfo_to_lufs_fattr(&fattr,&file_info))
+ if (!captivefs_GnomeVFSFileInfo_to_lufs_fattr(captivefs_vfs,&fattr,&file_info))
goto fail_unref;
for (csp=dots;*csp;csp++)
if (0>lu_cache_add2dir(ddir,(/* de-const */ char *)*csp,NULL,&fattr)) {
if (errvfsresult!=GNOME_VFS_OK)
goto fail_unref;
- if (!captivefs_GnomeVFSFileInfo_to_lufs_fattr(&fattr,&file_info))
+ if (!captivefs_GnomeVFSFileInfo_to_lufs_fattr(captivefs_vfs,&fattr,&file_info))
goto fail_unref;
if (0>lu_cache_add2dir(ddir,file_info.name,NULL,&fattr)) {
if (errvfsresult!=GNOME_VFS_OK)
return -1;
- if (!captivefs_GnomeVFSFileInfo_to_lufs_fattr(fattr,&file_info))
+ if (!captivefs_GnomeVFSFileInfo_to_lufs_fattr(captivefs_vfs,fattr,&file_info))
return -1;
return 0;
captive_new(captivefs_vfs);
captivefs_vfs->captive_vfs_object=NULL;
+ captivefs_vfs->private=FALSE;
captivefs_vfs->parent_pid=getpid();
captivefs_vfs->global_ctx=global_ctx;
*global_ctx=captivefs_vfs;
captive_options_string)) /* captive_args */
goto fail_free_options;
}
+ if (lu_opt_getchar(cfg,"MOUNT","private"))
+ captivefs_vfs->private=TRUE;
if (captivefs_vfs->options.debug_messages)
g_log(G_LOG_DOMAIN,G_LOG_LEVEL_DEBUG,"captivefs_init");
struct captivefs_vfs {
CaptiveVfsObject *captive_vfs_object;
struct captive_options options;
+ gboolean private;
pid_t parent_pid;
struct captivefs_vfs **global_ctx;
gint inits,mounts;
This is the only option is interpreted by B<mount.@PACKAGE@> itself; it is not
B<lufs-@PACKAGE@fs>(7) nor B<lufsd>(1) option.
-=item B<uid>=B<500>
-
-Supply the B<UID> to be the user identification number owning all the files.
+=item B<private>
-=item B<gid>=B<500>
-
-Supply the B<GID> to be the group identification number owning all the files.
+B<mount.captive>(8) defaults to filesystem files B<644> - read-write for system
+root (or the regular user owner) and read-only for others. You can force the
+mode B<600> by this option (read-write for the owner, inaccessible for others).
+Mode B<755> or <700> applies to directories. Options B<fmask>/B<dmask> will
+be OR-ed to the private/public permissions set by this option.
=item B<fmask>=B<666>
Octal mask to be OR-ed on directory permissions (minimum directory
permissions).
+=item B<uid>=B<500>
+
+Supply the B<UID> to be the user identification number owning all the files.
+
+=item B<gid>=B<500>
+
+Supply the B<GID> to be the group identification number owning all the files.
+
=back
=back