1/*- 2 * Copyright (c) 2005-2011 Pawel Jakub Dawidek <pawel@dawidek.net> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/geom/eli/g_eli.c 293306 2016-01-07 05:47:34Z allanjude $"); |
29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/cons.h> 33#include <sys/kernel.h> 34#include <sys/linker.h> 35#include <sys/module.h> 36#include <sys/lock.h> --- 529 unchanged lines hidden (view full) --- 566 if (sc->sc_flags & G_ELI_FLAG_AUTH) 567 g_eli_auth_run(wr, bp); 568 else 569 g_eli_crypto_run(wr, bp); 570 } 571 } 572} 573 |
574int 575g_eli_read_metadata(struct g_class *mp, struct g_provider *pp, 576 struct g_eli_metadata *md) 577{ 578 struct g_geom *gp; 579 struct g_consumer *cp; 580 u_char *buf = NULL; 581 int error; --- 130 unchanged lines hidden (view full) --- 712 * If detach-on-last-close feature is not enabled and we don't operate 713 * on read-only provider, we can simply use g_std_access(). 714 */ 715 if (md->md_flags & (G_ELI_FLAG_WO_DETACH | G_ELI_FLAG_RO)) 716 gp->access = g_eli_access; 717 else 718 gp->access = g_std_access; 719 |
720 eli_metadata_softc(sc, md, bpp->sectorsize, bpp->mediasize); |
721 sc->sc_nkey = nkey; 722 |
723 gp->softc = sc; 724 sc->sc_geom = gp; 725 726 bioq_init(&sc->sc_queue); 727 mtx_init(&sc->sc_queue_mtx, "geli:queue", NULL, MTX_DEF); 728 mtx_init(&sc->sc_ekeys_lock, "geli:ekeys", NULL, MTX_DEF); 729 730 pp = NULL; --- 26 unchanged lines hidden (view full) --- 757 bpp->name, error); 758 } else { 759 G_ELI_DEBUG(1, "Cannot access %s (error=%d).", 760 bpp->name, error); 761 } 762 goto failed; 763 } 764 |
765 /* 766 * Remember the keys in our softc structure. 767 */ 768 g_eli_mkey_propagate(sc, mkey); |
769 770 LIST_INIT(&sc->sc_workers); 771 772 threads = g_eli_threads; 773 if (threads == 0) 774 threads = mp_ncpus; 775 sc->sc_cpubind = (mp_ncpus > 1 && threads == mp_ncpus); 776 for (i = 0; i < threads; i++) { --- 491 unchanged lines hidden --- |