X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=fuse%2Fguestmount.c;h=e1cb2d89e2a45ca390f9d8d7ff6f4414fbcba6e5;hb=74958b0ad44df6ed703cd3009983d04ade3a8e93;hp=9f0a39ecbcbe7c8272fa385203ca420b54598b3f;hpb=4d45c45f0928c7791429d351dc69b75167888f7d;p=libguestfs.git diff --git a/fuse/guestmount.c b/fuse/guestmount.c index 9f0a39e..e1cb2d8 100644 --- a/fuse/guestmount.c +++ b/fuse/guestmount.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -652,7 +653,17 @@ fg_write (const char *path, const char *buf, size_t size, dir_cache_invalidate (path); - return -ENOSYS; /* XXX */ + /* See fg_read. */ + const size_t limit = 2 * 1024 * 1024; + if (size > limit) + size = limit; + + int r; + r = guestfs_pwrite (g, path, buf, size, offset); + if (r == -1) + return error (); + + return r; } static int @@ -896,6 +907,10 @@ usage (int status) int main (int argc, char *argv[]) { + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEBASEDIR); + textdomain (PACKAGE); + enum { HELP_OPTION = CHAR_MAX + 1 }; /* The command line arguments are broadly compatible with (a subset @@ -923,7 +938,7 @@ main (int argc, char *argv[]) struct mp *mps = NULL; struct mp *mp; char *p; - int c, i, r; + int c, r; int option_index; struct sigaction sa; @@ -1156,10 +1171,13 @@ mount_mps (struct mp *mp) if (mp) { mount_mps (mp->next); - if (!read_only) - r = guestfs_mount (g, mp->device, mp->mountpoint); - else - r = guestfs_mount_ro (g, mp->device, mp->mountpoint); + + /* Don't use guestfs_mount here because that will default to mount + * options -o sync,noatime. For more information, see guestfs(3) + * section "LIBGUESTFS GOTCHAS". + */ + const char *options = read_only ? "ro" : ""; + r = guestfs_mount_options (g, options, mp->device, mp->mountpoint); if (r == -1) exit (EXIT_FAILURE); }