DAOS API (v2.1 - dev)
Loading...
Searching...
No Matches
daos_fs.h
Go to the documentation of this file.
1/*
2 * (C) Copyright 2018-2023 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)
33#define DFS_DEFAULT_CHUNK_SIZE 1048576
35#define DFS_MAX_XATTR_NAME 255
37#define DFS_MAX_XATTR_LEN 65536
38
40typedef struct dfs_obj dfs_obj_t;
42typedef struct dfs dfs_t;
43
44/*
45 * Consistency modes of the DFS container. A container created with balanced
46 * mode, can only be accessed with balanced mode with dfs_mount. A container
47 * created with relaxed mode, can be accessed with either mode in the future.
48 *
49 * Reserve bit 3 in the access flags for dfs_mount() - bits 1 and 2 are used
50 * for read / write access (O_RDONLY, O_RDRW).
51 */
53#define DFS_BALANCED 4
55#define DFS_RELAXED 0
57#define DFS_RDONLY O_RDONLY
59#define DFS_RDWR O_RDWR
60
62typedef struct {
64 uint64_t da_id;
66 daos_size_t da_chunk_size;
68 daos_oclass_id_t da_oclass_id;
75 uint32_t da_mode;
77 daos_oclass_id_t da_dir_oclass_id;
79 daos_oclass_id_t da_file_oclass_id;
84 char da_hints[DAOS_CONT_HINT_MAX_LEN];
86
88typedef struct {
90 daos_size_t iod_nr;
93} dfs_iod_t;
94
96typedef struct {
98 daos_oclass_id_t doi_oclass_id;
100 daos_size_t doi_chunk_size;
102
112int
114
122int
124
148int
149dfs_connect(const char *pool, const char *sys, const char *cont, int flags, dfs_attr_t *attr,
150 dfs_t **dfs);
151
160int
162
179int
180dfs_destroy(const char *pool, const char *sys, const char *cont, int force, daos_event_t *ev);
181
195int
196dfs_cont_create(daos_handle_t poh, uuid_t *uuid, dfs_attr_t *attr, daos_handle_t *coh, dfs_t **dfs);
197
214int
216 uuid_t *uuid, daos_handle_t *coh, dfs_t **dfs);
217
233int
234dfs_mount(daos_handle_t poh, daos_handle_t coh, int flags, dfs_t **dfs);
235
245int
247
257int
259
268int
270
280int
282
291int
293
302int
304
317int
318dfs_local2global(dfs_t *dfs, d_iov_t *glob);
319
334int
335dfs_global2local(daos_handle_t poh, daos_handle_t coh, int flags, d_iov_t glob,
336 dfs_t **dfs);
337
349int
350dfs_local2global_all(dfs_t *dfs, d_iov_t *glob);
351
363int
364dfs_global2local_all(int flags, d_iov_t glob, dfs_t **dfs);
365
378int
379dfs_set_prefix(dfs_t *dfs, const char *prefix);
380
389int
391
405int
406dfs_lookup(dfs_t *dfs, const char *path, int flags, dfs_obj_t **obj,
407 mode_t *mode, struct stat *stbuf);
408
428int
429dfs_lookup_rel(dfs_t *dfs, dfs_obj_t *parent, const char *name, int flags,
430 dfs_obj_t **obj, mode_t *mode, struct stat *stbuf);
431
444int
445dfs_suggest_oclass(dfs_t *dfs, const char *hint, daos_oclass_id_t *cid);
446
471int
472dfs_open(dfs_t *dfs, dfs_obj_t *parent, const char *name, mode_t mode,
473 int flags, daos_oclass_id_t cid, daos_size_t chunk_size,
474 const char *value, dfs_obj_t **obj);
475
488int
489dfs_dup(dfs_t *dfs, dfs_obj_t *obj, int flags, dfs_obj_t **new_obj);
490
504int
505dfs_obj_local2global(dfs_t *dfs, dfs_obj_t *obj, d_iov_t *glob);
506
520int
521dfs_obj_global2local(dfs_t *dfs, int flags, d_iov_t glob, dfs_obj_t **obj);
522
530int
532
547int
548dfs_read(dfs_t *dfs, dfs_obj_t *obj, d_sg_list_t *sgl, daos_off_t off,
549 daos_size_t *read_size, daos_event_t *ev);
550
566int
567dfs_readx(dfs_t *dfs, dfs_obj_t *obj, dfs_iod_t *iod, d_sg_list_t *sgl,
568 daos_size_t *read_size, daos_event_t *ev);
569
582int
583dfs_write(dfs_t *dfs, dfs_obj_t *obj, d_sg_list_t *sgl, daos_off_t off,
584 daos_event_t *ev);
585
598int
599dfs_writex(dfs_t *dfs, dfs_obj_t *obj, dfs_iod_t *iod, d_sg_list_t *sgl,
600 daos_event_t *ev);
601
611int
612dfs_get_size(dfs_t *dfs, dfs_obj_t *obj, daos_size_t *size);
613
626int
627dfs_punch(dfs_t *dfs, dfs_obj_t *obj, daos_off_t offset, daos_size_t len);
628
647int
648dfs_readdir(dfs_t *dfs, dfs_obj_t *obj, daos_anchor_t *anchor, uint32_t *nr, struct dirent *dirs);
649
671int
672dfs_readdirplus(dfs_t *dfs, dfs_obj_t *obj, daos_anchor_t *anchor, uint32_t *nr,
673 struct dirent *dirs, struct stat *stbufs);
674
678typedef int (*dfs_filler_cb_t)(dfs_t *dfs, dfs_obj_t *obj, const char name[], void *arg);
679
700int
702 uint32_t *nr, size_t size, dfs_filler_cb_t op, void *arg);
703
714int
715dfs_dir_anchor_set(dfs_obj_t *obj, const char name[], daos_anchor_t *anchor);
716
737int
738dfs_obj_anchor_split(dfs_obj_t *obj, uint32_t *nr, daos_anchor_t *anchors);
739
752int
753dfs_obj_anchor_set(dfs_obj_t *obj, uint32_t index, daos_anchor_t *anchor);
754
766int
767dfs_mkdir(dfs_t *dfs, dfs_obj_t *parent, const char *name, mode_t mode,
768 daos_oclass_id_t cid);
769
783int
784dfs_remove(dfs_t *dfs, dfs_obj_t *parent, const char *name, bool force,
785 daos_obj_id_t *oid);
786
802int
803dfs_move(dfs_t *dfs, dfs_obj_t *parent, const char *name, dfs_obj_t *new_parent,
804 const char *new_name, daos_obj_id_t *oid);
805
817int
818dfs_exchange(dfs_t *dfs, dfs_obj_t *parent1, const char *name1, dfs_obj_t *parent2,
819 const char *name2);
820
829int
830dfs_get_mode(dfs_obj_t *obj, mode_t *mode);
831
842int
844
859int
860dfs_obj_set_oclass(dfs_t *dfs, dfs_obj_t *obj, int flags, daos_oclass_id_t cid);
861
875int
876dfs_obj_set_chunk_size(dfs_t *dfs, dfs_obj_t *obj, int flags, daos_size_t csize);
877
889int
891
901int
902dfs_get_chunk_size(dfs_obj_t *obj, daos_size_t *chunk_size);
903
917int
918dfs_get_symlink_value(dfs_obj_t *obj, char *buf, daos_size_t *size);
919
936int
937dfs_update_parent(dfs_obj_t *obj, dfs_obj_t *src_obj, const char *name);
938
960int
961dfs_stat(dfs_t *dfs, dfs_obj_t *parent, const char *name,
962 struct stat *stbuf);
963
973int
974dfs_ostat(dfs_t *dfs, dfs_obj_t *obj, struct stat *stbuf);
975
977#define DFS_SET_ATTR_MODE (1 << 0)
979#define DFS_SET_ATTR_ATIME (1 << 1)
981#define DFS_SET_ATTR_MTIME (1 << 2)
983#define DFS_SET_ATTR_SIZE (1 << 3)
985#define DFS_SET_ATTR_UID (1 << 4)
987#define DFS_SET_ATTR_GID (1 << 5)
988
1003int
1004dfs_osetattr(dfs_t *dfs, dfs_obj_t *obj, struct stat *stbuf, int flags);
1005
1020int
1021dfs_access(dfs_t *dfs, dfs_obj_t *parent, const char *name, int mask);
1022
1035int
1036dfs_chmod(dfs_t *dfs, dfs_obj_t *parent, const char *name, mode_t mode);
1037
1054int
1055dfs_chown(dfs_t *dfs, dfs_obj_t *parent, const char *name, uid_t uid, gid_t gid, int flags);
1056
1067int
1069
1085int
1086dfs_setxattr(dfs_t *dfs, dfs_obj_t *obj, const char *name,
1087 const void *value, daos_size_t size, int flags);
1088
1102int
1103dfs_getxattr(dfs_t *dfs, dfs_obj_t *obj, const char *name, void *value,
1104 daos_size_t *size);
1105
1116int
1117dfs_removexattr(dfs_t *dfs, dfs_obj_t *obj, const char *name);
1118
1134int
1135dfs_listxattr(dfs_t *dfs, dfs_obj_t *obj, char *list, daos_size_t *size);
1136
1137
1138enum {
1149};
1150
1167int
1168dfs_cont_check(daos_handle_t poh, const char *cont, uint64_t flags, const char *name);
1169
1170#if defined(__cplusplus)
1171}
1172#endif /* __cplusplus */
1173#endif /* __DAOS_FS_H__ */
#define DAOS_CONT_HINT_MAX_LEN
Definition daos_cont.h:83
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_destroy(const char *pool, const char *sys, const char *cont, int force, daos_event_t *ev)
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_cont_check(daos_handle_t poh, const char *cont, uint64_t flags, const char *name)
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_readdirplus(dfs_t *dfs, dfs_obj_t *obj, daos_anchor_t *anchor, uint32_t *nr, struct dirent *dirs, struct stat *stbufs)
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)
int dfs_cont_put(dfs_t *dfs, daos_handle_t coh)
struct dfs_obj dfs_obj_t
Definition daos_fs.h:40
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_pool_put(dfs_t *dfs, daos_handle_t poh)
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:678
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_dir_anchor_set(dfs_obj_t *obj, const char name[], daos_anchor_t *anchor)
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_suggest_oclass(dfs_t *dfs, const char *hint, daos_oclass_id_t *cid)
@ DFS_CHECK_RELINK
Definition daos_fs.h:1144
@ DFS_CHECK_REMOVE
Definition daos_fs.h:1142
@ DFS_CHECK_PRINT
Definition daos_fs.h:1140
@ DFS_CHECK_EVICT_ALL
Definition daos_fs.h:1148
@ DFS_CHECK_VERIFY
Definition daos_fs.h:1146
int dfs_global2local(daos_handle_t poh, daos_handle_t coh, int flags, d_iov_t glob, dfs_t **dfs)
int dfs_pool_get(dfs_t *dfs, daos_handle_t *poh)
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_cont_get(dfs_t *dfs, daos_handle_t *coh)
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:42
int dfs_local2global_all(dfs_t *dfs, d_iov_t *glob)
daos_oclass_id_t da_file_oclass_id
Definition daos_fs.h:79
daos_oclass_id_t da_dir_oclass_id
Definition daos_fs.h:77
uint32_t da_mode
Definition daos_fs.h:75
daos_prop_t * da_props
Definition daos_fs.h:70
uint64_t da_id
Definition daos_fs.h:64
daos_size_t da_chunk_size
Definition daos_fs.h:66
daos_oclass_id_t da_oclass_id
Definition daos_fs.h:68
daos_range_t * iod_rgs
Definition daos_fs.h:92
daos_size_t iod_nr
Definition daos_fs.h:90
daos_oclass_id_t doi_oclass_id
Definition daos_fs.h:98
daos_size_t doi_chunk_size
Definition daos_fs.h:100