geom(4): Fix some of the "set but not used" warnings

The few I've left in place look like potential bugs.

Sponsored By:	EPSRC
This commit is contained in:
Edward Tomasz Napierala 2021-12-13 15:19:56 +00:00
parent 33d56e57ec
commit 739a9c51b0
12 changed files with 16 additions and 23 deletions

View File

@ -57,6 +57,11 @@
/* This just needs to be "large enough" */
#define G_BDE_KEYBYTES 304
/* This file is being included by userspace. */
#ifndef __diagused
#define __diagused
#endif
struct g_bde_work;
struct g_bde_softc;
@ -176,7 +181,7 @@ void g_bde_worker(void *arg);
static __inline void
AES_init(cipherInstance *ci)
{
int error;
int error __diagused;
error = rijndael_cipherInit(ci, MODE_CBC, NULL);
KASSERT(error > 0, ("rijndael_cipherInit %d", error));
@ -185,7 +190,7 @@ AES_init(cipherInstance *ci)
static __inline void
AES_makekey(keyInstance *ki, int dir, u_int len, const void *key)
{
int error;
int error __diagused;
error = rijndael_makeKey(ki, dir, len, key);
KASSERT(error > 0, ("rijndael_makeKey %d", error));
@ -194,7 +199,7 @@ AES_makekey(keyInstance *ki, int dir, u_int len, const void *key)
static __inline void
AES_encrypt(cipherInstance *ci, keyInstance *ki, const void *in, void *out, u_int len)
{
int error;
int error __diagused;
error = rijndael_blockEncrypt(ci, ki, in, len * 8, out);
KASSERT(error > 0, ("rijndael_blockEncrypt %d", error));
@ -203,7 +208,7 @@ AES_encrypt(cipherInstance *ci, keyInstance *ki, const void *in, void *out, u_in
static __inline void
AES_decrypt(cipherInstance *ci, keyInstance *ki, const void *in, void *out, u_int len)
{
int error;
int error __diagused;
error = rijndael_blockDecrypt(ci, ki, in, len * 8, out);
KASSERT(error > 0, ("rijndael_blockDecrypt %d", error));

View File

@ -2961,7 +2961,7 @@ g_journal_do_switch(struct g_class *classp)
static void
g_journal_start_switcher(struct g_class *mp)
{
int error;
int error __diagused;
g_topology_assert();
MPASS(g_journal_switcher_proc == NULL);

View File

@ -249,11 +249,9 @@ g_shsec_xor1(uint32_t *src, uint32_t *dst, ssize_t len)
static void
g_shsec_done(struct bio *bp)
{
struct g_shsec_softc *sc;
struct bio *pbp;
pbp = bp->bio_parent;
sc = pbp->bio_to->geom->softc;
if (bp->bio_error == 0)
G_SHSEC_LOGREQ(2, bp, "Request done.");
else {

View File

@ -203,7 +203,7 @@ static int
g_stripe_access(struct g_provider *pp, int dr, int dw, int de)
{
struct g_consumer *cp1, *cp2, *tmp;
struct g_stripe_softc *sc;
struct g_stripe_softc *sc __diagused;
struct g_geom *gp;
int error;

View File

@ -552,11 +552,10 @@ gv_stripe(struct g_geom *gp, struct gctl_req *req)
struct gv_plex *p;
struct gv_softc *sc;
char *drive, buf[30], *vol;
int *drives, *flags, dcount, pcount;
int *drives, *flags, dcount;
sc = gp->softc;
dcount = 0;
pcount = 0;
vol = gctl_get_param(req, "name", NULL);
if (vol == NULL) {
gctl_error(req, "volume name not given");

View File

@ -233,7 +233,7 @@ gv_find_good_plex(struct gv_volume *v)
static int
gv_sync(struct gv_volume *v)
{
struct gv_softc *sc;
struct gv_softc *sc __diagused;
struct gv_plex *p, *up;
int error;

View File

@ -538,10 +538,8 @@ gv_normal_parity(struct gv_plex *p, struct bio *bp, struct gv_raid5_packet *wp)
static void
gv_plex_flush(struct gv_plex *p)
{
struct gv_softc *sc;
struct bio *bp;
sc = p->vinumconf;
bp = bioq_takefirst(p->rqueue);
while (bp != NULL) {
gv_plex_start(p, bp);

View File

@ -345,15 +345,12 @@ static int
gv_raid5_request(struct gv_plex *p, struct gv_raid5_packet *wp,
struct bio *bp, caddr_t addr, off_t boff, off_t bcount, int *delay)
{
struct g_geom *gp;
struct gv_sd *broken, *original, *parity, *s;
struct gv_bioq *bq;
struct bio *cbp;
int i, psdno, sdno, type, grow;
off_t real_len, real_off;
gp = bp->bio_to->geom;
if (p == NULL || LIST_EMPTY(&p->subdisks))
return (ENXIO);

View File

@ -226,7 +226,7 @@ int
gv_rename_vol(struct gv_softc *sc, struct gv_volume *v, char *newname,
int flags)
{
struct g_provider *pp;
struct g_provider *pp __diagused;
struct gv_plex *p;
char newplex[GV_MAXPLEXNAME], *ptr;
int err;

View File

@ -1124,7 +1124,7 @@ int
gv_attach_plex(struct gv_plex *p, struct gv_volume *v, int rename)
{
struct gv_sd *s;
struct gv_softc *sc;
struct gv_softc *sc __diagused;
g_topology_assert();

View File

@ -59,12 +59,10 @@ gv_volume_flush(struct gv_volume *v)
void
gv_volume_start(struct gv_softc *sc, struct bio *bp)
{
struct g_geom *gp;
struct gv_volume *v;
struct gv_plex *p, *lp;
int numwrites;
gp = sc->geom;
v = bp->bio_to->private;
if (v == NULL || v->state != GV_VOL_UP) {
g_io_deliver(bp, ENXIO);
@ -143,7 +141,7 @@ gv_volume_start(struct gv_softc *sc, struct bio *bp)
void
gv_bio_done(struct gv_softc *sc, struct bio *bp)
{
struct gv_volume *v;
struct gv_volume *v __diagused;
struct gv_plex *p;
struct gv_sd *s;

View File

@ -1528,11 +1528,9 @@ g_virstor_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp,
static void
g_virstor_done(struct bio *b)
{
struct g_virstor_softc *sc;
struct bio *parent_b;
parent_b = b->bio_parent;
sc = parent_b->bio_to->geom->softc;
if (b->bio_error != 0) {
LOG_MSG(LVL_ERROR, "Error %d for offset=%ju, length=%ju, %s",