Source-Changes-HG archive

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

[src/trunk]: src Document the ctod-family of macros from <sys/param.h>.



details:   https://anonhg.NetBSD.org/src/rev/593acda3410f
branches:  trunk
changeset: 753883:593acda3410f
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Tue Apr 13 08:40:19 2010 +0000

description:
Document the ctod-family of macros from <sys/param.h>.

XXX: Someone may want to check if there is anything to add or correct.

diffstat:

 distrib/sets/lists/comp/mi |  20 ++++++++++++-
 share/man/man9/Makefile    |   9 ++++-
 share/man/man9/ctod.9      |  71 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 97 insertions(+), 3 deletions(-)

diffs (216 lines):

diff -r 8e9e09b00861 -r 593acda3410f distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi        Tue Apr 13 08:24:31 2010 +0000
+++ b/distrib/sets/lists/comp/mi        Tue Apr 13 08:40:19 2010 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: mi,v 1.1428 2010/04/13 07:32:31 jruoho Exp $
+#      $NetBSD: mi,v 1.1429 2010/04/13 08:40:19 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -8660,6 +8660,8 @@
 ./usr/share/man/cat9/bswap16.0                 comp-sys-catman         .cat
 ./usr/share/man/cat9/bswap32.0                 comp-sys-catman         .cat
 ./usr/share/man/cat9/bswap64.0                 comp-sys-catman         .cat
+./usr/share/man/cat9/btoc.0                    comp-sys-catman         .cat
+./usr/share/man/cat9/btodb.0                   comp-sys-catman         .cat
 ./usr/share/man/cat9/buffercache.0             comp-sys-catman         .cat
 ./usr/share/man/cat9/bufq.0                    comp-sys-catman         .cat
 ./usr/share/man/cat9/bus_dma.0                 comp-sys-catman         .cat
@@ -8856,6 +8858,8 @@
 ./usr/share/man/cat9/crypto_register.0         comp-sys-catman         .cat
 ./usr/share/man/cat9/crypto_unregister.0       comp-sys-catman         .cat
 ./usr/share/man/cat9/csf.0                     comp-sys-catman         .cat
+./usr/share/man/cat9/ctob.0                    comp-sys-catman         .cat
+./usr/share/man/cat9/ctod.0                    comp-sys-catman         .cat
 ./usr/share/man/cat9/ctxsw.0                   comp-obsolete           obsolete
 ./usr/share/man/cat9/curcpu.0                  comp-sys-catman         .cat
 ./usr/share/man/cat9/curproc.0                 comp-sys-catman         .cat
@@ -8871,6 +8875,7 @@
 ./usr/share/man/cat9/cv_wait.0                 comp-sys-catman         .cat
 ./usr/share/man/cat9/cv_wait_sig.0             comp-sys-catman         .cat
 ./usr/share/man/cat9/cv_wakeup.0               comp-obsolete           obsolete
+./usr/share/man/cat9/dbtob.0                   comp-sys-catman         .cat
 ./usr/share/man/cat9/ddc.0                     comp-sys-catman         .cat
 ./usr/share/man/cat9/delay.0                   comp-sys-catman         .cat
 ./usr/share/man/cat9/deviter.0                 comp-sys-catman         .cat
@@ -8907,6 +8912,7 @@
 ./usr/share/man/cat9/dofilewritev.0            comp-sys-catman         .cat
 ./usr/share/man/cat9/dopowerhooks.0            comp-sys-catman         .cat
 ./usr/share/man/cat9/doshutdownhooks.0         comp-sys-catman         .cat
+./usr/share/man/cat9/dtoc.0                    comp-sys-catman         .cat
 ./usr/share/man/cat9/driver.0                  comp-sys-catman         .cat
 ./usr/share/man/cat9/dumpsys.0                 comp-sys-catman         .cat
 ./usr/share/man/cat9/dupfdopen.0               comp-sys-catman         .cat
@@ -14350,6 +14356,8 @@
 ./usr/share/man/html9/bswap16.html             comp-sys-htmlman        html
 ./usr/share/man/html9/bswap32.html             comp-sys-htmlman        html
 ./usr/share/man/html9/bswap64.html             comp-sys-htmlman        html
