Skip to content

Commit

Permalink
remane namespace as module becomes a reserved keyword with C++20 (sonar)
Browse files Browse the repository at this point in the history
  • Loading branch information
frs69wq committed May 24, 2024
1 parent c755359 commit f5a4740
Show file tree
Hide file tree
Showing 31 changed files with 52 additions and 53 deletions.
2 changes: 1 addition & 1 deletion examples/jbod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
XBT_LOG_NEW_DEFAULT_CATEGORY(fs_test, "File System Test");

namespace sg4 = simgrid::s4u;
namespace sgfs = simgrid::module::fs;
namespace sgfs = simgrid::fsmod;

class FileWriterActor {
std::shared_ptr<sgfs::FileSystem> fs_;
Expand Down
2 changes: 1 addition & 1 deletion examples/open_seek_write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
XBT_LOG_NEW_DEFAULT_CATEGORY(fs_test, "File System Test");

namespace sg4 = simgrid::s4u;
namespace sgfs = simgrid::module::fs;
namespace sgfs = simgrid::fsmod;

class FileWriterActor {
std::shared_ptr<sgfs::FileSystem> fs_;
Expand Down
4 changes: 2 additions & 2 deletions include/fsmod/File.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "FileStat.hpp"
#include "Partition.hpp"

namespace simgrid::module::fs {
namespace simgrid::fsmod {

/**
* @brief A class that implemented a file abstraction
Expand Down Expand Up @@ -68,7 +68,7 @@ namespace simgrid::module::fs {
std::unique_ptr<FileStat> stat() const;
};

} // namespace simgrid::module::fs
} // namespace simgrid::fsmod


#endif
2 changes: 1 addition & 1 deletion include/fsmod/FileMetadata.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <simgrid/forward.h>
#include <iostream>

namespace simgrid::module::fs {
namespace simgrid::fsmod {

/** \cond EXCLUDE_FROM_DOCUMENTATION */

Expand Down
2 changes: 1 addition & 1 deletion include/fsmod/FileStat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <simgrid/forward.h>
#include <iostream>

namespace simgrid::module::fs {
namespace simgrid::fsmod {

/**
* @brief A class that implemented a file stat data structure
Expand Down
4 changes: 2 additions & 2 deletions include/fsmod/FileSystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "Partition.hpp"
#include "File.hpp"

namespace simgrid::module::fs {
namespace simgrid::fsmod {

/**
* @brief A class that implements a file system abstraction
Expand Down Expand Up @@ -59,6 +59,6 @@ namespace simgrid::module::fs {

int num_open_files_ = 0;
};
} // namespace simgrid::module::fs
} // namespace simgrid::fsmod

#endif
2 changes: 1 addition & 1 deletion include/fsmod/FileSystemException.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// } \
// }

namespace simgrid::module::fs {
namespace simgrid::fsmod {

/**
* @brief The exception class for fsmod
Expand Down
2 changes: 1 addition & 1 deletion include/fsmod/JBODStorage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "Storage.hpp"


namespace simgrid::module::fs {
namespace simgrid::fsmod {

/**
* @brief A class that implements an abstraction of a "Just a Bunch Of Disks" storage
Expand Down
4 changes: 2 additions & 2 deletions include/fsmod/OneDiskStorage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <simgrid/s4u/MessageQueue.hpp>
#include "Storage.hpp"

namespace simgrid::module::fs {
namespace simgrid::fsmod {

/**
* @brief A class that implements a one-disk storage
Expand All @@ -22,6 +22,6 @@ namespace simgrid::module::fs {
OneDiskStorage(const std::string &name, simgrid::s4u::Disk *disk);
s4u::MessageQueue *mq_;
};
} // namespace simgrid::module::fs
} // namespace simgrid::fsmod

#endif //FSMOD_ONEDISKSTORAGE_HPP
4 changes: 2 additions & 2 deletions include/fsmod/Partition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "fsmod/FileMetadata.hpp"

namespace simgrid::module::fs {
namespace simgrid::fsmod {

class Storage;

Expand Down Expand Up @@ -98,6 +98,6 @@ namespace simgrid::module::fs {
protected:
void delete_file(const std::string& dir_path, const std::string& file_name);
};
} // namespace simgrid::module::fs
} // namespace simgrid::fsmod

#endif
4 changes: 2 additions & 2 deletions include/fsmod/PartitionFIFOCaching.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "fsmod/Partition.hpp"
#include "fsmod/FileMetadata.hpp"

namespace simgrid::module::fs {
namespace simgrid::fsmod {


/** \cond EXCLUDE_FROM_DOCUMENTATION */
Expand All @@ -36,6 +36,6 @@ namespace simgrid::module::fs {

/** \endcond */

} // namespace simgrid::module::fs
} // namespace simgrid::fsmod

#endif
4 changes: 2 additions & 2 deletions include/fsmod/PartitionLRUCaching.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "fsmod/PartitionFIFOCaching.hpp"
#include "fsmod/FileMetadata.hpp"

namespace simgrid::module::fs {
namespace simgrid::fsmod {

/** \cond EXCLUDE_FROM_DOCUMENTATION */

Expand All @@ -29,6 +29,6 @@ namespace simgrid::module::fs {

/** \endcond */

} // namespace simgrid::module::fs
} // namespace simgrid::fsmod

#endif
4 changes: 2 additions & 2 deletions include/fsmod/PathUtil.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "Partition.hpp"

namespace simgrid::module::fs {
namespace simgrid::fsmod {

/** \cond EXCLUDE_FROM_DOCUMENTATION */

Expand All @@ -23,6 +23,6 @@ namespace simgrid::module::fs {

/** \endcond */

} // namespace simgrid::module::fs
} // namespace simgrid::fsmod

#endif
4 changes: 2 additions & 2 deletions include/fsmod/Storage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "Partition.hpp"

namespace simgrid::module::fs {
namespace simgrid::fsmod {

/**
* @brief A class that iplements a storage abstraction
Expand All @@ -36,6 +36,6 @@ namespace simgrid::module::fs {
virtual void write(sg_size_t size) = 0;
};

} // namespace simgrid::module::fs
} // namespace simgrid::fsmod

#endif
2 changes: 1 addition & 1 deletion src/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

XBT_LOG_NEW_DEFAULT_CATEGORY(fsmod_file, "File System module: File management related logs");

namespace simgrid::module::fs {
namespace simgrid::fsmod {

/**
* @brief Asynchronously read data from the file
Expand Down
23 changes: 11 additions & 12 deletions src/FileMetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,25 @@
#include "fsmod/FileMetadata.hpp"
#include "fsmod/FileSystemException.hpp"

namespace simgrid::module::fs {
namespace simgrid::fsmod {

FileMetadata::FileMetadata(sg_size_t initial_size, simgrid::module::fs::Partition *partition, std::string dir_path,
std::string file_name)
FileMetadata::FileMetadata(sg_size_t initial_size, Partition *partition, std::string dir_path, std::string file_name)
: current_size_(initial_size),
future_size_(initial_size),
partition_(partition),
dir_path_(std::move(dir_path)),
file_name_(std::move(file_name)) {
creation_date_ = s4u::Engine::get_clock();
partition_->new_file_creation_event(this);
creation_date_ = s4u::Engine::get_clock();
partition_->new_file_creation_event(this);

access_date_ = s4u::Engine::get_clock();
partition_->new_file_access_event(this);
access_date_ = s4u::Engine::get_clock();
partition_->new_file_access_event(this);

modification_date_ = s4u::Engine::get_clock();
modification_date_ = s4u::Engine::get_clock();
}

void FileMetadata::set_access_date(double date) {
access_date_ = date;
partition_->new_file_access_event(this);
void FileMetadata::set_access_date(double date) {
access_date_ = date;
partition_->new_file_access_event(this);
}
} // namespace simgrid::module::fs
} // namespace simgrid::fsmod
2 changes: 1 addition & 1 deletion src/FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

XBT_LOG_NEW_DEFAULT_CATEGORY(fsmod_filesystem, "File System module: File system management related logs");

namespace simgrid::module::fs {
namespace simgrid::fsmod {

/**
* @brief Private method to find the partition and path at mount point for an absolute path
Expand Down
2 changes: 1 addition & 1 deletion src/JBODStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

XBT_LOG_NEW_DEFAULT_CATEGORY(fsmod_jbod, "File System module: JBOD Storage related logs");

namespace simgrid::module::fs {
namespace simgrid::fsmod {

/**
* @brief Method to create an instance of a JBOD (Just a Bunch of Disks) storage
Expand Down
2 changes: 1 addition & 1 deletion src/OneDiskStorage.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "fsmod/OneDiskStorage.hpp"
#include <simgrid/s4u/Actor.hpp>

namespace simgrid::module::fs {
namespace simgrid::fsmod {

/**
* @brief Method to create an instance of a one-disk storage
Expand Down
2 changes: 1 addition & 1 deletion src/Partition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "fsmod/FileMetadata.hpp"
#include "fsmod/FileSystemException.hpp"

namespace simgrid::module::fs {
namespace simgrid::fsmod {


Partition::Partition(std::string name, std::shared_ptr<Storage> storage, sg_size_t size)
Expand Down
2 changes: 1 addition & 1 deletion src/PartitionFIFOCaching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "fsmod/PartitionFIFOCaching.hpp"
#include "fsmod/FileSystemException.hpp"

namespace simgrid::module::fs {
namespace simgrid::fsmod {

void PartitionFIFOCaching::create_space(sg_size_t num_bytes) {
sg_size_t space_that_can_be_created = 0.0;
Expand Down
2 changes: 1 addition & 1 deletion src/PartitionLRUCaching.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "fsmod/PartitionLRUCaching.hpp"

namespace simgrid::module::fs {
namespace simgrid::fsmod {

void PartitionLRUCaching::new_file_access_event(FileMetadata *file_metadata) {
priority_list_.erase(file_metadata->sequence_number_);
Expand Down
2 changes: 1 addition & 1 deletion src/PathUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <filesystem>
#include "fsmod/PathUtil.hpp"

namespace simgrid::module::fs {
namespace simgrid::fsmod {

/**
* @brief A method to simplify a path string (which is either absolute or relative to /)
Expand Down
2 changes: 1 addition & 1 deletion src/Storage.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "fsmod/Storage.hpp"

namespace simgrid::module::fs {
namespace simgrid::fsmod {


}
2 changes: 1 addition & 1 deletion test/caching_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "./test_util.hpp"

namespace sgfs=simgrid::module::fs;
namespace sgfs=simgrid::fsmod;
namespace sg4=simgrid::s4u;

XBT_LOG_NEW_DEFAULT_CATEGORY(fifo_caching_test, "FIFO Caching Test");
Expand Down
2 changes: 1 addition & 1 deletion test/file_system_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "./test_util.hpp"

namespace sgfs=simgrid::module::fs;
namespace sgfs=simgrid::fsmod;
namespace sg4=simgrid::s4u;

XBT_LOG_NEW_DEFAULT_CATEGORY(fs_test, "File System Test");
Expand Down
2 changes: 1 addition & 1 deletion test/jbod_storage_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "./test_util.hpp"

namespace sgfs=simgrid::module::fs;
namespace sgfs=simgrid::fsmod;
namespace sg4=simgrid::s4u;

XBT_LOG_NEW_DEFAULT_CATEGORY(jds_io_test, "JBODStorage I/O Test");
Expand Down
2 changes: 1 addition & 1 deletion test/one_disk_storage_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "./test_util.hpp"

namespace sgfs=simgrid::module::fs;
namespace sgfs=simgrid::fsmod;
namespace sg4=simgrid::s4u;

XBT_LOG_NEW_DEFAULT_CATEGORY(ods_io_test, "OneDiskStorage I/O Test");
Expand Down
6 changes: 3 additions & 3 deletions test/path_util_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <iostream>
#include "fsmod/PathUtil.hpp"

namespace sgfs=simgrid::module::fs;
namespace sgfs=simgrid::fsmod;

// Ugly macro, but useful for these specific tests for knowing what's happening
#define MY_ASSERT_EQ(lhs, rhs, message) if ((lhs) != (rhs)) ASSERT_EQ((lhs), (rhs)) \
Expand Down Expand Up @@ -67,9 +67,9 @@ TEST_F(PathUtilTest, PathAtMountPoint) {

for (const auto &test_item: input_output) {
auto [path, mp, output] = test_item;
auto simplified_path = simgrid::module::fs::PathUtil::simplify_path_string(path);
auto simplified_path = sgfs::PathUtil::simplify_path_string(path);
try {
auto path_at_mp = simgrid::module::fs::PathUtil::path_at_mount_point(simplified_path, "/dev/a");
auto path_at_mp = sgfs::PathUtil::path_at_mount_point(simplified_path, "/dev/a");
MY_ASSERT_EQ(output, path_at_mp, "{" + path + ", " + mp + "}");
} catch (std::logic_error &e) {
MY_ASSERT_EQ(output, "Exception", "{" + path + ", " + mp + "}");
Expand Down
2 changes: 1 addition & 1 deletion test/seek_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "./test_util.hpp"

namespace sgfs=simgrid::module::fs;
namespace sgfs=simgrid::fsmod;
namespace sg4=simgrid::s4u;

XBT_LOG_NEW_DEFAULT_CATEGORY(seek_test, "Seek Test");
Expand Down
4 changes: 2 additions & 2 deletions test/stat_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "./test_util.hpp"

namespace sgfs=simgrid::module::fs;
namespace sgfs=simgrid::fsmod;
namespace sg4=simgrid::s4u;

XBT_LOG_NEW_DEFAULT_CATEGORY(stat_test, "Stat Test");
Expand Down Expand Up @@ -50,7 +50,7 @@ TEST_F(StatTest, Stat) {
XBT_INFO("Open File '/dev/a/foo.txt'");
ASSERT_NO_THROW(file = fs_->open("/dev/a/foo.txt", "r"));
XBT_INFO("Calling stat()");
std::unique_ptr<simgrid::module::fs::FileStat> stat_struct;
std::unique_ptr<sgfs::FileStat> stat_struct;
ASSERT_NO_THROW(stat_struct = file->stat());
XBT_INFO("Checking sanity");
ASSERT_EQ(stat_struct->size_in_bytes, 100*1000);
Expand Down

0 comments on commit f5a4740

Please sign in to comment.