]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libxfs: cleanup get_topology
authorChristoph Hellwig <hch@lst.de>
Wed, 29 Oct 2025 09:07:30 +0000 (10:07 +0100)
committerAndrey Albershteyn <aalbersh@kernel.org>
Fri, 7 Nov 2025 12:17:04 +0000 (13:17 +0100)
Add a libxfs_ prefix to the name, clear the structure in the helper
instead of in the callers, and use a bool to pass a boolean argument.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
libxfs/topology.c
libxfs/topology.h
mkfs/xfs_mkfs.c
repair/sb.c

index 7764687beac000379d0183e075514584a3981f6c..366165719c84ed9d47a4c2aad4b10100bde8987b 100644 (file)
@@ -224,7 +224,7 @@ static void
 blkid_get_topology(
        const char              *device,
        struct device_topology  *dt,
-       int                     force_overwrite)
+       bool                    force_overwrite)
 {
        blkid_topology tp;
        blkid_probe pr;
@@ -317,7 +317,7 @@ static void
 get_device_topology(
        struct libxfs_dev       *dev,
        struct device_topology  *dt,
-       int                     force_overwrite)
+       bool                    force_overwrite)
 {
        struct stat             st;
 
@@ -364,11 +364,12 @@ get_device_topology(
 }
 
 void
-get_topology(
+libxfs_get_topology(
        struct libxfs_init      *xi,
        struct fs_topology      *ft,
-       int                     force_overwrite)
+       bool                    force_overwrite)
 {
+       memset(ft, 0, sizeof(*ft));
        get_device_topology(&xi->data, &ft->data, force_overwrite);
        get_device_topology(&xi->rt, &ft->rt, force_overwrite);
        get_device_topology(&xi->log, &ft->log, force_overwrite);
index f0ca65f3576e927f621ff3264c58ae376e19bdc7..3688d56b542fd50b4bbd3cb6af8e21c945efa293 100644 (file)
@@ -25,11 +25,8 @@ struct fs_topology {
        struct device_topology  log;
 };
 
-void
-get_topology(
-       struct libxfs_init      *xi,
-       struct fs_topology      *ft,
-       int                     force_overwrite);
+void libxfs_get_topology(struct libxfs_init *xi, struct fs_topology *ft,
+               bool force_overwrite);
 
 extern void
 calc_default_ag_geometry(
index 3ccd379203218578219cc82f153bac89f0321267..0ba7798eccf6cd1f661d57dcdd1e98879915f75c 100644 (file)
@@ -2395,8 +2395,7 @@ validate_sectorsize(
                check_device_type(cli, &cli->xi->rt, !cli->rtsize, dry_run,
                                "RT", "r");
 
-       memset(ft, 0, sizeof(*ft));
-       get_topology(cli->xi, ft, force_overwrite);
+       libxfs_get_topology(cli->xi, ft, force_overwrite);
 
        /* set configured sector sizes in preparation for checks */
        if (!cli->sectorsize) {
index 0e4827e046780ba696cb72d4bc6c8d7e5e90ffe5..ee1cc63fae6470509eeb6a0a7a3b49b51287b2d3 100644 (file)
@@ -184,8 +184,7 @@ guess_default_geometry(
        uint64_t                dblocks;
        int                     multidisk;
 
-       memset(&ft, 0, sizeof(ft));
-       get_topology(x, &ft, 1);
+       libxfs_get_topology(x, &ft, true);
 
        /*
         * get geometry from get_topology result.