Functions | |
int | gfal_chmod (const char *url, mode_t mode) |
change file access permissions | |
int | gfal_rename (const char *oldurl, const char *newurl) |
change the name or location of a file | |
int | gfal_stat (const char *url, struct stat *st) |
get the file status, follow links | |
int | gfal_lstat (const char *url, struct stat *st) |
get the file status, does not follow links | |
int | gfal_access (const char *url, int amode) |
check user permissions for a file | |
ssize_t | gfal_readlink (const char *url, char *buff, size_t buffsiz) |
resolve a link destination | |
int | gfal_symlink (const char *oldurl, const char *newurl) |
create a symbolic link | |
int | gfal_unlink (const char *url) |
unlink a file, delete it | |
int | gfal_mkdir (const char *url, mode_t mode) |
create a directory | |
DIR * | gfal_opendir (const char *url) |
open a directory | |
struct dirent * | gfal_readdir (DIR *d) |
read a directory | |
int | gfal_closedir (DIR *d) |
close a directory | |
int | gfal_rmdir (const char *url) |
delete a directory | |
int | gfal_creat (const char *url, mode_t mode) |
creat a file | |
int | gfal_open (const char *url, int flags,...) |
open a file | |
off_t | gfal_lseek (int fd, off_t off, int flags) |
reposition read/write file offset | |
int | gfal_close (int fd) |
close a gfal file descriptor | |
ssize_t | gfal_read (int fd, void *buff, size_t size) |
read from a gfal file descriptor | |
ssize_t | gfal_write (int fd, const void *buff, size_t size) |
write from a gfal file descriptor | |
int | gfal_flush (int fd) |
flush the given file descriptor | |
ssize_t | gfal_pread (int fd, void *buff, size_t size, off_t offset) |
parallel read from a gfal file descriptor | |
ssize_t | gfal_pwrite (int fd, const void *buff, size_t size, off_t offset) |
parallel write from a gfal file descriptor | |
ssize_t | gfal_getxattr (const char *url, const char *name, void *value, size_t size) |
retrieve an extended attribute value | |
ssize_t | gfal_listxattr (const char *url, char *list, size_t size) |
retrieve a list of the extended attributes availables | |
int | gfal_setxattr (const char *url, const char *name, const void *value, size_t size, int flags) |
define an extended attribute value | |
int | gfal_removexattr (const char *url, const char *name) |
delete a extended attribute value | |
int | gfal_posix_check_error () |
void | gfal_posix_clear_error () |
void | gfal_posix_release_error () |
char * | gfal_posix_strerror_r (char *buff_err, size_t s_err) |
void | gfal_posix_print_error () |
int | gfal_posix_code_error () |
int | gfal_set_verbose (int) |
char * | gfal_version () |
gfal2_context_t | gfal_posix_get_context () |
get context for advanced operation return the gfal2 context used for POSIX operations allow to do advanced operation ( config, checksum, transfer ) on this context |
int gfal_access | ( | const char * | url, | |
int | amode | |||
) |
check user permissions for a file
Similar behavior to the POSIX access ( man 2 access )
url | : url of the file to access | |
amode | : access mode to check (R_OK, W_OK, X_OK or F_OK) |
int gfal_chmod | ( | const char * | url, | |
mode_t | mode | |||
) |
change file access permissions
Warnings about POSIX functions : some protocols do not permit a full POSIX support ( ex : no symlinks in srm:// URLs ) In case of a call to a unsupported function, -1 code is return and an error is set to EPROTONOSUPPORT
gfal_chmod changes the permissions of each given file according to mode, Similar behavior to the POSIX chmod ( man 2 chmod )
url | : url of the file or the folder, can be in all supported protocols (lfn, srm, file, guid,..) | |
mode | : right to configure |
int gfal_close | ( | int | fd | ) |
close a gfal file descriptor
Similar behavior to the POSIX close ( man 2 close )
fd | : gfal file descriptor of the file |
int gfal_closedir | ( | DIR * | d | ) |
close a directory
Similar behavior to the POSIX closedir ( man 2 closedir )
d | : descriptor of the directory |
int gfal_creat | ( | const char * | url, | |
mode_t | mode | |||
) |
creat a file
Similar behavior to the POSIX creat ( man 2 creat ) gfal_creat is similar to gfal_open with the flags O_CREAT|O_WRONLY|O_TRUNC
url | : url of the file to creat | |
mode | : mode of the file. |
int gfal_flush | ( | int | fd | ) |
flush the given file descriptor
flush the current fiel descriptor, clear the cache \ and commit the changes. This call is reserved fora futur usage.
fd | : gfal file descriptor of the file |
ssize_t gfal_getxattr | ( | const char * | url, | |
const char * | name, | |||
void * | value, | |||
size_t | size | |||
) |
retrieve an extended attribute value
similar to the getxattr function
In gfal 2.0, this is the standard way to interact \ with advanced file properties
ex : gfal_getxattr("srm://myurl/endpoint", "user.replicas", buff, 256);
url | : url of the file | |
name | : key of the extended attribute | |
value | : buffer for the extended attribute value | |
size | : maximum size of the buffer |
ssize_t gfal_listxattr | ( | const char * | url, | |
char * | list, | |||
size_t | size | |||
) |
retrieve a list of the extended attributes availables
similar to the etxattr function
url | : url of the file | |
list | : buffer for the list of availables attributes concatened. | |
size | : maximum size of the buffer |
off_t gfal_lseek | ( | int | fd, | |
off_t | off, | |||
int | flags | |||
) |
reposition read/write file offset
Similar behavior to the POSIX lseek ( man 2 lseek )
fd | : gfal file descriptor of the file | |
off | : offset to set | |
flags | : offset mode |
int gfal_lstat | ( | const char * | url, | |
struct stat * | st | |||
) |
get the file status, does not follow links
return informations about the given files and links Similar behavior to the POSIX lstat ( man 2 lstat )
In case of protocols without the support of links, GFAL 2.0 \ convert this call to gfal_stat
url | : url of the file | |
st | : pointer to an allocated struct stat |
int gfal_mkdir | ( | const char * | url, | |
mode_t | mode | |||
) |
create a directory
Similar behavior to the POSIX mkdir( man 2 mkdir )
url | : url of the directory to create | |
mode | : initial mode right of the directory |
int gfal_open | ( | const char * | url, | |
int | flags, | |||
... | ||||
) |
open a file
Similar behavior to the POSIX open ( man 2 open ) gfal_open supports the same flags than the POSIX open call
O_TRUNC If the file already exists and is a regular file and the open mode allows writing (i.e., is O_RDWR or O_WRONLY) it will be truncated to length 0. If the file is a FIFO or termi‐ nal device file, the O_TRUNC flag is ignored. Otherwise the effect of O_TRUNC is unspecified.
O_APPEND The file is opened in append mode. Before each write(2), the file offset is positioned at the end of the file, as if with lseek(2). O_APPEND may lead to corrupted files on NFS file systems if more than one process appends data to a file at once. This is because NFS does not support appending to a file, so the client kernel has to simulate it, which can't be done without a race condition.
O_CREAT If the file does not exist it will be created. The owner (user ID) of the file is set to the effective user ID of the process. The group ownership (group ID) is set either to the effective group ID of the process or to the group ID of the parent directory (depending on file system type and mount options, and the mode of the parent directory, see the mount options bsdgroups and sysvgroups described in mount(8)).
mode specifies the permissions to use in case a new file is created. This argument must be supplied when O_CREAT is specified in flags; if O_CREAT is not specified, then mode is ignored. The effective permissions are modified by the process's umask in the usual way: The permissions of the created file are (mode & ~umask). Note that this mode only applies to future accesses of the newly created file; the open() call that creates a read-only file may well return a read/write file descriptor.
O_DIRECT Try to minimize cache effects of the I/O to and from this file. In general this will degrade performance, but it is useful in special situations, such as when applications do their own caching. File I/O is done directly to/from user space buffers. The O_DIRECT flag on its own makes at an effort to transfer data synchronously, but does not give the guarantees of the O_SYNC that data and necessary metadata are transferred. To guarantee synchronous I/O the O_SYNC must be used in addition to O_DIRECT. See NOTES below for fur‐ ther discussion.
O_LARGEFILE (LFS) Allow files whose sizes cannot be represented in an off_t (but can be represented in an off64_t) to be opened. The _LARGEFILE64_SOURCE macro must be defined (before includ‐ ing any header files) in order to obtain this definition. Setting the _FILE_OFFSET_BITS feature test macro to 64 (rather than using O_LARGEFILE) is the preferred method of obtaining method of accessing large files on 32-bit systems
url | : url of the file to open | |
flags | : flags to use ( similar to open ) | |
mode | (optional) : mode of the file in case of a new file. |
DIR* gfal_opendir | ( | const char * | url | ) |
open a directory
Similar behavior to the POSIX opendir ( man 2 opendir )
url | : url of the directory to list |
int gfal_posix_check_error | ( | ) |
safe and easy error management : -> if last error -> print on stderr, return 1 -> else do nothing
void gfal_posix_clear_error | ( | ) |
clear the last error \ provided for convenience.
int gfal_posix_code_error | ( | ) |
return the code associated with the last error. In case of POSIX calls and when possible, this code is similar to the local errno
gfal2_context_t gfal_posix_get_context | ( | ) |
get context for advanced operation return the gfal2 context used for POSIX operations allow to do advanced operation ( config, checksum, transfer ) on this context
void gfal_posix_print_error | ( | ) |
display the last error recorded to the standard output, provided for convenience.
void gfal_posix_release_error | ( | ) |
display the last error to the standard output \ and clear it. provided for convenience.
char* gfal_posix_strerror_r | ( | char * | buff_err, | |
size_t | s_err | |||
) |
Get the string representation of the last error
buff_err | : buffer where string representation will be stored. | |
s_err | : maximum message size |
ssize_t gfal_pread | ( | int | fd, | |
void * | buff, | |||
size_t | size, | |||
off_t | offset | |||
) |
parallel read from a gfal file descriptor
Similar behavior to the POSIX pread ( man 2 pread )
In gfal 2.0, this call is thread-safe and allows the usage of \ parallels read at the same time on the same file descriptor.
This is the recommended way to execute parallels transfers.
This gfal_pread is emulated on filesystem that does not support it explicitely ( ex : rfio )
fd | : gfal file descriptor of the file | |
buff | : buffer for the read content | |
size | : maximum size to read | |
offset | : offset where the read start |
ssize_t gfal_pwrite | ( | int | fd, | |
const void * | buff, | |||
size_t | size, | |||
off_t | offset | |||
) |
parallel write from a gfal file descriptor
Similar behavior to the POSIX pwrite ( man 2 pwrite )
In gfal 2.0, this function is thread-safe and allows the usage of parallels write at the same time on the same file descriptor.
This is the recommended way to execute parallels transfers.
This gfal_pwrite is emulated on filesystem that does not support it explicitely ( ex : rfio )
fd | : gfal file descriptor of the file | |
buff | : buffer for the write content | |
size | : maximum size to write | |
offset | : offset where the write start |
ssize_t gfal_read | ( | int | fd, | |
void * | buff, | |||
size_t | size | |||
) |
read from a gfal file descriptor
Similar behavior to the POSIX read ( man 2 read )
fd | : gfal file descriptor of the file | |
buff | : buffer for the read content | |
size | : maximum size to read |
struct dirent* gfal_readdir | ( | DIR * | d | ) | [read] |
read a directory
the directory descriptor must be provided by gfal_opendir Similar behavior to the POSIX readdir ( man 2 readdir )
d | : descriptor of the directory |
ssize_t gfal_readlink | ( | const char * | url, | |
char * | buff, | |||
size_t | buffsiz | |||
) |
resolve a link destination
Similar behavior to the POSIX readlink ( man 2 readlink )
Some protocols can not support this functionality, \ check the protocol specification for more information.
url | : url of the file to access, can be in supported protocols (lfn, srm, file, guid,..) | |
buff | : buffer to fill | |
buffsiz | : maximum size of the link destination |
int gfal_removexattr | ( | const char * | url, | |
const char * | name | |||
) |
delete a extended attribute value
similar to the removexattr function
url | : url of the file | |
name | : key of the extended attribute |
int gfal_rename | ( | const char * | oldurl, | |
const char * | newurl | |||
) |
change the name or location of a file
gfal_rename will rename the specified files by replacing the first occurrence of from in their name by to. gfal_rename implies two URL with the same protocols and generally on the same server. Similar behavior to the POSIX rename ( man 2 rename )
oldurl | : the old url of the file | |
newurl | : the new url of the file |
int gfal_rmdir | ( | const char * | url | ) |
delete a directory
Similar behavior to the POSIX rmdir ( man 2 rmdir )
url | : url of the directory to suppress |
int gfal_set_verbose | ( | int | ) |
set the gfal verbose mode
see gfal_constant.h for details
int gfal_setxattr | ( | const char * | url, | |
const char * | name, | |||
const void * | value, | |||
size_t | size, | |||
int | flags | |||
) |
define an extended attribute value
similar to the listxattr function
In gfal 2.0, this is the standard way to interact \ with advanced file properties
ex : gfal_setxattr("srm://myurl/endpoint", "user.status", "ONLINE", strlen("ONLINE"),0); // -> simple brings_online
url | : url of the file | |
name | : key of the extended attribute | |
value | : buffer for the extended attribute value | |
size | : size of the attribute value | |
flags | : mode |
int gfal_stat | ( | const char * | url, | |
struct stat * | st | |||
) |
get the file status, follow links
return informations about the given files Similar behavior to the POSIX stat ( man 2 stat )
url | : url of the file | |
st | : pointer to an allocated struct stat |
int gfal_symlink | ( | const char * | oldurl, | |
const char * | newurl | |||
) |
create a symbolic link
Similar behavior to the POSIX symlink ( man 2 symlink )
Some protocols can not support this functionality, \ check the protocol specification for more information.
oldurl | : url of the original file | |
newurl | : url of the symlink |
int gfal_unlink | ( | const char * | url | ) |
unlink a file, delete it
Similar behavior to the POSIX unlink ( man 2 unlink )
url | : url of the file to delete |
char* gfal_version | ( | ) |
get a string representation of the gfal version
ssize_t gfal_write | ( | int | fd, | |
const void * | buff, | |||
size_t | size | |||
) |
write from a gfal file descriptor
Similar behavior to the POSIX write ( man 2 write )
fd | : gfal file descriptor of the file | |
buff | : buffer for the write content | |
size | : maximum size to write |