On Tue, Nov 10, 2015 at 02:06:30PM +0300, Maxim Perevedentsev wrote: > I've rewritten this script in C, and it works just as expected. > The only problem is that for unmount, we cannot reuse the same > handle, and have to call guestunmount. > > There's a dim place: > what is the difference between guestunmount and guestfs_umount_local? > As I understood, guestunmount does [not] need guestfs handle, launch etc. > Does umount_local need it? > If yes, how should this command be used (assumed that the handle is > already used in mount_local_run)? > > These questions confuse me a little :-s
guestfs_umount_local just calls guestunmount, so they're the same thing: https://github.com/libguestfs/libguestfs/blob/master/src/fuse.c#L1103 Also as you can see from the implementation, guestfs_umount_local doesn't really use the guestfs_h *g handle -- it only uses it to find the mountpoint (so it can run guestunmount /mountpoint) and for a bit of bookkeeping: creating the 'cmd' object and error messages. We have an example program: https://github.com/libguestfs/libguestfs/blob/master/examples/mount-local.c Also an example of using mount-local with threads (which I don't recommend - I see lots of deadlocks under load which I don't think have anything to do with libguestfs): https://github.com/libguestfs/libguestfs/blob/master/tests/mount-local/test-parallel-mount-local.c I found that pthreads + FUSE is a minefield. It's easy to end up with a forgotten file descriptor which makes the mountpoint busy and unmountable, or get deadlocks. Better to use fork()-parallelism instead. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top _______________________________________________ Libguestfs mailing list [email protected] https://www.redhat.com/mailman/listinfo/libguestfs
