DAOS API (v2.1 - dev)
Loading...
Searching...
No Matches
daos_fs.h File Reference
#include <dirent.h>
#include <inttypes.h>
#include <sys/stat.h>
#include <daos_types.h>
#include <daos_obj.h>
#include <daos_obj_class.h>
#include <daos_array.h>
#include <daos_cont.h>

Go to the source code of this file.

Data Structures

struct  dfs_attr_t
 
struct  dfs_iod_t
 
struct  dfs_obj_info_t
 
struct  dfs_predicate_t
 

Macros

#define DFS_MAX_NAME   NAME_MAX
 
#define DFS_MAX_PATH   PATH_MAX
 
#define DFS_MAX_FSIZE   (~0ULL)
 
#define DFS_DEFAULT_CHUNK_SIZE   1048576
 
#define DFS_MAX_XATTR_NAME   255
 
#define DFS_MAX_XATTR_LEN   65536
 
#define DFS_BALANCED   4
 
#define DFS_RELAXED   0
 
#define DFS_RDONLY   O_RDONLY
 
#define DFS_RDWR   O_RDWR
 
#define DFS_SET_ATTR_MODE   (1 << 0)
 
#define DFS_SET_ATTR_ATIME   (1 << 1)
 
#define DFS_SET_ATTR_MTIME   (1 << 2)
 
#define DFS_SET_ATTR_SIZE   (1 << 3)
 
#define DFS_SET_ATTR_UID   (1 << 4)
 
#define DFS_SET_ATTR_GID   (1 << 5)
 

Typedefs

typedef struct dfs_obj dfs_obj_t
 
typedef struct dfs dfs_t
 
typedef int(* dfs_filler_cb_t) (dfs_t *dfs, dfs_obj_t *obj, const char name[], void *arg)
 
typedef struct dfs_pipeline dfs_pipeline_t
 

Enumerations

enum  {
  DFS_CHECK_PRINT = (1 << 0) , DFS_CHECK_REMOVE = (1 << 1) , DFS_CHECK_RELINK = (1 << 2) , DFS_CHECK_VERIFY = (1 << 3) ,
  DFS_CHECK_EVICT_ALL = (1 << 4)
}
 
enum  { DFS_FILTER_NAME = (1 << 1) , DFS_FILTER_NEWER = (1 << 2) , DFS_FILTER_INCLUDE_DIRS = (1 << 3) }
 

Functions

int dfs_init (void)
 
int dfs_fini (void)
 
int dfs_connect (const char *pool, const char *sys, const char *cont, int flags, dfs_attr_t *attr, dfs_t **dfs)
 
int dfs_disconnect (dfs_t *dfs)
 
int dfs_destroy (const char *pool, const char *sys, const char *cont, int force, daos_event_t *ev)
 
int dfs_cont_create (daos_handle_t poh, uuid_t *uuid, dfs_attr_t *attr, daos_handle_t *coh, dfs_t **dfs)
 
int dfs_cont_create_with_label (daos_handle_t poh, const char *label, dfs_attr_t *attr, uuid_t *uuid, daos_handle_t *coh, dfs_t **dfs)
 
int dfs_mount (daos_handle_t poh, daos_handle_t coh, int flags, dfs_t **dfs)
 
int dfs_umount (dfs_t *dfs)
 
int dfs_pool_get (dfs_t *dfs, daos_handle_t *poh)
 
int dfs_pool_put (dfs_t *dfs, daos_handle_t poh)
 
int dfs_cont_get (dfs_t *dfs, daos_handle_t *coh)
 
int dfs_cont_put (dfs_t *dfs, daos_handle_t coh)
 
int dfs_query (dfs_t *dfs, dfs_attr_t *attr)
 
int dfs_local2global (dfs_t *dfs, d_iov_t *glob)
 
int dfs_global2local (daos_handle_t poh, daos_handle_t coh, int flags, d_iov_t glob, dfs_t **dfs)
 
int dfs_local2global_all (dfs_t *dfs, d_iov_t *glob)
 
int dfs_global2local_all (int flags, d_iov_t glob, dfs_t **dfs)
 
int dfs_set_prefix (dfs_t *dfs, const char *prefix)
 
int dfs_obj2id (dfs_obj_t *obj, daos_obj_id_t *oid)
 
int dfs_lookup (dfs_t *dfs, const char *path, int flags, dfs_obj_t **obj, mode_t *mode, struct stat *stbuf)
 
int dfs_lookup_rel (dfs_t *dfs, dfs_obj_t *parent, const char *name, int flags, dfs_obj_t **obj, mode_t *mode, struct stat *stbuf)
 
int dfs_suggest_oclass (dfs_t *dfs, const char *hint, daos_oclass_id_t *cid)
 
int dfs_open (dfs_t *dfs, dfs_obj_t *parent, const char *name, mode_t mode, int flags, daos_oclass_id_t cid, daos_size_t chunk_size, const char *value, dfs_obj_t **obj)
 
int dfs_dup (dfs_t *dfs, dfs_obj_t *obj, int flags, dfs_obj_t **new_obj)
 
int dfs_obj_local2global (dfs_t *dfs, dfs_obj_t *obj, d_iov_t *glob)
 
int dfs_obj_global2local (dfs_t *dfs, int flags, d_iov_t glob, dfs_obj_t **obj)
 
int dfs_release (dfs_obj_t *obj)
 
int dfs_read (dfs_t *dfs, dfs_obj_t *obj, d_sg_list_t *sgl, daos_off_t off, daos_size_t *read_size, daos_event_t *ev)
 
int dfs_readx (dfs_t *dfs, dfs_obj_t *obj, dfs_iod_t *iod, d_sg_list_t *sgl, daos_size_t *read_size, daos_event_t *ev)
 
int dfs_write (dfs_t *dfs, dfs_obj_t *obj, d_sg_list_t *sgl, daos_off_t off, daos_event_t *ev)
 
int dfs_writex (dfs_t *dfs, dfs_obj_t *obj, dfs_iod_t *iod, d_sg_list_t *sgl, daos_event_t *ev)
 
int dfs_get_size (dfs_t *dfs, dfs_obj_t *obj, daos_size_t *size)
 
int dfs_punch (dfs_t *dfs, dfs_obj_t *obj, daos_off_t offset, daos_size_t len)
 
int dfs_readdir (dfs_t *dfs, dfs_obj_t *obj, daos_anchor_t *anchor, uint32_t *nr, struct dirent *dirs)
 
int dfs_readdirplus (dfs_t *dfs, dfs_obj_t *obj, daos_anchor_t *anchor, uint32_t *nr, struct dirent *dirs, struct stat *stbufs)
 
int dfs_iterate (dfs_t *dfs, dfs_obj_t *obj, daos_anchor_t *anchor, uint32_t *nr, size_t size, dfs_filler_cb_t op, void *arg)
 
int dfs_dir_anchor_set (dfs_obj_t *obj, const char name[], daos_anchor_t *anchor)
 
