C wrapper for DMLite Catalog API. More...
#include "dmlite.h"#include "inode.h"#include "utils.h"
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. | |
| char * | dmlite_getcwd (dmlite_context *context, char *buffer, size_t size) |
| Gets the current working directory. | |
| mode_t | dmlite_umask (dmlite_context *context, mode_t mask) |
| Sets the file mode creation mask. | |
| int | dmlite_stat (dmlite_context *context, const char *path, struct stat *buf) |
| Does a stat of a file or directory. | |
| 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). | |
| int | dmlite_statx (dmlite_context *context, const char *path, dmlite_xstat *buf) |
| Does an extended stat of a file, directory or symbolic link. | |
| int | dmlite_addreplica (dmlite_context *context, const dmlite_replica *replica) |
| Adds a new replica to an entry. | |
| int | dmlite_delreplica (dmlite_context *context, const dmlite_replica *replica) |
| Deletes a replica. | |
| int | dmlite_getreplicas (dmlite_context *context, const char *path, unsigned *nReplicas, dmlite_replica **fileReplicas) |
| Gets the replicas of a file. | |
| int | dmlite_replicas_free (dmlite_context *context, unsigned nReplicas, dmlite_replica *fileReplicas) |
| Frees a replica list. | |
| int | dmlite_symlink (dmlite_context *context, const char *oldPath, const char *newPath) |
| Creates a symlink. | |
| int | dmlite_readlink (dmlite_context *context, const char *path, char *buf, size_t bufsize) |
| Reads a symlink. | |
| int | dmlite_unlink (dmlite_context *context, const char *path) |
| Removes a file. | |
| int | dmlite_create (dmlite_context *context, const char *path, mode_t mode) |
| Creates a file in the catalog (no replicas). | |
| int | dmlite_chmod (dmlite_context *context, const char *path, mode_t mode) |
| Changes the mode of a file or directory. | |
| int | dmlite_chown (dmlite_context *context, const char *path, uid_t newUid, gid_t newGid) |
| Changes the owner of a file or directory. | |
| 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). | |
| int | dmlite_setfsize (dmlite_context *context, const char *path, uint64_t filesize) |
| Changes the size of a file in the catalog. | |
| 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. | |
| int | dmlite_setacl (dmlite_context *context, const char *path, unsigned nEntries, dmlite_aclentry *acl) |
| Changes the ACL of a file. | |
| int | dmlite_utime (dmlite_context *context, const char *path, const struct utimbuf *buf) |
| Changes access and/or modification time. | |
| int | dmlite_getcomment (dmlite_context *context, const char *path, char *comment, size_t bufsize) |
| Gets the comment associated with a file. | |
| int | dmlite_setcomment (dmlite_context *context, const char *path, const char *comment) |
| Sets the comment associated with a file. | |
| int | dmlite_setguid (dmlite_context *context, const char *path, const char *guid) |
| Sets the file Grid Unique Identifier. | |
| int | dmlite_update_xattr (dmlite_context *context, const char *path, const dmlite_any_dict *xattr) |
| Updates the file extended attributes. | |
| int | dmlite_getgrpbynam (dmlite_context *context, const char *groupName, gid_t *gid) |
| Gets the id of a group. | |
| int | dmlite_getusrbynam (dmlite_context *context, const char *userName, uid_t *uid) |
| Get the user id. | |
| dmlite_dir * | dmlite_opendir (dmlite_context *context, const char *path) |
| Opens a directory to read it later. | |
| int | dmlite_closedir (dmlite_context *context, dmlite_dir *dir) |
| Closes a directory and free the internal structures. | |
| struct dirent * | dmlite_readdir (dmlite_context *context, dmlite_dir *dir) |
| Reads an entry from a directory. | |
| dmlite_xstat * | dmlite_readdirx (dmlite_context *context, dmlite_dir *dir) |
| Reads an entry from a directory (extended data). | |
| int | dmlite_mkdir (dmlite_context *context, const char *path, mode_t mode) |
| Creates a new directory. | |
| int | dmlite_rename (dmlite_context *context, const char *oldPath, const char *newPath) |
| Renames a file, directory or symlink. | |
| int | dmlite_rmdir (dmlite_context *context, const char *path) |
| Deletes a directory. It must be empty. | |
| int | dmlite_getreplica (dmlite_context *context, const char *rfn, dmlite_replica *replica) |
| Gets a specific replica. | |
| int | dmlite_updatereplica (dmlite_context *context, const dmlite_replica *replica) |
| Updates a replica. | |
C wrapper for DMLite Catalog API.
| typedef struct dmlite_dir dmlite_dir |
| 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 | ( | 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 | |||
| ) | [read] |
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 | ( | dmlite_context * | context, | |
| unsigned | nReplicas, | |||
| dmlite_replica * | fileReplicas | |||
| ) |
Frees a replica list.
| context | The DM context. | |
| 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_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. |
1.6.1