Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/tmpfs Adapt my previous patch differently. read(2) wa...



details:   https://anonhg.NetBSD.org/src/rev/1d4966771d3b
branches:  trunk
changeset: 326786:1d4966771d3b
user:      maxv <maxv%NetBSD.org@localhost>
date:      Mon Feb 17 20:16:52 2014 +0000

description:
Adapt my previous patch differently. read(2) wants EISDIR when the
object is a directory. Which also means that tmpfs_read() was returning
a wrong error code when dealing with non-regular vnodes.

diffstat:

 sys/fs/tmpfs/tmpfs_vnops.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r 1b98f4bdd53b -r 1d4966771d3b sys/fs/tmpfs/tmpfs_vnops.c
--- a/sys/fs/tmpfs/tmpfs_vnops.c        Mon Feb 17 20:08:53 2014 +0000
+++ b/sys/fs/tmpfs/tmpfs_vnops.c        Mon Feb 17 20:16:52 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tmpfs_vnops.c,v 1.116 2014/02/16 12:54:07 maxv Exp $   */
+/*     $NetBSD: tmpfs_vnops.c,v 1.117 2014/02/17 20:16:52 maxv Exp $   */
 
 /*
  * Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.116 2014/02/16 12:54:07 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.117 2014/02/17 20:16:52 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/dirent.h>
@@ -534,6 +534,9 @@
 
        KASSERT(VOP_ISLOCKED(vp));
 
+       if (vp->v_type == VDIR) {
+               return EISDIR;
+       }
        if (uio->uio_offset < 0 || vp->v_type != VREG) {
                return EINVAL;
        }



Home | Main Index | Thread Index | Old Index