xref: /netbsd-src/lib/libc/sys/lfs_bmapv.2 (revision e5548b402ae4c44fb816de42c7bba9581ce23ef5)
1.\"	$NetBSD: lfs_bmapv.2,v 1.9 2004/05/13 10:20:58 wiz Exp $
2.\"
3.\" Copyright (c) 2000 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Konrad Schroder.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\" 3. All advertising materials mentioning features or use of this software
18.\"    must display the following acknowledgement:
19.\"        This product includes software developed by the NetBSD
20.\"        Foundation, Inc. and its contributors.
21.\" 4. Neither the name of The NetBSD Foundation nor the names of its
22.\"    contributors may be used to endorse or promote products derived
23.\"    from this software without specific prior written permission.
24.\"
25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35.\" POSSIBILITY OF SUCH DAMAGE.
36.\"
37.Dd May 23, 2000
38.Dt LFS_BMAPV 2
39.Os
40.Sh NAME
41.Nm lfs_bmapv
42.Nd retrieve disk addresses for arrays of blocks
43.Sh LIBRARY
44.Lb libc
45.Sh SYNOPSIS
46.In sys/types.h
47.In ufs/lfs/lfs.h
48.Ft int
49.Fn lfs_bmapv "fsid_t *fsidp" "BLOCK_INFO *blkiov" "int blkcnt"
50.Sh DESCRIPTION
51.Fn lfs_bmapv
52fills in the bi_daddr field for every block listed in the block array
53.Fa blkiov
54with the disk address corresponding to the logical block
55.Fa bi_lbn
56of the file with inode
57.Fa bi_inode .
58If
59.Fa bi_lbn
60is LFS_UNUSED_LBN, the disk location of the inode block containing the
61file's inode will be returned in
62.Fa bi_daddr
63instead.
64.Pp
65The
66.Fa fsidp
67argument contains the id of the file system to which the inodes and
68blocks belong.
69The
70.Fa blkiov
71argument is an array of BLOCK_INFO structures (see below).
72The
73.Fa blkcnt
74argument determines the size of the
75.Fa blkiov
76array.
77.Bd -literal
78typedef struct block_info {
79    ino_t       bi_inode;     /* inode # */
80    ufs_daddr_t bi_lbn;       /* logical block w/in file */
81    ufs_daddr_t bi_daddr;     /* disk address of block */
82    time_t      bi_segcreate; /* origin segment create time */
83    int         bi_version;   /* file version number */
84    void       *bi_bp;        /* data buffer */
85    int         bi_size;      /* size of the block (if fragment) */
86} BLOCK_INFO;
87.Ed
88.Sh RETURN VALUES
89.Fn lfs_bmapv
90returns 0 on success, or \-1 on error.
91.Sh ERRORS
92An error return from
93.Fn lfs_bmapv
94indicates:
95.Bl -tag -width Er
96.It Bq Er EFAULT
97.Fa fsidp
98points outside the process's allocated address space.
99.It Bq Er EINVAL
100.Fa *fsidp
101does not specify a valid file system.
102.El
103.Sh SEE ALSO
104.Xr lfs_markv 2 ,
105.Xr lfs_segclean 2 ,
106.Xr lfs_segwait 2 ,
107.Xr lfs_cleanerd 8
108.Sh HISTORY
109The
110.Fn lfs_bmapv
111function call appeared in
112.Bx 4.4 .
113