Deleted Added
full compact
g_uzip.c (269456) g_uzip.c (289952)
1/*-
2 * Copyright (c) 2004 Max Khon
3 * Copyright (c) 2014 Juniper Networks, Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 12 unchanged lines hidden (view full) ---

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2004 Max Khon
3 * Copyright (c) 2014 Juniper Networks, Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 12 unchanged lines hidden (view full) ---

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: stable/10/sys/geom/uzip/g_uzip.c 269456 2014-08-03 03:06:00Z marcel $");
29__FBSDID("$FreeBSD: stable/10/sys/geom/uzip/g_uzip.c 289952 2015-10-25 22:21:19Z ngie $");
30
31#include <sys/param.h>
32#include <sys/bio.h>
33#include <sys/endian.h>
34#include <sys/errno.h>
35#include <sys/kernel.h>
36#include <sys/lock.h>
37#include <sys/mutex.h>

--- 51 unchanged lines hidden (view full) ---

89
90static void g_uzip_done(struct bio *bp);
91
92static void
93g_uzip_softc_free(struct g_uzip_softc *sc, struct g_geom *gp)
94{
95
96 if (gp != NULL) {
30
31#include <sys/param.h>
32#include <sys/bio.h>
33#include <sys/endian.h>
34#include <sys/errno.h>
35#include <sys/kernel.h>
36#include <sys/lock.h>
37#include <sys/mutex.h>

--- 51 unchanged lines hidden (view full) ---

89
90static void g_uzip_done(struct bio *bp);
91
92static void
93g_uzip_softc_free(struct g_uzip_softc *sc, struct g_geom *gp)
94{
95
96 if (gp != NULL) {
97 printf("%s: %d requests, %d cached\n",
98 gp->name, sc->req_total, sc->req_cached);
97 DPRINTF(("%s: %d requests, %d cached\n",
98 gp->name, sc->req_total, sc->req_cached));
99 }
100 if (sc->offsets != NULL) {
101 free(sc->offsets, M_GEOM_UZIP);
102 sc->offsets = NULL;
103 }
104 mtx_destroy(&sc->last_mtx);
105 free(sc->last_buf, M_GEOM_UZIP);
106 free(sc, M_GEOM_UZIP);

--- 407 unchanged lines hidden (view full) ---

514 pp2->stripeoffset = pp->stripeoffset;
515 g_error_provider(pp2, 0);
516 g_access(cp, -1, 0, 0);
517
518 DPRINTF(("%s: taste ok (%d, %jd), (%d, %d), %x\n",
519 gp->name,
520 pp2->sectorsize, (intmax_t)pp2->mediasize,
521 pp2->stripeoffset, pp2->stripesize, pp2->flags));
99 }
100 if (sc->offsets != NULL) {
101 free(sc->offsets, M_GEOM_UZIP);
102 sc->offsets = NULL;
103 }
104 mtx_destroy(&sc->last_mtx);
105 free(sc->last_buf, M_GEOM_UZIP);
106 free(sc, M_GEOM_UZIP);

--- 407 unchanged lines hidden (view full) ---

514 pp2->stripeoffset = pp->stripeoffset;
515 g_error_provider(pp2, 0);
516 g_access(cp, -1, 0, 0);
517
518 DPRINTF(("%s: taste ok (%d, %jd), (%d, %d), %x\n",
519 gp->name,
520 pp2->sectorsize, (intmax_t)pp2->mediasize,
521 pp2->stripeoffset, pp2->stripesize, pp2->flags));
522 printf("%s: %u x %u blocks\n", gp->name, sc->nblocks, sc->blksz);
522 DPRINTF(("%s: %u x %u blocks\n", gp->name, sc->nblocks, sc->blksz));
523 return (gp);
524
525err:
526 g_topology_lock();
527 g_access(cp, -1, 0, 0);
528 if (buf != NULL)
529 free(buf, M_GEOM);
530 if (gp->softc != NULL) {

--- 11 unchanged lines hidden (view full) ---

542g_uzip_destroy_geom(struct gctl_req *req, struct g_class *mp, struct g_geom *gp)
543{
544 struct g_provider *pp;
545
546 g_trace(G_T_TOPOLOGY, "%s(%s, %s)", __func__, mp->name, gp->name);
547 g_topology_assert();
548
549 if (gp->softc == NULL) {
523 return (gp);
524
525err:
526 g_topology_lock();
527 g_access(cp, -1, 0, 0);
528 if (buf != NULL)
529 free(buf, M_GEOM);
530 if (gp->softc != NULL) {

--- 11 unchanged lines hidden (view full) ---

542g_uzip_destroy_geom(struct gctl_req *req, struct g_class *mp, struct g_geom *gp)
543{
544 struct g_provider *pp;
545
546 g_trace(G_T_TOPOLOGY, "%s(%s, %s)", __func__, mp->name, gp->name);
547 g_topology_assert();
548
549 if (gp->softc == NULL) {
550 printf("%s(%s): gp->softc == NULL\n", __func__, gp->name);
550 DPRINTF(("%s(%s): gp->softc == NULL\n", __func__, gp->name));
551 return (ENXIO);
552 }
553
554 KASSERT(gp != NULL, ("NULL geom"));
555 pp = LIST_FIRST(&gp->provider);
556 KASSERT(pp != NULL, ("NULL provider"));
557 if (pp->acr > 0 || pp->acw > 0 || pp->ace > 0)
558 return (EBUSY);

--- 22 unchanged lines hidden ---
551 return (ENXIO);
552 }
553
554 KASSERT(gp != NULL, ("NULL geom"));
555 pp = LIST_FIRST(&gp->provider);
556 KASSERT(pp != NULL, ("NULL provider"));
557 if (pp->acr > 0 || pp->acw > 0 || pp->ace > 0)
558 return (EBUSY);

--- 22 unchanged lines hidden ---