Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/lfs Use u_int32_t instead of u_long to compute LFS c...



details:   https://anonhg.NetBSD.org/src/rev/b091bd8714af
branches:  trunk
changeset: 499629:b091bd8714af
user:      perseant <perseant%NetBSD.org@localhost>
date:      Sat Nov 25 02:39:34 2000 +0000

description:
Use u_int32_t instead of u_long to compute LFS checksums, since the
checksum is stored in a u_int32_t.

diffstat:

 sys/ufs/lfs/lfs_cksum.c  |  18 +++++++++---------
 sys/ufs/lfs/lfs_extern.h |   7 ++++---
 2 files changed, 13 insertions(+), 12 deletions(-)

diffs (73 lines):

diff -r d61640d9c106 -r b091bd8714af sys/ufs/lfs/lfs_cksum.c
--- a/sys/ufs/lfs/lfs_cksum.c   Fri Nov 24 23:30:02 2000 +0000
+++ b/sys/ufs/lfs/lfs_cksum.c   Sat Nov 25 02:39:34 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_cksum.c,v 1.13 2000/09/09 04:49:54 perseant Exp $  */
+/*     $NetBSD: lfs_cksum.c,v 1.14 2000/11/25 02:39:34 perseant Exp $  */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -91,27 +91,27 @@
  * XXX
  * Use the TCP/IP checksum instead.
  */
-u_long
+u_int32_t
 cksum(str, len)
        void *str;
        size_t len;
 {
-       u_long sum;
+       u_int32_t sum;
        
-       len &= ~(sizeof(u_short) - 1);
-       for (sum = 0; len; len -= sizeof(u_short)) {
-               sum ^= *(u_short *)str;
-               str = (void *)((u_short *)str + 1);
+       len &= ~(sizeof(u_int16_t) - 1);
+       for (sum = 0; len; len -= sizeof(u_int16_t)) {
+               sum ^= *(u_int16_t *)str;
+               str = (void *)((u_int16_t *)str + 1);
        }
        return (sum);
 }
 
-u_long 
+u_int32_t
 lfs_sb_cksum(fs)
        struct dlfs *fs;
 {
        size_t size;  
        
        size = (size_t)offsetof(struct dlfs, dlfs_cksum);
-       return cksum(fs,size);
+       return cksum(fs, size);
 }
diff -r d61640d9c106 -r b091bd8714af sys/ufs/lfs/lfs_extern.h
--- a/sys/ufs/lfs/lfs_extern.h  Fri Nov 24 23:30:02 2000 +0000
+++ b/sys/ufs/lfs/lfs_extern.h  Sat Nov 25 02:39:34 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_extern.h,v 1.22 2000/11/17 19:14:41 perseant Exp $ */
+/*     $NetBSD: lfs_extern.h,v 1.23 2000/11/25 02:39:35 perseant Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -111,6 +111,7 @@
 
 __BEGIN_DECLS
 /* lfs_alloc.c */
+int lfs_rf_valloc __P((struct lfs *, ino_t, int, struct proc *, struct vnode **));
 void lfs_vcreate __P((struct mount *, ino_t, struct vnode *));
 /* lfs_bio.c */
 int lfs_availwait __P((struct lfs *, int));
@@ -124,8 +125,8 @@
 int lfs_reserve __P((struct lfs *, struct vnode *, int));
 
 /* lfs_cksum.c */
-u_long cksum __P((void *, size_t));
-u_long lfs_sb_cksum __P((struct dlfs *));
+u_int32_t cksum __P((void *, size_t));
+u_int32_t lfs_sb_cksum __P((struct dlfs *));
 
 /* lfs_debug.c */
 #ifdef DEBUG



Home | Main Index | Thread Index | Old Index