summaryrefslogtreecommitdiff
path: root/usr/src/man/man9f/ddi_ffs.9f
blob: 1baa029aa66888e6dd052c6642478d260a3af111 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
.\"  Copyright (c) 2006 Sun Microsystems, Inc.  All Rights Reserved.
.\" Copyright 2019 Joyent, Inc.
.\"
.\" The contents of this file are subject to the terms of the
.\" Common Development and Distribution License (the "License").
.\" You may not use this file except in compliance with the License.
.\"
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
.\" or http://www.opensolaris.org/os/licensing.
.\" See the License for the specific language governing permissions
.\" and limitations under the License.
.\"
.\" When distributing Covered Code, include this CDDL HEADER in each
.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
.\" If applicable, add the following below this CDDL HEADER, with the
.\" fields enclosed by brackets "[]" replaced with your own identifying
.\" information: Portions Copyright [yyyy] [name of copyright owner]
.\"
.Dd December 21, 2019
.Dt DDI_FFS 9F
.Os
.Sh NAME
.Nm ddi_ffs, ddi_ffsll, ddi_fls, ddi_flsll
.Nd find first (last) bit set in a long (long) integer
.Sh SYNOPSIS
.In sys/conf.h
.In sys/ddi.h
.In sys/sunddi.h
.Ft int
.Fo "ddi_ffs"
.Fa "long mask"
.Fc
.Ft int
.Fo "ddi_fls"
.Fa "long mask"
.Fc
.Ft int
.Fo "ddi_ffsll"
.Fa "long long mask"
.Fc
.Ft int
.Fo "ddi_flsll"
.Fa "long long mask"
.Fc
.Sh INTERFACE LEVEL
Solaris DDI specific (Solaris DDI).
.Sh PARAMETERS
.Bl -tag -width Va
.It Fa mask
A 32-bit or 64-bit argument value to search through.
.El
.Sh DESCRIPTION
The functions
.Fn ddi_ffs
and
.Fn ddi_ffsll
take their argument and return the shift count that the first (least
significant) bit set in the argument corresponds to.
The functions
.Fn ddi_fls
and
.Fn ddi_flsll
do the same, only they returns the shift count for the last (most
significant) bit set in the argument.
.Fn ddi_ffs
and
.Fn ddi_fls
operate on 32-bit values, while
.Fn ddi_ffsll
and
.Fn ddi_flsll
operate on 64-bit values.
.Sh CONTEXT
These functions can be called from user, interrupt, or kernel context.
.Sh RETURN VALUES
.Bl -tag -width Va
.It 0
No bits are set in mask.
.It N
Bit
.Em N
is the least significant
.Po
.Fn ddi_ffs ,
.Fn ddi_ffsll
.Pc
or most significant
.Po
.Fn ddi_fls ,
.Fn ddi_flsll
.Pc
bit set in
.Fa mask .
Bits are numbered from
.Em 1
to
.Em 32
or
.Em 64 ,
with bit
.Em 1
being the least significant bit position and bit
.Em 32
or
.Em 64
the most significant position, depending on the variant of the
functions used.
.El
.Sh SEE ALSO
.%T Writing Device Drivers