diff --git a/sys/dev/dm/dm.h b/sys/dev/dm/dm.h index ed177d8941a0..1dc5d7c5d59c 100644 --- a/sys/dev/dm/dm.h +++ b/sys/dev/dm/dm.h @@ -1,4 +1,4 @@ -/* $NetBSD: dm.h,v 1.10 2009/03/01 23:15:56 haad Exp $ */ +/* $NetBSD: dm.h,v 1.11 2009/03/06 16:17:29 haad Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -43,6 +43,8 @@ #include #include +#include + #define DM_MAX_TYPE_NAME 16 #define DM_NAME_LEN 128 #define DM_UUID_LEN 129 @@ -130,7 +132,6 @@ typedef struct dm_dev { struct dm_dev_head upcalls; - struct disklabel *dk_label; /* Disklabel for this table. */ struct disk *diskp; TAILQ_ENTRY(dm_dev) next_upcall; /* LIST of mirrored, snapshoted devices. */ diff --git a/sys/dev/dm/dm_dev.c b/sys/dev/dm/dm_dev.c index fa5ce67636b7..899b4975badc 100644 --- a/sys/dev/dm/dm_dev.c +++ b/sys/dev/dm/dm_dev.c @@ -1,4 +1,4 @@ -/* $NetBSD: dm_dev.c,v 1.2 2008/12/19 15:24:03 haad Exp $ */ +/* $NetBSD: dm_dev.c,v 1.3 2009/03/06 16:17:29 haad Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -89,7 +90,7 @@ dm_dev_lookup(const char *dm_dev_name, const char *dm_dev_uuid, } if (dm_dev_uuid != NULL) - if ((dmv = dm_dev_lookup_name(dm_dev_uuid)) != NULL){ + if ((dmv = dm_dev_lookup_uuid(dm_dev_uuid)) != NULL){ dm_dev_busy(dmv); mutex_exit(&dm_dev_mutex); return dmv; @@ -304,8 +305,10 @@ dm_dev_alloc() dm_dev_t *dmv; dmv = kmem_zalloc(sizeof(dm_dev_t), KM_NOSLEEP); - dmv->dk_label = kmem_zalloc(sizeof(struct disklabel), KM_NOSLEEP); - + + if(dmv != NULL) + dmv->diskp = kmem_zalloc(sizeof(struct disk), KM_NOSLEEP); + return dmv; } @@ -316,9 +319,9 @@ int dm_dev_free(dm_dev_t *dmv) { KASSERT(dmv != NULL); - - if (dmv->dk_label != NULL) - (void)kmem_free(dmv->dk_label, sizeof(struct disklabel)); + + if(dmv->diskp != NULL) + (void)kmem_free(dmv->diskp, sizeof(struct disk)); (void)kmem_free(dmv, sizeof(dm_dev_t));