summaryrefslogtreecommitdiff
path: root/ioreplay/src/init/init.h
blob: 3d9f9e9683c90fe56a8a453673774d11af5519ac (plain)
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
// Copyright 2018 Mimecast Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef INIT_H
#define INIT_H

#include "../defaults.h"
#include "../options.h"
#include "../datas/amap.h"
#include "../datas/rbuffer.h"
#include "../mounts.h"

typedef struct init_s_ {
    amap_s *threads_map;
    rbuffer_s *reuse_queue;
    options_s *opts;
    mounts_s *mounts;
    FILE *replay_fd;
    pthread_mutex_t reuse_queue_mutex;
} init_s;

/**
 * @brief Creates a new init object
 *
 * @param opts The options object
 * @return The new mounts object
 */
init_s* init_new(options_s *opts);

/**
 * @brief Destroys the init object
 *
 * @param i The init object
 */
void init_destroy(init_s *i);

/**
 * @brief Initialises the test environment
 *
 * @param opts The options object
 * @return SUCCESS if initialised without any issues
 */
status_e init_run(options_s *opts);

/**
 * @brief Extracts some useful information from the .replay meta header
 *
 * @param i The init object
 * @param init_offset To store the offset of the init section
 */
void init_extract_header(init_s *i, off_t *init_offset);

#endif // INIT_H