Module Name: src
Committed By: hannken
Date: Tue Aug 23 07:40:32 UTC 2011
Modified Files:
src/sys/rump/librump/rumpvfs: rumpfs.c
Log Message:
When consuming only part of a path in rump_vop_lookup():
- Make sure to consume complete path components.
- Consume trailing slashes too.
- Do not clear REQUIREDIR.
Test rump/modautoload/t_modautoload now passes.
To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/rump/librump/rumpvfs/rumpfs.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/rump/librump/rumpvfs/rumpfs.c
diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.98 src/sys/rump/librump/rumpvfs/rumpfs.c:1.99
--- src/sys/rump/librump/rumpvfs/rumpfs.c:1.98 Sun Aug 7 05:56:32 2011
+++ src/sys/rump/librump/rumpvfs/rumpfs.c Tue Aug 23 07:40:32 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpfs.c,v 1.98 2011/08/07 05:56:32 hannken Exp $ */
+/* $NetBSD: rumpfs.c,v 1.99 2011/08/23 07:40:32 hannken Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.98 2011/08/07 05:56:32 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.99 2011/08/23 07:40:32 hannken Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -664,6 +664,7 @@
struct etfs *et;
bool dotdot = (cnp->cn_flags & ISDOTDOT) != 0;
int rv = 0;
+ const char *cp;
*vpp = NULL;
@@ -694,8 +695,17 @@
if (found) {
rn = et->et_rn;
cnp->cn_consume += et->et_keylen - cnp->cn_namelen;
- if (rn->rn_va.va_type != VDIR)
+ /*
+ * consume trailing slashes if any and clear
+ * REQUIREDIR if we consumed the full path.
+ */
+ cp = &cnp->cn_nameptr[cnp->cn_namelen];
+ cp += cnp->cn_consume;
+ KASSERT(*cp == '\0' || *cp == '/');
+ if (*cp == '\0' && rn->rn_va.va_type != VDIR)
cnp->cn_flags &= ~REQUIREDIR;
+ while (*cp++ == '/')
+ cnp->cn_consume++;
goto getvnode;
}
}