1.\" $NetBSD: lfs_markv.2,v 1.11 2008/04/30 13:10:51 martin 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.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28.\" POSSIBILITY OF SUCH DAMAGE. 29.\" 30.Dd May 23, 2000 31.Dt LFS_MARKV 2 32.Os 33.Sh NAME 34.Nm lfs_markv 35.Nd rewrite disk blocks to new disk locations 36.Sh LIBRARY 37.Lb libc 38.Sh SYNOPSIS 39.In sys/types.h 40.In ufs/lfs/lfs.h 41.Ft int 42.Fn lfs_markv "fsid_t *fsidp" "BLOCK_INFO *blkiov" "int blkcnt" 43.Sh DESCRIPTION 44.Fn lfs_markv 45rewrites the blocks specified in 46.Fa blkiov 47to new disk locations, for the purposes of grouping them next to one 48another, or to move them out of a segment to clean it. 49All fields of the BLOCK_INFO structure must be filled in, except for 50.Fa bi_segcreate . 51If 52.Fa bi_daddr 53is not the correct current address for logical block 54.Fa bi_lbn 55of the file with inode number 56.Fa bi_inode , 57or if the file's version number does not match 58.Fa bi_version , 59the block will not be written to disk, but no error will be returned. 60.Pp 61The 62.Fa fsidp 63argument contains the id of the filesystem to which the inodes and 64blocks belong. 65The 66.Fa bi_bp 67field contains 68.Fa bi_size 69bytes of data to be written into the appropriate block. 70If 71.Fa bi_lbn 72is specified as LFS_UNUSED_LBN, the inode itself will be rewritten. 73.Pp 74The 75.Fa blkiov 76argument is an array of BLOCK_INFO structures (see below). 77The 78.Fa blkcnt 79argument determines the size of the 80.Fa blkiov 81array. 82.Bd -literal 83typedef struct block_info { 84 ino_t bi_inode; /* inode # */ 85 ufs_daddr_t bi_lbn; /* logical block w/in file */ 86 ufs_daddr_t bi_daddr; /* disk address of block */ 87 time_t bi_segcreate; /* origin segment create time */ 88 int bi_version; /* file version number */ 89 void *bi_bp; /* data buffer */ 90 int bi_size; /* size of the block (if fragment) */ 91} BLOCK_INFO; 92.Ed 93.Sh RETURN VALUES 94.Fn lfs_markv 95returns 0 on success, or \-1 on error. 96.Sh ERRORS 97An error return from 98.Fn lfs_markv 99indicates: 100.Bl -tag -width Er 101.It Bq Er EFAULT 102.Fa fsidp 103points outside the process's allocated address space. 104.It Bq Er EINVAL 105.Fa *fsidp 106does not specify a valid filesystem. 107.It Bq Er EBUSY 108One or more of the inodes whose blocks were to be written was locked, 109and its blocks were not rewritten. 110.El 111.Sh SEE ALSO 112.Xr lfs_segclean 2 , 113.Xr lfs_segwait 2 , 114.Xr lfs_cleanerd 8 115.Sh HISTORY 116The 117.Fn lfs_markv 118function call appeared in 119.Bx 4.4 . 120.Sh BUGS 121The functionality of 122.Fn lfs_markv 123does not really belong in user space. 124Among other things it could be used to work around the 125SF_IMMUTABLE 126and 127SF_APPEND 128file flags (see 129.Xr chflags 2 ) . 130