diff --git a/sys/geom/bde/g_bde.c b/sys/geom/bde/g_bde.c index 1e53875479c5..4b4e947790bc 100644 --- a/sys/geom/bde/g_bde.c +++ b/sys/geom/bde/g_bde.c @@ -108,7 +108,7 @@ g_bde_access(struct g_provider *pp, int dr, int dw, int de) de--; dr--; } - return (g_access_rel(cp, dr, dw, de)); + return (g_access(cp, dr, dw, de)); } static void @@ -136,7 +136,7 @@ g_bde_create_geom(struct gctl_req *req, struct g_class *mp, struct g_provider *p gp->spoiled = g_std_spoiled; cp = g_new_consumer(gp); g_attach(cp, pp); - error = g_access_rel(cp, 1, 1, 1); + error = g_access(cp, 1, 1, 1); if (error) { g_detach(cp); g_destroy_consumer(cp); @@ -211,7 +211,7 @@ g_bde_create_geom(struct gctl_req *req, struct g_class *mp, struct g_provider *p bzero(key, 16); if (error == 0) return; - g_access_rel(cp, -1, -1, -1); + g_access(cp, -1, -1, -1); g_detach(cp); g_destroy_consumer(cp); if (gp->softc != NULL) @@ -244,7 +244,7 @@ g_bde_destroy_geom(struct gctl_req *req, struct g_class *mp, struct g_geom *gp) KASSERT(cp != NULL, ("NULL consumer")); sc->dead = 1; wakeup(sc); - error = g_access_rel(cp, -1, -1, -1); + error = g_access(cp, -1, -1, -1); KASSERT(error == 0, ("error on close")); g_detach(cp); g_destroy_consumer(cp); diff --git a/sys/geom/geom.h b/sys/geom/geom.h index 0514a198c278..63db46a13398 100644 --- a/sys/geom/geom.h +++ b/sys/geom/geom.h @@ -202,8 +202,10 @@ void g_orphan_provider(struct g_provider *pp, int error); void g_waitidle(void); /* geom_subr.c */ -int g_access_abs(struct g_consumer *cp, int nread, int nwrite, int nexcl); -int g_access_rel(struct g_consumer *cp, int nread, int nwrite, int nexcl); +int g_access(struct g_consumer *cp, int nread, int nwrite, int nexcl); +#ifndef BURN_BRIDGES +#define g_access_rel(a, b, c, d) g_access(a, b, c, d) +#endif int g_attach(struct g_consumer *cp, struct g_provider *pp); void g_destroy_consumer(struct g_consumer *cp); void g_destroy_geom(struct g_geom *pp); diff --git a/sys/geom/geom_aes.c b/sys/geom/geom_aes.c index 867efd9fdaa8..1ac425ad9efe 100644 --- a/sys/geom/geom_aes.c +++ b/sys/geom/geom_aes.c @@ -266,7 +266,7 @@ g_aes_access(struct g_provider *pp, int dr, int dw, int de) /* ... and let go of it on last close */ if ((cp->acr + dr) == 0 && (cp->acw + dw) == 0 && (cp->ace + de) == 1) de--; - return (g_access_rel(cp, dr, dw, de)); + return (g_access(cp, dr, dw, de)); } static struct g_geom * @@ -288,7 +288,7 @@ g_aes_taste(struct g_class *mp, struct g_provider *pp, int flags __unused) gp->spoiled = g_std_spoiled; cp = g_new_consumer(gp); g_attach(cp, pp); - error = g_access_rel(cp, 1, 0, 0); + error = g_access(cp, 1, 0, 0); if (error) { g_detach(cp); g_destroy_consumer(cp); @@ -357,7 +357,7 @@ g_aes_taste(struct g_class *mp, struct g_provider *pp, int flags __unused) g_topology_lock(); if (buf) g_free(buf); - g_access_rel(cp, -1, 0, 0); + g_access(cp, -1, 0, 0); if (gp->softc != NULL) return (gp); g_detach(cp); diff --git a/sys/geom/geom_apple.c b/sys/geom/geom_apple.c index 328b8353989c..f076a3a01e37 100644 --- a/sys/geom/geom_apple.c +++ b/sys/geom/geom_apple.c @@ -243,7 +243,7 @@ g_apple_taste(struct g_class *mp, struct g_provider *pp, int insist) break; } while(0); g_topology_lock(); - g_access_rel(cp, -1, 0, 0); + g_access(cp, -1, 0, 0); if (LIST_EMPTY(&gp->provider)) { g_slice_spoiled(cp); return (NULL); diff --git a/sys/geom/geom_bsd.c b/sys/geom/geom_bsd.c index 1a309eb8c228..ce74c9f029a9 100644 --- a/sys/geom/geom_bsd.c +++ b/sys/geom/geom_bsd.c @@ -569,7 +569,7 @@ g_bsd_taste(struct g_class *mp, struct g_provider *pp, int flags) } while (0); /* Success or failure, we can close our provider now. */ - error = g_access_rel(cp, -1, 0, 0); + error = g_access(cp, -1, 0, 0); /* If we have configured any providers, return the new geom. */ if (gsp->nprovider > 0) { @@ -639,26 +639,26 @@ g_bsd_config(struct gctl_req *req, struct g_class *mp, char const *verb) h0h0.label = label; h0h0.error = -1; /* XXX: Does this reference register with our selfdestruct code ? */ - error = g_access_rel(cp, 1, 1, 1); + error = g_access(cp, 1, 1, 1); if (error) { gctl_error(req, "could not access consumer"); return; } g_bsd_callconfig(&h0h0, 0); error = h0h0.error; - g_access_rel(cp, -1, -1, -1); + g_access(cp, -1, -1, -1); } else if (!strcmp(verb, "write bootcode")) { label = gctl_get_paraml(req, "bootcode", BBSIZE); if (label == NULL) return; /* XXX: Does this reference register with our selfdestruct code ? */ - error = g_access_rel(cp, 1, 1, 1); + error = g_access(cp, 1, 1, 1); if (error) { gctl_error(req, "could not access consumer"); return; } error = g_bsd_writelabel(gp, label); - g_access_rel(cp, -1, -1, -1); + g_access(cp, -1, -1, -1); } else { gctl_error(req, "Unknown verb parameter"); } diff --git a/sys/geom/geom_ccd.c b/sys/geom/geom_ccd.c index bd58410fe86f..7ec3d2ea5ca2 100644 --- a/sys/geom/geom_ccd.c +++ b/sys/geom/geom_ccd.c @@ -168,12 +168,12 @@ g_ccd_access(struct g_provider *pp, int dr, int dw, int de) gp = pp->geom; error = ENXIO; LIST_FOREACH(cp1, &gp->consumer, consumer) { - error = g_access_rel(cp1, dr, dw, de); + error = g_access(cp1, dr, dw, de); if (error) { LIST_FOREACH(cp2, &gp->consumer, consumer) { if (cp1 == cp2) break; - g_access_rel(cp2, -dr, -dw, -de); + g_access(cp2, -dr, -dw, -de); } break; } diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c index baad2eeaff83..97abc2a893d9 100644 --- a/sys/geom/geom_dev.c +++ b/sys/geom/geom_dev.c @@ -213,7 +213,7 @@ g_dev_open(dev_t dev, int flags, int fmt, struct thread *td) if (dev->si_devsw == NULL) error = ENXIO; /* We were orphaned */ else - error = g_access_rel(cp, r, w, e); + error = g_access(cp, r, w, e); g_topology_unlock(); g_waitidle(); if (!error) @@ -245,7 +245,7 @@ g_dev_close(dev_t dev, int flags, int fmt, struct thread *td) if (dev->si_devsw == NULL) error = ENXIO; /* We were orphaned */ else - error = g_access_rel(cp, r, w, e); + error = g_access(cp, r, w, e); for (i = 0; i < 10 * hz;) { if (cp->acr != 0 || cp->acw != 0) break; @@ -434,7 +434,7 @@ g_dev_orphan(struct g_consumer *cp) msleep(&dev, NULL, PRIBIO, "gdevorphan", hz / 10); if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0) - g_access_rel(cp, -cp->acr, -cp->acw, -cp->ace); + g_access(cp, -cp->acr, -cp->acw, -cp->ace); g_detach(cp); g_destroy_consumer(cp); diff --git a/sys/geom/geom_fox.c b/sys/geom/geom_fox.c index df4b68ccab38..2c4b3d085b4f 100644 --- a/sys/geom/geom_fox.c +++ b/sys/geom/geom_fox.c @@ -90,13 +90,13 @@ g_fox_select_path(void *arg, int flag) cp1 = LIST_NEXT(sc->opath, consumer); - error = g_access_rel(sc->opath, -sc->cr, -sc->cw, -(sc->ce + 1)); + error = g_access(sc->opath, -sc->cr, -sc->cw, -(sc->ce + 1)); KASSERT(error == 0, ("Failed close of old path %d", error)); /* * The attempt to reopen it with a exclusive count */ - error = g_access_rel(sc->opath, 0, 0, 1); + error = g_access(sc->opath, 0, 0, 1); if (error) { /* * Ok, ditch this consumer, we can't use it. @@ -130,7 +130,7 @@ g_fox_select_path(void *arg, int flag) cp1 = LIST_FIRST(&gp->consumer); printf("Open new path (%s) on fox (%s)\n", cp1->provider->name, gp->name); - error = g_access_rel(cp1, sc->cr, sc->cw, sc->ce); + error = g_access(cp1, sc->cr, sc->cw, sc->ce); if (error) { /* * If we failed, we take another trip through here @@ -179,7 +179,7 @@ g_fox_orphan(struct g_consumer *cp) } mtx_unlock(&sc->lock); - g_access_rel(cp, -cp->acr, -cp->acw, -cp->ace); + g_access(cp, -cp->acr, -cp->acw, -cp->ace); error = cp->provider->error; g_detach(cp); g_destroy_consumer(cp); @@ -299,7 +299,7 @@ g_fox_access(struct g_provider *pp, int dr, int dw, int de) */ error = 0; LIST_FOREACH(cp1, &gp->consumer, consumer) { - error = g_access_rel(cp1, 0, 0, 1); + error = g_access(cp1, 0, 0, 1); if (error) { printf("FOX: access(%s,0,0,1) = %d\n", cp1->provider->name, error); @@ -309,7 +309,7 @@ g_fox_access(struct g_provider *pp, int dr, int dw, int de) if (error) { LIST_FOREACH(cp1, &gp->consumer, consumer) { if (cp1->ace) - g_access_rel(cp1, 0, 0, -1); + g_access(cp1, 0, 0, -1); } return (error); } @@ -319,7 +319,7 @@ g_fox_access(struct g_provider *pp, int dr, int dw, int de) if (sc->path == NULL) error = ENXIO; else - error = g_access_rel(sc->path, dr, dw, de); + error = g_access(sc->path, dr, dw, de); if (error == 0) { sc->cr += dr; sc->cw += dw; @@ -329,7 +329,7 @@ g_fox_access(struct g_provider *pp, int dr, int dw, int de) * Last close, remove e-bit on all consumers */ LIST_FOREACH(cp1, &gp->consumer, consumer) - g_access_rel(cp1, 0, 0, -1); + g_access(cp1, 0, 0, -1); } } return (error); @@ -360,7 +360,7 @@ g_fox_taste(struct g_class *mp, struct g_provider *pp, int flags __unused) gp->access= g_fox_access; cp = g_new_consumer(gp); g_attach(cp, pp); - error = g_access_rel(cp, 1, 0, 0); + error = g_access(cp, 1, 0, 0); if (error) { g_free(sc); g_detach(cp); @@ -401,7 +401,7 @@ g_fox_taste(struct g_class *mp, struct g_provider *pp, int flags __unused) g_attach(cp2, pp); pp2 = LIST_FIRST(&gp2->provider); if (pp2->acr > 0 || pp2->acw > 0 || pp2->ace > 0) { - error = g_access_rel(cp2, 0, 0, 1); + error = g_access(cp2, 0, 0, 1); if (error) { /* * This is bad, or more likely, @@ -433,7 +433,7 @@ printf("fox %s lock %p\n", gp->name, &sc->lock); } while (0); if (buf != NULL) g_free(buf); - g_access_rel(cp, -1, 0, 0); + g_access(cp, -1, 0, 0); if (!LIST_EMPTY(&gp->provider)) return (gp); diff --git a/sys/geom/geom_gpt.c b/sys/geom/geom_gpt.c index 52951c4c5442..601d7e819067 100644 --- a/sys/geom/geom_gpt.c +++ b/sys/geom/geom_gpt.c @@ -211,7 +211,7 @@ g_gpt_taste(struct g_class *mp, struct g_provider *pp, int insist) g_free(mbr); g_topology_lock(); - g_access_rel(cp, -1, 0, 0); + g_access(cp, -1, 0, 0); if (LIST_EMPTY(&gp->provider)) { g_slice_spoiled(cp); return (NULL); diff --git a/sys/geom/geom_mbr.c b/sys/geom/geom_mbr.c index 877f090c4f78..9ba0815a4070 100644 --- a/sys/geom/geom_mbr.c +++ b/sys/geom/geom_mbr.c @@ -263,7 +263,7 @@ g_mbr_taste(struct g_class *mp, struct g_provider *pp, int insist) break; } while (0); g_topology_lock(); - g_access_rel(cp, -1, 0, 0); + g_access(cp, -1, 0, 0); if (LIST_EMPTY(&gp->provider)) { g_slice_spoiled(cp); return (NULL); @@ -403,7 +403,7 @@ g_mbrext_taste(struct g_class *mp, struct g_provider *pp, int insist __unused) break; } while (0); g_topology_lock(); - g_access_rel(cp, -1, 0, 0); + g_access(cp, -1, 0, 0); if (LIST_EMPTY(&gp->provider)) { g_slice_spoiled(cp); return (NULL); diff --git a/sys/geom/geom_mirror.c b/sys/geom/geom_mirror.c index 092947e2cc68..ea14ae99ba7a 100644 --- a/sys/geom/geom_mirror.c +++ b/sys/geom/geom_mirror.c @@ -73,7 +73,7 @@ g_mirror_orphan(struct g_consumer *cp) g_topology_assert(); gp = cp->geom; - g_access_rel(cp, -cp->acr, -cp->acw, -cp->ace); + g_access(cp, -cp->acr, -cp->acw, -cp->ace); error = cp->provider->error; g_detach(cp); g_destroy_consumer(cp); @@ -143,12 +143,12 @@ g_mirror_access(struct g_provider *pp, int dr, int dw, int de) gp = pp->geom; error = ENXIO; LIST_FOREACH(cp1, &gp->consumer, consumer) { - error = g_access_rel(cp1, dr, dw, de); + error = g_access(cp1, dr, dw, de); if (error) { LIST_FOREACH(cp2, &gp->consumer, consumer) { if (cp2 == cp1) break; - g_access_rel(cp2, -dr, -dw, -de); + g_access(cp2, -dr, -dw, -de); } return (error); } @@ -177,7 +177,7 @@ g_mirror_taste(struct g_class *mp, struct g_provider *pp, int flags __unused) gp->access= g_mirror_access; cp = g_new_consumer(gp); g_attach(cp, pp); - error = g_access_rel(cp, 1, 0, 0); + error = g_access(cp, 1, 0, 0); if (error) { g_detach(cp); g_destroy_consumer(cp); @@ -220,7 +220,7 @@ g_mirror_taste(struct g_class *mp, struct g_provider *pp, int flags __unused) g_topology_lock(); if (buf != NULL) g_free(buf); - g_access_rel(cp, -1, 0, 0); + g_access(cp, -1, 0, 0); if (gp->softc != NULL) return (gp); g_detach(cp); diff --git a/sys/geom/geom_pc98.c b/sys/geom/geom_pc98.c index 667e8669262a..2e0c21275131 100644 --- a/sys/geom/geom_pc98.c +++ b/sys/geom/geom_pc98.c @@ -273,7 +273,7 @@ g_pc98_taste(struct g_class *mp, struct g_provider *pp, int flags) break; } while (0); g_topology_lock(); - g_access_rel(cp, -1, 0, 0); + g_access(cp, -1, 0, 0); if (LIST_EMPTY(&gp->provider)) { g_slice_spoiled(cp); return (NULL); diff --git a/sys/geom/geom_slice.c b/sys/geom/geom_slice.c index 64c000e23c2d..8a769105319f 100644 --- a/sys/geom/geom_slice.c +++ b/sys/geom/geom_slice.c @@ -119,7 +119,7 @@ g_slice_access(struct g_provider *pp, int dr, int dw, int de) /* ... and let go of it on last close */ if ((cp->acr + dr) == 0 && (cp->acw + dw) == 0 && (cp->ace + de) == 1) de--; - error = g_access_rel(cp, dr, dw, de); + error = g_access(cp, dr, dw, de); return (error); } @@ -463,7 +463,7 @@ g_slice_new(struct g_class *mp, u_int slices, struct g_provider *pp, struct g_co cp = g_new_consumer(gp); error = g_attach(cp, pp); if (error == 0) - error = g_access_rel(cp, 1, 0, 0); + error = g_access(cp, 1, 0, 0); if (error) { g_wither_geom(gp, ENXIO); return (NULL); diff --git a/sys/geom/geom_subr.c b/sys/geom/geom_subr.c index a56c0af0b0f9..b6a9c7f34588 100644 --- a/sys/geom/geom_subr.c +++ b/sys/geom/geom_subr.c @@ -558,33 +558,15 @@ g_detach(struct g_consumer *cp) redo_rank(cp->geom); } - /* - * g_access_abs() - * - * Access-check with absolute new values: Just fall through - * and use the relative version. - */ -int -g_access_abs(struct g_consumer *cp, int acr, int acw, int ace) -{ - - g_topology_assert(); - return(g_access_rel(cp, - acr - cp->acr, - acw - cp->acw, - ace - cp->ace)); -} - -/* - * g_access_rel() + * g_access() * * Access-check with delta values. The question asked is "can provider * "cp" change the access counters by the relative amounts dc[rwe] ?" */ int -g_access_rel(struct g_consumer *cp, int dcr, int dcw, int dce) +g_access(struct g_consumer *cp, int dcr, int dcw, int dce) { struct g_provider *pp; int pr,pw,pe; @@ -592,7 +574,7 @@ g_access_rel(struct g_consumer *cp, int dcr, int dcw, int dce) pp = cp->provider; - g_trace(G_T_ACCESS, "g_access_rel(%p(%s), %d, %d, %d)", + g_trace(G_T_ACCESS, "g_access(%p(%s), %d, %d, %d)", cp, pp->name, dcr, dcw, dce); g_topology_assert(); diff --git a/sys/geom/geom_sunlabel.c b/sys/geom/geom_sunlabel.c index 0718056a31a3..8b11dd996701 100644 --- a/sys/geom/geom_sunlabel.c +++ b/sys/geom/geom_sunlabel.c @@ -194,19 +194,19 @@ g_sunlabel_config(struct gctl_req *req, struct g_class *mp, const char *verb) h0h0.label = label; h0h0.error = -1; /* XXX: Does this reference register with our selfdestruct code ? */ - error = g_access_rel(cp, 1, 1, 1); + error = g_access(cp, 1, 1, 1); if (error) { gctl_error(req, "could not access consumer"); return; } g_sunlabel_callconfig(&h0h0, 0); - g_access_rel(cp, -1, -1, -1); + g_access(cp, -1, -1, -1); } else if (!strcmp(verb, "write bootcode")) { label = gctl_get_paraml(req, "bootcode", SUN_BOOTSIZE); if (label == NULL) return; /* XXX: Does this reference register with our selfdestruct code ? */ - error = g_access_rel(cp, 1, 1, 1); + error = g_access(cp, 1, 1, 1); if (error) { gctl_error(req, "could not access consumer"); return; @@ -218,7 +218,7 @@ g_sunlabel_config(struct gctl_req *req, struct g_class *mp, const char *verb) gsp->slices[i].offset + SUN_SIZE, label + SUN_SIZE, SUN_BOOTSIZE - SUN_SIZE); } - g_access_rel(cp, -1, -1, -1); + g_access(cp, -1, -1, -1); } else { gctl_error(req, "Unknown verb parameter"); } @@ -261,7 +261,7 @@ g_sunlabel_taste(struct g_class *mp, struct g_provider *pp, int flags) break; } while (0); - g_access_rel(cp, -1, 0, 0); + g_access(cp, -1, 0, 0); if (LIST_EMPTY(&gp->provider)) { g_slice_spoiled(cp); return (NULL); diff --git a/sys/geom/geom_vol_ffs.c b/sys/geom/geom_vol_ffs.c index de046edd78a0..afc41487b3f6 100644 --- a/sys/geom/geom_vol_ffs.c +++ b/sys/geom/geom_vol_ffs.c @@ -127,7 +127,7 @@ g_vol_ffs_taste(struct g_class *mp, struct g_provider *pp, int flags) break; } g_topology_lock(); - g_access_rel(cp, -1, 0, 0); + g_access(cp, -1, 0, 0); if (LIST_EMPTY(&gp->provider)) { g_slice_spoiled(cp); return (NULL); diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 8de9c40ea1ed..6fbed93f115e 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -2449,7 +2449,7 @@ swapgeom_close_ev(void *arg, int flags) struct g_consumer *cp; cp = arg; - g_access_rel(cp, -1, -1, 0); + g_access(cp, -1, -1, 0); g_detach(cp); g_destroy_consumer(cp); } @@ -2509,7 +2509,7 @@ swapongeom_ev(void *arg, int flags) * savecore(8) wants to write to our swapdev so we cannot * set an exclusive count :-( */ - error = g_access_rel(cp, 1, 1, 0); + error = g_access(cp, 1, 1, 0); if (error) { g_detach(cp); g_destroy_consumer(cp);