Module Name: src Committed By: pooka Date: Thu Mar 26 14:03:30 UTC 2009
Modified Files: src/lib/libp2k: p2k.c Log Message: Don't abort() if the kernel complains we supplied an invalid type for lookup, as this most likely means that the fs has some bad file on it. Rather, just flag an error to the user and be happy. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/lib/libp2k/p2k.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libp2k/p2k.c diff -u src/lib/libp2k/p2k.c:1.9 src/lib/libp2k/p2k.c:1.10 --- src/lib/libp2k/p2k.c:1.9 Sun Feb 22 20:28:05 2009 +++ src/lib/libp2k/p2k.c Thu Mar 26 14:03:30 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: p2k.c,v 1.9 2009/02/22 20:28:05 ad Exp $ */ +/* $NetBSD: p2k.c,v 1.10 2009/03/26 14:03:30 pooka Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -54,6 +54,7 @@ #include <errno.h> #include <puffs.h> #include <stdlib.h> +#include <stdio.h> #include <rump/rump.h> #include <rump/p2k.h> @@ -132,6 +133,23 @@ rump_clear_curlwp(); } +static void +p2k_errcatcher(struct puffs_usermount *pu, uint8_t type, int error, + const char *str, puffs_cookie_t cook) +{ + + fprintf(stderr, "type %d, error %d, cookie %p (%s)\n", + type, error, cook, str); + + /* + * Trap all EINVAL responses to lookup. It most likely means + * that we supplied VNON/VBAD as the type. The real kernel + * doesn't panic from this either, but just handles it. + */ + if (type != PUFFS_VN_LOOKUP && error == EINVAL) + abort(); +} + int p2k_run_fs(const char *vfsname, const char *devpath, const char *mountpath, int mntflags, void *arg, size_t alen, uint32_t puffs_flags) @@ -221,6 +239,7 @@ puffs_fakecc = 1; puffs_set_prepost(pu, makelwp, clearlwp); + puffs_set_errnotify(pu, p2k_errcatcher); puffs_setspecific(pu, ukfs_getmp(ukfs)); if ((rv = puffs_mount(pu, mountpath, mntflags, rvp))== -1)