Deleted Added
full compact
geom_ctl.c (112709) geom_ctl.c (112876)
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/geom_ctl.c 112709 2003-03-27 14:35:00Z phk $
35 * $FreeBSD: head/sys/geom/geom_ctl.c 112876 2003-03-31 18:35:37Z phk $
36 */
37
38#include "opt_geom.h"
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/kernel.h>
43#include <sys/sysctl.h>

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

393{
394 struct g_class *mp;
395 struct g_provider *pp;
396
397 g_topology_assert();
398 mp = gctl_get_class(req);
399 if (mp == NULL)
400 return;
36 */
37
38#include "opt_geom.h"
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/kernel.h>
43#include <sys/sysctl.h>

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

393{
394 struct g_class *mp;
395 struct g_provider *pp;
396
397 g_topology_assert();
398 mp = gctl_get_class(req);
399 if (mp == NULL)
400 return;
401 printf("Found class: %p\n", mp);
402 if (mp->create_geom == NULL) {
403 gctl_error(req, "Class has no create_geom method");
404 return;
405 }
406 pp = gctl_get_provider(req);
401 if (mp->create_geom == NULL) {
402 gctl_error(req, "Class has no create_geom method");
403 return;
404 }
405 pp = gctl_get_provider(req);
407 printf("Found provider: %p\n", pp);
408 mp->create_geom(req, mp, pp);
409 g_topology_assert();
410}
411
412static void
413gctl_destroy_geom(struct gctl_req *req)
414{
415 struct g_class *mp;
416 struct g_geom *gp;
417
418 g_topology_assert();
419 mp = gctl_get_class(req);
420 if (mp == NULL)
421 return;
406 mp->create_geom(req, mp, pp);
407 g_topology_assert();
408}
409
410static void
411gctl_destroy_geom(struct gctl_req *req)
412{
413 struct g_class *mp;
414 struct g_geom *gp;
415
416 g_topology_assert();
417 mp = gctl_get_class(req);
418 if (mp == NULL)
419 return;
422 printf("Found class: %p\n", mp);
423 if (mp->destroy_geom == NULL) {
424 gctl_error(req, "Class has no destroy_geom method");
425 return;
426 }
427 gp = gctl_get_geom(req, mp);
428 if (gp == NULL) {
429 gctl_error(req, "Geom not specified");
430 return;
431 }
432 if (gp->class != mp) {
433 gctl_error(req, "Geom not of specificed class");
434 return;
435 }
420 if (mp->destroy_geom == NULL) {
421 gctl_error(req, "Class has no destroy_geom method");
422 return;
423 }
424 gp = gctl_get_geom(req, mp);
425 if (gp == NULL) {
426 gctl_error(req, "Geom not specified");
427 return;
428 }
429 if (gp->class != mp) {
430 gctl_error(req, "Geom not of specificed class");
431 return;
432 }
436 printf("Found geom: %p\n", gp);
437 mp->destroy_geom(req, mp, gp);
438 g_topology_assert();
439}
440
441/*
442 * Handle ioctl from libgeom::geom_ctl.c
443 */
444static int

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

468 return (gctl_error(req, "invalid request"));
469 req->reqt = &gcrt[i];
470
471 /* Get things on board */
472 error = gctl_copyin(req);
473 if (error)
474 return (error);
475
433 mp->destroy_geom(req, mp, gp);
434 g_topology_assert();
435}
436
437/*
438 * Handle ioctl from libgeom::geom_ctl.c
439 */
440static int

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

464 return (gctl_error(req, "invalid request"));
465 req->reqt = &gcrt[i];
466
467 /* Get things on board */
468 error = gctl_copyin(req);
469 if (error)
470 return (error);
471
476 gctl_dump(req);
472 if (g_debugflags & G_F_CTLDUMP)
473 gctl_dump(req);
477#if 0
478 g_stall_events();
479#endif
480 g_topology_lock();
481 switch (req->request) {
482 case GCTL_CREATE_GEOM:
483 gctl_create_geom(req);
484 break;

--- 39 unchanged lines hidden ---
474#if 0
475 g_stall_events();
476#endif
477 g_topology_lock();
478 switch (req->request) {
479 case GCTL_CREATE_GEOM:
480 gctl_create_geom(req);
481 break;

--- 39 unchanged lines hidden ---