Sfoglia il codice sorgente

Several refactorings and docs updates

channel
Ludovic 'Archivist' Lagouardette 3 anni fa
parent
commit
06fa00ce56
11 ha cambiato i file con 422 aggiunte e 518 eliminazioni
  1. +1
    -1
      include/gp/containers/ring_list.hpp
  2. +0
    -15
      include/gp/containers/vector.hpp
  3. +0
    -1
      include/gp/functional/bind_front.hpp
  4. +1
    -1
      include/gp/functional/function.hpp
  5. +1
    -1
      include/gp/functional/optional.hpp
  6. +1
    -85
      include/gp/functional/variant.hpp
  7. +2
    -0
      include/gp/ipc/envelope/cbor.hpp
  8. +412
    -411
      include/gp/ipc/io/io_operation.hpp
  9. +0
    -1
      include/gp/math/rendering/renderer.hpp
  10. +1
    -1
      include/gp/utils/allocators/buddy.hpp
  11. +3
    -1
      include/gp/utils/pointers.hpp

+ 1
- 1
include/gp/containers/ring_list.hpp Vedi File

@ -2,7 +2,7 @@
#include "gp_config.hpp"
#include "gp/algorithms/modifiers.hpp"
#include "gp/functional/bind_front.hpp"
#include "gp/algorithms/tmp_manip.hpp"
#include "gp/utils/allocators/allocator.hpp"
#include "gp/utils/allocators/dummy.hpp"

+ 0
- 15
include/gp/containers/vector.hpp Vedi File

