g_eli_ctl.c (148456) | g_eli_ctl.c (149304) |
---|---|
1/*- 2 * Copyright (c) 2005 Pawel Jakub Dawidek <pjd@FreeBSD.org> 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> | 1/*- 2 * Copyright (c) 2005 Pawel Jakub Dawidek <pjd@FreeBSD.org> 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_ctl.c 148456 2005-07-27 21:43:37Z pjd $"); | 28__FBSDID("$FreeBSD: head/sys/geom/eli/g_eli_ctl.c 149304 2005-08-19 22:19:25Z pjd $"); |
29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/kernel.h> 33#include <sys/module.h> 34#include <sys/lock.h> 35#include <sys/mutex.h> 36#include <sys/bio.h> --- 285 unchanged lines hidden (view full) --- 322{ 323 struct g_eli_softc *sc; 324 struct g_eli_metadata md; 325 struct g_provider *pp; 326 struct g_consumer *cp; 327 const char *name; 328 u_char *key, *mkeydst, *sector; 329 intmax_t *valp; | 29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/kernel.h> 33#include <sys/module.h> 34#include <sys/lock.h> 35#include <sys/mutex.h> 36#include <sys/bio.h> --- 285 unchanged lines hidden (view full) --- 322{ 323 struct g_eli_softc *sc; 324 struct g_eli_metadata md; 325 struct g_provider *pp; 326 struct g_consumer *cp; 327 const char *name; 328 u_char *key, *mkeydst, *sector; 329 intmax_t *valp; |
330 int nkey; 331 int keysize, error; | 330 int keysize, nkey, error; |
332 333 g_topology_assert(); 334 335 name = gctl_get_asciiparam(req, "arg0"); 336 if (name == NULL) { 337 gctl_error(req, "No 'arg%u' argument.", 0); 338 return; 339 } --- 21 unchanged lines hidden (view full) --- 361 nkey = *valp; 362 else 363 nkey = sc->sc_nkey; 364 if (nkey < 0 || nkey >= G_ELI_MAXMKEYS) { 365 gctl_error(req, "Invalid '%s' argument.", "keyno"); 366 return; 367 } 368 | 331 332 g_topology_assert(); 333 334 name = gctl_get_asciiparam(req, "arg0"); 335 if (name == NULL) { 336 gctl_error(req, "No 'arg%u' argument.", 0); 337 return; 338 } --- 21 unchanged lines hidden (view full) --- 360 nkey = *valp; 361 else 362 nkey = sc->sc_nkey; 363 if (nkey < 0 || nkey >= G_ELI_MAXMKEYS) { 364 gctl_error(req, "Invalid '%s' argument.", "keyno"); 365 return; 366 } 367 |
368 valp = gctl_get_paraml(req, "iterations", sizeof(*valp)); 369 if (valp == NULL) { 370 gctl_error(req, "No '%s' argument.", "iterations"); 371 return; 372 } 373 /* Check if iterations number should and can be changed. */ 374 if (*valp != -1) { 375 if (bitcount32(md.md_keys) != 1) { 376 gctl_error(req, "To be able to use '-i' option, only " 377 "one key can be defined."); 378 return; 379 } 380 if (md.md_keys != (1 << nkey)) { 381 gctl_error(req, "Only already defined key can be " 382 "changed when '-i' option is used."); 383 return; 384 } 385 md.md_iterations = *valp; 386 } 387 |
|
369 key = gctl_get_param(req, "key", &keysize); 370 if (key == NULL || keysize != G_ELI_USERKEYLEN) { 371 bzero(&md, sizeof(md)); 372 gctl_error(req, "No '%s' argument.", "key"); 373 return; 374 } 375 376 mkeydst = md.md_mkeys + nkey * G_ELI_MKEYLEN; --- 263 unchanged lines hidden --- | 388 key = gctl_get_param(req, "key", &keysize); 389 if (key == NULL || keysize != G_ELI_USERKEYLEN) { 390 bzero(&md, sizeof(md)); 391 gctl_error(req, "No '%s' argument.", "key"); 392 return; 393 } 394 395 mkeydst = md.md_mkeys + nkey * G_ELI_MKEYLEN; --- 263 unchanged lines hidden --- |