C wrapper for DMLite INode API. More...
#include <stdint.h>#include "any.h"#include "dmlite.h"#include "utils.h"
Go to the source code of this file.
Classes | |
| struct | dmlite_replica |
| struct | dmlite_xstat |
Typedefs | |
| typedef struct dmlite_idir | dmlite_idir |
Enumerations | |
| enum | dmlite_replica_status { kAvailable = '-', kBeingPopulated = 'P', kToBeDeleted = 'D' } |
| enum | dmlite_replica_type { kVolatile = 'V', kPermanent = 'P' } |
| enum | dmlite_file_status { kOnline = '-', kMigrated = 'm' } |
Functions | |
| int | dmlite_ibegin (dmlite_context *context) |
| Starts a transaction. | |
| int | dmlite_icommit (dmlite_context *context) |
| Commits the changes. | |
| int | dmlite_irollback (dmlite_context *context) |
| Undo the changes. | |
| int | dmlite_icreate (dmlite_context *context, const dmlite_xstat *f) |
| Creates a new file. | |
| int | dmlite_isymlink (dmlite_context *context, ino_t inode, const char *link) |
| Associates a symlink with an existing file. | |
| int | dmlite_iunlink (dmlite_context *context, ino_t inode) |
| Removes a file or directory from the database. | |
| int | dmlite_imove (dmlite_context *context, ino_t inode, ino_t dest) |
| Moves a file to a different parent directory. | |
| int | dmlite_irename (dmlite_context *context, ino_t inode, const char *name) |
| Changes the name of an entry. | |
| int | dmlite_istat (dmlite_context *context, ino_t inode, struct stat *buf) |
| Does a stat of an entry using the inode instead of the path. | |
| int | dmlite_istatx (dmlite_context *context, ino_t inode, dmlite_xstat *buf) |
| Does an extended stat of an entry using the inode instead of the path. | |
| int | dmlite_istatx_by_name (dmlite_context *context, ino_t parent, const char *name, dmlite_xstat *buf) |
| Does an extended stat using the parent inode and the entry name. | |
| int | dmlite_ireadlink (dmlite_context *context, ino_t inode, char *path, size_t bufsize) |
| Reads a symbolic link. | |
| int | dmlite_iaddreplica (dmlite_context *context, const dmlite_replica *replica) |
| Adds a new replica. | |
| int | dmlite_ideletereplica (dmlite_context *context, const dmlite_replica *replica) |
| Deletes a replica. | |
| int | dmlite_igetreplica (dmlite_context *context, int64_t rid, dmlite_replica *buf) |
| Gets a specific replica using its replica id. | |
| int | dmlite_igetreplicas (dmlite_context *context, ino_t inode, unsigned *nreplicas, dmlite_replica **replicas) |
| Gets all the replicas associated to a file. | |
| int | dmlite_iutime (dmlite_context *context, ino_t inode, const struct utimbuf *buf) |
| Sets the access and modification time. | |
| int | dmlite_isetmode (dmlite_context *context, ino_t inode, uid_t uid, gid_t gid, mode_t mode, unsigned nentries, dmlite_aclentry *acl) |
| Sets the mode and ACL of a file. | |
| int | dmlite_isetsize (dmlite_context *context, ino_t inode, size_t size) |
| Sets the size of a file. | |
| int | dmlite_isetchecksum (dmlite_context *context, ino_t inode, const char *csumtype, const char *csumvalue) |
| Sets the checksum of a file. | |
| int | dmlite_igetcomment (dmlite_context *context, ino_t inode, char *comment, size_t bufsize) |
| Gets the comment associated with an entry. | |
| int | dmlite_isetcomment (dmlite_context *context, ino_t inode, const char *comment) |
| Sets the comment associated with an entry. | |
| int | dmlite_ideletecomment (dmlite_context *context, ino_t inode) |
| Deletes the comment associated with an entry. | |
| int | dmlite_isetguid (dmlite_context *context, ino_t inode, const char *guid) |
| Sets the file Grid Unique Identifier. | |
| int | dmlite_iupdate_xattr (dmlite_context *context, ino_t inode, const dmlite_any_dict *xattr) |
| Updates the file extended attributes. | |
| dmlite_idir * | dmlite_iopendir (dmlite_context *context, ino_t inode) |
| Opens a directory. | |
| int | dmlite_iclosedir (dmlite_context *context, dmlite_idir *dir) |
| Closes a directory, freeing any internally allocated memory. | |
| dmlite_xstat * | dmlite_ireaddirx (dmlite_context *context, dmlite_idir *dir) |
| Reads a directory. Extended data. | |
| struct dirent * | dmlite_ireaddir (dmlite_context *context, dmlite_idir *dir) |
| Reads a directory. | |
C wrapper for DMLite INode API.
| typedef struct dmlite_idir dmlite_idir |
Opaque directory handler
| enum dmlite_file_status |
| enum dmlite_replica_type |
| int dmlite_iaddreplica | ( | dmlite_context * | context, | |
| const dmlite_replica * | replica | |||
| ) |
Adds a new replica.
| context | The DM context. | |
| replica | The replica to add. replica->fileid must point to a valid file. |
| int dmlite_ibegin | ( | dmlite_context * | context | ) |
Starts a transaction.
Depending on the plugin stack, it can be possible to nest several calls.
| context | The DM context. |
| int dmlite_iclosedir | ( | dmlite_context * | context, | |
| dmlite_idir * | dir | |||
| ) |
Closes a directory, freeing any internally allocated memory.
| context | The DM context. | |
| dir | The directory to close, as returned by dmlite_opendir. |
| int dmlite_icommit | ( | dmlite_context * | context | ) |
Commits the changes.
Depending on the plugin stack, it can be possible to nest several calls, and there must be one icommit per ibegin for the changes to be permanent.
| context | The DM context. |
| int dmlite_icreate | ( | dmlite_context * | context, | |
| const dmlite_xstat * | f | |||
| ) |
Creates a new file.
| context | The DM context. | |
| f | Only some fields from this struct will be used. That would depend on the plugin, but usually it will be: parent, name, mode, uid, gid, size, status, checksum and ACL. |
| int dmlite_ideletecomment | ( | dmlite_context * | context, | |
| ino_t | inode | |||
| ) |
Deletes the comment associated with an entry.
| context | The DM context. | |
| inode | The file id. |
| int dmlite_ideletereplica | ( | dmlite_context * | context, | |
| const dmlite_replica * | replica | |||
| ) |
Deletes a replica.
| context | The DM context. | |
| replica | The replica to remove. |
| int dmlite_igetcomment | ( | dmlite_context * | context, | |
| ino_t | inode, | |||
| char * | comment, | |||
| size_t | bufsize | |||
| ) |
Gets the comment associated with an entry.
| context | The DM context. | |
| inode | The file id. | |
| comment | Where to put the comment. | |
| bufsize | The size of the memory pointed by comment. |
| int dmlite_igetreplica | ( | dmlite_context * | context, | |
| int64_t | rid, | |||
| dmlite_replica * | buf | |||
| ) |
Gets a specific replica using its replica id.
| context | The DM context. | |
| rid | The replica id. | |
| buf | Where to put the retrieved data. |
| int dmlite_igetreplicas | ( | dmlite_context * | context, | |
| ino_t | inode, | |||
| unsigned * | nreplicas, | |||
| dmlite_replica ** | replicas | |||
| ) |
Gets all the replicas associated to a file.
| context | The DM context. | |
| inode | The file id. | |
| nreplicas | The number of replicas will be put here. | |
| replicas | It will be initialized to an array of nreplicas replicas. Free it with dmlite_replicas_free. |
| int dmlite_imove | ( | dmlite_context * | context, | |
| ino_t | inode, | |||
| ino_t | dest | |||
| ) |
Moves a file to a different parent directory.
| context | The DM context. | |
| inode | The file id. | |
| dest | The destination id. |
| dmlite_idir* dmlite_iopendir | ( | dmlite_context * | context, | |
| ino_t | inode | |||
| ) |
Opens a directory.
| context | The DM context. | |
| inode | The directory ID. |
| struct dirent* dmlite_ireaddir | ( | dmlite_context * | context, | |
| dmlite_idir * | dir | |||
| ) | [read] |
Reads a directory.
| context | The DM context. | |
| dir | The directory to read, as returned by dmlite_opendir. |
| dmlite_xstat* dmlite_ireaddirx | ( | dmlite_context * | context, | |
| dmlite_idir * | dir | |||
| ) |
Reads a directory. Extended data.
| context | The DM context. | |
| dir | The directory to read, as returned by dmlite_opendir. |
| int dmlite_ireadlink | ( | dmlite_context * | context, | |
| ino_t | inode, | |||
| char * | path, | |||
| size_t | bufsize | |||
| ) |
Reads a symbolic link.
| context | The DM context. | |
| inode | The file id. | |
| path | The link will be put here. | |
| bufsize | The size of the memory area pointed by path. |
| int dmlite_irename | ( | dmlite_context * | context, | |
| ino_t | inode, | |||
| const char * | name | |||
| ) |
Changes the name of an entry.
| context | The DM context. | |
| inode | The file id. | |
| name | The new name. |
| int dmlite_irollback | ( | dmlite_context * | context | ) |
Undo the changes.
If several ibegin were nested, all the transactions will be probable be undone, regardless on the nesting level.
| context | The DM context. |
| int dmlite_isetchecksum | ( | dmlite_context * | context, | |
| ino_t | inode, | |||
| const char * | csumtype, | |||
| const char * | csumvalue | |||
| ) |
Sets the checksum of a file.
| context | The DM context. | |
| inode | The file id. | |
| csumtype | The new checksum type. | |
| csumvalue | The new checksum value. |
| int dmlite_isetcomment | ( | dmlite_context * | context, | |
| ino_t | inode, | |||
| const char * | comment | |||
| ) |
Sets the comment associated with an entry.
| context | The DM context. | |
| inode | The file id. | |
| comment | The new comment. |
| int dmlite_isetguid | ( | dmlite_context * | context, | |
| ino_t | inode, | |||
| const char * | guid | |||
| ) |
Sets the file Grid Unique Identifier.
| context | The DM context. | |
| inode | The entry id. | |
| guid | The new GUID. |
| int dmlite_isetmode | ( | dmlite_context * | context, | |
| ino_t | inode, | |||
| uid_t | uid, | |||
| gid_t | gid, | |||
| mode_t | mode, | |||
| unsigned | nentries, | |||
| dmlite_aclentry * | acl | |||
| ) |
Sets the mode and ACL of a file.
| context | The DM context. | |
| inode | The file id. | |
| uid | The new UID. | |
| gid | The new GID. | |
| mode | The new mode. | |
| nentries | The number of acl entries. | |
| acl | The new ACL. |
| int dmlite_isetsize | ( | dmlite_context * | context, | |
| ino_t | inode, | |||
| size_t | size | |||
| ) |
Sets the size of a file.
| context | The DM context. | |
| inode | The file id. | |
| size | The new size. |
| int dmlite_istat | ( | dmlite_context * | context, | |
| ino_t | inode, | |||
| struct stat * | buf | |||
| ) |
Does a stat of an entry using the inode instead of the path.
| context | The DM context. | |
| inode | The entry inode. | |
| buf | Where to put the retrieved information. |
| int dmlite_istatx | ( | dmlite_context * | context, | |
| ino_t | inode, | |||
| dmlite_xstat * | buf | |||
| ) |
Does an extended stat of an entry using the inode instead of the path.
| context | The DM context. | |
| inode | The entry inode. | |
| buf | Where to put the retrieved information. |
| int dmlite_istatx_by_name | ( | dmlite_context * | context, | |
| ino_t | parent, | |||
| const char * | name, | |||
| dmlite_xstat * | buf | |||
| ) |
Does an extended stat using the parent inode and the entry name.
| context | The DM context. | |
| parent | The parent id. | |
| name | The entry name. | |
| buf | Where to put the retrieved information. |
| int dmlite_isymlink | ( | dmlite_context * | context, | |
| ino_t | inode, | |||
| const char * | link | |||
| ) |
Associates a symlink with an existing file.
| context | The DM context. | |
| inode | The file that will be a symlink. | |
| link | The destination link. |
| int dmlite_iunlink | ( | dmlite_context * | context, | |
| ino_t | inode | |||
| ) |
Removes a file or directory from the database.
| context | The DM context. | |
| inode | The id of the entry to remove. |
| int dmlite_iupdate_xattr | ( | dmlite_context * | context, | |
| ino_t | inode, | |||
| const dmlite_any_dict * | xattr | |||
| ) |
Updates the file extended attributes.
| context | The DM context. | |
| inode | The entry id. | |
| xattr | The new set of extended attributes. |
| int dmlite_iutime | ( | dmlite_context * | context, | |
| ino_t | inode, | |||
| const struct utimbuf * | buf | |||
| ) |
Sets the access and modification time.
| context | The DM context. | |
| inode | The file id. | |
| buf | The timestamps. |
1.6.1