Sat Jan 3 04:38:07 2009 UTC ()
Clarify a comment


(dholland)
diff -r1.35 -r1.36 src/sys/miscfs/genfs/layer_vnops.c

cvs diff -r1.35 -r1.36 src/sys/miscfs/genfs/layer_vnops.c (expand / switch to unified diff)

--- src/sys/miscfs/genfs/layer_vnops.c 2008/01/30 09:50:23 1.35
+++ src/sys/miscfs/genfs/layer_vnops.c 2009/01/03 04:38:07 1.36
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: layer_vnops.c,v 1.35 2008/01/30 09:50:23 ad Exp $ */ 1/* $NetBSD: layer_vnops.c,v 1.36 2009/01/03 04:38:07 dholland Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1999 National Aeronautics & Space Administration 4 * Copyright (c) 1999 National Aeronautics & Space Administration
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This software was written by William Studenmund of the 7 * This software was written by William Studenmund of the
8 * Numerical Aerospace Simulation Facility, NASA Ames Research Center. 8 * Numerical Aerospace Simulation Facility, NASA Ames Research Center.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -222,27 +222,27 @@ @@ -222,27 +222,27 @@
222 * currently being handled on the lower layer. It has the advantage 222 * currently being handled on the lower layer. It has the advantage
223 * that the bypass routine already must do argument mapping. 223 * that the bypass routine already must do argument mapping.
224 * An example of this is null_getattrs in the null layer. 224 * An example of this is null_getattrs in the null layer.
225 * 225 *
226 * A second approach is to directly invoke vnode operations on 226 * A second approach is to directly invoke vnode operations on
227 * the lower layer with the VOP_OPERATIONNAME interface. 227 * the lower layer with the VOP_OPERATIONNAME interface.
228 * The advantage of this method is that it is easy to invoke 228 * The advantage of this method is that it is easy to invoke
229 * arbitrary operations on the lower layer. The disadvantage 229 * arbitrary operations on the lower layer. The disadvantage
230 * is that vnodes' arguments must be manually mapped. 230 * is that vnodes' arguments must be manually mapped.
231 * 231 *
232 */ 232 */
233 233
234#include <sys/cdefs.h> 234#include <sys/cdefs.h>
235__KERNEL_RCSID(0, "$NetBSD: layer_vnops.c,v 1.35 2008/01/30 09:50:23 ad Exp $"); 235__KERNEL_RCSID(0, "$NetBSD: layer_vnops.c,v 1.36 2009/01/03 04:38:07 dholland Exp $");
236 236
237#include <sys/param.h> 237#include <sys/param.h>
238#include <sys/systm.h> 238#include <sys/systm.h>
239#include <sys/proc.h> 239#include <sys/proc.h>
240#include <sys/time.h> 240#include <sys/time.h>
241#include <sys/vnode.h> 241#include <sys/vnode.h>
242#include <sys/mount.h> 242#include <sys/mount.h>
243#include <sys/namei.h> 243#include <sys/namei.h>
244#include <sys/kmem.h> 244#include <sys/kmem.h>
245#include <sys/buf.h> 245#include <sys/buf.h>
246#include <sys/kauth.h> 246#include <sys/kauth.h>
247 247
248#include <miscfs/genfs/layer.h> 248#include <miscfs/genfs/layer.h>
@@ -448,28 +448,29 @@ layer_lookup(v) @@ -448,28 +448,29 @@ layer_lookup(v)
448 448
449 if (error == EJUSTRETURN && (flags & ISLASTCN) && 449 if (error == EJUSTRETURN && (flags & ISLASTCN) &&
450 (dvp->v_mount->mnt_flag & MNT_RDONLY) && 450 (dvp->v_mount->mnt_flag & MNT_RDONLY) &&
451 (cnp->cn_nameiop == CREATE || cnp->cn_nameiop == RENAME)) 451 (cnp->cn_nameiop == CREATE || cnp->cn_nameiop == RENAME))
452 error = EROFS; 452 error = EROFS;
453 453
454 /* 454 /*
455 * We must do the same locking and unlocking at this layer as 455 * We must do the same locking and unlocking at this layer as
456 * is done in the layers below us. 456 * is done in the layers below us.
457 */ 457 */
458 if (ldvp == lvp) { 458 if (ldvp == lvp) {
459 459
460 /* 460 /*
461 * Did lookup on "." or ".." in the root node of a mount point. 461 * Got the same object back, because we looked up ".",
462 * So we return dvp after a VREF. 462 * or ".." in the root node of a mount point.
 463 * So we make another reference to dvp and return it.
463 */ 464 */
464 VREF(dvp); 465 VREF(dvp);
465 *ap->a_vpp = dvp; 466 *ap->a_vpp = dvp;
466 vrele(lvp); 467 vrele(lvp);
467 } else if (lvp != NULL) { 468 } else if (lvp != NULL) {
468 /* dvp, ldvp and vp are all locked */ 469 /* dvp, ldvp and vp are all locked */
469 error = layer_node_create(dvp->v_mount, lvp, ap->a_vpp); 470 error = layer_node_create(dvp->v_mount, lvp, ap->a_vpp);
470 if (error) { 471 if (error) {
471 vput(lvp); 472 vput(lvp);
472 } 473 }
473 } 474 }
474 return (error); 475 return (error);
475} 476}