1.\" $NetBSD: lfs_bmapv.2,v 1.4 2002/02/08 01:28:18 ross 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.Fd #include \*[Lt]sys/types.h\*[Gt] 47.Fd #include \*[Lt]ufs/lfs/lfs.h\*[Gt] 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 corrseponding 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 filesystem to which the inodes and 68blocks belong. 69The 70.Fa blkiov 71argument is an array of BLOCK_INFO structures (see below). The 72.Fa blkcnt 73argument determines the size of the 74.Fa blkiov 75array. 76.Bd -literal 77typedef struct block_info { 78 ino_t bi_inode; /* inode # */ 79 ufs_daddr_t bi_lbn; /* logical block w/in file */ 80 ufs_daddr_t bi_daddr; /* disk address of block */ 81 time_t bi_segcreate; /* origin segment create time */ 82 int bi_version; /* file version number */ 83 void *bi_bp; /* data buffer */ 84 int bi_size; /* size of the block (if fragment) */ 85} BLOCK_INFO; 86.Ed 87.Sh RETURN VALUES 88.Fn lfs_bmapv 89returns 0 on success, or -1 on error. 90.Sh ERRORS 91An error return from 92.Fn lfs_bmapv 93indicates: 94.Bl -tag -width Er 95.It Bq Er EFAULT 96.Fa fsidp 97points outside the process's allocated address space. 98.It Bq Er EINVAL 99.Fa *fsidp 100does not specify a valid filesystem. 101.El 102.Sh SEE ALSO 103.Xr lfs_markv 2 , 104.Xr lfs_segclean 2 , 105.Xr lfs_segwait 2 , 106.Xr lfs_cleanerd 8 107.Sh HISTORY 108The 109.Fn lfs_bmapv 110function call appeared in 111.Bx 4.4 . 112