gpfs_clone_snap() subroutine

Creates a read-only clone parent from a source file.

Library

GPFS Library (libgpfs.a for AIX®, libgpfs.so for Linux®)

Synopsis

#include <gpfs.h>
int gpfs_clone_snap(const char *sourcePathP, const char *destPathP);

Description

The gpfs_clone_snap() subroutine creates a read-only clone parent from a source file.

Parameters

sourcePathP
The path of the source file to clone.
destPathP
The path of the destination file to create. The destination file will become a read-only clone parent file.

If destPathP is NULL, then the source file will be changed in place into a read-only clone parent. When using this method to create a clone parent, the specified file cannot be open for writing or have hard links.

Exit status

If the gpfs_clone_snap() subroutine is successful, it returns a value of 0 and creates a read-only clone parent from the source file.

If the gpfs_clone_snap() subroutine is unsuccessful, it returns a value of -1 and sets the global error variable errno to indicate the nature of the error.

Exceptions

None.

Error status

Error codes include but are not limited to the following:

EACCESS
Permission denied when writing to the destination path or reading from the source path.
EEXIST
The destination file already exists.
EFAULT
The input argument points outside accessible address space.
EINVAL
The source or destination does not refer to a regular file or a GPFS file system.
EISDIR
The specified destination file is a directory.
ENAMETOOLONG
The source or destination path name is too long.
ENOENT
The source file does not exist.
ENOSPC
The file system has run out of disk space.
ENOSYS
The gpfs_clone_snap() subroutine is not available.
EPERM
The source file is a directory or is not a regular file, or you tried to create a clone file with depth greater than 1000.
EXDEV
The source file and destination file are not in the same file system.

Location

/usr/lpp/mmfs/lib/libgpfs.a for AIX

/usr/lpp/mmfs/lib/libgpfs.so for Linux