diff -Naur a/src/pmount-hal.c b/src/pmount-hal.c --- a/src/pmount-hal.c 2009-02-13 01:45:40.000000000 +0300 +++ b/src/pmount-hal.c 2010-08-29 16:33:28.000000000 +0400 @@ -112,7 +112,7 @@ } void exec_pmount( const char* device, const char* fstype, const char* label, - dbus_bool_t sync, dbus_bool_t noatime, dbus_bool_t exec, const char* + dbus_bool_t sync, dbus_bool_t flush, dbus_bool_t noatime, dbus_bool_t exec, const char* umask, const char *fmask, const char *dmask, const char* iocharset, int addargc, const char* const* addargv ) { const char** argv = (const char**) calloc( sizeof( const char* ), addargc+15 ); @@ -129,6 +129,8 @@ if( sync ) argv[argc++] = "--sync"; + if( flush ) + argv[argc++] = "--flush"; if( noatime ) argv[argc++] = "--noatime"; if( exec ) @@ -190,7 +192,7 @@ DBusConnection *dbus_conn; LibHalVolume* volume; LibHalDrive* drive; - dbus_bool_t sync = FALSE, noatime = FALSE, exec = FALSE; + dbus_bool_t sync = FALSE, flush = FALSE, noatime = FALSE, exec = FALSE; char *umask = NULL; char *fmask = NULL; char *dmask = NULL; @@ -344,6 +346,8 @@ noatime = TRUE; else if( !strncmp( s, "sync", 4 ) ) sync = TRUE; + else if( !strncmp( s, "flush", 5 ) ) + flush = TRUE; else if( !strncmp( s, "async", 5 ) ) sync = FALSE; else if( !strncmp( s, "iocharset=", 10) ) { @@ -405,7 +409,7 @@ dbus_connection_unref( dbus_conn ); /* go */ - exec_pmount( device, fstype, label, sync, noatime, exec, umask, fmask, dmask, iocharset, argc-2, argv+2 ); + exec_pmount( device, fstype, label, sync, flush, noatime, exec, umask, fmask, dmask, iocharset, argc-2, argv+2 ); return 0; } diff -Naur a/src/pmount.c b/src/pmount.c --- a/src/pmount.c 2010-05-05 00:22:07.000000000 +0400 +++ b/src/pmount.c 2010-08-28 14:03:28.000000000 +0400 @@ -80,6 +80,7 @@ " -r : force to be mounted read-only\n" " -w : force to be mounted read-write\n" " -s, --sync : mount with the 'sync' option (default: 'async')\n" + " -f, --flush : mount with the 'flush' option\n" " -A, --noatime\n" " mount with the 'noatime' option (default: 'atime')\n" " -e, --exec : mount with the 'exec' option (default: 'noexec')\n" @@ -213,6 +214,7 @@ * @param fsname file system name (mount option -t) * @param async if not 0, the device will be mounted with 'async' (i. e. write * caching) + * @param flush if not 0, the device will be mounted with 'flush' * @param noatime if not 0, the device will be mounted with 'noatime' * @param exec if not 0, the device will be mounted with 'exec' * @param force_write 1 for forced r/w, 0 for forced r/o, -1 for kernel default @@ -227,7 +229,7 @@ */ int do_mount( const char* device, const char* mntpt, const char* fsname, int async, - int noatime, int exec, int force_write, const char* iocharset, + int flush, int noatime, int exec, int force_write, const char* iocharset, int utf8, const char* umask, const char *fmask, const char *dmask, int suppress_errors ) @@ -238,6 +240,7 @@ char fdmask_opt[100]; char iocharset_opt[100]; const char* sync_opt = ",sync"; + const char* flush_opt = ",flush"; const char* atime_opt = ",atime"; const char* exec_opt = ",noexec"; const char* access_opt = NULL; @@ -325,6 +328,9 @@ if( async ) sync_opt = ",async"; + if( flush && ! strcmp(fsname, "vfat") ) + flush_opt = ",flush"; + if( noatime ) atime_opt = ",noatime"; @@ -372,7 +378,7 @@ } snprintf( options, sizeof( options ), "%s%s%s%s%s%s%s%s%s", - fs->options, sync_opt, atime_opt, exec_opt, access_opt, ugid_opt, + fs->options, sync_opt, flush_opt, atime_opt, exec_opt, access_opt, ugid_opt, umask_opt, fdmask_opt, iocharset_opt ); /* go for it */ @@ -400,7 +406,7 @@ * @return last return value of do_mount (i. e. 0 on success, != 0 on error) */ int -do_mount_auto( const char* device, const char* mntpt, int async, +do_mount_auto( const char* device, const char* mntpt, int async, int flush, int noatime, int exec, int force_write, const char* iocharset, int utf8, const char* umask, const char *fmask, const char *dmask ) @@ -422,7 +428,7 @@ debug("blkdid detected ntfs and ntfs-3g was found. Using ntfs-3g\n"); tp = "ntfs-3g"; } - result = do_mount( device, mntpt, tp, async, noatime, exec, + result = do_mount( device, mntpt, tp, async, flush, noatime, exec, force_write, iocharset, utf8, umask, fmask, dmask, nostderr ); if(result == 0) @@ -444,14 +450,14 @@ /* don't suppress stderr if we try the last possible fs */ if( (fs+1)->fsname == NULL ) nostderr = 0; - result = do_mount( device, mntpt, fs->fsname, async, noatime, exec, + result = do_mount( device, mntpt, fs->fsname, async, flush, noatime, exec, force_write, iocharset, utf8, umask, fmask, dmask, nostderr ); if( result == 0 ) break; /* sometimes VFAT fails when using iocharset; try again without */ if( iocharset ) - result = do_mount( device, mntpt, fs->fsname, async, noatime, exec, + result = do_mount( device, mntpt, fs->fsname, async, flush, noatime, exec, force_write, NULL, utf8, umask, fmask, dmask, nostderr ); if( result <= 0 ) break; @@ -615,6 +621,7 @@ const char* fstab_device; int is_real_path = 0; int async = 1; + int flush = 0; int noatime = 0; int exec = 0; int force_write = -1; /* 0: ro, 1: rw, -1: default */ @@ -636,6 +643,7 @@ { "lock", 0, NULL, 'l'}, { "unlock", 0, NULL, 'L'}, { "sync", 0, NULL, 's' }, + { "flush", 0, NULL, 'f' }, { "noatime", 0, NULL, 'A' }, { "exec", 0, NULL, 'e' }, { "type", 1, NULL, 't' }, @@ -692,6 +700,8 @@ case 'L': mode = UNLOCK; break; case 's': async = 0; break; + + case 'f': flush = 1; break; case 'A': noatime = 1; break; @@ -866,10 +876,10 @@ /* off we go */ if( use_fstype ) - result = do_mount( decrypted_device, mntpt, use_fstype, async, noatime, + result = do_mount( decrypted_device, mntpt, use_fstype, async, flush, noatime, exec, force_write, iocharset, utf8, umask, fmask, dmask, 0 ); else - result = do_mount_auto( decrypted_device, mntpt, async, noatime, exec, + result = do_mount_auto( decrypted_device, mntpt, async, flush, noatime, exec, force_write, iocharset, utf8, umask, fmask, dmask ); /* unlock the mount point again */