int dfs_obj_anchor_split (dfs_obj_t *obj, uint32_t *nr, daos_anchor_t *anchors)
 
int dfs_obj_anchor_set (dfs_obj_t *obj, uint32_t index, daos_anchor_t *anchor)
 
int dfs_mkdir (dfs_t *dfs, dfs_obj_t *parent, const char *name, mode_t mode, daos_oclass_id_t cid)
 
int dfs_remove (dfs_t *dfs, dfs_obj_t *parent, const char *name, bool force, daos_obj_id_t *oid)
 
int dfs_move (dfs_t *dfs, dfs_obj_t *parent, const char *name, dfs_obj_t *new_parent, const char *new_name, daos_obj_id_t *oid)
 
int dfs_exchange (dfs_t *dfs, dfs_obj_t *parent1, const char *name1, dfs_obj_t *parent2, const char *name2)
 
int dfs_get_mode (dfs_obj_t *obj, mode_t *mode)
 
int dfs_obj_get_info (dfs_t *dfs, dfs_obj_t *obj, dfs_obj_info_t *info)
 
int dfs_obj_set_oclass (dfs_t *dfs, dfs_obj_t *obj, int flags, daos_oclass_id_t cid)
 
int dfs_obj_set_chunk_size (dfs_t *dfs, dfs_obj_t *obj, int flags, daos_size_t csize)
 
int dfs_get_file_oh (dfs_obj_t *obj, daos_handle_t *oh)
 
int dfs_get_chunk_size (dfs_obj_t *obj, daos_size_t *chunk_size)
 
int dfs_get_symlink_value (dfs_obj_t *obj, char *buf, daos_size_t *size)
 
int dfs_update_parent (dfs_obj_t *obj, dfs_obj_t *src_obj, const char *name)
 
int dfs_stat (dfs_t *dfs, dfs_obj_t *parent, const char *name, struct stat *stbuf)
 
int dfs_ostat (dfs_t *dfs, dfs_obj_t *obj, struct stat *stbuf)
 
int dfs_osetattr (dfs_t *dfs, dfs_obj_t *obj, struct stat *stbuf, int flags)
 
int dfs_access (dfs_t *dfs, dfs_obj_t *parent, const char *name, int mask)
 
int dfs_chmod (dfs_t *dfs, dfs_obj_t *parent, const char *name, mode_t mode)
 
int dfs_chown (dfs_t *dfs, dfs_obj_t *parent, const char *name, uid_t uid, gid_t gid, int flags)
 
int dfs_sync (dfs_t *dfs)
 
int dfs_setxattr (dfs_t *dfs, dfs_obj_t *obj, const char *name, const void *value, daos_size_t size, int flags)
 
int dfs_getxattr (dfs_t *dfs, dfs_obj_t *obj, const char *name, void *value, daos_size_t *size)
 
int dfs_removexattr (dfs_t *dfs, dfs_obj_t *obj, const char *name)
 
int dfs_listxattr (dfs_t *dfs, dfs_obj_t *obj, char *list, daos_size_t *size)
 
int dfs_cont_check (daos_handle_t poh, const char *cont, uint64_t flags, const char *name)
 
int dfs_cont_set_owner (daos_handle_t coh, d_string_t user, uid_t uid, d_string_t group, gid_t gid)
 
int dfs_get_size_by_oid (dfs_t *dfs, daos_obj_id_t oid, daos_size_t chunk_size, daos_size_t *size)
 
int dfs_pipeline_create (dfs_t *dfs, dfs_predicate_t pred, uint64_t flags, dfs_pipeline_t **dpipe)
 
int dfs_pipeline_destroy (dfs_pipeline_t *dpipe)
 
int dfs_readdir_with_filter (dfs_t *dfs, dfs_obj_t *obj, dfs_pipeline_t *dpipe, daos_anchor_t *anchor, uint32_t *nr, struct dirent *dirs, daos_obj_id_t *oids, daos_size_t *csizes, uint64_t *nr_scanned)
 
int dfs_cont_scan (daos_handle_t poh, const char *cont, uint64_t flags, const char *name)
 

Detailed Description

DAOS File System API

The DFS API provides an encapuslated namespace with a POSIX like API directly on top of the DAOS API. The namespace is encapsulated under a single DAOS container where directories and files are objects in that container.

Definition in file daos_fs.h.

Macro Definition Documentation

◆ DFS_BALANCED

#define DFS_BALANCED   4

DFS container balanced consistency mode. DFS operations using a DTX

Definition at line 60 of file daos_fs.h.

◆ DFS_DEFAULT_CHUNK_SIZE

#define DFS_DEFAULT_CHUNK_SIZE   1048576

Default chunk size for files (arrays)

Definition at line 40 of file daos_fs.h.

◆ DFS_MAX_FSIZE

#define DFS_MAX_FSIZE   (~0ULL)

Maximum file size

Definition at line 38 of file daos_fs.h.

◆ DFS_MAX_NAME

#define DFS_MAX_NAME   NAME_MAX

Maximum Name length

Definition at line 34 of file daos_fs.h.

◆ DFS_MAX_PATH

#define DFS_MAX_PATH   PATH_MAX

Maximum PATH length

Definition at line 36 of file daos_fs.h.

◆ DFS_MAX_XATTR_LEN

#define DFS_MAX_XATTR_LEN   65536

Maximum xattr value

Definition at line 44 of file daos_fs.h.

◆ DFS_MAX_XATTR_NAME

#define DFS_MAX_XATTR_NAME   255

Maximum xattr name

Definition at line 42 of file daos_fs.h.

◆ DFS_RDONLY

#define DFS_RDONLY   O_RDONLY

read-only access

Definition at line 64 of file daos_fs.h.

◆ DFS_RDWR

#define DFS_RDWR   O_RDWR

read/write access

Definition at line 66 of file daos_fs.h.

◆ DFS_RELAXED

#define DFS_RELAXED   0

DFS container relaxed consistency mode. DFS operations do not use a DTX (default mode)

Definition at line 62 of file daos_fs.h.

◆ DFS_SET_ATTR_ATIME

#define DFS_SET_ATTR_ATIME   (1 << 1)

Option to set the access time on an entry

Definition at line 992 of file daos_fs.h.

◆ DFS_SET_ATTR_GID

#define DFS_SET_ATTR_GID   (1 << 5)

Option to set gid of object

Definition at line 1000 of file daos_fs.h.

◆ DFS_SET_ATTR_MODE

#define DFS_SET_ATTR_MODE   (1 << 0)

Option to set the mode_t on an entry

Definition at line 990 of file daos_fs.h.

◆ DFS_SET_ATTR_MTIME

#define DFS_SET_ATTR_MTIME   (1 << 2)

Option to set the modify time on an entry

Definition at line 994 of file daos_fs.h.

◆ DFS_SET_ATTR_SIZE

#define DFS_SET_ATTR_SIZE   (1 << 3)

