tail head cat sleep
QR code linking to this page

Manual Pages  — VOP_COPY_FILE_RANGE

NAME

VOP_COPY_FILE_RANGE – copy a byte range within a file or from one file to another in a single file system or between multiple file systems

CONTENTS

SYNOPSIS

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

int
VOP_COPY_FILE_RANGE(struct vnode *invp, off_t *inoff, struct vnode *outvp, off_t *outoff, size_t *len, unsigned int flags, struct ucred *incred, struct ucred *outcred, struct thread *fsize_td);

DESCRIPTION

This entry point copies a byte range from one regular file to another or within one file in a single file system. invp and outvp can refer to the same file. For this case, the byte ranges defined by *inoff, *outoff, and *len will not overlap.

The arguments are:
invp
  The vnode of the input file.
inoff
  A pointer to the file offset for the input file.
outvp
  The vnode of the output file.
outoff
  A pointer to the file offset for the output file.
len
  A pointer to the byte count for the copy.
flags
  Flags, should be set to 0 for now.
incred
  The credentials used to read invp.
outcred
  The credentials used to write outvp.
fsize_td
  The thread pointer to be passed to vn_rlimit_fsize(). This will be NULL for a server thread without limits, such as for the NFS server or curthread otherwise.

On entry and on return, the inoff and outoff arguments point to the locations of the file offsets. These file offsets should be updated by the number of bytes copied. The len argument points to the location that stores the number of bytes to be copied. Upon a successful return len will be updated to the number of bytes actually copied. Normally, this will be the number of bytes requested to be copied, however a copy of fewer bytes than requested is permitted. This does not necessarily indicate that the copy reached EOF on the input file. However, if the value pointed to by the len argument is zero upon a successful return, it indicates that the offset pointed to by inoff is at or beyond EOF on the input file.

LOCKS

The vnode are unlocked on entry and must be unlocked on return. The byte ranges for both invp and outvp should be range locked when this call is done.

RETURN VALUES

Zero is returned on success, otherwise an error code is returned.

ERRORS

[EFBIG]
  If the copy exceeds the process's file size limit or the maximum file size for the file system invp and outvp reside on.
[EINTR]
  A signal interrupted the VOP call before it could be completed.
[EIO] An I/O error occurred while reading/writing the files.
[EINTEGRITY]
  Corrupted data was detected while reading/writing the files.
[ENOSPC]
  The file system is full.

SEE ALSO

vn_rdwr(9), vnode(9)

VOP_COPY_FILE_RANGE (9) March 30, 2020

tail head cat sleep
QR code linking to this page


Please direct any comments about this manual page service to Ben Bullock. Privacy policy.

As soon as we started programming, we found to our surprise that it wasn't as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs.
— Maurice Wilkes