+./usr/share/man/html9/btoc.html                        comp-sys-htmlman        html
+./usr/share/man/html9/btodb.html               comp-sys-htmlman        html
 ./usr/share/man/html9/buffercache.html         comp-sys-htmlman        html
 ./usr/share/man/html9/bufq.html                        comp-sys-htmlman        html
 ./usr/share/man/html9/bus_dma.html             comp-sys-htmlman        html
@@ -14529,6 +14537,8 @@
 ./usr/share/man/html9/crypto_register.html     comp-sys-htmlman        html
 ./usr/share/man/html9/crypto_unregister.html   comp-sys-htmlman        html
 ./usr/share/man/html9/csf.html                 comp-sys-htmlman        html
+./usr/share/man/html9/ctob.html                        comp-sys-htmlman        html
+./usr/share/man/html9/ctod.html                        comp-sys-htmlman        html
 ./usr/share/man/html9/curcpu.html              comp-sys-htmlman        html
 ./usr/share/man/html9/curproc.html             comp-sys-htmlman        html
 ./usr/share/man/html9/curlwp.html              comp-sys-htmlman        html
@@ -14543,6 +14553,7 @@
 ./usr/share/man/html9/cv_wait.html             comp-sys-htmlman        html
 ./usr/share/man/html9/cv_wait_sig.html         comp-sys-htmlman        html
 ./usr/share/man/html9/cv_wakeup.html           comp-obsolete           obsolete
+./usr/share/man/html9/dbtob.html               comp-sys-htmlman        html
 ./usr/share/man/html9/ddc.html                 comp-sys-htmlman        html
 ./usr/share/man/html9/delay.html               comp-sys-htmlman        html
 ./usr/share/man/html9/deviter.html             comp-sys-htmlman        html
@@ -14577,6 +14588,7 @@
 ./usr/share/man/html9/dofilewritev.html                comp-sys-htmlman        html
 ./usr/share/man/html9/dopowerhooks.html                comp-sys-htmlman        html
 ./usr/share/man/html9/doshutdownhooks.html     comp-sys-htmlman        html
+./usr/share/man/html9/dtoc.html                        comp-sys-htmlman        html
 ./usr/share/man/html9/driver.html              comp-sys-htmlman        html
 ./usr/share/man/html9/dumpsys.html             comp-sys-htmlman        html
 ./usr/share/man/html9/dupfdopen.html           comp-sys-htmlman        html
@@ -20151,6 +20163,8 @@
 ./usr/share/man/man9/bswap16.9                 comp-sys-man            .man
 ./usr/share/man/man9/bswap32.9                 comp-sys-man            .man
 ./usr/share/man/man9/bswap64.9                 comp-sys-man            .man
+./usr/share/man/man9/btoc.9                    comp-sys-man            .man
+./usr/share/man/man9/btodb.9                   comp-sys-man            .man
 ./usr/share/man/man9/buffercache.9             comp-sys-man            .man
 ./usr/share/man/man9/bufq.9                    comp-sys-man            .man
 ./usr/share/man/man9/bus_dma.9                 comp-sys-man            .man
@@ -20347,6 +20361,8 @@
 ./usr/share/man/man9/crypto_register.9         comp-sys-man            .man
 ./usr/share/man/man9/crypto_unregister.9       comp-sys-man            .man
 ./usr/share/man/man9/csf.9                     comp-sys-man            .man
+./usr/share/man/man9/ctob.9                    comp-sys-man            .man
+./usr/share/man/man9/ctod.9                    comp-sys-man            .man
 ./usr/share/man/man9/ctxsw.9                   comp-obsolete           obsolete
 ./usr/share/man/man9/curcpu.9                  comp-sys-man            .man
 ./usr/share/man/man9/curproc.9                 comp-sys-man            .man
@@ -20362,6 +20378,7 @@
 ./usr/share/man/man9/cv_wait.9                 comp-sys-man            .man
 ./usr/share/man/man9/cv_wait_sig.9             comp-sys-man            .man
 ./usr/share/man/man9/cv_wakeup.9               comp-obsolete           obsolete
+./usr/share/man/man9/dbtob.9                   comp-sys-man            .man
 ./usr/share/man/man9/ddc.9                     comp-sys-man            .man
 ./usr/share/man/man9/delay.9                   comp-sys-man            .man
 ./usr/share/man/man9/deviter.9                 comp-sys-man            .man
