summaryrefslogtreecommitdiff
path: root/sys/dev/dm/dm_pdev.c
diff options
context:
space:
mode:
authordholland <dholland@NetBSD.org>2010-11-19 06:44:33 +0000
committerdholland <dholland@NetBSD.org>2010-11-19 06:44:33 +0000
commit8f6ed30d57969451cf6dee44963bdbfad19bea01 (patch)
tree4d7f4fee51c9f0d03aeb78a6de5fe56a3a096106 /sys/dev/dm/dm_pdev.c
parent0ce666ede04fa90ffe8633b9bd63f0454d2c09ff (diff)
Introduce struct pathbuf. This is an abstraction to hold a pathname
and the metadata required to interpret it. Callers of namei must now create a pathbuf and pass it to NDINIT (instead of a string and a uio_seg), then destroy the pathbuf after the namei session is complete. Update all namei call sites accordingly. Add a pathbuf(9) man page and update namei(9). The pathbuf interface also now appears in a couple of related additional places that were passing string/uio_seg pairs that were later fed into NDINIT. Update other call sites accordingly.
Diffstat (limited to 'sys/dev/dm/dm_pdev.c')
-rw-r--r--sys/dev/dm/dm_pdev.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/dev/dm/dm_pdev.c b/sys/dev/dm/dm_pdev.c
index 250624898f2..7f63a463691 100644
--- a/sys/dev/dm/dm_pdev.c
+++ b/sys/dev/dm/dm_pdev.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_pdev.c,v 1.6 2010/01/04 00:19:08 haad Exp $ */
+/* $NetBSD: dm_pdev.c,v 1.7 2010/11/19 06:44:40 dholland Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -84,6 +84,7 @@ SLIST_HEAD(dm_pdevs, dm_pdev) dm_pdev_list;
dm_pdev_t *
dm_pdev_insert(const char *dev_name)
{
+ struct pathbuf *dev_pb;
dm_pdev_t *dmp;
int error;
@@ -103,7 +104,15 @@ dm_pdev_insert(const char *dev_name)
if ((dmp = dm_pdev_alloc(dev_name)) == NULL)
return NULL;
- error = dk_lookup(dev_name, curlwp, &dmp->pdev_vnode, UIO_SYSSPACE);
+ dev_pb = pathbuf_create(dev_name);
+ if (dev_pb == NULL) {
+ aprint_debug("pathbuf_create on device: %s failed!\n",
+ dev_name);
+ kmem_free(dmp, sizeof(dm_pdev_t));
+ return NULL;
+ }
+ error = dk_lookup(dev_pb, curlwp, &dmp->pdev_vnode);
+ pathbuf_destroy(dev_pb);
if (error) {
aprint_debug("dk_lookup on device: %s failed with error %d!\n",
dev_name, error);