diff options
| author | dholland <dholland@NetBSD.org> | 2010-11-19 06:44:33 +0000 |
|---|---|---|
| committer | dholland <dholland@NetBSD.org> | 2010-11-19 06:44:33 +0000 |
| commit | 8f6ed30d57969451cf6dee44963bdbfad19bea01 (patch) | |
| tree | 4d7f4fee51c9f0d03aeb78a6de5fe56a3a096106 /sys/dev/kloader.c | |
| parent | 0ce666ede04fa90ffe8633b9bd63f0454d2c09ff (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/kloader.c')
| -rw-r--r-- | sys/dev/kloader.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sys/dev/kloader.c b/sys/dev/kloader.c index 481bd2acf8f..86c8ed72a2f 100644 --- a/sys/dev/kloader.c +++ b/sys/dev/kloader.c @@ -1,4 +1,4 @@ -/* $NetBSD: kloader.c,v 1.23 2010/11/12 16:47:18 uebayasi Exp $ */ +/* $NetBSD: kloader.c,v 1.24 2010/11/19 06:44:39 dholland Exp $ */ /*- * Copyright (c) 2001, 2002, 2004 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kloader.c,v 1.23 2010/11/12 16:47:18 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kloader.c,v 1.24 2010/11/19 06:44:39 dholland Exp $"); #include "debug_kloader.h" @@ -585,14 +585,22 @@ kloader_load_segment(Elf_Phdr *p) struct vnode * kloader_open(const char *filename) { + struct pathbuf *pb; struct nameidata nid; int error; - NDINIT(&nid, LOOKUP, FOLLOW, UIO_SYSSPACE, filename); + pb = pathbuf_create(filename); + if (pb == NULL) { + PRINTF("%s: pathbuf_create failed\n", filename); + return (NULL); + } + + NDINIT(&nid, LOOKUP, FOLLOW, pb); error = namei(&nid); if (error != 0) { PRINTF("%s: namei failed, errno=%d\n", filename, error); + pathbuf_destroy(pb); return (NULL); } @@ -602,6 +610,7 @@ kloader_open(const char *filename) return (NULL); } + pathbuf_destroy(pb); return (nid.ni_vp); } |
