CTOD(9) BSD Kernel Developer's Manual CTOD(9)NAME
ctod -- macros related to bytes, pages, and disk blocks
SYNOPSIS
#include <sys/param.h>
size
ctod(size x);
size
dtoc(size x);
size
ctob(size x);
size
btoc(size x);
size
dbtob(size x);
size
btodb(size x);
DESCRIPTION
The ctod family of macros can be used to convert between bytes, pages (``clicks''), and disk blocks.
The following table lists the possible conversions:
Macro From To
ctod() pages disk blocks
dtoc() disk blocks pages
ctob() pages bytes
btoc() bytes pages
dbtob() disk blocks bytes
btodb() bytes disk blocks
These are typical macros that may appear with different names in other operating systems. Examples include btop() and btopr() in Solaris.
SEE ALSO param(3)HISTORY
Some of these macros appeared in Version 7 AT&T UNIX.
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.
BSD April 8, 2011 BSD
Check Out this Related Man Page
ROUNDUP(9) BSD Kernel Developer's Manual ROUNDUP(9)NAME
roundup -- macros for counting and rounding
SYNOPSIS
#include <sys/param.h>
size
howmany(x, size);
size
roundup(x, size);
size
rounddown(x, size);
size
roundup2(x, size);
int
powerof2(x);
DESCRIPTION
The roundup() and rounddown() macros return an integer from rounding x up and down, respectively, to the next size. The howmany() macro in
turn reveals how many times size fits into x, rounding the residual up.
The roundup2() macro also rounds up, but with the assumption that size is a power of two. If x is indeed a power of two, powerof2() return
1.
RETURN VALUES
The return value is an integer from the respective operation. If x is 0, all macros except powerof2() return 0. The behavior is undefined
if size is 0.
EXAMPLES
The following example rounds the variable rx to a 32-bit boundary:
uint16_t rx;
...
rx = roundup2(rx, sizeof(uint32_t));
SEE ALSO ilog2(3), param(3), imax(9)CAVEATS
All described macros make no assumptions about the type of the parameters. These are implicitly assumed to be unsigned integers.
BSD June 1, 2011 BSD
Hello!
I applied the solaris9 "recomended and sequrity"-bundle Oktober release last night, and after that the system will not boot.
I missed to reboot the system using "reboot -r", but I am able to mount the root disk by booting from cdrom "cdrom -s".
Please advise!
These are the last... (3 Replies)
Which post should win this weeks UNIX/Linux post of the week nomination contest?
Choose from the posts listed throughout the forum(s), and vote for your favorite post now.
What is Topic Of The Week?
Post of the Week is a contest that select posts which we would like the community to... (8 Replies)
Which post should win this weeks UNIX/Linux post of the week nomination contest?
Choose from the posts listed throughout the forum(s), and vote for your favorite post now.
What is Topic Of The Week?
Post of the Week is a contest that select posts which we would like the community to... (0 Replies)
Which post should win this weeks UNIX/Linux post of the week nomination contest?
Choose from the posts listed throughout the forum(s), and vote for your favorite post now.
What is Topic Of The Week?
Post of the Week is a contest that select posts which we would like the community to... (0 Replies)
Which post should win this weeks UNIX/Linux post of the week nomination contest?
Choose from the posts listed throughout the forum(s), and vote for your favorite post now.
What is Topic Of The Week?
Post of the Week is a contest that select posts which we would like the community to... (0 Replies)
Good evening:
Need your help please
Before deleting older logs from octobre 4th i need to identify which files i have to remove, for instance today is octobre 8ht, i need to remove files from October 4th
Because there are many files i can not list because error args too long, so
... (5 Replies)
Good night, i need your help please
Because there are about 10000 files from October 6th, i need to to compress but i use this command and it does not do anything, in the prompt has no respones and i have to press CRTL+C to goback to the shell
for file in $(ls -l | grep "Impres" | grep "Oct ... (4 Replies)