@ -55,21 +55,6 @@ namespace gp{
oth.ary = nullptr;
}
/* TODO: Build the templated equivalents
array(T (& oth)[sz]) {
gp::move_uninitialized<T>(
gp::nameless_range<int*>(oth, oth+sz),
gp::nameless_range<associated_iterator>(begin(), end())
);
}
array(T (&& oth)[sz]) {
gp::move_uninitialized(
gp::nameless_range<int*>((T*)oth, (T*)oth+sz),
gp::nameless_range<associated_iterator>(begin(), end())
);
}*/
vector& operator=(vector& oth)
{
gp_config::assertion(reserve(oth.size()), "could not reserve space on assign");

include/gp/algorithms/modifiers.hpp → include/gp/functional/bind_front.hpp Vedi File

@ -7,7 +7,6 @@
#include <type_traits>
namespace gp {
// TODO: this goes into functional
template<typename F, typename ... Args>
auto bind_front(F&& func, Args&&... arg_parent)
{

+ 1
- 1
include/gp/functional/function.hpp Vedi File

@ -1,7 +1,7 @@
#pragma once
#include "gp/exception.hpp"
#include "gp/algorithms/modifiers.hpp"
#include "gp/functional/bind_front.hpp"
#include "gp/algorithms/move.hpp"
#include "gp/algorithms/tmp_manip.hpp"
#include "gp/utils/allocators/allocator.hpp"

+ 1
- 1
include/gp/functional/optional.hpp Vedi File

@ -2,7 +2,7 @@
#include "gp_config.hpp"
#include "gp/algorithms/modifiers.hpp"
#include "gp/functional/bind_front.hpp"
#include "gp/algorithms/move.hpp"
#include "gp/exception.hpp"

+ 1
- 85
include/gp/functional/variant.hpp Vedi File

@ -11,6 +11,7 @@
#include <type_traits>
#include <new>
// TODO: Implement the allocating flavour of variant
namespace gp{
@ -239,89 +240,4 @@ namespace gp{
}
}
};
/*template<typename allocator_t = gp_config::memory_module::default_allocator, typename ...T>
class variant{
std::size_t index = std::numeric_limits<std::size_t>::max();
void* ptr;
gp::function<void(void*)> dtor = [](void*){};
allocator_t allocator;
public:
template<typename U, typename std::enable_if<list_contains_class<U,T...>::value,int>::type>
constexpr variant(U& value)
: index{r_index_of<U, T...>::value}
{
ptr = (void*)new(allocator.allocate(sizeof(U))) U(value);
dtor = gp::function([](void* thing){((U*)thing)->~U();}); // TODO:replae with delete(p,t)
}
template<typename U, typename std::enable_if<list_contains_class<U,T...>::value,int>::type>
constexpr variant(U&& value)
: index{r_index_of<U, T...>::value}
{
ptr = (void*)new(allocator.allocate(sizeof(U))) U(std::move(value));
dtor = gp::function([](void* thing){((U*)thing)->~U();}); // TODO:replae with delete(p,t)
}
template<typename U, typename std::enable_if<list_contains_class<U,T...>::value,int>::type>
void operator=(U& value)
{
if(index != std::numeric_limits<std::size_t>::max())
{
dtor(ptr);
allocator.deallocate(ptr);
}
index = r_index_of<U, T...>::value;
ptr = (void*)new(allocator.allocate(sizeof(U))) U(value);
dtor = gp::function([](void* thing){((U*)thing)->~U();}); // TODO:replae with delete(p,t)
}
template<typename U, typename std::enable_if<list_contains_class<U,T...>::value,int>::type>
void operator=(U&& value)
{
if(index != std::numeric_limits<std::size_t>::max())
{
dtor(ptr);
allocator.deallocate(ptr);
}
index = r_index_of<U, T...>::value;
ptr = (void*)new(allocator.allocate(sizeof(U))) U(std::move(value));
dtor = gp::function([](void* thing){((U*)thing)->~U();}); // TODO: replace with delete(p, t)
}
~variant()
{
if(index != std::numeric_limits<std::size_t>::max())
{
dtor(ptr);
allocator.deallocate(ptr);
}
}
template<typename U>
constexpr U& value()
{
if constexpr (gp_config::has_exceptions)
{
if(r_index_of<U, T...>::value != index)
{
throw bad_variant_access<U>{};
}
}
return *reinterpret_cast<U*>(ptr);
}
template<typename U>
constexpr U& is_a()
{
if(r_index_of<U, T...>::value == index)
{
return true;
}
else
{
return false;
}
}
};*/
}

+ 2
- 0
include/gp/ipc/envelope/cbor.hpp Vedi File

@ -7,6 +7,8 @@
#include <gp/functional/variant.hpp>
#include <gp/containers/vector.hpp>
// TODO: Rewrite in a more ORM-like way
// TODO: Implement some bignum for support
namespace gp {
enum class cbor_type : uint8_t {

+ 412
- 411
include/gp/ipc/io/io_operation.hpp Vedi File

@ -6,441 +6,442 @@
#include <cstdint>
// TODO: File locking and fsync/fdatasync
namespace gp {
/**
* @brief this enum represents the types of operations available
*/
enum class operation_type {
version, ///< this operation queries properties of the filesystem
flush, ///< flushes any buffer for writing on the filesystem
attach, ///< adds a filesystem to the system
detach, ///< remove a filesystem from the system
walk, ///< change the current directory
create, ///< creates a file
open, ///< opens a file, yielding a fid
read, ///< reads from a file
write, ///< writes to a file
clunk, ///< relinquishes a fid
remove, ///< removes a file
stat, ///< reads a file metadata
wstat ///< writes a file metadata
};
/**
* @brief this enum represent the type of file handled
*/
enum class file_type {
directory, ///< the file is a normal directory
master_directory, ///< the file is the root directory of a non-root filesystem
device_directory, ///< the file is a driver mapped to a directory
root_directory, ///< the file is the root directory
file, ///< the file is a normal file
file_device, ///< the file is a driver mapped to a file
message_pipe ///< the file is a channel to read and write messages to
};
/**
* @brief represents file permissions
*/
struct permission_list {
bool
read : 1,
write : 1,
execute : 1;
};
/**
* @brief represents all levels of permissions in a file
*/
struct file_permissions {
permission_list
user, ///< list of permissions for the owner
group, ///< list of permissions for the owning group
others; ///< list of permissions for other users
};
/**
* @brief represent a value that should be unique for every entity of the system
*/
using unique_node = uint64_t;
/**
* @brief represent a timestamp in seconds
*/
using timestamp = uint64_t;
/**
* @brief represent a value that represent an offset into a file
*/
using file_offset = uint64_t;
/**
* @brief the expected return type of a stat query, as well as its writing counterpart
*/
struct f_stats {
file_type type; ///< the type of file
unique_node file_id; ///< the unique file id
unique_node owner_user_id; ///< the user id of the owner of the file
unique_node owner_group_id; ///< the group id of the file
unique_node last_modifier_id; ///< the user id of the last user that wrote data to the file
timestamp last_access; ///< the timestamp for the last time the file was opened or created. If the current user is not root, it is replaced by the system on wstat
timestamp last_modification; ///< the last modification timestamp. If the current user is not root, it is replaced by the system on wstat
file_offset file_size; ///< the filesize in bytes
gp::array<char, 255> filename; ///< the filename, padded with null characters
};
/**
* @brief this enum represents the types of operations available
*/
enum class operation_type {
version, ///< this operation queries properties of the filesystem
flush, ///< flushes any buffer for writing on the filesystem
attach, ///< adds a filesystem to the system
detach, ///< remove a filesystem from the system
walk, ///< change the current directory
create, ///< creates a file
open, ///< opens a file, yielding a fid
read, ///< reads from a file
write, ///< writes to a file
clunk, ///< relinquishes a fid
remove, ///< removes a file
stat, ///< reads a file metadata
wstat ///< writes a file metadata
};
/**
* @brief this enum represent the type of file handled
*/
enum class file_type {
directory, ///< the file is a normal directory
master_directory, ///< the file is the root directory of a non-root filesystem
device_directory, ///< the file is a driver mapped to a directory
root_directory, ///< the file is the root directory
file, ///< the file is a normal file
file_device, ///< the file is a driver mapped to a file
message_pipe ///< the file is a channel to read and write messages to
};
/**
* @brief represents file permissions
*/
struct permission_list {
bool
read : 1,
write : 1,
execute : 1;
};
/**
* @brief represents all levels of permissions in a file
*/
struct file_permissions {
permission_list
user, ///< list of permissions for the owner
group, ///< list of permissions for the owning group
others; ///< list of permissions for other users
};
/**
* @brief represent a value that should be unique for every entity of the system
*/
using unique_node = uint64_t;
/**
* @brief represent a timestamp in seconds
*/
using timestamp = uint64_t;
/**
* @brief represent a value that represent an offset into a file
*/
using file_offset = uint64_t;
/**
* @brief the expected return type of a stat query, as well as its writing counterpart
*/
struct f_stats {
file_type type; ///< the type of file
unique_node file_id; ///< the unique file id
unique_node owner_user_id; ///< the user id of the owner of the file
unique_node owner_group_id; ///< the group id of the file
unique_node last_modifier_id; ///< the user id of the last user that wrote data to the file
timestamp last_access; ///< the timestamp for the last time the file was opened or created. If the current user is not root, it is replaced by the system on wstat
timestamp last_modification; ///< the last modification timestamp. If the current user is not root, it is replaced by the system on wstat
file_offset file_size; ///< the filesize in bytes
gp::array<char, 255> filename; ///< the filename, padded with null characters
};
/**
* @brief Represent an IO operation as sent to the system, this is an abstract class.
*/
struct io_operation {
const operation_type type; ///< the discriminant for the operation type
protected:
io_operation(operation_type a) : type(a) {}
};
/**
* @brief This operation obtains the version of the targeted filesystem
*/
struct version_operation : public io_operation {
const gp::buffer<char> destination; ///< the destination where the data is written
const gp::buffer<char> root_path; ///< the path of the file system to query for version
const gp::optional<gp_config::file_descriptor_t> fd; ///< the relative root to use
/**
* @brief Represent an IO operation as sent to the system, this is an abstract class.
*/
struct io_operation {
const operation_type type; ///< the discriminant for the operation type
protected:
io_operation(operation_type a) : type(a) {}
};
/**
* @brief This operation obtains the version of the targeted filesystem
*/
struct version_operation : public io_operation {
const gp::buffer<char> destination; ///< the destination where the data is written
const gp::buffer<char> root_path; ///< the path of the file system to query for version
const gp::optional<gp_config::file_descriptor_t> fd; ///< the relative root to use
/**
* @brief Construct a new version operation object
*
* @param dest the destination where the data is written
* @param path the path to the target filesystem
* @param v_fd a relative root that is used
*/
version_operation(
gp::buffer<char> dest,
gp::buffer<char> path,
gp::optional<gp_config::file_descriptor_t> v_fd
)
: io_operation{operation_type::version}
, destination(dest)
, root_path(path)
, fd(v_fd)
{}
};
/**
* @brief This operation flushes a filesystem, writing the data to the associated medium
*/
struct flush_operation : public io_operation {
const gp::buffer<char> root_path; ///< the path that is going to be flushed
const gp::optional<gp_config::file_descriptor_t> fd; ///< the relative root to use
/**
* @brief Construct a new flush operation object
*
* @param path the path to a file or to a master directory that is to be flushed
* @param v_fd a relative root that is used
*/
flush_operation(
gp::buffer<char> path,
gp::optional<gp_config::file_descriptor_t> v_fd
)
: io_operation{operation_type::flush}
, root_path(path)
, fd(v_fd)
{}
};
/**
* @brief Construct a new version operation object
*
* @param dest the destination where the data is written
* @param path the path to the target filesystem
* @param v_fd a relative root that is used
*/
version_operation(
gp::buffer<char> dest,
gp::buffer<char> path,
gp::optional<gp_config::file_descriptor_t> v_fd
)
: io_operation{operation_type::version}
, destination(dest)
, root_path(path)
, fd(v_fd)
{}
};
/**
* @brief This operation flushes a filesystem, writing the data to the associated medium
*/
struct flush_operation : public io_operation {
const gp::buffer<char> root_path; ///< the path that is going to be flushed
const gp::optional<gp_config::file_descriptor_t> fd; ///< the relative root to use
* @brief This operation mounts a filesystem given a format and a configuration data.
*
* It also mounts devices.
*/
struct attach_operation : public io_operation {
const gp::buffer<char> target_path; ///< location where the filesystem is going to be attached
const gp::buffer<char> format; ///< format string of the filesystem
const gp::buffer<char> configuration; ///< configuration data
const gp::optional<gp_config::file_descriptor_t> fd; ///< the relative root to use
/**
* @brief Construct a new attach operation object
*
* @param path path where the filesystem will be attached, must be either not existing or an empty directory
* @param v_format the format name that will be invoked with the config
* @param config the configuration to send
* @param v_fd a relative root that is used
*/
attach_operation(
gp::buffer<char> path,
gp::buffer<char> v_format,
gp::buffer<char> config,
gp::optional<gp_config::file_descriptor_t> v_fd
)
: io_operation{operation_type::attach}
, target_path(path)
, format(v_format)
, configuration(config)
, fd(v_fd)
{}
};
/**
* @brief Construct a new flush operation object
*
* @param path the path to a file or to a master directory that is to be flushed
* @param v_fd a relative root that is used
*/
n">flush_operation(
gp::buffer<char> path,
gp::optional<gp_config::file_descriptor_t> v_fd
)
: io_operation{operation_type::flush}
, root_path(path)
, fd(v_fd)
{}
};
/**
* @brief This operation mounts a filesystem given a format and a configuration data.
*
* It also mounts devices.
*/
struct attach_operation : public io_operation {
const gp::buffer<char> target_path; ///< location where the filesystem is going to be attached
const gp::buffer<char> format; ///< format string of the filesystem
const gp::buffer<char> configuration; ///< configuration data
k">const gp::optional<gp_config::file_descriptor_t> fd; ///< the relative root to use
* @brief This operation removes the master status of a directory and dismounts the
* filesystem attached to it after flushing it. Will fail if any file is still attached
* in the filesystem.
*
* This applies to the devices too.
err">*/
struct detach_operation : public io_operation {
k">const gp::buffer<char> target_path; ///< the target master directory
const gp::optional<gp_config::file_descriptor_t> fd; ///< the relative root to use
/**
* @brief Construct a new detach operation object
*
* @param path the item to be detached
* @param v_fd a relative root that is used
*/
detach_operation(
gp::buffer<char> path,
gp::optional<gp_config::file_descriptor_t> v_fd
)
: io_operation{operation_type::attach}
, target_path(path)
, fd(v_fd)
{}
p">};
/**
* @brief Construct a new attach operation object
*
* @param path path where the filesystem will be attached, must be either not existing or an empty directory
* @param v_format the format name that will be invoked with the config
* @param config the configuration to send
* @param v_fd a relative root that is used
*/
attach_operation(
gp::buffer<char> path,
gp::buffer<char> v_format,
gp::buffer<char> config,
gp::optional<gp_config::file_descriptor_t> v_fd
)
: io_operation{operation_type::attach}
, target_path(path)
, format(v_format)
, configuration(config)
, fd(v_fd)
{}
};
/**
* @brief This operation removes the master status of a directory and dismounts the
* filesystem attached to it after flushing it. Will fail if any file is still attached
* in the filesystem.
*
* This applies to the devices too.
*/
struct detach_operation : public io_operation {
const gp::buffer<char> target_path; ///< the target master directory
const gp::optional<gp_config::file_descriptor_t> fd; ///< the relative root to use
* @brief This operation will move the focus of the target directory relative to itself or absolutely
*/
struct walk_operation : public io_operation {
const gp::buffer<char> target_path; ///< the target to move to
const gp_config::file_descriptor_t fd_to_alter; ///< the fd that will be modified
/**
* @brief Construct a new walk operation object
*
* @param path the target to move to
* @param dir the original file descriptor
*/
walk_operation(
gp::buffer<char> path,
gp_config::file_descriptor_t dir
)
: io_operation{operation_type::walk}
, target_path(path)
, fd_to_alter(dir)
{}
};
/**
* @brief Construct a new detach operation object
*
* @param path the item to be detached
* @param v_fd a relative root that is used
*/
detach_operation(
gp::buffer<char> path,
gp::optional<gp_config::file_descriptor_t> v_fd
)
: io_operation{operation_type::attach}
, target_path(path)
, fd(v_fd)
{}
};
/**
* @brief This operation will move the focus of the target directory relative to itself or absolutely
*/
struct walk_operation : public io_operation {
const gp::buffer<char> target_path; ///< the target to move to
const gp_config::file_descriptor_t fd_to_alter; ///< the fd that will be modified
* @brief selector for the type of file to be created in a given environment
*/
enum class create_type {
file, ///< normal file
directory, ///< directory file
temporary, ///< file which is to be remove upon all of his descriptors being closed
pipe_read_side, ///< pipe, read side returned
pipe_write_side ///< pipe, write side returned
};
/**
* @brief Construct a new walk operation object
*
* @param path the target to move to
* @param dir the original file descriptor
*/
walk_operation(
gp::buffer<char> path,
gp_config::file_descriptor_t dir
)
: io_operation{operation_type::walk}
, target_path(path)
, fd_to_alter(dir)
{}
};
/**
* @brief selector for the type of file to be created in a given environment
*/
enum class create_type {
file, ///< normal file
directory, ///< directory file
temporary, ///< file which is to be remove upon all of his descriptors being closed
pipe_read_side, ///< pipe, read side returned
pipe_write_side ///< pipe, write side returned
};
/**
* @brief This operation will attempt to create a file at the specified destination
*/
struct create_operation : public io_operation {
const gp::buffer<char> target_path;
const create_type mode;
const gp::optional<gp_config::file_descriptor_t> fd;
* @brief This operation will attempt to create a file at the specified destination
*/
struct create_operation : public io_operation {
const gp::buffer<char> target_path;
const create_type mode;
const gp::optional<gp_config::file_descriptor_t> fd;
/**
* @brief Create a new create operation object
*
* @param path the new file that is created
* @param v_mode the type of file to create
* @param v_fd a relative root that is used
*/
create_operation(
gp::buffer<char> path,
create_type v_mode,
gp::optional<gp_config::file_descriptor_t> v_fd
)
: io_operation{operation_type::create}
, target_path(path)
, mode(v_mode)
, fd(v_fd)
{}
};
/**
* @brief Create a new create operation object
*
* @param path the new file that is created
* @param v_mode the type of file to create
* @param v_fd a relative root that is used
*/
create_operation(
gp::buffer<char> path,
create_type v_mode,
gp::optional<gp_config::file_descriptor_t> v_fd
)
: io_operation{operation_type::create}
, target_path(path)
, mode(v_mode)
, fd(v_fd)
{}
};
/**
* @brief selector for the properties expected from an opened file descriptor
*/
enum class open_mode {
read_only, ///< the descriptor will be read only, will fail if no read permissions
read_write, ///< the descriptor is read-write, will fail if no write permissions, but not if no read permissions
read_write_create ///< the descriptor is read-write, and has the same proterties as the read-write. The file will be created if it does not exist.
};
/**
* @brief This operation will attempt to open a file at the specified destination
*/
struct open_operation : public io_operation {
const gp::buffer<char> target_path; ///< the specified path
open_mode mode; ///< the openning mode
const gp::optional<gp_config::file_descriptor_t> fd; ///< the relative root to use
* @brief selector for the properties expected from an opened file descriptor
*/
enum class open_mode {
read_only, ///< the descriptor will be read only, will fail if no read permissions
read_write, ///< the descriptor is read-write, will fail if no write permissions, but not if no read permissions
read_write_create ///< the descriptor is read-write, and has the same proterties as the read-write. The file will be created if it does not exist.
};
/**
* @brief Construct a new open operation object
*
* @param path the path where to open a file
* @param v_mode the mode of opening
* @param v_fd a relative root that is used
*/
open_operation(
n">gp::buffer<char> path,
n">open_mode v_mode,
n">gp::optional<gp_config::file_descriptor_t> v_fd
)
: io_operation{operation_type::create}
, target_path(path)
, mode(v_mode)
, fd(v_fd)
{}
};
/**
* @brief This operation will attempt to read a file into the destination starting at the specified offset in the file
*/
struct read_operation : public io_operation {
const gp_config::file_descriptor_t fd; ///< the file to read
const file_offset offset; ///< the offset to start reading at
k">const gp::buffer<char> destination; ///< the destination where to write the data
* @brief This operation will attempt to open a file at the specified destination
*/
struct open_operation : public io_operation {
const gp::buffer<char> target_path; ///< the specified path
open_mode mode; ///< the openning mode
const gp::optional<gp_config::file_descriptor_t> fd; ///< the relative root to use
/**
* @brief Construct a new open operation object
*
* @param path the path where to open a file
* @param v_mode the mode of opening
* @param v_fd a relative root that is used
*/
open_operation(
gp::buffer<char> path,
open_mode v_mode,
gp::optional<gp_config::file_descriptor_t> v_fd
)
: io_operation{operation_type::create}
, target_path(path)
, mode(v_mode)
, fd(v_fd)
{}
};
/**
* @brief Construct a new read operation object
*
* @param v_fd the descriptor to read
* @param off the offset to read
* @param v_destination the location where the data will be written
*/
read_operation(
n">gp_config::file_descriptor_t v_fd,
n">file_offset off,
n">gp::buffer<char> v_destination
)
: io_operation{operation_type::read}
, fd{v_fd}
, offset(off)
, destination(v_destination)
{}
};
/**
* @brief This operation will attempt to write in file from the source starting at the specified offset in the file
*/
struct write_operation : public io_operation {
const gp_config::file_descriptor_t fd; ///< the descriptor of the file where writing happens
const file_offset offset; ///< the offset in the file where writing starts
k">const gp::buffer<char> source; ///< the source data
* @brief This operation will attempt to read a file into the destination starting at the specified offset in the file
*/
struct read_operation : public io_operation {
const gp_config::file_descriptor_t fd; ///< the file to read
const file_offset offset; ///< the offset to start reading at
const gp::buffer<char> destination; ///< the destination where to write the data
cm">/**
o">* @brief Construct a new read operation object
o">*
* @param v_fd the descriptor to read
* @param off the offset to read
* @param v_destination the location where the data will be written
*/
read_operation(
gp_config::file_descriptor_t v_fd,
file_offset off,
gp::buffer<char> v_destination
)
: io_operation{operation_type::read}
, fd{v_fd}
, offset(off)
, destination(v_destination)
{}
p">};
/**
* @brief Construct a new write operation object
*
* @param v_fd the target file
* @param off the target offset
* @param v_source the data source buffer
*/
write_operation(
gp_config::file_descriptor_t v_fd,
file_offset off,
gp::buffer<char> v_source
)
: io_operation{operation_type::write}
, fd{v_fd}
, offset(off)
, source(v_source)
{}
};
/**
* @brief This operation closes a file by relinquishing its file descriptor
*/
struct clunk_operation : public io_operation {
const gp_config::file_descriptor_t fd; ///< The descriptor that will be disposed of
* @brief This operation will attempt to write in file from the source starting at the specified offset in the file
*/
struct write_operation : public io_operation {
const gp_config::file_descriptor_t fd; ///< the descriptor of the file where writing happens
const file_offset offset; ///< the offset in the file where writing starts
const gp::buffer<char> source; ///< the source data
/**
* @brief Construct a new write operation object
*
* @param v_fd the target file
* @param off the target offset
* @param v_source the data source buffer
*/
write_operation(
gp_config::file_descriptor_t v_fd,
file_offset off,
gp::buffer<char> v_source
)
: io_operation{operation_type::write}
, fd{v_fd}
, offset(off)
, source(v_source)
{}
};
/**
* @brief Construct a new clunk operation object
*
* @param v_fd the fd to close
*/
clunk_operation(gp_config::file_descriptor_t v_fd)
: io_operation{operation_type::clunk}
, fd{v_fd}
{}
};
/**
* @brief This operation removes a fileas soon as all its file descriptors are given back
*/
struct remove_operation : public io_operation {
const gp::buffer<char*> target_path; ///< the target file
const gp::optional<gp_config::file_descriptor_t> fd; ///< the relative root to use
* @brief This operation closes a file by relinquishing its file descriptor
*/
struct clunk_operation : public io_operation {
const gp_config::file_descriptor_t fd; ///< The descriptor that will be disposed of
/**
* @brief Construct a new clunk operation object
*
* @param v_fd the fd to close
*/
clunk_operation(gp_config::file_descriptor_t v_fd)
: io_operation{operation_type::clunk}
, fd{v_fd}
{}
};
/**
* @brief Construct a new remove operation object
*
* @param path the path to the file to remove
* @param v_fd a relative root that is used
*/
remove_operation(
n">gp::buffer<char*> path,
n">gp::optional<gp_config::file_descriptor_t> v_fd
)
: io_operation{operation_type::remove}
, target_path(path)
, fd(v_fd)
{}
};
/**
* @brief This operation fetches metadata about a file
*/
struct stat_operation : public io_operation {
const gp::buffer<char*> target_path; ///< the file to query metadata about
k">const gp::optional<gp_config::file_descriptor_t> fd; ///< the relative root to use
* @brief This operation removes a fileas soon as all its file descriptors are given back
*/
struct remove_operation : public io_operation {
const gp::buffer<char*> target_path; ///< the target file
const gp::optional<gp_config::file_descriptor_t> fd; ///< the relative root to use
cm">/**
o">* @brief Construct a new remove operation object
*
* @param path the path to the file to remove
* @param v_fd a relative root that is used
*/
remove_operation(
gp::buffer<char*> path,
gp::optional<gp_config::file_descriptor_t> v_fd
)
: io_operation{operation_type::remove}
, target_path(path)
, fd(v_fd)
{}
p">};
/**
* @brief Construct a new stat operation object
*
* @param path the path to the file to query about
* @param v_fd a relative root that is used
*/
stat_operation(
n">gp::buffer<char*> path,
n">gp::optional<gp_config::file_descriptor_t> v_fd
)
: io_operation{operation_type::stat}
, target_path(path)
, fd(v_fd)
{}
};
/**
* @brief This operation writes metadata about a file
*/
struct wstat_operation : public io_operation {
const gp::buffer<char*> target_path; ///< the file to set metadata on
k">const gp::optional<gp_config::file_descriptor_t> fd; ///< the relative root to use
* @brief This operation fetches metadata about a file
*/
struct stat_operation : public io_operation {
const gp::buffer<char*> target_path; ///< the file to query metadata about
const gp::optional<gp_config::file_descriptor_t> fd; ///< the relative root to use
cm">/**
o">* @brief Construct a new stat operation object
*
* @param path the path to the file to query about
* @param v_fd a relative root that is used
*/
stat_operation(
gp::buffer<char*> path,
gp::optional<gp_config::file_descriptor_t> v_fd
)
: io_operation{operation_type::stat}
, target_path(path)
, fd(v_fd)
{}
p">};
/**
* @brief Construct a new wstat operation object
*
* @param path the path to the file to write about
* @param v_fd a relative root that is used
*/
wstat_operation(
gp::buffer<char*> path,
gp::optional<gp_config::file_descriptor_t> v_fd
)
: io_operation{operation_type::wstat}
, target_path(path)
, fd(v_fd)
{}
};
* @brief This operation writes metadata about a file
*/
struct wstat_operation : public io_operation {
const gp::buffer<char*> target_path; ///< the file to set metadata on
const gp::optional<gp_config::file_descriptor_t> fd; ///< the relative root to use
/**
* @brief Construct a new wstat operation object
*
* @param path the path to the file to write about
* @param v_fd a relative root that is used
*/
wstat_operation(
gp::buffer<char*> path,
gp::optional<gp_config::file_descriptor_t> v_fd
)
: io_operation{operation_type::wstat}
, target_path(path)
, fd(v_fd)
{}
};
}

+ 0
- 1
include/gp/math/rendering/renderer.hpp Vedi File

@ -9,7 +9,6 @@
#include "gp/math.hpp"
#include "gp/math/rendering_math.hpp"
// TODO: Namespace this correctly
// BUG: The rendering behaves improperly, I don't know why
namespace gp {

+ 1
- 1
include/gp/utils/allocators/buddy.hpp Vedi File

@ -2,7 +2,7 @@
#include "gp_config.hpp"
#include "gp/algorithms/modifiers.hpp"
#include "gp/functional/bind_front.hpp"
#include "gp/algorithms/tmp_manip.hpp"
#include "gp/utils/allocators/dummy.hpp"
#include "gp/containers/array.hpp"

+ 3
- 1
include/gp/utils/pointers.hpp Vedi File

@ -1,10 +1,12 @@
#pragma once
#include "gp/algorithms/modifiers.hpp"
#include "gp/functional/bind_front.hpp"
#include "gp/algorithms/move.hpp"
#include "gp/containers/buffer.hpp"
#include "gp/functional/function.hpp"
#include <atomic>
namespace gp {
template<typename T>

Caricamento…
Annulla
Salva