Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/ffs KNF. No functional change.



details:   https://anonhg.NetBSD.org/src/rev/5592a11418d5
branches:  trunk
changeset: 806276:5592a11418d5
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Feb 14 07:56:31 2015 +0000

description:
KNF. No functional change.

diffstat:

 sys/ufs/ffs/ffs_appleufs.c |  32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)

diffs (102 lines):

diff -r 2f7d39a45269 -r 5592a11418d5 sys/ufs/ffs/ffs_appleufs.c
--- a/sys/ufs/ffs/ffs_appleufs.c        Sat Feb 14 07:41:40 2015 +0000
+++ b/sys/ufs/ffs/ffs_appleufs.c        Sat Feb 14 07:56:31 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_appleufs.c,v 1.12 2011/11/19 22:51:31 tls Exp $    */
+/*     $NetBSD: ffs_appleufs.c,v 1.13 2015/02/14 07:56:31 maxv Exp $   */
 
 /*
  * Copyright (c) 2002 Darrin B. Jewell
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_appleufs.c,v 1.12 2011/11/19 22:51:31 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_appleufs.c,v 1.13 2015/02/14 07:56:31 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/time.h>
@@ -52,7 +52,7 @@
 #endif
 
 /*
- * this is the same calculation as in_cksum
+ * This is the same calculation as in_cksum.
  */
 u_int16_t
 ffs_appleufs_cksum(const struct appleufslabel *appleufs)
@@ -73,26 +73,28 @@
        return (~res);
 }
 
-/* copies o to n, validating and byteswapping along the way
- * returns 0 if ok, EINVAL if not valid
+/*
+ * Copies o to n, validating and byteswapping along the way. Returns 0 if ok,
+ * EINVAL if not valid.
  */
 int
 ffs_appleufs_validate(const char *name, const struct appleufslabel *o,
     struct appleufslabel *n)
 {
        struct appleufslabel tmp;
-       if (!n) n = &tmp;
 
-       if (o->ul_magic != be32toh(APPLEUFS_LABEL_MAGIC)) {
+       if (!n)
+               n = &tmp;
+       if (o->ul_magic != be32toh(APPLEUFS_LABEL_MAGIC))
                return EINVAL;
-       }
+
        *n = *o;
        n->ul_checksum = 0;
        n->ul_checksum = ffs_appleufs_cksum(n);
        if (n->ul_checksum != o->ul_checksum) {
 #if defined(DIAGNOSTIC) || !defined(_KERNEL)
                printf("%s: invalid APPLE UFS checksum. found 0x%x, expecting 0x%x",
-                       name,o->ul_checksum,n->ul_checksum);
+                   name, o->ul_checksum, n->ul_checksum);
 #endif
                return EINVAL;
        }
@@ -104,7 +106,7 @@
        if (n->ul_namelen > APPLEUFS_MAX_LABEL_NAME) {
 #if defined(DIAGNOSTIC) || !defined(_KERNEL)
                printf("%s: APPLE UFS label name too long, truncated.\n",
-                               name);
+                   name);
 #endif
                n->ul_namelen = APPLEUFS_MAX_LABEL_NAME;
        }
@@ -112,8 +114,8 @@
        n->ul_name[n->ul_namelen - 1] = '\0';
 
 #ifdef DEBUG
-       printf("%s: found APPLE UFS label v%d: \"%s\"\n",
-           name,n->ul_version,n->ul_name);
+       printf("%s: found APPLE UFS label v%d: \"%s\"\n", name,
+           n->ul_version, n->ul_name);
 #endif
        n->ul_uuid = be64toh(o->ul_uuid);
 
@@ -125,7 +127,9 @@
     uint64_t uuid)
 {
        size_t namelen;
-       if (!name) name = "untitled";
+
+       if (!name)
+               name = "untitled";
        if (t == ((time_t)-1)) {
 #if defined(_KERNEL)
                t = time_second;
@@ -148,7 +152,7 @@
        appleufs->ul_version = htobe32(APPLEUFS_LABEL_VERSION);
        appleufs->ul_time    = htobe32((u_int32_t)t);
        appleufs->ul_namelen = htobe16(namelen);
-       strncpy(appleufs->ul_name,name,namelen);
+       strncpy(appleufs->ul_name, name, namelen);
        appleufs->ul_uuid    = htobe64(uuid);
        appleufs->ul_checksum = ffs_appleufs_cksum(appleufs);
 }



Home | Main Index | Thread Index | Old Index