From 06fbdeb8692466b6a6ba2fe1edbc3a0e1487e1cd Mon Sep 17 00:00:00 2001 From: mav Date: Thu, 5 Dec 2019 15:07:32 +0000 Subject: [PATCH] Remove duplicate g_debugflags declaration. While there, define G_F_FOOTSHOOTING instead of numeric constants. MFC after: 13 days X-MFX-with: r355412 --- sys/geom/geom.h | 9 ++++++--- sys/geom/geom_int.h | 12 ------------ sys/geom/geom_subr.c | 2 +- sys/geom/mirror/g_mirror_ctl.c | 2 +- sys/geom/part/g_part.c | 2 +- sys/geom/part/g_part_mbr.c | 2 +- sys/geom/part/g_part_vtoc8.c | 2 +- 7 files changed, 11 insertions(+), 20 deletions(-) diff --git a/sys/geom/geom.h b/sys/geom/geom.h index 2c2b25faa909..a0735c76269d 100644 --- a/sys/geom/geom.h +++ b/sys/geom/geom.h @@ -256,10 +256,13 @@ struct g_provider *g_dev_getprovider(struct cdev *dev); /* geom_dump.c */ void (g_trace)(int level, const char *, ...) __printflike(2, 3); -# define G_T_TOPOLOGY 1 -# define G_T_BIO 2 -# define G_T_ACCESS 4 +#define G_T_TOPOLOGY 0x01 +#define G_T_BIO 0x02 +#define G_T_ACCESS 0x04 extern int g_debugflags; +#define G_F_FOOTSHOOTING 0x10 +#define G_F_DISKIOCTL 0x40 +#define G_F_CTLDUMP 0x80 #define g_trace(level, fmt, ...) do { \ if (__predict_false(g_debugflags & (level))) \ (g_trace)(level, fmt, ## __VA_ARGS__); \ diff --git a/sys/geom/geom_int.h b/sys/geom/geom_int.h index 1064a31da531..9f2a011b23f0 100644 --- a/sys/geom/geom_int.h +++ b/sys/geom/geom_int.h @@ -44,18 +44,6 @@ extern int g_collectstats; #define G_STATS_PROVIDERS 1 /* Collect I/O stats for providers */ #define G_STATS_CONSUMERS 2 /* Collect I/O stats for consumers */ -extern int g_debugflags; -/* - * 1 G_T_TOPOLOGY - * 2 G_T_BIO - * 4 G_T_ACCESS - * 8 (unused) - * 16 Allow footshooting on rank#1 providers - * 32 G_T_DETAILS - */ -#define G_F_DISKIOCTL 64 -#define G_F_CTLDUMP 128 - /* geom_dump.c */ void g_confxml(void *, int flag); void g_conf_specific(struct sbuf *sb, struct g_class *mp, struct g_geom *gp, struct g_provider *pp, struct g_consumer *cp); diff --git a/sys/geom/geom_subr.c b/sys/geom/geom_subr.c index d829b54aa2b9..f7f0a4b096f0 100644 --- a/sys/geom/geom_subr.c +++ b/sys/geom/geom_subr.c @@ -983,7 +983,7 @@ g_access(struct g_consumer *cp, int dcr, int dcw, int dce) pp, pp->name); /* If foot-shooting is enabled, any open on rank#1 is OK */ - if ((g_debugflags & 16) && gp->rank == 1) + if ((g_debugflags & G_F_FOOTSHOOTING) && gp->rank == 1) ; /* If we try exclusive but already write: fail */ else if (dce > 0 && pw > 0) diff --git a/sys/geom/mirror/g_mirror_ctl.c b/sys/geom/mirror/g_mirror_ctl.c index cf362d4ffb5e..b7e4913cf2c3 100644 --- a/sys/geom/mirror/g_mirror_ctl.c +++ b/sys/geom/mirror/g_mirror_ctl.c @@ -853,7 +853,7 @@ g_mirror_ctl_resize(struct gctl_req *req, struct g_class *mp) return; } /* Deny shrinking of an opened provider */ - if ((g_debugflags & 16) == 0 && sc->sc_provider_open > 0) { + if ((g_debugflags & G_F_FOOTSHOOTING) == 0 && sc->sc_provider_open > 0) { if (sc->sc_mediasize > mediasize) { gctl_error(req, "Device %s is busy.", sc->sc_provider->name); diff --git a/sys/geom/part/g_part.c b/sys/geom/part/g_part.c index 583fa190f9f8..70cc4df6cc6c 100644 --- a/sys/geom/part/g_part.c +++ b/sys/geom/part/g_part.c @@ -1383,7 +1383,7 @@ g_part_ctl_resize(struct gctl_req *req, struct g_part_parms *gpp) } pp = entry->gpe_pp; - if ((g_debugflags & 16) == 0 && + if ((g_debugflags & G_F_FOOTSHOOTING) == 0 && (pp->acr > 0 || pp->acw > 0 || pp->ace > 0)) { if (entry->gpe_end - entry->gpe_start + 1 > gpp->gpp_size) { /* Deny shrinking of an opened partition. */ diff --git a/sys/geom/part/g_part_mbr.c b/sys/geom/part/g_part_mbr.c index 013b2a934ccc..720872257e32 100644 --- a/sys/geom/part/g_part_mbr.c +++ b/sys/geom/part/g_part_mbr.c @@ -381,7 +381,7 @@ g_part_mbr_resize(struct g_part_table *basetable, return (EINVAL); /* XXX: prevent unexpected shrinking. */ pp = baseentry->gpe_pp; - if ((g_debugflags & 0x10) == 0 && size < gpp->gpp_size && + if ((g_debugflags & G_F_FOOTSHOOTING) == 0 && size < gpp->gpp_size && pp->mediasize / pp->sectorsize > size) return (EBUSY); entry = (struct g_part_mbr_entry *)baseentry; diff --git a/sys/geom/part/g_part_vtoc8.c b/sys/geom/part/g_part_vtoc8.c index 8f238a3a6400..7b595cb14598 100644 --- a/sys/geom/part/g_part_vtoc8.c +++ b/sys/geom/part/g_part_vtoc8.c @@ -373,7 +373,7 @@ g_part_vtoc8_resize(struct g_part_table *basetable, return (EINVAL); /* XXX: prevent unexpected shrinking. */ pp = entry->gpe_pp; - if ((g_debugflags & 0x10) == 0 && size < gpp->gpp_size && + if ((g_debugflags & G_F_FOOTSHOOTING) == 0 && size < gpp->gpp_size && pp->mediasize / pp->sectorsize > size) return (EBUSY); entry->gpe_end = entry->gpe_start + size - 1;