- 14 12月, 2018 1 次提交
-
-
由 Daniel P. Berrangé 提交于
This introduces a syntax-check script that validates header files use a common layout: /* ...copyright header... */ <one blank line> #ifndef SYMBOL # define SYMBOL ....content.... #endif /* SYMBOL */ For any file ending priv.h, before the #ifndef, we will require a guard to prevent bogus imports: #ifndef SYMBOL_ALLOW # error .... #endif /* SYMBOL_ALLOW */ <one blank line> The many mistakes this script identifies are then fixed. Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
-
- 20 9月, 2018 1 次提交
-
-
由 Erik Skultety 提交于
It doesn't really make sense for us to have stdlib.h and string.h but not stdio.h in the internal.h header. Signed-off-by: NErik Skultety <eskultet@redhat.com> Acked-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 12 9月, 2018 1 次提交
-
-
由 Shi Lei 提交于
Signed-off-by: NShi Lei <shi_lei@massclouds.com>
-
- 14 7月, 2018 1 次提交
-
-
由 Sukrit Bhatnagar 提交于
Using the new VIR_DEFINE_AUTOPTR_FUNC macro defined in src/util/viralloc.h, define a new wrapper around an existing cleanup function which will be called when a variable declared with VIR_AUTOPTR macro goes out of scope. Also, drop the redundant viralloc.h include, since that has moved from the source module into the header. When a variable of type virFileWrapperFdPtr is declared using VIR_AUTOPTR, the function virFileWrapperFdFree will be run automatically on it when it goes out of scope. Signed-off-by: NSukrit Bhatnagar <skrtbhtngr@gmail.com> Reviewed-by: NErik Skultety <eskultet@redhat.com>
-
- 08 6月, 2018 1 次提交
-
-
由 Martin Kletzander 提交于
We already have virFileLock(), but we are now using flock() in the code as well (due to requirements for mutual exclusion between libvirt and other programs using flock() as well), so let's have a function for that as well so we don't need to have stubs for unsupported platforms in other files. Signed-off-by: NMartin Kletzander <mkletzan@redhat.com> Reviewed-by: NJán Tomko <jtomko@redhat.com>
-
- 07 6月, 2018 1 次提交
-
-
由 Stefan Berger 提交于
The dirent's d_type field is not portable to all platforms. So we have to use stat() to determine the type of file for the functions that need to be cross-platform. Fix virFileChownFiles() by calling the new virFileIsRegular() function. Signed-off-by: NStefan Berger <stefanb@linux.vnet.ibm.com> Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
-
- 06 6月, 2018 1 次提交
-
-
由 Stefan Berger 提交于
Implement virFileChownFiles() which changes file ownership of all files in a given directory. Signed-off-by: NStefan Berger <stefanb@linux.vnet.ibm.com> Reviewed-by: NJohn Ferlan <jferlan@redhat.com> Reviewed-by: NJán Tomko <jtomko@redhat.com>
-
- 07 5月, 2018 1 次提交
-
-
由 Peter Krempa 提交于
Add detection mechanism which will allow to check whether a path to a block device is a physical CDROM drive. This will be useful once we will need to pass it to hypervisors. The linux implementation uses an ioctl to do the detection, while the fallback uses a simple string prefix match. Signed-off-by: NPeter Krempa <pkrempa@redhat.com> Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
-
- 04 5月, 2018 1 次提交
-
-
由 Andrea Bolognani 提交于
It's a trivial wrapper around canonicalize_file_name(), which we need in order to fully mock file access on non-Linux platforms. Signed-off-by: NAndrea Bolognani <abologna@redhat.com> Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
-
- 04 1月, 2018 1 次提交
-
-
由 Paolo Bonzini 提交于
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com> Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
-
- 03 11月, 2017 1 次提交
-
-
由 Andrea Bolognani 提交于
Right-aligning backslashes when defining macros or using complex commands in Makefiles looks cute, but as soon as any changes is required to the code you end up with either distractingly broken alignment or unnecessarily big diffs where most of the changes are just pushing all backslashes a few characters to one side. Generated using $ git grep -El '[[:blank:]][[:blank:]]\\$' | \ grep -E '*\.([chx]|am|mk)$$' | \ while read f; do \ sed -Ei 's/[[:blank:]]*[[:blank:]]\\$/ \\/g' "$f"; \ done Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
-
- 19 10月, 2017 1 次提交
-
-
由 Erik Skultety 提交于
Since we have a number of places where we workaround timing issues with devices, attributes (files in general) not being available at the time of processing them by calling usleep in a loop for a fixed number of tries, we could as well have a utility function that would do that. Therefore we won't have to duplicate this ugly workaround even more. Signed-off-by: NErik Skultety <eskultet@redhat.com>
-
- 27 9月, 2017 1 次提交
-
-
由 Ján Tomko 提交于
Introduce a new function virFileAllocate that will call the non-destructive variants of safezero, essentially reverting my commit 1390c268 safezero: fall back to writing zeroes even when resizing back to the state as of commit 18f03166 virstoragefile: Have virStorageFileResize use safezero This means that _ALLOCATE flag will no longer work on platforms without the allocate syscalls, but it will not overwrite data either.
-
- 13 7月, 2017 1 次提交
-
-
由 Daniel P. Berrange 提交于
This reverts commit e4b980c8. When a binary links against a .a archive (as opposed to a shared library), any symbols which are marked as 'weak' get silently dropped. As a result when the binary later runs, those 'weak' functions have an address of 0x0 and thus crash when run. This happened with virtlogd and virtlockd because they don't link to libvirt.so, but instead just libvirt_util.a and libvirt_rpc.a. The virRandomBits symbols was weak and so left out of the virtlogd & virtlockd binaries, despite being required by virHashTable functions. Various other binaries like libvirt_lxc, libvirt_iohelper, etc also link directly to .a files instead of libvirt.so, so are potentially at risk of dropping symbols leading to a later runtime crash. This is normal linker behaviour because a weak symbol is not treated as undefined, so nothing forces it to be pulled in from the .a You have to force the linker to pull in weak symbols using -u$SYMNAME which is not a practical approach. This risk is silent bad linkage that affects runtime behaviour is not acceptable for a fix that was merely trying to fix the test suite. So stop using __weak__ again. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 11 7月, 2017 1 次提交
-
-
由 Daniel P. Berrange 提交于
Currently all mockable functions are annotated with the 'noinline' attribute. This is insufficient to guarantee that a function can be reliably mocked with an LD_PRELOAD. The C language spec allows the compiler to assume there is only a single implementation of each function. It can thus do things like propagating constant return values into the caller at compile time, or creating multiple specialized copies of the function body each optimized for a different caller. To prevent these optimizations we must also set the 'noclone' and 'weak' attributes. This fixes the test suite when libvirt.so is built with CLang with optimization enabled. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 18 5月, 2017 1 次提交
-
-
由 Michal Privoznik 提交于
This function takes a FD and determines whether the current position is in data section or in a hole. In addition to that, it also determines how much bytes are there remaining till the current section ends. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 09 5月, 2017 1 次提交
-
-
由 Martin Kletzander 提交于
It is no longer needed thanks to the great virfilewrapper.c. And this way we don't have to add a new set of functions for each prefixed path. While on that, add two functions that weren't there before, string and scaled integer reading ones. Also increase the length of the string being read by one to accompany for the optional newline at the end (i.e. change INT_STRLEN_BOUND to INT_BUFSIZE_BOUND). Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
-
- 19 4月, 2017 1 次提交
-
-
由 Daniel P. Berrange 提交于
CLang's optimizer is more aggressive at inlining functions than gcc and so will often inline functions that our tests want to mock-override. This causes the test to fail in bizarre ways. We don't want to disable inlining completely, but we must at least prevent inlining of mocked functions. Fortunately there is a 'noinline' attribute that lets us control this per function. A syntax check rule is added that parses tests/*mock.c to extract the list of functions that are mocked (restricted to names starting with 'vir' prefix). It then checks that src/*.h header file to ensure it has a 'ATTRIBUTE_NOINLINE' annotation. This should prevent use from bit-rotting in future. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 27 3月, 2017 1 次提交
-
-
由 Martin Kletzander 提交于
These helpers are doing just a read and covert the value, but they properly size the read limit, handle additional whitespace characters, and unify error reporting. Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
-
- 16 3月, 2017 1 次提交
-
-
由 John Ferlan 提交于
The function is actually in virutil.c, but prototyped in virfile.h. This patch fixes that by renaming the function to virWaitForDevices, adding the prototype in virutil.h and libvirt_private.syms, and then changing the callers to use the new name. Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
-
- 11 2月, 2017 1 次提交
-
-
由 Erik Skultety 提交于
So rather than comparing 2 paths (strings) as they are, which can very easily lead to unnecessary errors (e.g. in storage driver) that the paths are not the same when in fact they'd be e.g. just symlinks to the same location, we should put our best effort into resolving any symlinks and canonicalizing the path and only then compare the 2 paths for equality. Signed-off-by: NErik Skultety <eskultet@redhat.com>
-
- 07 2月, 2017 1 次提交
-
-
由 Michal Privoznik 提交于
We will need to traverse the symlinks one step at the time. Therefore we need to see where a symlink is pointing to. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 12 1月, 2017 1 次提交
-
-
由 Michal Privoznik 提交于
This is a simple wrapper over mount(). However, not every system out there is capable of moving a mount point. Therefore, instead of having to deal with this fact in all the places of our code we can have a simple wrapper and deal with this fact at just one place. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 15 12月, 2016 2 次提交
-
-
由 Michal Privoznik 提交于
Namely, virFileGetACLs, virFileSetACLs, virFileFreeACLs and virFileCopyACLs. These functions are going to be required when we are creating /dev for qemu. We have copy anything that's in host's /dev exactly as is. Including ACLs. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
由 Michal Privoznik 提交于
This part of code that LXC currently uses will be reused so move to a generic function. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 06 12月, 2016 1 次提交
-
-
由 Michal Privoznik 提交于
There are couple of places where we have a string and want to save it to a file. Atomically. In all those places we use virFileRewrite() but also implement the very same callback which takes the string and write it into temp file. This makes no sense. Unify the callbacks and move them to one place. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 01 12月, 2016 1 次提交
-
-
由 Laine Stump 提交于
This new function just calls fstat() (if provided with a valid fd) or stat() (if fd is -1) and returns st_size (or -1 if there is an error). We may decide we want this function to be more complex, and handle things like block devices - this is a placeholder (that works) for any more complicated function.
-
- 24 6月, 2016 4 次提交
-
-
由 Ján Tomko 提交于
A helper function that does not report any errors.
-
由 Ján Tomko 提交于
Just like virDirOpen, but it returns 0 without reporting an error on ENOENT.
-
由 Ján Tomko 提交于
A helper that calls opendir and reports an error if it fails.
-
由 Ján Tomko 提交于
Introduce a helper that only calls closedir if DIR* is non-NULL and sets it to NULL afterwards.
-
- 13 5月, 2016 1 次提交
-
-
由 Michal Privoznik 提交于
Move some parts of virStorageFileRemoveLastPathComponent into a separate function so they can be reused. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 03 5月, 2016 1 次提交
-
-
由 Nikolay Shirokovskiy 提交于
Signed-off-by: NNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
-
- 21 9月, 2015 1 次提交
-
-
由 John Ferlan 提交于
Similar to commit id '35847860', it's possible to attempt to create a 'netfs' directory in an NFS root-squash environment which will cause the 'vol-delete' command to fail. It's also possible error paths from the 'vol-create' would result in an error to remove a created directory if the permissions were incorrect (and disallowed root access). Thus rename the virFileUnlink to be virFileRemove to match the C API functionality, adjust the code to following using rmdir or unlink depending on the path type, and then use/call it for the VIR_STORAGE_VOL_DIR
-
- 02 9月, 2015 1 次提交
-
-
由 John Ferlan 提交于
In an NFS root-squashed environment the 'vol-delete' command will fail to 'unlink' the target volume since it was created under a different uid:gid. This code continues the concepts introduced in virFileOpenForked and virDirCreate[NoFork] with respect to running the unlink command under the uid/gid of the child. Unlike the other two, don't retry on EACCES (that's why we're here doing this now).
-
- 20 5月, 2015 1 次提交
-
-
由 Cole Robinson 提交于
The only two virDirCreate callers already use it
-
- 09 1月, 2015 1 次提交
-
-
由 Ján Tomko 提交于
Remove the resize flag and use the same code path for all callers. This flag was added by commit 18f03166 to allow virStorageFileResize use 'safezero' while preserving the behavior. Explicitly return -2 when a fallback to a different method should be done, to make the code path more obvious. Fail immediately when ftruncate fails in the mmap method, as we did before commit 18f03166.
-
- 17 12月, 2014 1 次提交
-
-
由 John Ferlan 提交于
Currently virStorageFileResize() function uses build conditionals to choose either the posix_fallocate() or syscall(SYS_fallocate) with no fallback in order to preallocate the space in the newly resized file. Since the safezero code has a similar set of conditionals modify the resize and safezero code in order to allow the resize logic to make use of safezero to unify the look/feel of the code paths. Add a new boolean (resize) to safezero() to make the optional decision whether to try syscall(SYS_fallocate) if the posix_fallocate fails because HAVE_POSIX_FALLOCATE is not defined (eg, return -1 and errno == 0). Create a local safezero_sys_fallocate in order to handle the resize code paths that support that. If not present, the set errno = ENOSYS in order to allow the caller to handle the failure scenarios. Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
-
- 29 7月, 2014 1 次提交
-
-
由 Michal Privoznik 提交于
This should iterate over mount tab and search for hugetlbfs among with looking for the default value of huge pages. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 01 7月, 2014 1 次提交
-
-
由 Ján Tomko 提交于
Just like virFileReadAll, but returns -errno instead of reporting errors. Useful for ignoring some errors.
-