From: Christoph Hellwig Date: Wed, 29 Oct 2025 09:07:30 +0000 (+0100) Subject: libxfs: cleanup get_topology X-Git-Tag: v6.18.0~84 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d1b3cc5e1c8487007c525908df76bbad77752ec;p=thirdparty%2Fxfsprogs-dev.git libxfs: cleanup get_topology 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 Reviewed-by: Darrick J. Wong --- diff --git a/libxfs/topology.c b/libxfs/topology.c index 7764687b..36616571 100644 --- a/libxfs/topology.c +++ b/libxfs/topology.c @@ -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); diff --git a/libxfs/topology.h b/libxfs/topology.h index f0ca65f3..3688d56b 100644 --- a/libxfs/topology.h +++ b/libxfs/topology.h @@ -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( diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 3ccd3792..0ba7798e 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -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) { diff --git a/repair/sb.c b/repair/sb.c index 0e4827e0..ee1cc63f 100644 --- a/repair/sb.c +++ b/repair/sb.c @@ -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.