@@ -20398,6 +20415,7 @@
 ./usr/share/man/man9/dofilewritev.9            comp-sys-man            .man
 ./usr/share/man/man9/dopowerhooks.9            comp-sys-man            .man
 ./usr/share/man/man9/doshutdownhooks.9         comp-sys-man            .man
+./usr/share/man/man9/dtoc.9                    comp-sys-man            .man
 ./usr/share/man/man9/driver.9                  comp-sys-man            .man
 ./usr/share/man/man9/dumpsys.9                 comp-sys-man            .man
 ./usr/share/man/man9/dupfdopen.9               comp-sys-man            .man
diff -r 8e9e09b00861 -r 593acda3410f share/man/man9/Makefile
--- a/share/man/man9/Makefile   Tue Apr 13 08:24:31 2010 +0000
+++ b/share/man/man9/Makefile   Tue Apr 13 08:40:19 2010 +0000
@@ -1,4 +1,4 @@
-#       $NetBSD: Makefile,v 1.325 2010/04/13 07:32:31 jruoho Exp $
+#       $NetBSD: Makefile,v 1.326 2010/04/13 08:40:19 jruoho Exp $
 
 #      Makefile for section 9 (kernel function and variable) manual pages.
 
@@ -13,7 +13,7 @@
        cpu_idle.9 cpu_initclocks.9 cpu_need_resched.9 \
        cpu_number.9 cpu_reboot.9 cpu_rootconf.9 \
        cpu_startup.9 cpu_swapout.9 cpu_switchto.9 \
-       csf.9 \
+       csf.9 ctod.9 \
        curproc.9 \
        delay.9 disk.9 ddc.9 disklabel.9 dofileread.9 \
        dopowerhooks.9 do_setresuid.9 doshutdownhooks.9 driver.9 \
@@ -224,6 +224,11 @@
 MLINKS+=cpu_lwp_fork.9 child_return.9 cpu_lwp_fork.9 proc_trampoline.9
 MLINKS+=cpu_rootconf.9 setroot.9
 MLINKS+=cpu_swapout.9 cpu_swapin.9
+MLINKS+=ctod.9 dtoc.9 \
+       ctod.9 ctob.9 \
+       ctod.9 btoc.9 \
+       ctod.9 dbtob.9 \
+       ctod.9 btodb.9
 MLINKS+=curproc.9 curcpu.9 curproc.9 curlwp.9
 MLINKS+=delay.9 DELAY.9
 MLINKS+=disk.9 disk_attach.9 disk.9 disk_detach.9 \
diff -r 8e9e09b00861 -r 593acda3410f share/man/man9/ctod.9
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man9/ctod.9     Tue Apr 13 08:40:19 2010 +0000
@@ -0,0 +1,71 @@
+.\" $NetBSD: ctod.9,v 1.1 2010/04/13 08:40:19 jruoho Exp $
+.\"
+.\" Copyright (c) 2010 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Jukka Ruohonen.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd April 13, 2010
+.Dt CTOD 9
+.Os
+.Sh NAME
+.Nm ctod
+.Nd macros related to bytes, pages, and disk blocks
+.Sh SYNOPSIS
+.In sys/param.h
+.Ft size
+.Fn ctod "size x"
+.Ft size
+.Fn dtoc "size x"
+.Ft size
+.Fn ctob "size x"
+.Ft size
+.Fn btoc "size x"
+.Ft size
+.Fn dbtob "size x"
+.Ft size
+.Fn btodb "size x"
+.Sh DESCRIPTION
+The
+.Nm
+family of macros can be used to convert between bytes, pages
+.Pq Dq clicks ,
+and disk blocks.
+.Pp
+The following table lists the possible conversions:
+.Bl -column -offset indent "disk blocks " "disk blocks " "disk blocks "
+.It Sy Macro Ta Sy From Ta Sy To
+.It Li Fn ctod Ta pages Ta disk blocks
+.It Li Fn dtoc Ta disk blocks Ta pages
+.It Li Fn ctob Ta pages Ta bytes
+.It Li Fn btoc Ta bytes Ta pages
+.It Li Fn dbtob Ta disk blocks Ta bytes
+.It Li Fn btodb Ta bytes Ta disk blocks
+.El
+.Sh CAVEATS
+The described macros make no assumptions
+about the type of the input parameter.
+A caller should ensure that neither
+integer overflow nor integer underflow are possible.



Home | Main Index | Thread Index | Old Index