Option to set size of a file

Definition at line 996 of file daos_fs.h.

◆ DFS_SET_ATTR_UID

#define DFS_SET_ATTR_UID   (1 << 4)

Option to set uid of object

Definition at line 998 of file daos_fs.h.

Typedef Documentation

◆ dfs_filler_cb_t

typedef int(* dfs_filler_cb_t) (dfs_t *dfs, dfs_obj_t *obj, const char name[], void *arg)

User callback defined for dfs_readdir_size.

Definition at line 691 of file daos_fs.h.

◆ dfs_obj_t

typedef struct dfs_obj dfs_obj_t

File/Directory/Symlink object handle struct

Definition at line 47 of file daos_fs.h.

◆ dfs_pipeline_t

typedef struct dfs_pipeline dfs_pipeline_t

DFS pipeline object

Definition at line 1207 of file daos_fs.h.

◆ dfs_t

typedef struct dfs dfs_t

DFS mount handle struct

Definition at line 49 of file daos_fs.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
DFS_CHECK_PRINT 

print the leaked OIDS

DFS_CHECK_REMOVE 

remove / punch the leaked objects

DFS_CHECK_RELINK 

relink the leaked oids under "/lost+found"

DFS_CHECK_VERIFY 

verify data consistency of each oid in the container (note that this will be slow)

DFS_CHECK_EVICT_ALL 

Evict all open container handles to ensure exclusive open works for the checker

Definition at line 1154 of file daos_fs.h.

◆ anonymous enum

anonymous enum

Definition at line 1209 of file daos_fs.h.

Function Documentation

◆ dfs_access()

int dfs_access ( dfs_t * dfs,
dfs_obj_t * parent,
const char * name,
int mask )

Check access permissions on an object. Similar to Linux access(2). Symlinks are dereferenced.

Parameters
[in]dfsPointer to the mounted file system.
[in]parentOpened parent directory object. If NULL, use root obj.
[in]nameLink name of the object. Can be NULL if parent is root, which means operation will be on root object.
[in]maskaccessibility check(s) to be performed. It should be either the value F_OK, or a mask with bitwise OR of one or more of R_OK, W_OK, and X_OK.
Returns
0 on success, errno code on failure.

◆ dfs_chmod()

int dfs_chmod ( dfs_t * dfs,
dfs_obj_t * parent,
const char * name,
mode_t mode )

Change permission access bits. Symlinks are dereferenced.

Parameters
[in]dfsPointer to the mounted file system.
[in]parentOpened parent directory object. If NULL, use root obj.
[in]nameLink name of the object. Can be NULL if parent is root, which means operation will be on root object.
[in]modeNew permission access modes. For now, we don't support the sticky bit, setuid, and setgid.
Returns
0 on success, errno code on failure.

◆ dfs_chown()

int dfs_chown ( dfs_t * dfs,
dfs_obj_t * parent,
const char * name,
uid_t uid,
gid_t gid,
int flags )

Change owner and group. Since uid and gid are not enforced at the DFS level, we do not also enforce the process privileges to be able to change the uid and gid. Any process with write access to the DFS container can make changes to the uid and gid using this function.

Parameters
[in]dfsPointer to the mounted file system.
[in]parentOpened parent directory object. If NULL, use root obj.
[in]nameLink name of the object. Can be NULL if parent is root, which means operation will be on root object.
[in]uidchange owner of file (-1 to leave unchanged).
[in]gidchange group of file (-1 to leave unchanged).
[in]flagsif 0, symlinks are dereferenced. Pass O_NOFOLLOW to not dereference.
Returns
0 on success, errno code on failure.

◆ dfs_connect()

int dfs_connect ( const char * pool,
const char * sys,
const char * cont,
int flags,
dfs_attr_t * attr,
dfs_t ** dfs )

Mount a DFS namespace over the specified pool and container. The container can be optionally created if it doesn't exist, and O_CREAT is passed in flags. The handle must be released using dfs_disconnect() and not dfs_umount(). Using the latter in this case will leak open handles for the pool and container.

This function works only if dfs_init() is called, otherwise would return EACCES. In addition to setting up the pool and container handles for the user, this also utilizes an internal cache for keeping the pool and container handles open internally with a ref count and closes those handles on dfs_finalize().

Parameters
[in]poolPool label.
[in]sysDAOS system name to use for the pool connect. Pass NULL to use the default system.
[in]contContainer label.
[in]flagsMount flags (O_RDONLY or O_RDWR, O_CREAT). O_CREAT attempts to create the DFS container if it doesn't exists.
[in]attrOptional set of properties and attributes to set on the container (if being created). Pass NULL to use default.
[out]dfsPointer to the created DFS mount point.
Returns
0 on success, errno code on failure.

◆ dfs_cont_check()

int dfs_cont_check ( daos_handle_t poh,
const char * cont,
uint64_t flags,
const char * name )

Scan the DFS namespace and check if there are any leaked objects. Depending on the flag passed, either remove those leaked objects to reclaim space, add those object to "Lost+Found" directory, or just print the oids to stdout.

Parameters
[in]pohOpen pool handle.
[in]contPOSIX container label.
[in]flagsFlags to indicate what to do with leaked objects: punch, link to l+f, or print to stdout.
[in]nameOptional directory name to be created under lost+found where all oids are stored. If NULL is specified, a directory will be created with a name corresponding to the current timestamp with the format "%Y-%m-%d-%H:%M:%S". If the DFS_CHECK_LINK_LF is not set, this is ignored.
Returns
0 on success, errno code on failure.

◆ dfs_cont_create()

int dfs_cont_create ( daos_handle_t poh,
uuid_t * uuid,
dfs_attr_t * attr,
daos_handle_t * coh,
dfs_t ** dfs )

Create a DFS container with the POSIX property layout set. Optionally set attributes for hints on the container.

Parameters
[in]pohPool open handle.
[out]uuidPointer to uuid_t to hold the implementation-generated container UUID.
[in]attrOptional set of properties and attributes to set on the container. Pass NULL if none.
[out]cohOptionally leave the container open and return its hdl.
[out]dfsOptionally mount DFS on the container and return the dfs handle.
Returns
0 on success, errno code on failure.

◆ dfs_cont_create_with_label()

int dfs_cont_create_with_label ( daos_handle_t poh,
const char * label,
dfs_attr_t * attr,
uuid_t * uuid,
daos_handle_t * coh,
dfs_t ** dfs )

Create a DFS container with label label. This is the same as dfs_container_create() with the label property set in attr->da_props.

Parameters
[in]pohPool open handle.
[in]labelRequired, label property of the new container. Supersedes any label specified in cont_prop.
[in]attrOptional set of properties and attributes to set on the container. Pass NULL if none.
[out]uuidOptional pointer to uuid_t to hold the implementation-generated container UUID.
[out]cohOptionally leave the container open and return its hdl.
[out]dfsOptionally mount DFS on the container and return the dfs handle.
Returns
0 on success, errno code on failure.

