Source-Changes-HG archive

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

[src/trunk]: src/sys/miscfs/kernfs Find the right entry when doing lookup on ...



details:   https://anonhg.NetBSD.org/src/rev/77f85867df3b
branches:  trunk
changeset: 566381:77f85867df3b
user:      cl <cl%NetBSD.org@localhost>
date:      Fri May 07 14:56:48 2004 +0000

description:
Find the right entry when doing lookup on dotdot in kern/ipsec subdirs.
Also remove some duplicate code.

diffstat:

 sys/miscfs/kernfs/kernfs_vnops.c |  40 ++++++++++++++++++----------------------
 1 files changed, 18 insertions(+), 22 deletions(-)

diffs (72 lines):

diff -r 45258c263ae9 -r 77f85867df3b sys/miscfs/kernfs/kernfs_vnops.c
--- a/sys/miscfs/kernfs/kernfs_vnops.c  Fri May 07 14:15:11 2004 +0000
+++ b/sys/miscfs/kernfs/kernfs_vnops.c  Fri May 07 14:56:48 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kernfs_vnops.c,v 1.99 2004/04/29 16:10:55 jrf Exp $    */
+/*     $NetBSD: kernfs_vnops.c,v 1.100 2004/05/07 14:56:48 cl Exp $    */
 
 /*
  * Copyright (c) 1992, 1993
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.99 2004/04/29 16:10:55 jrf Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.100 2004/05/07 14:56:48 cl Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ipsec.h"
@@ -477,18 +477,16 @@
 
 #ifdef IPSEC
        case KFSipsecsadir:
-               for (i = 0; i < nipsecsa_targets; i++) {
+               if (cnp->cn_flags & ISDOTDOT) {
+                       kt = &kern_targets[0];
+                       goto found;
+               }
+
+               for (i = 2; i < nipsecsa_targets; i++) {
                        kt = &ipsecsa_targets[i];
                        if (cnp->cn_namelen == kt->kt_namlen &&
-                           memcmp(kt->kt_name, pname, cnp->cn_namelen) == 0) {
-                               error = kernfs_allocvp(dvp->v_mount, vpp,
-                                   kt->kt_tag, kt, 0);
-                               if ((error == 0) && wantpunlock) {
-                                       VOP_UNLOCK(dvp, 0);
-                                       cnp->cn_flags |= PDIRUNLOCK;
-                               }
-                               return (error);
-                       }
+                           memcmp(kt->kt_name, pname, cnp->cn_namelen) == 0)
+                               goto found;
                }
 
                ep = NULL;
@@ -504,18 +502,16 @@
                return (error);
 
        case KFSipsecspdir:
-               for (i = 0; i < nipsecsp_targets; i++) {
+               if (cnp->cn_flags & ISDOTDOT) {
+                       kt = &kern_targets[0];
+                       goto found;
+               }
+
+               for (i = 2; i < nipsecsp_targets; i++) {
                        kt = &ipsecsp_targets[i];
                        if (cnp->cn_namelen == kt->kt_namlen &&
-                           memcmp(kt->kt_name, pname, cnp->cn_namelen) == 0) {
-                               error = kernfs_allocvp(dvp->v_mount, vpp,
-                                   kt->kt_tag, kt, 0);
-                               if ((error == 0) && wantpunlock) {
-                                       VOP_UNLOCK(dvp, 0);
-                                       cnp->cn_flags |= PDIRUNLOCK;
-                               }
-                               return (error);
-                       }
+                           memcmp(kt->kt_name, pname, cnp->cn_namelen) == 0)
+                               goto found;
                }
 
                ep = NULL;



Home | Main Index | Thread Index | Old Index