mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
Added xfs support to vfs_minimum_size.
This commit is contained in:
committed by
Richard W.M. Jones
parent
a4da3f74c9
commit
f5caa421d1
@@ -269,6 +269,7 @@ extern int copy_xattrs (const char *src, const char *dest);
|
||||
extern int xfs_set_uuid (const char *device, const char *uuid);
|
||||
extern int xfs_set_uuid_random (const char *device);
|
||||
extern int xfs_set_label (const char *device, const char *label);
|
||||
extern int64_t xfs_minimum_size (const char *path);
|
||||
|
||||
/*-- debug-bmap.c --*/
|
||||
extern char *debug_bmap (const char *subcmd, size_t argc, char *const *const argv);
|
||||
|
||||
@@ -73,6 +73,13 @@ do_vfs_minimum_size (const mountable_t *mountable)
|
||||
r = btrfs_minimum_size (path);
|
||||
}
|
||||
|
||||
else if (STREQ (vfs_type, "xfs")) {
|
||||
CLEANUP_FREE char *path = get_mount_point (mountable->device);
|
||||
if (path == NULL)
|
||||
return -1;
|
||||
r = xfs_minimum_size (path);
|
||||
}
|
||||
|
||||
else
|
||||
NOT_SUPPORTED (-1, "don't know how to get minimum size of '%s' filesystems",
|
||||
vfs_type);
|
||||
|
||||
16
daemon/xfs.c
16
daemon/xfs.c
@@ -660,3 +660,19 @@ do_xfs_repair (const char *device,
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
int64_t
|
||||
xfs_minimum_size (const char *path)
|
||||
{
|
||||
CLEANUP_FREE guestfs_int_xfsinfo *info = do_xfs_info (path);
|
||||
|
||||
if (info == NULL)
|
||||
return -1;
|
||||
|
||||
// XFS does not support shrinking.
|
||||
if (INT64_MAX / info->xfs_blocksize < info->xfs_datablocks) {
|
||||
reply_with_error ("filesystem size too big: overflow");
|
||||
return -1;
|
||||
}
|
||||
return info->xfs_blocksize * info->xfs_datablocks;
|
||||
}
|
||||
|
||||
@@ -12765,6 +12765,10 @@ To read the UUID on a filesystem, call C<guestfs_vfs_uuid>." };
|
||||
[["mkfs"; "btrfs"; "/dev/sda1"; ""; "NOARG"; ""; ""; "NOARG"];
|
||||
["mount"; "/dev/sda1"; "/"];
|
||||
["vfs_minimum_size"; "/dev/sda1"]]), [];
|
||||
InitPartition, Always, TestRun (
|
||||
[["mkfs"; "xfs"; "/dev/sda1"; ""; "NOARG"; ""; ""; "NOARG"];
|
||||
["mount"; "/dev/sda1"; "/"];
|
||||
["vfs_minimum_size"; "/dev/sda1"]]), [];
|
||||
];
|
||||
shortdesc = "get minimum filesystem size";
|
||||
longdesc = "\
|
||||
@@ -12774,7 +12778,7 @@ This is the minimum possible size for filesystem shrinking.
|
||||
If getting minimum size of specified filesystem is not supported,
|
||||
this will fail and set errno as ENOTSUP.
|
||||
|
||||
See also L<ntfsresize(8)>, L<resize2fs(8)>, L<btrfs(8)>." };
|
||||
See also L<ntfsresize(8)>, L<resize2fs(8)>, L<btrfs(8)>, L<xfs_info(8)>." };
|
||||
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user