◆ dfs_cont_get()

int dfs_cont_get ( dfs_t * dfs,
daos_handle_t * coh )

Retrieve the open cont handle on the DFS mount. This is refcounted internally and must be released with dfs_cont_put().

Parameters
[in]dfsPointer to the mounted file system.
[out]cohOpen cont handle.
Returns
0 on success, errno code on failure.

◆ dfs_cont_put()

int dfs_cont_put ( dfs_t * dfs,
daos_handle_t coh )

Release refcount of cont handle taken by dfs_cont_get().

Parameters
[in]dfsPointer to the mounted file system.
[out]cohCont handle that was returned from dfs_cont_get().
Returns
0 on success, errno code on failure.

◆ dfs_cont_scan()

int dfs_cont_scan ( daos_handle_t poh,
const char * cont,
uint64_t flags,
const char * name )

Scan the DFS namespace and report statistics about file/dir size and namespace structure.

Parameters
[in]pohOpen pool handle.
[in]contPOSIX container label.
[in]flagsUnused flag, added for future use.
[in]nameOptional subdirectory path to scan from. Start from container root if not specified.
Returns
0 on success, errno code on failure.

◆ dfs_cont_set_owner()

int dfs_cont_set_owner ( daos_handle_t coh,
d_string_t user,
uid_t uid,
d_string_t group,
gid_t gid )

Update a POSIX's container's owner user and/or owner group. This is the same as calling daos_cont_set_owner() but will also update the owner of the root directory in the container.

Parameters
[in]cohOpen container handle
[in]userNew owner user (NULL if not updating)
[in]uidNew owner uid, if different from user's on local system (-1 otherwise)
[in]groupNew owner group (NULL if not updating)
[in]gidNew owner gid, if different from group's on local system (-1 otherwise)
Returns
0 on success, errno code on failure.

◆ dfs_destroy()

int dfs_destroy ( const char * pool,
const char * sys,
const char * cont,
int force,
daos_event_t * ev )

Evict all the container handles from the hashtable and destroy the container.

Parameters
[in]poolPool label where the container is.
[in]sysDAOS system name to use for the pool. Pass NULL to use the default system.
[in]contContainer label to destroy.
[in]forceContainer destroy will return failure if the container is still busy (outstanding open handles from other open calls). This parameter will force the destroy to proceed even if there is an outstanding open handle.
[in]evCompletion event, it is optional and can be NULL. The function will run in blocking mode if ev is NULL.
Returns
0 on success, errno code on failure.

◆ dfs_dir_anchor_set()

int dfs_dir_anchor_set ( dfs_obj_t * obj,
const char name[],
daos_anchor_t * anchor )

Set the readdir/iterate anchor to start from a specific entry name in a directory object. When using the anchor in a readdir call, the iteration will start from the position of that entry.

Parameters
[in]objOpened directory object.
[in]nameEntry name of a file/dir in the open directory where anchor should be set.
[out]anchorHash anchor returned for the position of the entry name in obj.
Returns
0 on success, errno code on failure.

◆ dfs_disconnect()

int dfs_disconnect ( dfs_t * dfs)

Umount the DFS namespace, and release the ref count on the container and pool handles. This should be called on a dfs mount created with dfs_connect() and not dfs_mount().

Parameters
[in]dfsPointer to the mounted file system from dfs_connect().
Returns
0 on success, errno code on failure.

◆ dfs_dup()

int dfs_dup ( dfs_t * dfs,
dfs_obj_t * obj,
int flags,
dfs_obj_t ** new_obj )

Duplicate the DFS object without any RPCs (locally) by using the existing open handles. This is used mostly for low-level fuse to avoid re-opening. The duplicated object must be released with dfs_release().

Parameters
[in]dfsPointer to the mounted file system.
[in]objObject to dup.
[in]flagsAccess flags to open with (O_RDONLY or O_RDWR).
[out]new_objDFS object that is duplicated/opened.
Returns
0 on success, errno code on failure.

◆ dfs_exchange()

int dfs_exchange ( dfs_t * dfs,
dfs_obj_t * parent1,
const char * name1,
dfs_obj_t * parent2,
const char * name2 )

Exchange two objects.

Parameters
[in]dfsPointer to the mounted file system.
[in]parent1Parent directory object of name1. If NULL, use root obj.
[in]name1Link name of first object.
[in]parent2Parent directory object of name2. If NULL, use root obj.
[in]name2link name of second object.
Returns
0 on success, errno code on failure.

◆ dfs_fini()

int dfs_fini ( void )

Finalize the DAOS and DFS library. Typically this is called at the end of a user program or in IO middleware finalization. This is required to be called if dfs_init() was called and closes all cached open pool and container handles that resulted from dfs_connect() calls.

Returns
0 on success, errno code on failure.

◆ dfs_get_chunk_size()

int dfs_get_chunk_size ( dfs_obj_t * obj,
daos_size_t * chunk_size )

Retrieve the chunk size of a DFS file object.

Parameters
[in]objOpen object.
[out]chunk_sizeChunk size of array object.
Returns
0 on success, errno code on failure.

◆ dfs_get_file_oh()

int dfs_get_file_oh ( dfs_obj_t * obj,
daos_handle_t * oh )

Retrieve the DAOS open handle of a DFS file object. User should not close this handle. This is used in cases like MPI-IO where 1 rank creates the file with dfs, but wants to access the file with the array API directly rather than the DFS API.

Parameters
[in]objOpen object.
[out]ohDAOS object open handle.
Returns
0 on success, errno code on failure.

◆ dfs_get_mode()

int dfs_get_mode ( dfs_obj_t * obj,
mode_t * mode )

Retrieve mode of an open object.

Parameters
[in]objOpen object to query.
[out]modemode_t (permissions + type).
Returns
0 on success, errno code on failure.

◆ dfs_get_size()

int dfs_get_size ( dfs_t * dfs,
dfs_obj_t * obj,
daos_size_t * size )

Query size of file data.

Parameters
[in]dfsPointer to the mounted file system.
[in]objOpened file object.
[out]sizeSize of file.
Returns
0 on success, errno code on failure.

◆ dfs_get_size_by_oid()

int dfs_get_size_by_oid ( dfs_t * dfs,
daos_obj_id_t oid,
daos_size_t chunk_size,
daos_size_t * size )

Same as dfs_get_size() but using the OID of the file instead of the open handle. Note that the chunk_size of the file is also required to be passed if the file was created with a different chunk size than the default (passing other than 0 to dfs_open). Otherwise, 0 should be passed to chunk size.

Parameters
[in]dfsPointer to the mounted file system.
[in]oidObject ID of the file.
[in]chunk_sizeChunk size of the file (pass 0 if it was created with default).
[out]sizeReturned size of the file.
Returns
0 on success, errno code on failure.

◆ dfs_get_symlink_value()

