aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2023-04-24 12:06:17 +0100
committerRichard Henderson <richard.henderson@linaro.org>2023-04-24 12:06:17 +0100
commit81072abf1575b11226b3779af76dc71dfa85ee5d (patch)
tree4efcc1b56ba1b230f957ca4a8e3e54ed0d5199aa /util
parent327ec8d6c2a2223b78d311153a471036e474c5c5 (diff)
parentb02c7fc9ef447787414e6fa67eff75e7b7b30180 (diff)
downloadqemu-81072abf1575b11226b3779af76dc71dfa85ee5d.zip
qemu-81072abf1575b11226b3779af76dc71dfa85ee5d.tar.gz
qemu-81072abf1575b11226b3779af76dc71dfa85ee5d.tar.bz2
Merge tag 'migration-20230420-pull-request' of https://gitlab.com/juan.quintela/qemu into staging
Migration Pull request (take 2) Remove the two atomic patches that broke mips32. Please, apply. # -----BEGIN PGP SIGNATURE----- # # iQIzBAABCAAdFiEEGJn/jt6/WMzuA0uC9IfvGFhy1yMFAmRGYTkACgkQ9IfvGFhy # 1yMD5RAApL8bJTMpmkZ8afxG124/CID7fvg/WMp3vOTG/6923XZHfosUwqrCCvzN # 8qfSfOl4P5Gtv1dOU+ZBcgoFS3tj00Ud2YhcZiSVUy5LZPJNJEfv4YzIErDTJq3I # wcv/CgHvK1CKJ5DZ1g9hqnRvw9qYiodDEHS7UxvhGzckFExHps2oWt9nDuEZefKV # XptOX7YDFYmWE87fp8+rQMYGZEN/6Cc7p4HmSt9I11CgLbeaqTpmKuwTv89PU9qV # 7/X9kfoHNsKsVKw5WosEdRvEqhVQbvcCCxq+TGpeQz6d5U2mY7RVxQSNJxXNdD3P # uz7uannx+UhESgzf5GnwOMIcxWD6UMAcDt349IAWFbq5d1QGaXJ9fVVHVJDV1Irl # XHqxkugNMxRVZ8hQy5gSE6UTpeIjkIpSoZGnGS7E/iLMZHZBgv7s5VK21mYxn/QF # F9g3Ewo2lF+kpQ/ZEnQ9mFyCYtqOHOAOLAUa7/6WdGnUMuqQ47Fh+jbb+KdEyCLg # l7yXk2gXAb8SN6957Tlvo9okOB4NzhDPDXgvewAG/1yW4zL9hA+YCMvEvy90N8Be # rRKO7H9YlsW4wKjA//i2YNAbtaZN5+zeAS39m0exYmXA54AMufjWq/a7Ya/ix5Jo # 452LEz5hA4ckXXtP715pKQjqafxWXbHSS1qw9LBfMYr5TEEWC6c= # =JTxg # -----END PGP SIGNATURE----- # gpg: Signature made Mon 24 Apr 2023 12:00:09 PM BST # gpg: using RSA key 1899FF8EDEBF58CCEE034B82F487EF185872D723 # gpg: Good signature from "Juan Quintela <quintela@redhat.com>" [undefined] # gpg: aka "Juan Quintela <quintela@trasno.org>" [undefined] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 1899 FF8E DEBF 58CC EE03 4B82 F487 EF18 5872 D723 * tag 'migration-20230420-pull-request' of https://gitlab.com/juan.quintela/qemu: migration: Pass migrate_caps_check() the old and new caps migration: rename enabled_capabilities to capabilities migration/postcopy: Detect file system on dest host vl.c: Create late backends before migration object util/mmap-alloc: qemu_fd_getfs() migration: Handle block device inactivation failures better migration: Rename normal to normal_pages migration: Rename duplicate to zero_pages migration: Make postcopy_requests atomic migration: Make dirty_sync_count atomic migration: Make downtime_bytes atomic migration: Make precopy_bytes atomic migration: Make dirty_sync_missed_zero_copy atomic migration: Make multifd_bytes atomic migration: Update atomic stats out of the mutex migration: Merge ram_counters and ram_atomic_counters migration: remove extra whitespace character for code style Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'util')
-rw-r--r--util/mmap-alloc.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c
index 5ed7d29..ed14f9c 100644
--- a/util/mmap-alloc.c
+++ b/util/mmap-alloc.c
@@ -27,8 +27,36 @@
#ifdef CONFIG_LINUX
#include <sys/vfs.h>
+#include <linux/magic.h>
#endif
+QemuFsType qemu_fd_getfs(int fd)
+{
+#ifdef CONFIG_LINUX
+ struct statfs fs;
+ int ret;
+
+ if (fd < 0) {
+ return QEMU_FS_TYPE_UNKNOWN;
+ }
+
+ do {
+ ret = fstatfs(fd, &fs);
+ } while (ret != 0 && errno == EINTR);
+
+ switch (fs.f_type) {
+ case TMPFS_MAGIC:
+ return QEMU_FS_TYPE_TMPFS;
+ case HUGETLBFS_MAGIC:
+ return QEMU_FS_TYPE_HUGETLBFS;
+ default:
+ return QEMU_FS_TYPE_UNKNOWN;
+ }
+#else
+ return QEMU_FS_TYPE_UNKNOWN;
+#endif
+}
+
size_t qemu_fd_getpagesize(int fd)
{
#ifdef CONFIG_LINUX