Source-Changes-HG archive

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

[src/trunk]: src/sys provide VNOVALSIZE and VNOVALFLAGS to avoid casting in s...



details:   https://anonhg.NetBSD.org/src/rev/a304f18fbdc9
branches:  trunk
changeset: 459821:a304f18fbdc9
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Sep 26 20:57:19 2019 +0000

description:
provide VNOVALSIZE and VNOVALFLAGS to avoid casting in source.

diffstat:

 sys/fs/ptyfs/ptyfs_vnops.c |  8 ++++----
 sys/sys/vnode.h            |  4 +++-
 2 files changed, 7 insertions(+), 5 deletions(-)

diffs (54 lines):

diff -r ea77061c2a30 -r a304f18fbdc9 sys/fs/ptyfs/ptyfs_vnops.c
--- a/sys/fs/ptyfs/ptyfs_vnops.c        Thu Sep 26 20:11:10 2019 +0000
+++ b/sys/fs/ptyfs/ptyfs_vnops.c        Thu Sep 26 20:57:19 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ptyfs_vnops.c,v 1.56 2019/09/26 18:35:48 christos Exp $        */
+/*     $NetBSD: ptyfs_vnops.c,v 1.57 2019/09/26 20:57:19 christos Exp $        */
 
 /*
  * Copyright (c) 1993, 1995
@@ -76,7 +76,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ptyfs_vnops.c,v 1.56 2019/09/26 18:35:48 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ptyfs_vnops.c,v 1.57 2019/09/26 20:57:19 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -405,7 +405,7 @@
        kauth_action_t action = KAUTH_VNODE_WRITE_FLAGS;
        bool changing_sysflags = false;
 
-       if (vap->va_size != (u_quad_t)VNOVAL) {
+       if (vap->va_size != VNOVALSIZE) {
                switch (ptyfs->ptyfs_type) {
                case PTYFSroot:
                        return EISDIR;
@@ -417,7 +417,7 @@
                }
        }
 
-       if (vap->va_flags != (u_quad_t)VNOVAL) {
+       if (vap->va_flags != VNOVALFLAGS) {
                if (vp->v_mount->mnt_flag & MNT_RDONLY)
                        return EROFS;
 
diff -r ea77061c2a30 -r a304f18fbdc9 sys/sys/vnode.h
--- a/sys/sys/vnode.h   Thu Sep 26 20:11:10 2019 +0000
+++ b/sys/sys/vnode.h   Thu Sep 26 20:57:19 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vnode.h,v 1.281 2019/01/01 10:06:54 hannken Exp $      */
+/*     $NetBSD: vnode.h,v 1.282 2019/09/26 20:57:19 christos Exp $     */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -277,6 +277,8 @@
  * Token indicating no attribute value yet assigned.
  */
 #define        VNOVAL  (-1)
+#define VNOVALSIZE ((u_quad_t)-1)
+#define VNOVALFLAGS ((u_long)-1)
 
 /*
  * Convert between vnode types and inode formats (since POSIX.1



Home | Main Index | Thread Index | Old Index