int dfs_get_symlink_value ( dfs_obj_t * obj,
char * buf,
daos_size_t * size )

Retrieve Symlink value of object if it's a symlink. If the buffer size passed in is not large enough, we copy up to size of the buffer, and update the size to actual value size. The size returned includes the null terminator.

Parameters
[in]objOpen object to query.
[in]bufuser buffer to copy the symlink value in.
[in,out]size[in]: Size of buffer passed in. [out]: Actual size of value.
Returns
0 on success, errno code on failure.

◆ dfs_getxattr()

int dfs_getxattr ( dfs_t * dfs,
dfs_obj_t * obj,
const char * name,
void * value,
daos_size_t * size )

Get extended attribute of an open object. If object is a symlink, the link itself is interogated.

Parameters
[in]dfsPointer to the mounted file system.
[in]objOpen object where xattr is checked.
[in]nameName of xattr to get.
[out]valueBuffer to place value of xattr.
[in,out]size[in]: Size of buffer value. [out]: Actual size of xattr.
Returns
0 on success, errno code on failure.

◆ dfs_global2local()

int dfs_global2local ( daos_handle_t poh,
daos_handle_t coh,
int flags,
d_iov_t glob,
dfs_t ** dfs )

Create a dfs mount from global representation data. This has to be closed with dfs_umount().

Parameters
[in]pohPool connection handle
[in]cohContainer open handle.
[in]flagsMount flags (O_RDONLY or O_RDWR). If 0, inherit flags of serialized DFS handle.
[in]globGlobal (shared) representation of a collective handle to be extracted
[out]dfsReturned dfs mount
Returns
0 on success, errno code on failure.

◆ dfs_global2local_all()

int dfs_global2local_all ( int flags,
d_iov_t glob,
dfs_t ** dfs )

Create a dfs mount from global representation data. This has to be closed with dfs_disconnect() since the pool and container connections are established with it.

Parameters
[in]flagsMount flags (O_RDONLY or O_RDWR). If 0, inherit flags of serialized DFS handle.
[in]globGlobal (shared) representation of a collective handle to be extracted.
[out]dfsReturned dfs mount
Returns
0 on success, errno code on failure.

◆ dfs_init()

int dfs_init ( void )

Initialize the DAOS and DFS library. Typically this is called at the beginning of a user program or in IO middleware initialization. This is required to be called if using the dfs_connect/disconnect calls to setup the DFS cache for the pool and container handles. There is no harm however in calling it whenever using any of the DFS API (mount/umount) and can be equivalent to calling daos_init() instead.

Returns
0 on success, errno code on failure.

◆ dfs_iterate()

int dfs_iterate ( dfs_t * dfs,
dfs_obj_t * obj,
daos_anchor_t * anchor,
uint32_t * nr,
size_t size,
dfs_filler_cb_t op,
void * arg )

Same as dfs_readdir, but this also adds a buffer size limitation when enumerating. On every entry, it issues a user defined callback. If size limitation is reached, function returns E2BIG

Parameters
[in]dfsPointer to the mounted file system.
[in]objOpened directory object.
[in,out]anchorHash anchor for the next call, it should be set to zeroes for the first call, it should not be changed by caller between calls.
[in,out]nr[in]: MAX number of entries to enumerate. [out]: Actual number of entries enumerated.
[in]sizeMax buffer size to be used internally before breaking.
[in]opOptional callback to be issued on every entry.
[in]argPointer to user data to be passed to op.
Returns
0 on success, errno code on failure.

◆ dfs_listxattr()

int dfs_listxattr ( dfs_t * dfs,
dfs_obj_t * obj,
char * list,
daos_size_t * size )

list extended attributes of an open object and place them all in a buffer NULL terminated one after the other. If object is a symlink, the link itself is interogated.

Parameters
[in]dfsPointer to the mounted file system.
[in]objOpen object where xattrs will be listed.
[in,out]list[in]: Allocated buffer for all xattr names. [out]: Names placed after each other (null terminated).
[in,out]size[in]: Size of list. [out]: Actual size of list.
Returns
0 on success, errno code on failure.

◆ dfs_local2global()

int dfs_local2global ( dfs_t * dfs,
d_iov_t * glob )

Convert a local dfs mount to global representation data which can be shared with peer processes. If glob->iov_buf is set to NULL, the actual size of the global handle is returned through glob->iov_buf_len. This function does not involve any communication and does not block.

Parameters
[in]dfsvalid dfs mount to be shared
[out]globpointer to iov of the buffer to store mount information
Returns
0 on success, errno code on failure.

◆ dfs_local2global_all()

int dfs_local2global_all ( dfs_t * dfs,
d_iov_t * glob )

Convert a local dfs mount including the pool and container handles to global representation data which can be shared with peer processes. If glob->iov_buf is set to NULL, the actual size of the global handle is returned through glob->iov_buf_len. This function does not involve any communication and does not block.

Parameters
[in]dfsvalid dfs mount to be shared
[out]globpointer to iov of the buffer to store mount information
Returns
0 on success, errno code on failure.

◆ dfs_lookup()

int dfs_lookup ( dfs_t * dfs,
const char * path,
int flags,
dfs_obj_t ** obj,
mode_t * mode,
struct stat * stbuf )

Lookup a path in the DFS and return the associated open object and mode. The object must be released with dfs_release().

Parameters
[in]dfsPointer to the mounted file system.
[in]pathPath to lookup.
[in]flagsAccess flags to open with (O_RDONLY or O_RDWR).
[out]objPointer to the object looked up.
[out]modeOptional mode_t of object looked up.
[out]stbufOptional stat struct of object looked up.
Returns
0 on success, errno code on failure.

◆ dfs_lookup_rel()

int dfs_lookup_rel ( dfs_t * dfs,
dfs_obj_t * parent,
const char * name,
int flags,
dfs_obj_t ** obj,
mode_t * mode,
struct stat * stbuf )

Lookup an entry in the parent object and return the associated open object and mode of that entry. If the entry is a symlink, the symlink value is not resolved and the user can decide what to do to further resolve the value of the symlink. The object must be released with dfs_release().

Parameters
[in]dfsPointer to the mounted file system.
[in]parentOpened parent directory object. If NULL, use root obj. This is useful in cases where the creator/opener is working in a flat namespace and doesn't need to lookup/release the root object.
[in]nameLink name of the object to create/open.
[in]flagsAccess flags to open with (O_RDONLY or O_RDWR).
[out]objPointer to the object looked up.
[out]modeOptional mode_t of object looked up.
[out]stbufOptional stat struct of object looked up.
Returns
0 on success, errno code on failure.

◆ dfs_mkdir()

int dfs_mkdir ( dfs_t * dfs,
dfs_obj_t * parent,
const char * name,
mode_t mode,
daos_oclass_id_t cid )

Create a directory.

