Commit 35d70763 authored by Marc Vef's avatar Marc Vef
Browse files

ifs: ifs_test fix + errorhandling for creating tmpfiles

parent 32b30aae
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -19,6 +19,6 @@ bool db_is_dir_entry(const std::string& dir_path);

bool db_update_metadentry(const std::string& old_key, const std::string& new_key, const std::string& val);

bool db_iterate_all_entries();
void db_iterate_all_entries();

#endif //IFS_DB_OPS_HPP
+1 −3
Original line number Diff line number Diff line
@@ -5,9 +5,7 @@
#ifndef IFS_OPEN_FILE_MAP_HPP
#define IFS_OPEN_FILE_MAP_HPP

#include <map>
#include <mutex>
#include <memory>
#include <preload/preload.hpp>

class OpenFile {
private:
+6 −2
Original line number Diff line number Diff line
@@ -6,10 +6,14 @@
#define IOINTERCEPT_PRELOAD_HPP

#include <memory>
#include <map>
#include <mutex>
#include <iostream>
#include <sys/statfs.h>
#include <stdio.h>
#include <stdint.h>
#include <fcntl.h>
#include <errno.h>

#include "../../configure.hpp"

+1 −2
Original line number Diff line number Diff line
@@ -51,14 +51,13 @@ bool db_update_metadentry(const std::string& old_key, const std::string& new_key
    return db->Write(ADAFS_DATA->rdb_write_options(), &batch).ok();
}

bool db_iterate_all_entries() {
void db_iterate_all_entries() {
    string key;
    string val;
    auto db = ADAFS_DATA->rdb();
    // Do RangeScan on parent inode
    auto iter = db->NewIterator(rocksdb::ReadOptions());
    for (iter->SeekToFirst(); iter->Valid(); iter->Next()) {
//    while (iter->Valid()) {
        key = iter->key().ToString();
        val = iter->value().ToString();
        ADAFS_DATA->spdlogger()->trace("key '{}' value '{}'", key, val);
+5 −0
Original line number Diff line number Diff line
@@ -8,6 +8,11 @@ using namespace std;

OpenFile::OpenFile(const string& path, const bool append_flag) : path_(path), append_flag_(append_flag) {
    tmp_file_ = tmpfile(); // create a temporary file in memory and
    if (tmp_file_ == NULL) {
        LD_LOG_ERROR(debug_fd, "Error while creating temporary file in OpenFile constructor %s\n", strerror(errno));
        cout << strerror(errno) << endl;
        exit(1);
    }
    fd_ = fileno(tmp_file_); // get a valid file descriptor from the kernel
}

Loading