Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/rump/librump/rumpvfs When consuming only part of a path ...



details:   https://anonhg.NetBSD.org/src/rev/57d40e20a1c6
branches:  trunk
changeset: 768619:57d40e20a1c6
user:      hannken <hannken%NetBSD.org@localhost>
date:      Tue Aug 23 07:40:32 2011 +0000

description:
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.

diffstat:

 sys/rump/librump/rumpvfs/rumpfs.c |  16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diffs (45 lines):

diff -r cf3933925230 -r 57d40e20a1c6 sys/rump/librump/rumpvfs/rumpfs.c
--- a/sys/rump/librump/rumpvfs/rumpfs.c Tue Aug 23 07:39:37 2011 +0000
+++ b/sys/rump/librump/rumpvfs/rumpfs.c Tue Aug 23 07:40:32 2011 +0000
@@ -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;
                }
        }



Home | Main Index | Thread Index | Old Index