Parameters
[in]dfsPointer to the mounted file system.
[in]parentOpened parent directory object. If NULL, use root obj.
[in]nameLink name of new dir.
[in]modemkdir mode.
[in]cidDAOS object class id (pass 0 for default MAX_RW).
Returns
0 on success, errno code on failure.

◆ dfs_mount()

int dfs_mount ( daos_handle_t poh,
daos_handle_t coh,
int flags,
dfs_t ** dfs )

Mount a file system over DAOS. The pool and container handle must remain connected/open until after dfs_umount() is called; otherwise access to the dfs namespace will fail.

The mount will create a root directory (DAOS object) for the file system. The user will associate the dfs object returned with a mount point.

Parameters
[in]pohPool connection handle
[in]cohContainer open handle.
[in]flagsMount flags (O_RDONLY or O_RDWR).
[out]dfsPointer to the file system object created.
Returns
0 on success, errno code on failure.

◆ dfs_move()

int dfs_move ( dfs_t * dfs,
dfs_obj_t * parent,
const char * name,
dfs_obj_t * new_parent,
const char * new_name,
daos_obj_id_t * oid )

Move/rename an object.

Parameters
[in]dfsPointer to the mounted file system.
[in]parentSource parent directory object. If NULL, use root obj.
[in]nameLink name of object.
[in]new_parentTarget parent directory object. If NULL, use root obj.
[in]new_nameNew link name of object.
[out]oidOptional: return the internal object ID of the removed obj if the move clobbered it.
Returns
0 on success, errno code on failure.

◆ dfs_obj2id()

int dfs_obj2id ( dfs_obj_t * obj,
daos_obj_id_t * oid )

Convert from a dfs_obj_t to a daos_obj_id_t.

Parameters
[in]objObject to convert
[out]oidDaos object ID.
Returns
0 on success, errno code on failure.

◆ dfs_obj_anchor_set()

int dfs_obj_anchor_set ( dfs_obj_t * obj,
uint32_t index,
daos_anchor_t * anchor )

Set an anchor with an index based on split done with dfs_obj_anchor_split. The anchor passed will be re-intialized and set to start and finish iteration based on the specified index.

Parameters
[in]objDir object to split anchor for.
[in]indexIndex of set this anchor for iteration.
[in,out]anchorHash anchor to set.
Returns
0 on success, errno code on failure.

◆ dfs_obj_anchor_split()

int dfs_obj_anchor_split ( dfs_obj_t * obj,
uint32_t * nr,
daos_anchor_t * anchors )

Provide a function for large directories to split an anchor to be able to execute a parallel readdir or iterate. This routine suggests the optimal number of anchors to use instead of just 1 and optionally returns all those anchors. The user would allocate the array of anchors after querying the number of anchors needed. Alternatively, user does not provide an array and can call dfs_obj_anchor_set() for every anchor to set.

The user could suggest how many anchors to split the iteration over. This feature is not supported yet.

Parameters
[in]objDir object to split anchor for.
[in,out]nr[in]: Number of anchors requested and allocated in anchors. Pass 0 for DAOS to recommend split num. [out]: Number of anchors recommended if 0 is passed in.
[in]anchorsOptional array of anchors that are split.
Returns
0 on success, errno code on failure.

◆ dfs_obj_get_info()

int dfs_obj_get_info ( dfs_t * dfs,
dfs_obj_t * obj,
dfs_obj_info_t * info )

Retrieve some attributes of DFS object. Those include the object class and the chunk size.

Parameters
[in]dfsPointer to the mounted file system.
[in]objOpen object handle to query.
[out]infoinfo object container object class, chunks size, etc.
Returns
0 on success, errno code on failure.

◆ dfs_obj_global2local()

int dfs_obj_global2local ( dfs_t * dfs,
int flags,
d_iov_t glob,
dfs_obj_t ** obj )

Create a dfs object from global representation data. This has to be closed with dfs_release().

Parameters
[in]dfsPointer to the mounted file system.
[in]flagsAccess flags (O_RDONLY/O_RDWR/O_WRONLY). If 0, inherit flags of serialized object handle.
[in]globGlobal (shared) representation of a collective handle to be extracted
[out]objReturned open object handle
Returns
0 on success, errno code on failure.

◆ dfs_obj_local2global()

int dfs_obj_local2global ( dfs_t * dfs,
dfs_obj_t * obj,
d_iov_t * glob )

Convert a local DFS object to global representation data which can be shared with peer processes. If glob->iov_buf is set to NULL, the actual size of the global handle is returned through glob->iov_buf_len. This function does not involve any communication and does not block.

Parameters
[in]dfsPointer to the mounted file system.
[in]objDFS Object to serialize
[out]globpointer to iov of the buffer to store obj information
Returns
0 on success, errno code on failure.

◆ dfs_obj_set_chunk_size()

int dfs_obj_set_chunk_size ( dfs_t * dfs,
dfs_obj_t * obj,
int flags,
daos_size_t csize )

Set the chunk size on a directory for new files or sub-dirs that are created in that dir. This does not change the chunk size for existing files or dirs in that directory. Note that this is only supported on directories and will fail if called on non-directory objects.

Parameters
[in]dfsPointer to the mounted file system.
[in]objOpen object handle to access.
[in]flagsFlags for setting chunk size (currently ignored)
[in]csizeChunk size to set object to.
Returns
0 on success, errno code on failure.

◆ dfs_obj_set_oclass()

int dfs_obj_set_oclass ( dfs_t * dfs,
dfs_obj_t * obj,
int flags,
daos_oclass_id_t cid )

Set the object class on a directory for new files or sub-dirs that are created in that dir. This does not change the chunk size for existing files or dirs in that directory, nor it does change the object class of the directory itself. Note that this is only supported on directories and will fail if called on non-directory objects.

Parameters
[in]dfsPointer to the mounted file system.
[in]objOpen object handle to access.
[in]flagsFlags for setting oclass (currently ignored)
[in]cidobject class.
Returns
0 on success, errno code on failure.

◆ dfs_open()

int dfs_open ( dfs_t * dfs,
dfs_obj_t * parent,
const char * name,
mode_t mode,
int flags,
daos_oclass_id_t cid,
daos_size_t chunk_size,
const char * value,
dfs_obj_t ** obj )

Create/Open a directory, file, or Symlink. The object must be released with dfs_release().

Parameters
[in]dfsPointer to the mounted file system.
[in]parentOpened parent directory object. If NULL, use root obj. This is useful in cases where the creator/opener is working in a flat namespace and doesn't need to lookup/release the root object.
[in]nameLink name of the object to create/open.
[in]modemode_t (permissions + type).
[in]flagsAccess flags (handles: O_RDONLY, O_RDWR, O_EXCL, O_CREAT, O_TRUNC).
[in]cidDAOS object class id (pass 0 for default MAX_RW). Valid on create only; ignored otherwise.
[in]chunk_sizeChunk size of the array object to be created. (pass 0 for default 1 MiB chunk size). Valid on file create only; ignored otherwise.
[in]valueSymlink value (NULL if not syml).
[out]objPointer to object opened.
Returns
0 on success, errno code on failure.

