g_bde.c (105542) | g_bde.c (105551) |
---|---|
1/*- 2 * Copyright (c) 2002 Poul-Henning Kamp 3 * Copyright (c) 2002 Networks Associates Technology, Inc. 4 * All rights reserved. 5 * 6 * This software was developed for the FreeBSD Project by Poul-Henning Kamp 7 * and NAI Labs, the Security Research Division of Network Associates, Inc. 8 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the --- 18 unchanged lines hidden (view full) --- 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * | 1/*- 2 * Copyright (c) 2002 Poul-Henning Kamp 3 * Copyright (c) 2002 Networks Associates Technology, Inc. 4 * All rights reserved. 5 * 6 * This software was developed for the FreeBSD Project by Poul-Henning Kamp 7 * and NAI Labs, the Security Research Division of Network Associates, Inc. 8 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the --- 18 unchanged lines hidden (view full) --- 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * |
35 * $FreeBSD: head/sys/geom/bde/g_bde.c 105542 2002-10-20 19:18:07Z phk $ | 35 * $FreeBSD: head/sys/geom/bde/g_bde.c 105551 2002-10-20 20:28:24Z phk $ |
36 * 37 */ 38 39#include <sys/param.h> 40#include <sys/stdint.h> 41#include <sys/bio.h> 42#include <sys/lock.h> 43#include <sys/mutex.h> --- 19 unchanged lines hidden (view full) --- 63 switch (bp->bio_cmd) { 64 case BIO_DELETE: 65 case BIO_READ: 66 case BIO_WRITE: 67 g_bde_start1(bp); 68 break; 69 case BIO_GETATTR: 70 case BIO_SETATTR: | 36 * 37 */ 38 39#include <sys/param.h> 40#include <sys/stdint.h> 41#include <sys/bio.h> 42#include <sys/lock.h> 43#include <sys/mutex.h> --- 19 unchanged lines hidden (view full) --- 63 switch (bp->bio_cmd) { 64 case BIO_DELETE: 65 case BIO_READ: 66 case BIO_WRITE: 67 g_bde_start1(bp); 68 break; 69 case BIO_GETATTR: 70 case BIO_SETATTR: |
71 if (g_handleattr_off_t(bp, "GEOM::mediasize", sc->mediasize)) 72 return; 73 if (g_handleattr_int(bp, "GEOM::sectorsize", sc->sectorsize)) 74 return; | |
75 g_io_deliver(bp, EOPNOTSUPP); 76 break; 77 default: 78 g_io_deliver(bp, EOPNOTSUPP); 79 return; 80 } 81 return; 82} --- 125 unchanged lines hidden (view full) --- 208 if (error) { 209 g_detach(cp); 210 g_destroy_consumer(cp); 211 g_destroy_geom(gp); 212 return (error); 213 } 214 g_topology_unlock(); 215 while (1) { | 71 g_io_deliver(bp, EOPNOTSUPP); 72 break; 73 default: 74 g_io_deliver(bp, EOPNOTSUPP); 75 return; 76 } 77 return; 78} --- 125 unchanged lines hidden (view full) --- 204 if (error) { 205 g_detach(cp); 206 g_destroy_consumer(cp); 207 g_destroy_geom(gp); 208 return (error); 209 } 210 g_topology_unlock(); 211 while (1) { |
216 error = g_getattr("GEOM::sectorsize", cp, §orsize); 217 if (error) 218 break; 219 error = g_getattr("GEOM::mediasize", cp, &mediasize); 220 if (error) 221 break; | 212 sectorsize = cp->provider->sectorsize; 213 mediasize = cp->provider->mediasize; |
222 sc = g_malloc(sizeof(struct g_bde_softc), M_WAITOK | M_ZERO); 223 gp->softc = sc; 224 sc->geom = gp; 225 sc->consumer = cp; 226 227 error = g_bde_decrypt_lock(sc, ga->ptr, 228 (u_char *)ga->ptr + 256, mediasize, sectorsize, NULL); 229 bzero(sc->arc4_sbox, sizeof sc->arc4_sbox); --- 55 unchanged lines hidden --- | 214 sc = g_malloc(sizeof(struct g_bde_softc), M_WAITOK | M_ZERO); 215 gp->softc = sc; 216 sc->geom = gp; 217 sc->consumer = cp; 218 219 error = g_bde_decrypt_lock(sc, ga->ptr, 220 (u_char *)ga->ptr + 256, mediasize, sectorsize, NULL); 221 bzero(sc->arc4_sbox, sizeof sc->arc4_sbox); --- 55 unchanged lines hidden --- |