File: dfs.h

package info (click to toggle)
openmpi 3.1.3-11
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 118,572 kB
  • sloc: ansic: 628,972; f90: 17,993; makefile: 13,761; sh: 7,051; java: 6,360; perl: 3,215; cpp: 2,225; python: 1,350; lex: 988; fortran: 52; tcl: 12
file content (184 lines) | stat: -rw-r--r-- 6,591 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
 * Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
 *                         reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 */

#ifndef ORTE_MCA_DFS_H
#define ORTE_MCA_DFS_H

#include "orte_config.h"
#include "orte/types.h"

#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif

#include "orte/mca/mca.h"
#include "opal/mca/base/base.h"

#include "orte/mca/dfs/dfs_types.h"

BEGIN_C_DECLS

/*
 * Framework Interfaces
 */
/**
 * Module initialization function.
 *
 * @retval ORTE_SUCCESS The operation completed successfully
 * @retval ORTE_ERROR   An unspecifed error occurred
 */
typedef int (*orte_dfs_base_module_init_fn_t)(void);

/**
 * Module finalization function.
 *
 * @retval ORTE_SUCCESS The operation completed successfully
 * @retval ORTE_ERROR   An unspecifed error occurred
 */
typedef int (*orte_dfs_base_module_finalize_fn_t)(void);

/* Open a file
 *
 * Open a possibly remote file for reading. The uri can include file
 * system descriptions (e.g., file:///, nfs:///, or hdfs:///). Note
 * that this is a full uri - i.e., it may include a hostname to
 * indicate where the file is located
 *
 * The file descriptor will be returned in the cbfunc. It
 * represents the number by which the file can be referenced,
 * and will be an ORTE error code upon failure
 */
typedef void (*orte_dfs_base_module_open_fn_t)(char *uri,
                                               orte_dfs_open_callback_fn_t cbfunc,
                                               void *cbdata);

/* Close a file
 *
 * Closes and invalidates the file descriptor
 */
typedef void (*orte_dfs_base_module_close_fn_t)(int fd,
                                                orte_dfs_close_callback_fn_t cbfunc,
                                                void *cbdata);

/* Get the size of a file
 *
 */
typedef void (*orte_dfs_base_module_get_file_size_fn_t)(int fd,
                                                        orte_dfs_size_callback_fn_t cbfunc,
                                                        void *cbdata);

/* Position a file
 *
 * Move the read position in the file to the specified byte number
 * relative to the location specified by whence:
 *     SEEK_SET => from beginning of file
 *     SEEK_CUR => from current location
 *
 * The callback will return the offset, or a negative value if
 * the requested seek would take the pointer past the end of the
 * file. This is contrary to standard lseek behavior, but is consistent
 * with the read-only nature of this framework
 */
typedef void (*orte_dfs_base_module_seek_fn_t)(int fd, long offset, int whence,
                                               orte_dfs_seek_callback_fn_t cbfunc,
                                               void *cbdata);

/* Read bytes from a possibly remote file
 *
 * Read the specified number of bytes from the given file, using the
 * specified offset (in bytes). The status returned in cbfunc is the actual number
 * of bytes read, which should match the request unless the requested
 * length/offset would read past the end of file. An ORTE error code
 * will be returned upon error
 *
 * Note: the caller is responsible for ensuring the buffer is at least
 *       length bytes in size
 */
typedef void (*orte_dfs_base_module_read_fn_t)(int fd, uint8_t *buffer,
                                               long length,
                                               orte_dfs_read_callback_fn_t cbfunc,
                                               void *cbdata);


/* Post a file map so others may access it */
typedef void (*orte_dfs_base_module_post_file_map_fn_t)(opal_buffer_t *buf,
                                                        orte_dfs_post_callback_fn_t cbfunc,
                                                        void *cbdata);

/* Get the file map for a process
 *
 * Returns the file map associated with the specified process name. If
 * NULL is provided, then all known process maps will be returned in the
 * byte object. It is the responsibility of the caller to unpack it, so
 * applications are free to specify whatever constitutes a "file map" that
 * suits their purposes
 */
typedef void (*orte_dfs_base_module_get_file_map_fn_t)(orte_process_name_t *target,
                                                       orte_dfs_fm_callback_fn_t cbfunc,
                                                       void *cbdata);


/* Load file maps for a job
 */
typedef void (*orte_dfs_base_module_load_file_maps_fn_t)(orte_jobid_t jobid,
                                                         opal_buffer_t *buf,
                                                         orte_dfs_load_callback_fn_t cbfunc,
                                                         void *cbdata);

/* Purge file maps for a job */
typedef void (*orte_dfs_base_module_purge_file_maps_fn_t)(orte_jobid_t jobid,
                                                          orte_dfs_purge_callback_fn_t cbfunc,
                                                          void *cbdata);

/*
 * Module Structure
 */
struct orte_dfs_base_module_1_0_0_t {
    /** Initialization Function */
    orte_dfs_base_module_init_fn_t             init;
    /** Finalization Function */
    orte_dfs_base_module_finalize_fn_t         finalize;

    orte_dfs_base_module_open_fn_t             open;
    orte_dfs_base_module_close_fn_t            close;
    orte_dfs_base_module_get_file_size_fn_t    get_file_size;
    orte_dfs_base_module_seek_fn_t             seek;
    orte_dfs_base_module_read_fn_t             read;
    orte_dfs_base_module_post_file_map_fn_t    post_file_map;
    orte_dfs_base_module_get_file_map_fn_t     get_file_map;
    orte_dfs_base_module_load_file_maps_fn_t   load_file_maps;
    orte_dfs_base_module_purge_file_maps_fn_t  purge_file_maps;
};
typedef struct orte_dfs_base_module_1_0_0_t orte_dfs_base_module_1_0_0_t;
typedef orte_dfs_base_module_1_0_0_t orte_dfs_base_module_t;
ORTE_DECLSPEC extern orte_dfs_base_module_t orte_dfs;

/*
 * DFS Component
 */
struct orte_dfs_base_component_1_0_0_t {
    /** MCA base component */
    mca_base_component_t base_version;
    /** MCA base data */
    mca_base_component_data_t base_data;
};
typedef struct orte_dfs_base_component_1_0_0_t orte_dfs_base_component_1_0_0_t;
typedef orte_dfs_base_component_1_0_0_t orte_dfs_base_component_t;

/*
 * Macro for use in components that are of type errmgr
 */
#define ORTE_DFS_BASE_VERSION_1_0_0 \
    ORTE_MCA_BASE_VERSION_2_1_0("dfs", 1, 0, 0)

END_C_DECLS

#endif