◆ dfs_osetattr()

int dfs_osetattr ( dfs_t * dfs,
dfs_obj_t * obj,
struct stat * stbuf,
int flags )

Set stat attributes for a file and fetch new values. If the object is a symlink the link itself is modified. See dfs_stat() for which entries are filled. While the set-user/group-id bits in stbuf::st_mode are stored by libdfs, it up to the caller to implement support for the associated functionality since libdfs does not provide any way to execute binaries.

Parameters
[in]dfsPointer to the mounted file system.
[in]objOpen object (File, dir or syml) to modify.
[in,out]stbuf[in]: Stat struct with the members set. [out]: Stat struct with all valid members filled.
[in]flagsBitmask of flags to set
Returns
0 on Success. errno code on Failure.

◆ dfs_ostat()

int dfs_ostat ( dfs_t * dfs,
dfs_obj_t * obj,
struct stat * stbuf )

Same as dfs_stat but works directly on an open object.

Parameters
[in]dfsPointer to the mounted file system.
[in]objOpen object (File, dir or syml) to stat.
[out]stbufStat struct with the members above filled.
Returns
0 on success, errno code on failure.

◆ dfs_pipeline_create()

int dfs_pipeline_create ( dfs_t * dfs,
dfs_predicate_t pred,
uint64_t flags,
dfs_pipeline_t ** dpipe )

Create a pipeline object to be used during readdir with filter. Should be destroyed with dfs_pipeline_destroy().

Parameters
[in]dfsPointer to the mounted file system.
[in]predPredicate condition values (name/regex, newer timestamp, etc.).
[in]flagsPipeline flags (conditions to apply).
[out]dpipePipeline object created.
Returns
0 on success, errno code on failure.

◆ dfs_pipeline_destroy()

int dfs_pipeline_destroy ( dfs_pipeline_t * dpipe)

Destroy pipeline object.

Parameters
[in]dpipePipeline object.
Returns
0 on success, errno code on failure.

◆ dfs_pool_get()

int dfs_pool_get ( dfs_t * dfs,
daos_handle_t * poh )

Retrieve the open pool handle on the DFS mount. This is refcounted internally and must be released with dfs_pool_put().

Parameters
[in]dfsPointer to the mounted file system.
[out]pohOpen pool handle.
Returns
0 on success, errno code on failure.

◆ dfs_pool_put()

int dfs_pool_put ( dfs_t * dfs,
daos_handle_t poh )

Release refcount of pool handle taken by dfs_pool_get().

Parameters
[in]dfsPointer to the mounted file system.
[out]pohPool handle that was returned from dfs_pool_get().
Returns
0 on success, errno code on failure.

◆ dfs_punch()

int dfs_punch ( dfs_t * dfs,
dfs_obj_t * obj,
daos_off_t offset,
daos_size_t len )

Punch a hole in the file starting at offset to len. If len is set to DFS_MAX_FSIZE, this will be equivalent to a truncate operation to shrink or extend the file to offset bytes depending on the file size.

Parameters
[in]dfsPointer to the mounted file system.
[in]objOpened file object.
[in]offsetoffset of file to punch at.
[in]lennumber of bytes to punch.
Returns
0 on success, errno code on failure.

◆ dfs_query()

int dfs_query ( dfs_t * dfs,
dfs_attr_t * attr )

Query attributes of a DFS mount.

Parameters
[in]dfsPointer to the mounted file system.
[out]attrAttributes on the DFS container.
Returns
0 on success, errno code on failure.

◆ dfs_read()

int dfs_read ( dfs_t * dfs,
dfs_obj_t * obj,
d_sg_list_t * sgl,
daos_off_t off,
daos_size_t * read_size,
daos_event_t * ev )

Read data from the file object, and return actual data read.

Parameters
[in]dfsPointer to the mounted file system.
[in]objOpened file object.
[in]sglScatter/Gather list for data buffer.
[in]offOffset into the file to read from.
[out]read_sizeHow much data is actually read.
[in]evCompletion event, it is optional and can be NULL. Function will run in blocking mode if ev is NULL.
Returns
0 on success, errno code on failure.

◆ dfs_readdir()

int dfs_readdir ( dfs_t * dfs,
dfs_obj_t * obj,
daos_anchor_t * anchor,
uint32_t * nr,
struct dirent * dirs )

directory readdir.

Parameters
[in]dfsPointer to the mounted file system.
[in]objOpened directory object.
[in,out]anchorHash anchor for the next call, it should be set to zeroes for the first call, it should not be changed by caller between calls.
[in,out]nr[in]: number of dirents allocated in dirs. [out]: number of returned dirents.
[in,out]dirs[in] preallocated array of dirents. [out]: dirents returned with d_name filled only.
Returns
0 on success, errno code on failure.

◆ dfs_readdir_with_filter()

int dfs_readdir_with_filter ( dfs_t * dfs,
dfs_obj_t * obj,
dfs_pipeline_t * dpipe,
daos_anchor_t * anchor,
uint32_t * nr,
struct dirent * dirs,
daos_obj_id_t * oids,
daos_size_t * csizes,
uint64_t * nr_scanned )

Same as dfs_readdir() but this additionally applies a filter created with dfs_pipeline_create() on the entries that are enumerated. This function also optionally returns the object ID of each dirent if requested through a pre-allocated OID input array.

Parameters
[in]dfsPointer to the mounted file system.
[in]objOpened directory object.
[in]dpipeDFS pipeline filter.
[in,out]anchorHash anchor for the next call, it should be set to zeroes for the first call, it should not be changed by caller between calls.
[in,out]nr[in]: number of dirents allocated in dirs. [out]: number of returned dirents.
[in,out]dirs[in] preallocated array of dirents. [out]: dirents returned with d_name filled only.
[in,out]oids[in] Optional preallocated array of object IDs. [out]: Object ID associated with each dirent that was read.
[in,out]csizes[in] Optional preallocated array of sizes. [out]: chunk size associated with each dirent that was read.
[out]nr_scannedTotal number of entries scanned by readdir before returning.
Returns
0 on success, errno code on failure.

◆ dfs_readdirplus()

int dfs_readdirplus ( dfs_t * dfs,
dfs_obj_t * obj,
daos_anchor_t * anchor,
uint32_t * nr,
struct dirent * dirs,
struct stat * stbufs )

directory readdir + stat.

Parameters
[in]dfsPointer to the mounted file system.
[in]objOpened directory object.
[in,out]anchorHash anchor for the next call, it should be set to zeroes for the first call, it should not be changed by caller between calls.
[in,out]nr[in]: number of dirents allocated in dirs. [out]: number of returned dirents.
[in,out]dirs[in] preallocated array of dirents. [out]: dirents returned with d_name filled only.
[in,out]stbufs[in] preallocated array of struct stat. [out]: stat of every entry in dirs.
Returns
0 on success, errno code on failure.

