dmlite
0.6
|
C wrapper for DMLite Catalog API. More...
Go to the source code of this file.
Typedefs | |
typedef struct dmlite_dir | dmlite_dir |
Functions | |
int | dmlite_chdir (dmlite_context *context, const char *path) |
Changes the working dir. More... | |
char * | dmlite_getcwd (dmlite_context *context, char *buffer, size_t size) |
Gets the current working directory. More... | |
mode_t | dmlite_umask (dmlite_context *context, mode_t mask) |
Sets the file mode creation mask. More... | |
int | dmlite_stat (dmlite_context *context, const char *path, struct stat *buf) |
Does a stat of a file or directory. More... | |
int | dmlite_statl (dmlite_context *context, const char *path, struct stat *buf) |
Does a stat of a file, directory, or symbolic link (does not follow). More... | |
int | dmlite_statx (dmlite_context *context, const char *path, dmlite_xstat *buf) |
Does an extended stat of a file, directory or symbolic link. More... | |
int | dmlite_rstatx (dmlite_context *context, const char *rfn, dmlite_xstat *buf) |
Does an extended stat of a logical file using an associated replica filename. More... | |
int | dmlite_access (dmlite_context *context, const char *lfn, int mode) |
Checks wether the process would be allowed to read, write, or check existence. More... | |
int | dmlite_accessr (dmlite_context *context, const char *rfn, int mode) |
Checks wether the process would be allowed to read, write, or check existence. More... | |
int | dmlite_addreplica (dmlite_context *context, const dmlite_replica *replica) |
Adds a new replica to an entry. More... | |
int | dmlite_delreplica (dmlite_context *context, const dmlite_replica *replica) |
Deletes a replica. More... | |
int | dmlite_getreplicas (dmlite_context *context, const char *path, unsigned *nReplicas, dmlite_replica **fileReplicas) |
Gets the replicas of a file. More... | |
int | dmlite_replicas_free (unsigned nReplicas, dmlite_replica *fileReplicas) |
Frees a replica list. More... | |
int | dmlite_symlink (dmlite_context *context, const char *oldPath, const char *newPath) |
Creates a symlink. More... | |
int | dmlite_readlink (dmlite_context *context, const char *path, char *buf, size_t bufsize) |
Reads a symlink. More... | |
int | dmlite_unlink (dmlite_context *context, const char *path) |
Removes a file. More... | |
int | dmlite_create (dmlite_context *context, const char *path, mode_t mode) |
Creates a file in the catalog (no replicas). More... | |
int | dmlite_chmod (dmlite_context *context, const char *path, mode_t mode) |
Changes the mode of a file or directory. More... | |
int | dmlite_chown (dmlite_context *context, const char *path, uid_t newUid, gid_t newGid) |
Changes the owner of a file or directory. More... | |
int | dmlite_lchown (dmlite_context *context, const char *path, uid_t newUid, gid_t newGid) |
Changes the owner of a file, directory or symlink (does not follow). More... | |
int | dmlite_setfsize (dmlite_context *context, const char *path, uint64_t filesize) |
Changes the size of a file in the catalog. More... | |
int | dmlite_setfsizec (dmlite_context *context, const char *path, uint64_t filesize, const char *csumtype, const char *csumvalue) |
Changes the size and checksum of a file in the catalog. More... | |
int | dmlite_setacl (dmlite_context *context, const char *path, unsigned nEntries, dmlite_aclentry *acl) |
Changes the ACL of a file. More... | |
int | dmlite_utime (dmlite_context *context, const char *path, const struct utimbuf *buf) |
Changes access and/or modification time. More... | |
int | dmlite_getcomment (dmlite_context *context, const char *path, char *comment, size_t bufsize) |
Gets the comment associated with a file. More... | |
int | dmlite_setcomment (dmlite_context *context, const char *path, const char *comment) |
Sets the comment associated with a file. More... | |
int | dmlite_setguid (dmlite_context *context, const char *path, const char *guid) |
Sets the file Grid Unique Identifier. More... | |
int | dmlite_update_xattr (dmlite_context *context, const char *path, const dmlite_any_dict *xattr) |
Updates the file extended attributes. More... | |
int | dmlite_getgrpbynam (dmlite_context *context, const char *groupName, gid_t *gid) |
Gets the id of a group. More... | |
int | dmlite_getusrbynam (dmlite_context *context, const char *userName, uid_t *uid) |
Get the user id. More... | |
dmlite_dir * | dmlite_opendir (dmlite_context *context, const char *path) |
Opens a directory to read it later. More... | |
int | dmlite_closedir (dmlite_context *context, dmlite_dir *dir) |
Closes a directory and free the internal structures. More... | |
struct dirent * | dmlite_readdir (dmlite_context *context, dmlite_dir *dir) |
Reads an entry from a directory. More... | |
dmlite_xstat * | dmlite_readdirx (dmlite_context *context, dmlite_dir *dir) |
Reads an entry from a directory (extended data). More... | |
int | dmlite_mkdir (dmlite_context *context, const char *path, mode_t mode) |
Creates a new directory. More... | |
int | dmlite_rename (dmlite_context *context, const char *oldPath, const char *newPath) |
Renames a file, directory or symlink. More... | |
int | dmlite_rmdir (dmlite_context *context, const char *path) |
Deletes a directory. It must be empty. More... | |
int | dmlite_getreplica_by_rfn (dmlite_context *context, const char *rfn, dmlite_replica *replica) |
Gets a specific replica. More... | |
int | dmlite_updatereplica (dmlite_context *context, const dmlite_replica *replica) |
Updates a replica. More... | |
C wrapper for DMLite Catalog API.
typedef struct dmlite_dir dmlite_dir |
int dmlite_access | ( | dmlite_context * | context, |
const char * | lfn, | ||
int | mode | ||
) |
Checks wether the process would be allowed to read, write, or check existence.
context | The DM context. |
lfn | Logical filename. |
mode | A mask consisting of one or more of R_OK, W_OK, X_OK and F_OK. |
int dmlite_accessr | ( | dmlite_context * | context, |
const char * | rfn, | ||
int | mode | ||
) |
Checks wether the process would be allowed to read, write, or check existence.
context | The DM context. |
rfn | Replica filename. |
mode | A mask consisting of one or more of R_OK, W_OK, X_OK and F_OK. |
int dmlite_addreplica | ( | dmlite_context * | context, |
const dmlite_replica * | replica | ||
) |
Adds a new replica to an entry.
context | The DM context. |
replica | The replica to add. |
int dmlite_chdir | ( | dmlite_context * | context, |
const char * | path | ||
) |
Changes the working dir.
context | The DM context. |
path | The new working dir. |
int dmlite_chmod | ( | dmlite_context * | context, |
const char * | path, | ||
mode_t | mode | ||
) |
Changes the mode of a file or directory.
context | The DM context. |
path | The logical path. |
mode | The new mode. |
int dmlite_chown | ( | dmlite_context * | context, |
const char * | path, | ||
uid_t | newUid, | ||
gid_t | newGid | ||
) |
Changes the owner of a file or directory.
context | The DM context. |
path | The logical path. |
newUid | The new owner. |
newGid | The new group. |
int dmlite_closedir | ( | dmlite_context * | context, |
dmlite_dir * | dir | ||
) |
Closes a directory and free the internal structures.
context | The DM context. |
dir | The pointer returned by dmlite_opendir. |
int dmlite_create | ( | dmlite_context * | context, |
const char * | path, | ||
mode_t | mode | ||
) |
Creates a file in the catalog (no replicas).
context | The DM context. |
path | The logical file name. |
mode | The creation mode. |
int dmlite_delreplica | ( | dmlite_context * | context, |
const dmlite_replica * | replica | ||
) |
Deletes a replica.
context | The DM context. |
replica | The replica to delete. |
int dmlite_getcomment | ( | dmlite_context * | context, |
const char * | path, | ||
char * | comment, | ||
size_t | bufsize | ||
) |
Gets the comment associated with a file.
context | The DM context. |
path | The logical path. |
comment | Where to put the retrieved comment. It must be at least of size COMMENT_MAX. |
bufsize | Size of the memory zone pointed by comment. |
char* dmlite_getcwd | ( | dmlite_context * | context, |
char * | buffer, | ||
size_t | size | ||
) |
Gets the current working directory.
context | The DM context. |
buffer | If not NULL, the path will be stored here. malloc will be used otherwise. |
size | The buffer size. |
int dmlite_getgrpbynam | ( | dmlite_context * | context, |
const char * | groupName, | ||
gid_t * | gid | ||
) |
Gets the id of a group.
context | The DM context. |
groupName | The group name. |
gid | Where to put the group ID. |
int dmlite_getreplica_by_rfn | ( | dmlite_context * | context, |
const char * | rfn, | ||
dmlite_replica * | replica | ||
) |
Gets a specific replica.
context | The DM context. |
rfn | The replica file name. |
replica | A buffer where the retrieved data will be put. |
int dmlite_getreplicas | ( | dmlite_context * | context, |
const char * | path, | ||
unsigned * | nReplicas, | ||
dmlite_replica ** | fileReplicas | ||
) |
Gets the replicas of a file.
context | The DM context. |
path | The logical file name. |
nReplicas | The number of entries will be put here. |
fileReplicas | An array with nEntries elements will be stored here. Use dmlite_replicas_free to free it. |
int dmlite_getusrbynam | ( | dmlite_context * | context, |
const char * | userName, | ||
uid_t * | uid | ||
) |
Get the user id.
context | The DM context. |
userName | The user name. |
uid | Where to put the user ID. |
int dmlite_lchown | ( | dmlite_context * | context, |
const char * | path, | ||
uid_t | newUid, | ||
gid_t | newGid | ||
) |
Changes the owner of a file, directory or symlink (does not follow).
context | The DM context. |
path | The logical path. |
newUid | The new owner. |
newGid | The new group. |
int dmlite_mkdir | ( | dmlite_context * | context, |
const char * | path, | ||
mode_t | mode | ||
) |
Creates a new directory.
context | The DM context. |
path | The directory for the new path. All the precedent folders must exist. |
mode | Permissions to use for the creation. |
dmlite_dir* dmlite_opendir | ( | dmlite_context * | context, |
const char * | path | ||
) |
Opens a directory to read it later.
context | The DM context. |
path | The directory to open. |
struct dirent* dmlite_readdir | ( | dmlite_context * | context, |
dmlite_dir * | dir | ||
) |
Reads an entry from a directory.
context | The DM context. |
dir | The pointer returned by dmlite_opendir. |
dmlite_xstat* dmlite_readdirx | ( | dmlite_context * | context, |
dmlite_dir * | dir | ||
) |
Reads an entry from a directory (extended data).
context | The DM context. |
dir | The pointer returned by dmlite_opendir. |
int dmlite_readlink | ( | dmlite_context * | context, |
const char * | path, | ||
char * | buf, | ||
size_t | bufsize | ||
) |
Reads a symlink.
context | The DM context. |
path | The symlink file. |
buf | Where to put the symlink target. |
bufsize | The size of the memory pointed by buf. |
int dmlite_rename | ( | dmlite_context * | context, |
const char * | oldPath, | ||
const char * | newPath | ||
) |
Renames a file, directory or symlink.
context | The DM context. |
oldPath | The old name. |
newPath | The new name. |
int dmlite_replicas_free | ( | unsigned | nReplicas, |
dmlite_replica * | fileReplicas | ||
) |
Frees a replica list.
nReplicas | The number of replicas contained in the array. |
fileReplicas | The array to free. |
int dmlite_rmdir | ( | dmlite_context * | context, |
const char * | path | ||
) |
Deletes a directory. It must be empty.
context | The DM context. |
path | The directory to remove. |
int dmlite_rstatx | ( | dmlite_context * | context, |
const char * | rfn, | ||
dmlite_xstat * | buf | ||
) |
Does an extended stat of a logical file using an associated replica filename.
context | The DM context. |
rfn | Replica filename. |
buf | Where to put the retrieved information. |
int dmlite_setacl | ( | dmlite_context * | context, |
const char * | path, | ||
unsigned | nEntries, | ||
dmlite_aclentry * | acl | ||
) |
Changes the ACL of a file.
context | The DM context. |
path | The logical path. |
nEntries | The number of entries in the acl array. |
acl | An ACL array. |
int dmlite_setcomment | ( | dmlite_context * | context, |
const char * | path, | ||
const char * | comment | ||
) |
Sets the comment associated with a file.
context | The DM context. |
path | The logical path. |
comment | The comment to associate. '\0' terminated string. |
int dmlite_setfsize | ( | dmlite_context * | context, |
const char * | path, | ||
uint64_t | filesize | ||
) |
Changes the size of a file in the catalog.
context | The DM context. |
path | The logical path. |
filesize | The new file size. |
int dmlite_setfsizec | ( | dmlite_context * | context, |
const char * | path, | ||
uint64_t | filesize, | ||
const char * | csumtype, | ||
const char * | csumvalue | ||
) |
Changes the size and checksum of a file in the catalog.
context | The DM context. |
path | The logical path. |
filesize | The new file size. |
csumtype | The new checksum type (CS, AD or MD). |
csumvalue | The new checksum value. |
int dmlite_setguid | ( | dmlite_context * | context, |
const char * | path, | ||
const char * | guid | ||
) |
Sets the file Grid Unique Identifier.
context | The DM context. |
path | The logical path. |
guid | The new GUID. |
int dmlite_stat | ( | dmlite_context * | context, |
const char * | path, | ||
struct stat * | buf | ||
) |
Does a stat of a file or directory.
context | The DM context. |
path | The path. |
buf | Where to put the retrieved information. |
int dmlite_statl | ( | dmlite_context * | context, |
const char * | path, | ||
struct stat * | buf | ||
) |
Does a stat of a file, directory, or symbolic link (does not follow).
context | The DM context. |
path | The path. |
buf | Where to put the retrieved information. |
int dmlite_statx | ( | dmlite_context * | context, |
const char * | path, | ||
dmlite_xstat * | buf | ||
) |
Does an extended stat of a file, directory or symbolic link.
context | The DM context. |
path | The path. |
buf | Where to put the retrieved information. |
int dmlite_symlink | ( | dmlite_context * | context, |
const char * | oldPath, | ||
const char * | newPath | ||
) |
Creates a symlink.
context | The DM context. |
oldPath | The old path. |
newPath | The new path. |
mode_t dmlite_umask | ( | dmlite_context * | context, |
mode_t | mask | ||
) |
Sets the file mode creation mask.
context | The DM context. |
mask | The new mask. |
int dmlite_unlink | ( | dmlite_context * | context, |
const char * | path | ||
) |
Removes a file.
context | The DM context. |
path | The logical file name. |
int dmlite_update_xattr | ( | dmlite_context * | context, |
const char * | path, | ||
const dmlite_any_dict * | xattr | ||
) |
Updates the file extended attributes.
context | The DM context. |
path | The logical path. |
xattr | The new set of extended attributes. |
int dmlite_updatereplica | ( | dmlite_context * | context, |
const dmlite_replica * | replica | ||
) |
Updates a replica.
context | The DM context. |
replica | The replica to modify. |
int dmlite_utime | ( | dmlite_context * | context, |
const char * | path, | ||
const struct utimbuf * | buf | ||
) |
Changes access and/or modification time.
context | The DM context. |
path | The file path. |
buf | A struct holding the new times. |