vm_mvc Kernel Service

Purpose

Reads or writes partial pages of files.

Syntax

#include <sys/types.h>
#include <sys/errno.h>
#include <sys/vmuser.h>

int vm_mvc ( in_sid, in_pno, in_pgoffs, in_count, in_cmd, in_xmemdp, in_ptr)
vmid_t in_sid;
vpn_t in_pno;
int in_pgoffs;
int in_count;
int in_cmd;
struct xmem * in_xmemdp;
void * in_ptr;

Parameters

Item Description
in_sid The primary memory object, m1.
in_pno The m1 pno object. If it is a read operation, this parameter refers to the source. If not, it refers to a target.
in_pgoffs The byte offset in the pno object.
in_count The number of bytes to zero or copy in memory.
in_cmd The reason for the function call. The possible values could be Zero, Zero(protect), read, or write.
in_xmemdp The xmem descriptor for the second memory object, m2.
in_ptr The byte offset in the xmem object.

Description

The vm_mvc kernel service is meant to be used by client file systems doing read or write operations to partial pages of files, where the file is denoted by the m1 object and the read or write buffer by the m2 object. Such cases arise on EOF handling, fragments, compression, and holes among other situations.

Given two memory object, m1 and m2, the vm_mvc kernel service allows you to do one of the following operations:
  • Zero out bytes on the m1 object (VM_MVC_ZERO).
  • Zero out and protect the m1 object (VM_MVC_PROTZERO).
  • Copy bytes from the m1 object to the m2 object (VM_MVC_READ).
  • Copy bytes from the m2 object to the m1 object (VM_MVC_WRITE).

The first memory object, m1, is characterized by a sid parameter and a pno parameter. The second memory object, m2, is characterized by an xmem descriptor and a pointer for an offset. The second memory object is a user or kernel buffer.

Note: The second memory object must be pinned.

Flags

in_cmd Purpose
VM_MVC_ZERO Zeros out the bytes on the m1 object.
VM_MVC_READ Copies bytes from the m1 object to the m2 object.
VM_MVC_WRITE Copies bytes from the m2 object to the m1 object.
VM_MVC_PROTZERO Zeros out and protects the m1 object.

Execution Environment

The vm_mvc kernel service can be called from the process environment only.

Return Values

Item Description
0 Indicates that the I/O access operations completed successfully.
ENOENT Indicates that the (sid, pno) set was not mapped to a real frame.
EINVAL Indicates one of the following errors:
  • The m1 object crosses page boundary.
  • The in_cmd parameter does not contain a valid command.