xref: /titanic_51/usr/src/man/man9f/biomodified.9f (revision 5eb667aca135f8c963f5eb9e534c0cd1fdc81fcd)
te
Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
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]
biomodified 9F "20 Nov 1996" "SunOS 5.11" "Kernel Functions for Drivers"
NAME
biomodified - check if a buffer is modified
SYNOPSIS

#include <sys/ddi.h>
#include <sys/sunddi.h>

int biomodified(struct buf *bp);
INTERFACE LEVEL

Solaris DDI specific (Solaris DDI).

PARAMETERS

bp

Pointer to the buffer header structure.

DESCRIPTION

The biomodified() function returns status to indicate if the buffer is modified. The biomodified() function is only supported for paged- I/O request, that is the B_PAGEIOflag must be set in the b_flags field of the buf(9S) structure. The biomodified() function will check the memory pages associated with this buffer whether the Virtual Memory system's modification bit is set. If at least one of these pages is modified, the buffer is indicated as modified. A filesystem will mark the pages unmodified when it writes the pages to the backing store. The biomodified() function can be used to detect any modifications to the memory pages while I/O is in progress.

A device driver can use biomodified() for disk mirroring. An application is allowed to mmap a file which can reside on a disk which is mirrored by multiple submirrors. If the file system writes the file to the backing store, it is written to all submirrors in parallel. It must be ensured that the copies on all submirrors are identical. The biomodified() function can be used in the device driver to detect any modifications to the buffer by the user program during the time the buffer is written to multiple submirrors.

RETURN VALUES

The biomodified() function returns the following values:

1

Buffer is modified.

0

Buffer is not modified.

-1

Buffer is not used for paged I/O request.

CONTEXT

biomodified() can be called from any context.

SEE ALSO

bp_mapin(9F), buf(9S)

Writing Device Drivers