Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/ffs Sprinkle in a pinch of const, not too much, just...



details:   https://anonhg.NetBSD.org/src/rev/a49d6363bb75
branches:  trunk
changeset: 351302:a49d6363bb75
user:      kre <kre%NetBSD.org@localhost>
date:      Thu Feb 09 04:37:35 2017 +0000

description:
Sprinkle in a pinch of const, not too much, just enough
to add a little strength without affecting the overall balance...

diffstat:

 sys/ufs/ffs/ffs_bswap.c  |  13 +++++++------
 sys/ufs/ffs/ffs_extern.h |   6 +++---
 2 files changed, 10 insertions(+), 9 deletions(-)

diffs (74 lines):

diff -r a993b274c582 -r a49d6363bb75 sys/ufs/ffs/ffs_bswap.c
--- a/sys/ufs/ffs/ffs_bswap.c   Thu Feb 09 03:38:01 2017 +0000
+++ b/sys/ufs/ffs/ffs_bswap.c   Thu Feb 09 04:37:35 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_bswap.c,v 1.39 2015/05/20 18:21:17 riastradh Exp $ */
+/*     $NetBSD: ffs_bswap.c,v 1.40 2017/02/09 04:37:35 kre Exp $       */
 
 /*
  * Copyright (c) 1998 Manuel Bouyer.
@@ -30,7 +30,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_bswap.c,v 1.39 2015/05/20 18:21:17 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_bswap.c,v 1.40 2017/02/09 04:37:35 kre Exp $");
 
 #include <sys/param.h>
 #if defined(_KERNEL)
@@ -52,17 +52,18 @@
 #endif
 
 void
-ffs_sb_swap(struct fs *o, struct fs *n)
+ffs_sb_swap(const struct fs *o, struct fs *n)
 {
        size_t i;
-       u_int32_t *o32, *n32;
+       const u_int32_t *o32;
+       u_int32_t *n32;
 
        /*
         * In order to avoid a lot of lines, as the first N fields (52)
         * of the superblock up to fs_fmod are u_int32_t, we just loop
         * here to convert them.
         */
-       o32 = (u_int32_t *)o;
+       o32 = (const u_int32_t *)o;
        n32 = (u_int32_t *)n;
        for (i = 0; i < offsetof(struct fs, fs_fmod) / sizeof(u_int32_t); i++)
                n32[i] = bswap32(o32[i]);
@@ -178,7 +179,7 @@
 }
 
 void
-ffs_csumtotal_swap(struct csum_total *o, struct csum_total *n)
+ffs_csumtotal_swap(const struct csum_total *o, struct csum_total *n)
 {
        n->cs_ndir = bswap64(o->cs_ndir);
        n->cs_nbfree = bswap64(o->cs_nbfree);
diff -r a993b274c582 -r a49d6363bb75 sys/ufs/ffs/ffs_extern.h
--- a/sys/ufs/ffs/ffs_extern.h  Thu Feb 09 03:38:01 2017 +0000
+++ b/sys/ufs/ffs/ffs_extern.h  Thu Feb 09 04:37:35 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_extern.h,v 1.83 2016/10/01 13:15:45 jdolecek Exp $ */
+/*     $NetBSD: ffs_extern.h,v 1.84 2017/02/09 04:37:35 kre Exp $      */
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -186,13 +186,13 @@
                         uint64_t);
 
 /* ffs_bswap.c */
-void   ffs_sb_swap(struct fs*, struct fs *);
+void   ffs_sb_swap(const struct fs *, struct fs *);
 void   ffs_dinode1_swap(struct ufs1_dinode *, struct ufs1_dinode *);
 void   ffs_dinode2_swap(struct ufs2_dinode *, struct ufs2_dinode *);
 struct csum;
 void   ffs_csum_swap(struct csum *, struct csum *, int);
 struct csum_total;
-void   ffs_csumtotal_swap(struct csum_total *, struct csum_total *);
+void   ffs_csumtotal_swap(const struct csum_total *, struct csum_total *);
 void   ffs_cg_swap(struct cg *, struct cg *, struct fs *);
 
 /* ffs_subr.c */



Home | Main Index | Thread Index | Old Index