*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->FreeBSD man pages -> VOP_PUTPAGES (9)              



NAME    [Toc]    [Back]

     VOP_GETPAGES, VOP_PUTPAGES -- read or write VM pages from a file

SYNOPSIS    [Toc]    [Back]

     #include <sys/param.h>
     #include <sys/vnode.h>
     #include <vm/vm.h>

     VOP_GETPAGES(struct vnode *vp, vm_page_t *m, int count, int reqpage,
	 vm_ooffset_t offset);

     VOP_PUTPAGES(struct vnode *vp, vm_page_t *m, int count, int sync,
	 int *rtvals, vm_ooffset_t offset);

DESCRIPTION    [Toc]    [Back]

     The VOP_GETPAGES() method is called to read in pages of virtual memory
     which are backed by ordinary files.  If other adjacent pages are backed
     by adjacent regions of the same file, VOP_GETPAGES() is requested to read
     those pages as well, although it is not required to do so.  The
     VOP_PUTPAGES() method does the converse; that is to say, it writes out
     adjacent dirty pages of virtual memory.

     On entry, the vnode lock is held but neither the page queue nor VM object
     locks are held.  Both methods return in the same state on both success
     and error returns.

     The arguments are:

     vp       The file to access.

     m	      Pointer to the first element of an array of contiguous pages
	      representing a contiguous region of the file to be read or written.

     count    The number of pages in the array.

     sync     VM_PAGER_PUT_SYNC if the write should be synchronous.

     rtvals   An array of VM system result codes indicating the status of each
	      page written by VOP_PUTPAGES().

     reqpage  The index in the page array of the requested page; i.e., the one
	      page which the implementation of this method must handle.

     offset   Offset in the file at which the mapped pages begin.

     The status of the VOP_PUTPAGES() method is returned on a page-by-page
     basis in the array rtvals[].  The possible status values are as follows:

     VM_PAGER_OK     The page was successfully written.  The implementation
		     must call vm_pager_undirty(9) to mark the page as clean.

     VM_PAGER_PEND   The page was scheduled to be written asynchronously.
		     When the write completes, the completion callback should
		     call vm_object_pip_wakeup(9) and vm_page_io_finish(9) to
		     clear the busy flag and awaken any other threads waiting
		     for this page, in addition to calling vm_page_undirty(9).

     VM_PAGER_BAD    The page was entirely beyond the end of the backing file.
		     This condition should not be possible if the vnode's
		     filesystem is correctly implemented.

     VM_PAGER_ERROR  The page could not be written because of an error on the
		     underlying storage medium or protocol.

     VM_PAGER_FAIL   Treated identically to VM_PAGER_ERROR

     VM_PAGER_AGAIN  The page was not handled by this request.

     The VOP_GETPAGES() method is expected to release any pages in m that it
     does not successfully handle, by calling vm_page_free(9).	When it succeeds,
 VOP_GETPAGES() must set the valid bits appropriately, clear the
     dirty bit (using vm_page_undirty(9)), either activate the page (if its
     wanted bit is set) or deactivate it (otherwise), and finally call
     vm_page_wakeup(9) to arouse any threads currently waiting for the page to
     be faulted in, for each page read.

RETURN VALUES    [Toc]    [Back]

     If it successfully reads m[reqpage], VOP_GETPAGES() returns VM_PAGER_OK;
     otherwise, VM_PAGER_ERROR.  By convention, the return value of
     VOP_PUTPAGES() is rtvals[0].

SEE ALSO    [Toc]    [Back]

     vm_object_pip_wakeup(9), vm_page_free(9), vm_page_io_finish(9),
     vm_page_undirty(9), vm_page_wakeup(9), vnode(9)

AUTHORS    [Toc]    [Back]

     This manual page was written by Doug Rabson and then substantially
     rewritten by
     Garrett Wollman.

FreeBSD 5.2.1		      September 27, 2003		 FreeBSD 5.2.1
[ Back ]
 Similar pages
Name OS Title
AFreadmisc IRIX read from / write to / move logical read/write pointer for data in a miscellaneous chunk in an audio file
VOP_RDWR FreeBSD read or write a file
VOP_READ FreeBSD read or write a file
VOP_WRITE FreeBSD read or write a file
curs_scr_dmp IRIX read (write) a curses screen from (to) a file
scr_init OpenBSD read (write) a curses screen from (to) a file
scr_dump OpenBSD read (write) a curses screen from (to) a file
lseek IRIX move read/write file pointer
curs_scr_dump FreeBSD read (write) a curses screen from (to) a file
scr_restore OpenBSD read (write) a curses screen from (to) a file
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service