| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
doesn't support chown (RHBZ#840572).
When using tar-in or tools built around it such as virt-make-fs, if
the target filesystem is vfat then unpacking the tarball would fail
because tar tries to chown(2) files and fails.
You would see errors such as:
tar: <file>: Cannot change ownership to uid 500, gid 500: Operation not permitted
This change detects whether the target filesystem supports chown(2).
If not, it adds the --no-same-owner flag to tar to stop it from trying
to change the ownership of newly created files.
(cherry picked from commit 50780a84f65ec5d76605691cea889392c2730f54)
|
|
|
|
|
|
| |
This is mostly code motion, although the precise contract of this
function changes slightly to make it more generally useful
(cherry picked from commit 781857a86b3bc8238995a9212ea09aa368fc2fc9)
|
|
|
|
|
|
|
| |
Just make gcc happy.
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
(cherry picked from commit 2f89f584c0203023f8a829ff9796dc2c14ddeb68)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
case_sensitive_path is undefined when the final path element doesn't
exist. Currently it returns an error, but this means that creating a
new file doesn't work as expected:
$ guestfish --rw -i -d windows touch 'win:c:\blah'
libguestfs: error: case_sensitive_path: blah no file or directory found with this name
We should allow this case (provided there is no trailing slash) so
that new files or directories can be created.
(cherry picked from commit 973581780d8a006f336684fef6762801402d775d)
|
|
|
|
|
| |
This is just code motion.
(cherry picked from commit ac0373bdecfabe6acf99d3662e5117de73fa2aef)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On Linux, sync(2) does not actually issue a write barrier, thus it
doesn't force a flush of the underlying hardware write cache (or
qemu's disk cache in the virtual case).
This can be a problem, because libguestfs relies on running sync in
the appliance, followed by killing qemu (using SIGTERM).
In most cases, this is fine, because killing qemu with SIGTERM should
cause it to flush out the disk cache before it exits. However we have
found various bugs in qemu which cause qemu to crash while doing the
flush, leaving the data unwritten (see RHBZ#836913).
The solution is to issue fsync(2) to the block devices. This has a
write barrier, so it ensures that qemu writes out its cache long
before we get around to killing qemu.
(cherry picked from commit c0a3c9ce70b98171e737e49e6dccc4457963f2ec)
|
|
|
|
|
| |
No functional change.
(cherry picked from commit cb24ceedd8a8ef7da71cfcce6db10669de47685c)
|
|
|
|
|
|
|
|
| |
This returns the number of whole block devices added. It is usually
simpler to call this than to list the devices and count them, which
is what we do in some places in the current codebase.
(cherry picked from commit 152b179a19e43fcb0baec65ea65d394ee1dba891)
|
|
|
|
|
|
|
|
| |
This returns the index of the device, eg. /dev/sdb => 1.
Or you can think of it as the order that the device was
added, or the index of the device in guestfs_list_devices.
(cherry picked from commit a9d7d044f552855a7ef78d953c0c2672e35bfc80)
|
|
|
|
|
|
|
|
|
| |
The original fix for this in
commit 511c82df46f5c6f4a7f984fdb81d4691038ed6da was not complete, in
that it did not fix the case of the old (pre '-m' option) parted.
This doesn't matter for Fedora, but it matters for RHEL 5 which has
this ancient parted.
(cherry picked from commit 4d3ec25b47361601604e2f585178393e60f4cd4d)
|
|
|
|
|
| |
Thanks Alasdair Kergon.
(cherry picked from commit 998ebc333dbfe40c5953e36fb42f9610727a7532)
|
|
|
|
|
|
| |
Sort the device names correctly, not just treating them as
strings. As a result, /dev/sdz < /dev/sdaa.
(cherry picked from commit c0a087b8236755e95371d5c352c9d29a3ca992c0)
|
|
|
|
|
|
|
|
|
|
|
| |
Apparently e2fsprogs only knows that "/dev/sda" is a whole device, but
doesn't think that "/dev/vda" is. On switching the default device
over to virtio-scsi, that causes mke2fs without -F option to complain
and ask for an interactive prompt. Adding -F forces it to go ahead
anyway.
This caused several less-used APIs to break with virtio-scsi.
(cherry picked from commit 62c5b6db58911a5e51f59965619355437b7a7214)
|
|
|
|
| |
(cherry picked from commit ee9ab52bc3e087f63dcc51d3b6ac5c79277425e1)
|
|
|
|
|
|
|
|
|
| |
Add the new API btrfs-fsck to check the btrfs filesystem.
Btrfs is currently under heavy development, and not suitable for
any uses other than benchmarking and review. But it'll be useful
in the near future.
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
|
|
|
|
|
|
| |
Change the return value from "r" to "0".
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
|
|
|
|
|
|
|
|
|
| |
I used scsi_debug to create a 4k sector virtual disk:
modprobe scsi_debug dev_size_mb=128 sector_size=4096
I then used 'gdisk' to create lots of partitions, and used 'hexdump'
to examine what was written to disk.
|
|
|
|
|
|
|
| |
Add the new API btrfs-set-seeding to support the seeding-device
feature for btrfs.
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
|
|
|
|
|
|
| |
reasonable (RHBZ#816839).
Thanks Yuyu Zhou.
|
|
|
|
| |
This fixes commit 87ea7a04094d5ed40f3f047ff2b7a613d4d530d4.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bind the easy parts of the 'btrfs' program.
The new APIs are:
btrfs-device-add: add devices to a btrfs filesystem
btrfs-device-delete: remove devices from a btrfs filesystem
btrfs-filesystem-sync: sync a btrfs filesystem
btrfs-filesystem-balance: balance a btrfs filesystem
btrfs-subvolume-create: create a btrfs snapshot
btrfs-subvolume-delete: delete a btrfs snapshot
btrfs-subvolume-list: list btrfs snapshots and subvolumes
btrfs-subvolume-set-default: set default btrfs subvolume
btrfs-subvolume-snapshot: create a writable btrfs snapshot
|
|
|
|
|
|
|
| |
btrfs filesystems can span multiple filesystems.
Note this changes the API, but this API has not yet been released in a
stable version of libguestfs.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new APIs are:
get-e2attrs: List ext2 file attributes of a file.
set-e2attrs: Set or clear ext2 file attributes of a file.
get-e2generation: Get ext2 file generation of a file.
set-e2generation: Set ext2 file generation of a file.
These are implemented using the lsattr and chattr programs from
e2fsprogs.
|
|
|
|
| |
This allows all parameters from btrfs to be accessed.
|
| |
|
|
|
|
|
| |
This returns information about the underlying devices of an MD
(software RAID) device.
|
|
|
|
|
|
| |
This function allows you to pass an explicit errno back to the
library. reply_with_error is redefined as a macro that calls
reply_with_error_errno with errno == 0.
|
| |
|
|
|
|
|
| |
Get ISO primary volume descriptor information for either ISO devices
or ISO files.
|
|
|
|
|
| |
split_lines already sets reply_with_*, so calling it again would lose
protocol synchronization.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add an API for doing what virt-sparsify was doing: freeing up free
space in a filesystem.
The current implementation is simple-minded: we create a file, fill it
with zeroes until we run out of space, then delete the file. However
the description leaves it open to do a better implementation, eg.
using sparsification support that is currently being worked on in ext4
and qemu.
The implementation also sends progress notifications, which is an
advantage over the old 'dd' method.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The presumption is that all file descriptors should be created with
the close-on-exec flag set. The only exception are file descriptors
that we want passed through to exec'd subprocesses (mainly pipes and
stdin/stdout/stderr).
For open calls, we pass O_CLOEXEC as an extra flag, eg:
fd = open ("foo", O_RDONLY|O_CLOEXEC);
This is a Linux-ism, but using a macro we can easily make it portable.
For sockets, similarly:
sock = socket (..., SOCK_STREAM|SOCK_CLOEXEC, ...);
For accepted sockets, we use the Linux accept4 system call which
allows flags to be supplied, but we use the Gnulib 'accept4' module to
make this portable.
For dup, dup2, we use the Linux dup3 system call, and the Gnulib
modules 'dup3' and 'cloexec'.
|
|
|
|
| |
Useful for debugging.
|
|
|
|
| |
This fixes commit d1711dae9dbd7f516469f88807604894c1304228.
|
|
|
|
|
| |
Analyze all uses of 'int' in the code, and replace with 'size_t' where
appropriate.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously a lot of daemon code used three variables (a string list,
'int size' and 'int alloc') to track growable strings buffers. This
commit implements a simple struct containing the same variables, but
using size_t instead of int:
struct stringsbuf {
char **argv;
size_t size;
size_t alloc;
};
Use it like this:
DECLARE_STRINGSBUF (ret);
//...
if (add_string (&ret, str) == -1)
return NULL;
//...
if (end_stringsbuf (&ret) == -1)
return NULL;
return ret.argv;
|
| |
|
| |
|
| |
|
|
|
|
| |
This reverts commit 0eaf06e673833bc25673d5c3d2487fffae310285.
|
|
|
|
|
|
|
|
|
| |
Error: UNINIT:
/builddir/build/BUILD/libguestfs-1.16.5/daemon/glob.c:32: var_decl: Declaring variable "buf" without initializer.
/builddir/build/BUILD/libguestfs-1.16.5/daemon/glob.c:36: uninit_use_in_call: Using uninitialized value "buf.gl_offs" when calling "rpl_glob".
/builddir/build/BUILD/libguestfs-1.16.5/gnulib/lib/glob.c:557: read_parm_fld: Reading a parameter field.
/builddir/build/BUILD/libguestfs-1.16.5/daemon/glob.c:36: uninit_use_in_call: Using uninitialized value "buf.gl_pathc" when calling "rpl_glob".
/builddir/build/BUILD/libguestfs-1.16.5/gnulib/lib/glob.c:557: read_parm_fld: Reading a parameter field.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The Coverity error is this (which I think is wrong):
Error: TAINTED_SCALAR:
/builddir/build/BUILD/libguestfs-1.16.5/daemon/inotify.c:211: tainted_data_argument: Calling function "read" taints argument "inotify_buf".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/inotify.c:232: var_assign_var: Assigning: "event" = "(struct inotify_event *)&inotify_buf[n]". Both are now tainted.
/builddir/build/BUILD/libguestfs-1.16.5/daemon/inotify.c:258: lower_bounds: Checking lower bounds of unsigned scalar "event->len" by "event->len > 0U".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/inotify.c:272: var_assign_var: Compound assignment involving tainted variable "16UL + event->len" to variable "n" taints "n".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/inotify.c:228: lower_bounds: Checking lower bounds of unsigned scalar "n" by "n < inotify_posn".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/inotify.c:281: tainted_data: Using tainted variable "n" as an index into an array "inotify_buf".
Adding a sanity check of event->len is prudent.
|
|
|
|
|
|
|
|
| |
Error: RESOURCE_LEAK:
/builddir/build/BUILD/libguestfs-1.16.5/daemon/debug.c:469: open_fn: Calling opening function "open".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/debug.c:469: var_assign: Assigning: "fd" = handle returned from "open("/proc/sys/kernel/core_pattern", 1)".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/debug.c:474: noescape: Variable "fd" is not closed or saved in function "write".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/debug.c:476: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
|
|
|
|
|
|
|
|
| |
Error: RESOURCE_LEAK:
/builddir/build/BUILD/libguestfs-1.16.5/daemon/upload.c:225: open_fn: Calling opening function "open".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/upload.c:225: var_assign: Assigning: "fd" = handle returned from "open(filename, 0)".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/upload.c:233: noescape: Variable "fd" is not closed or saved in function "lseek".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/upload.c:235: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
|
|
|
|
|
|
|
|
|
| |
Error: RESOURCE_LEAK:
/builddir/build/BUILD/libguestfs-1.16.5/daemon/9p.c:130: open_fn: Calling opening function "open".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/9p.c:130: var_assign: Assigning: "fd" = handle returned from "open(filename, 0)".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/9p.c:142: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
/builddir/build/BUILD/libguestfs-1.16.5/daemon/9p.c:149: noescape: Variable "fd" is not closed or saved in function "read".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/9p.c:153: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
|
|
|
|
|
|
| |
Currently only ext2/3/4 and (newly) NTFS are supported.
This change also deprecates set-e2label.
|
| |
|