◆ dfs_readx()

int dfs_readx ( dfs_t * dfs,
dfs_obj_t * obj,
dfs_iod_t * iod,
d_sg_list_t * sgl,
daos_size_t * read_size,
daos_event_t * ev )

Non-contiguous read interface to a DFS file. Same as dfs_read with the ability to have a segmented file layout to read.

Parameters
[in]dfsPointer to the mounted file system.
[in]objOpened file object.
[in]iodIO descriptor for list-io.
[in]sglScatter/Gather list for data buffer.
[out]read_sizeHow much data is actually read.
[in]evCompletion event, it is optional and can be NULL. Function will run in blocking mode if ev is NULL.
Returns
0 on success, errno code on failure.

◆ dfs_release()

int dfs_release ( dfs_obj_t * obj)

Close/release open object.

Parameters
[in]objObject to release.
Returns
0 on success, errno code on failure.

◆ dfs_remove()

int dfs_remove ( dfs_t * dfs,
dfs_obj_t * parent,
const char * name,
bool force,
daos_obj_id_t * oid )

Remove an object from parent directory. If object is a directory and is non-empty; this will fail unless force option is true. If object is a symlink, the symlink is removed.

Parameters
[in]dfsPointer to the mounted file system.
[in]parentOpened parent directory object. If NULL, use root obj.
[in]nameName of object to remove in parent dir.
[in]forceIf true, remove dir even if non-empty.
[in]oidOptionally return the DAOS Object ID of the removed obj.
Returns
0 on success, errno code on failure.

◆ dfs_removexattr()

int dfs_removexattr ( dfs_t * dfs,
dfs_obj_t * obj,
const char * name )

Remove extended attribute of an open object. If object is a symlink, the link itself is interogated.

Parameters
[in]dfsPointer to the mounted file system.
[in]objOpen object where xattr will be removed.
[in]nameName of xattr to remove.
Returns
0 on success, errno code on failure.

◆ dfs_set_prefix()

int dfs_set_prefix ( dfs_t * dfs,
const char * prefix )

Optionally set a prefix on the dfs mount where all paths passed to dfs_lookup are trimmed off that prefix. This is helpful when using DFS API with a dfuse mount and the user would like to reference files in the dfuse mount instead of the absolute path from the root of the DFS container.

Parameters
[in]dfsPointer to the mounted file system.
[in]prefixabsolute prefix to trim off path to dfs_lookup. Passing NULL unsets the prefix.
Returns
0 on success, errno code on failure.

◆ dfs_setxattr()

int dfs_setxattr ( dfs_t * dfs,
dfs_obj_t * obj,
const char * name,
const void * value,
daos_size_t size,
int flags )

Set extended attribute on an open object (File, dir, syml). If object is a symlink, the value is set on the symlink itself.

Parameters
[in]dfsPointer to the mounted file system.
[in]objOpen object where xattr will be added.
[in]nameName of xattr to add.
[in]valueValue of xattr.
[in]sizeSize in bytes of the value.
[in]flagsSet flags. passing 0 does not check for xattr existence. XATTR_CREATE: create or fail if xattr exists. XATTR_REPLACE: replace or fail if xattr does not exist.
Returns
0 on success, errno code on failure.

◆ dfs_stat()

int dfs_stat ( dfs_t * dfs,
dfs_obj_t * parent,
const char * name,
struct stat * stbuf )

stat attributes of an entry. If object is a symlink, the link itself is interogated. The following elements of the stat struct are populated (the rest are set to 0): mode_t st_mode; uid_t st_uid; gid_t st_gid; off_t st_size; blkcnt_t st_blocks struct timespec st_atim; struct timespec st_mtim; struct timespec st_ctim;

Parameters
[in]dfsPointer to the mounted file system.
[in]parentOpened parent directory object. If NULL, use root obj.
[in]nameLink name of the object. Can be NULL if parent is root, which means operation will be on root object.
[out]stbufStat struct with the members above filled.
Returns
0 on success, errno code on failure.

◆ dfs_suggest_oclass()

int dfs_suggest_oclass ( dfs_t * dfs,
const char * hint,
daos_oclass_id_t * cid )

Suggest an oclass for creating DFS objects given a hint from the user of the format: obj:val where obj can be either file or dir/directory and val from: single: tiny files or directories to be single sharded. max: large files or directories to be max shared.

Parameters
[in]dfsPointer to the mounted file system.
[in]hinthint from user for a file or directory
[out]cidobject class suggested to use
Returns
0 on success, errno code on failure.

◆ dfs_sync()

int dfs_sync ( dfs_t * dfs)

Sync to commit the latest epoch on the container. This applies to the entire namespace and not to a particular file/directory.

TODO: This should take a persistent snapshot at current timestamp.

Parameters
[in]dfsPointer to the mounted file system.
Returns
0 on success, errno code on failure.

◆ dfs_umount()

int dfs_umount ( dfs_t * dfs)

Unmount a DAOS file system. This closes open handles to the root object and commits the epoch at current timestamp. The internal dfs struct is freed, so further access to that dfs will be invalid.

Parameters
[in]dfsPointer to the mounted file system.
Returns
0 on success, errno code on failure.

◆ dfs_update_parent()

int dfs_update_parent ( dfs_obj_t * obj,
dfs_obj_t * src_obj,
const char * name )

A DFS object open handle has links to its parent (oid) and the entry name of that object in that parent. In some cases a user would want to update the oh of an object in case of a rename. This API would allow modifying an existing open handle of an object to change it's parent and it's entry name. Note this is a local operation and doesn't change anything on the storage.

Parameters
[in]objOpen object handle to update.
[in]src_objOpen object handle of the object whose parent will be used as the new parent of obj.
[in]nameOptional new name of entry in parent. Pass NULL to leave the entry name unchanged.
Returns
0 on Success. errno code on Failure.

◆ dfs_write()

int dfs_write ( dfs_t * dfs,
dfs_obj_t * obj,
d_sg_list_t * sgl,
daos_off_t off,
daos_event_t * ev )

Write data to the file object.

Parameters
[in]dfsPointer to the mounted file system.
[in]objOpened file object.
[in]sglScatter/Gather list for data buffer.
[in]offOffset into the file to write to.
[in]evCompletion event, it is optional and can be NULL. Function will run in blocking mode if ev is NULL.
Returns
0 on success, errno code on failure.

◆ dfs_writex()

int dfs_writex ( dfs_t * dfs,
dfs_obj_t * obj,
dfs_iod_t * iod,
d_sg_list_t * sgl,
daos_event_t * ev )

Non-contiguous write interface to a DFS file.

Parameters
[in]dfsPointer to the mounted file system.
[in]objOpened file object.
[in]iodIO descriptor of file view.
[in]sglScatter/Gather list for data buffer.
[in]evCompletion event, it is optional and can be NULL. Function will run in blocking mode if ev is NULL.
Returns
0 on success, errno code on failure.