DAOS API (v2.1 - dev)
Loading...
Searching...
No Matches
daos_fs.h
Go to the documentation of this file.
1/*
2 * (C) Copyright 2018-2022 Intel Corporation.
3 *
4 * SPDX-License-Identifier: BSD-2-Clause-Patent
5 */
16#ifndef __DAOS_FS_H__
17#define __DAOS_FS_H__
18
19#if defined(__cplusplus)
20extern "C" {
21#endif
22
23#include <dirent.h>
24#include <sys/stat.h>
25
27#define DFS_MAX_NAME NAME_MAX
29#define DFS_MAX_PATH PATH_MAX
31#define DFS_MAX_FSIZE (~0ULL)
32
34#define DFS_MAX_XATTR_NAME 255
36#define DFS_MAX_XATTR_LEN 65536
37
39typedef struct dfs_obj dfs_obj_t;
41typedef struct dfs dfs_t;
42
43/*
44 * Consistency modes of the DFS container. A container created with balanced
45 * mode, can only be accessed with balanced mode with dfs_mount. A container
46 * created with relaxed mode, can be accessed with either mode in the future.
47 *
48 * Reserve bit 3 in the access flags for dfs_mount() - bits 1 and 2 are used
49 * for read / write access (O_RDONLY, O_RDRW).
50 */
52#define DFS_BALANCED 4
54#define DFS_RELAXED 0
56#define DFS_RDONLY O_RDONLY
58#define DFS_RDWR O_RDWR
59
61typedef struct {
63 uint64_t da_id;
65 daos_size_t da_chunk_size;
67 daos_oclass_id_t da_oclass_id;
75 uint32_t da_mode;
77
79typedef struct {
81 daos_size_t iod_nr;
84} dfs_iod_t;
85
87typedef struct {
89 daos_oclass_id_t doi_oclass_id;
91 daos_size_t doi_chunk_size;
93
103int
105
113int
115
139int
140dfs_connect(const char *pool, const char *sys, const char *cont, int flags, dfs_attr_t *attr,
141 dfs_t **dfs);
142
151int
153
167int
168dfs_cont_create(daos_handle_t poh, uuid_t *uuid, dfs_attr_t *attr, daos_handle_t *coh, dfs_t **dfs);
169
186int
188 uuid_t *uuid, daos_handle_t *coh, dfs_t **dfs);
189
205int
206dfs_mount(daos_handle_t poh, daos_handle_t coh, int flags, dfs_t **dfs);
207
217int
219
228int
230
243int
244dfs_local2global(dfs_t *dfs, d_iov_t *glob);
245
260int
261dfs_global2local(daos_handle_t poh, daos_handle_t coh, int flags, d_iov_t glob,
262 dfs_t **dfs);
263
275int
276dfs_local2global_all(dfs_t *dfs, d_iov_t *glob);
277
289int
290dfs_global2local_all(int flags, d_iov_t glob, dfs_t **dfs);
291
304int
305dfs_set_prefix(dfs_t *dfs, const char *prefix);
306
315int
317
331int
332dfs_lookup(dfs_t *dfs, const char *path, int flags, dfs_obj_t **obj,
333 mode_t *mode, struct stat *stbuf);
334
354int
355dfs_lookup_rel(dfs_t *dfs, dfs_obj_t *parent, const char *name, int flags,
356 dfs_obj_t **obj, mode_t *mode, struct stat *stbuf);
357
382int
383dfs_open(dfs_t *dfs, dfs_obj_t *parent, const char *name, mode_t mode,
384 int flags, daos_oclass_id_t cid, daos_size_t chunk_size,
385 const char *value, dfs_obj_t **obj);
386
399int
400dfs_dup(dfs_t *dfs, dfs_obj_t *obj, int flags, dfs_obj_t **new_obj);
401
415int
416dfs_obj_local2global(dfs_t *dfs, dfs_obj_t *obj, d_iov_t *glob);
417
431int
432dfs_obj_global2local(dfs_t *dfs, int flags, d_iov_t glob, dfs_obj_t **obj);
433
441int
443
458int
459dfs_read(dfs_t *dfs, dfs_obj_t *obj, d_sg_list_t *sgl, daos_off_t off,
460 daos_size_t *read_size, daos_event_t *ev);
461
477int
478dfs_readx(dfs_t *dfs, dfs_obj_t *obj, dfs_iod_t *iod, d_sg_list_t *sgl,
479 daos_size_t *read_size, daos_event_t *ev);
480
493int
494dfs_write(dfs_t *dfs, dfs_obj_t *obj, d_sg_list_t *sgl, daos_off_t off,
495 daos_event_t *ev);
496
509int
510dfs_writex(dfs_t *dfs, dfs_obj_t *obj, dfs_iod_t *iod, d_sg_list_t *sgl,
511 daos_event_t *ev);
512
522int
523dfs_get_size(dfs_t *dfs, dfs_obj_t *obj, daos_size_t *size);
524
537int
538dfs_punch(dfs_t *dfs, dfs_obj_t *obj, daos_off_t offset, daos_size_t len);
539
558int
560 uint32_t *nr, struct dirent *dirs);
561
565typedef int (*dfs_filler_cb_t)(dfs_t *dfs, dfs_obj_t *obj, const char name[],
566 void *arg);
567
588int
590 uint32_t *nr, size_t size, dfs_filler_cb_t op, void *arg);
591
612int
613dfs_obj_anchor_split(dfs_obj_t *obj, uint32_t *nr, daos_anchor_t *anchors);
614
627int
628dfs_obj_anchor_set(dfs_obj_t *obj, uint32_t index, daos_anchor_t *anchor);
629
641int
642dfs_mkdir(dfs_t *dfs, dfs_obj_t *parent, const char *name, mode_t mode,
643 daos_oclass_id_t cid);
644
658int
659dfs_remove(dfs_t *dfs, dfs_obj_t *parent, const char *name, bool force,
660 daos_obj_id_t *oid);
661
677int
678dfs_move(dfs_t *dfs, dfs_obj_t *parent, const char *name, dfs_obj_t *new_parent,
679 const char *new_name, daos_obj_id_t *oid);
680
692int
693dfs_exchange(dfs_t *dfs, dfs_obj_t *parent1, const char *name1, dfs_obj_t *parent2,
694 const char *name2);
695
704int
705dfs_get_mode(dfs_obj_t *obj, mode_t *mode);
706
717int
719
734int
735dfs_obj_set_oclass(dfs_t *dfs, dfs_obj_t *obj, int flags, daos_oclass_id_t cid);
736
750int
752 daos_size_t csize);
753
765int
767
777int
778dfs_get_chunk_size(dfs_obj_t *obj, daos_size_t *chunk_size);
779
793int
794dfs_get_symlink_value(dfs_obj_t *obj, char *buf, daos_size_t *size);
795
812int
813dfs_update_parent(dfs_obj_t *obj, dfs_obj_t *src_obj, const char *name);
814
836int
837dfs_stat(dfs_t *dfs, dfs_obj_t *parent, const char *name,
838 struct stat *stbuf);
839
849int
850dfs_ostat(dfs_t *dfs, dfs_obj_t *obj, struct stat *stbuf);
851
853#define DFS_SET_ATTR_MODE (1 << 0)
855#define DFS_SET_ATTR_ATIME (1 << 1)
857#define DFS_SET_ATTR_MTIME (1 << 2)
859#define DFS_SET_ATTR_SIZE (1 << 3)
861#define DFS_SET_ATTR_UID (1 << 4)
863#define DFS_SET_ATTR_GID (1 << 5)
864
879int
880dfs_osetattr(dfs_t *dfs, dfs_obj_t *obj, struct stat *stbuf, int flags);
881
896int
897dfs_access(dfs_t *dfs, dfs_obj_t *parent, const char *name, int mask);
898
911int
912dfs_chmod(dfs_t *dfs, dfs_obj_t *parent, const char *name, mode_t mode);
913
930int
931dfs_chown(dfs_t *dfs, dfs_obj_t *parent, const char *name, uid_t uid, gid_t gid, int flags);
932
943int
945
961int
962dfs_setxattr(dfs_t *dfs, dfs_obj_t *obj, const char *name,
963 const void *value, daos_size_t size, int flags);
964
978int
979dfs_getxattr(dfs_t *dfs, dfs_obj_t *obj, const char *name, void *value,
980 daos_size_t *size);
981
992int
993dfs_removexattr(dfs_t *dfs, dfs_obj_t *obj, const char *name);
994
1010int
1011dfs_listxattr(dfs_t *dfs, dfs_obj_t *obj, char *list, daos_size_t *size);
1012
1013#if defined(__cplusplus)
1014}
1015#endif /* __cplusplus */
1016#endif /* __DAOS_FS_H__ */
int dfs_cont_create(daos_handle_t poh, uuid_t *uuid, dfs_attr_t *attr, daos_handle_t *coh, dfs_t **dfs)
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_init(void)
int dfs_obj_get_info(dfs_t *dfs, dfs_obj_t *obj, dfs_obj_info_t *info)
int dfs_obj_anchor_set(dfs_obj_t *obj, uint32_t index, daos_anchor_t *anchor)
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_get_mode(dfs_obj_t *obj, mode_t *mode)
int dfs_remove(dfs_t *dfs, dfs_obj_t *parent, const char *name, bool force, daos_obj_id_t *oid)
int dfs_set_prefix(dfs_t *dfs, const char *prefix)
int dfs_connect(const char *pool, const char *sys, const char *cont, int flags, dfs_attr_t *attr, dfs_t **dfs)
int dfs_release(dfs_obj_t *obj)
int dfs_global2local_all(int flags, d_iov_t glob, 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_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_get_file_oh(dfs_obj_t *obj, daos_handle_t *oh)
int dfs_disconnect(dfs_t *dfs)
int dfs_mount(daos_handle_t poh, daos_handle_t coh, int flags, dfs_t **dfs)
struct dfs_obj dfs_obj_t
Definition daos_fs.h:39
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_listxattr(dfs_t *dfs, dfs_obj_t *obj, char *list, daos_size_t *size)
int dfs_getxattr(dfs_t *dfs, dfs_obj_t *obj, const char *name, void *value, daos_size_t *size)
int dfs_osetattr(dfs_t *dfs, dfs_obj_t *obj, struct stat *stbuf, int flags)
int dfs_query(dfs_t *dfs, dfs_attr_t *attr)
int dfs_stat(dfs_t *dfs, dfs_obj_t *parent, const char *name, struct stat *stbuf)
int dfs_update_parent(dfs_obj_t *obj, dfs_obj_t *src_obj, const char *name)
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_get_symlink_value(dfs_obj_t *obj, char *buf, daos_size_t *size)
int dfs_chown(dfs_t *dfs, dfs_obj_t *parent, const char *name, uid_t uid, gid_t gid, int flags)
int dfs_exchange(dfs_t *dfs, dfs_obj_t *parent1, const char *name1, dfs_obj_t *parent2, const char *name2)
int dfs_fini(void)
int dfs_get_size(dfs_t *dfs, dfs_obj_t *obj, daos_size_t *size)
int dfs_obj2id(dfs_obj_t *obj, daos_obj_id_t *oid)
int dfs_obj_local2global(dfs_t *dfs, dfs_obj_t *obj, d_iov_t *glob)
int dfs_get_chunk_size(dfs_obj_t *obj, daos_size_t *chunk_size)
int dfs_removexattr(dfs_t *dfs, dfs_obj_t *obj, const char *name)
int dfs_obj_set_chunk_size(dfs_t *dfs, dfs_obj_t *obj, int flags, daos_size_t csize)
int dfs_punch(dfs_t *dfs, dfs_obj_t *obj, daos_off_t offset, daos_size_t len)
int dfs_dup(dfs_t *dfs, dfs_obj_t *obj, int flags, dfs_obj_t **new_obj)
int dfs_obj_global2local(dfs_t *dfs, int flags, d_iov_t glob, dfs_obj_t **obj)
int dfs_chmod(dfs_t *dfs, dfs_obj_t *parent, const char *name, mode_t mode)
int dfs_obj_set_oclass(dfs_t *dfs, dfs_obj_t *obj, int flags, daos_oclass_id_t cid)
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_filler_cb_t)(dfs_t *dfs, dfs_obj_t *obj, const char name[], void *arg)
Definition daos_fs.h:565
int dfs_access(dfs_t *dfs, dfs_obj_t *parent, const char *name, int mask)
int dfs_lookup(dfs_t *dfs, const char *path, int flags, dfs_obj_t **obj, mode_t *mode, struct stat *stbuf)
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_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_umount(dfs_t *dfs)
int dfs_readdir(dfs_t *dfs, dfs_obj_t *obj, daos_anchor_t *anchor, uint32_t *nr, struct dirent *dirs)
int dfs_global2local(daos_handle_t poh, daos_handle_t coh, int flags, d_iov_t glob, dfs_t **dfs)
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_mkdir(dfs_t *dfs, dfs_obj_t *parent, const char *name, mode_t mode, daos_oclass_id_t cid)
int dfs_local2global(dfs_t *dfs, d_iov_t *glob)
int dfs_ostat(dfs_t *dfs, dfs_obj_t *obj, struct stat *stbuf)
int dfs_obj_anchor_split(dfs_obj_t *obj, uint32_t *nr, daos_anchor_t *anchors)
int dfs_sync(dfs_t *dfs)
struct dfs dfs_t
Definition daos_fs.h:41
int dfs_local2global_all(dfs_t *dfs, d_iov_t *glob)
uint32_t da_mode
Definition daos_fs.h:75
daos_prop_t * da_props
Definition daos_fs.h:69
uint64_t da_id
Definition daos_fs.h:63
daos_size_t da_chunk_size
Definition daos_fs.h:65
daos_oclass_id_t da_oclass_id
Definition daos_fs.h:67
daos_range_t * iod_rgs
Definition daos_fs.h:83
daos_size_t iod_nr
Definition daos_fs.h:81
daos_oclass_id_t doi_oclass_id
Definition daos_fs.h:89
daos_size_t doi_chunk_size
Definition daos_fs.h:91