0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-10 20:11:07 +01:00
construct/include/ircd/fs/fs.h

80 lines
2.3 KiB
C
Raw Normal View History

2018-02-04 03:22:01 +01:00
// Matrix Construct
//
// Copyright (C) Matrix Construct Developers, Authors & Contributors
2018-02-04 03:22:01 +01:00
// Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
2018-02-04 03:22:01 +01:00
// copyright notice and this permission notice is present in all copies. The
// full license for this software is available in the LICENSE file.
#pragma once
#define HAVE_IRCD_FS_H
2018-12-30 00:27:58 +01:00
/// Local filesystem interface.
2017-10-12 02:43:11 +02:00
///
/// IRCd has wrapped operations for the local filesystem to maintain a
/// cross-platform implementation of asynchronous file IO in conjunction with
/// the ircd::ctx userspace context system. These operations will yield your
/// ircd::ctx when necessary to not block the event loop on the main thread
/// during IOs.
2018-12-30 00:27:58 +01:00
///
/// Paths are stored in the platform-specific format using plain old character
/// strings, which means you should never directly manipulate path strings to
/// maintain x-platformness; instead use the (or add more) tools provided by
/// this interface (see: path.h).
///
namespace ircd::fs
{
struct init;
// Log facility for ircd::fs
extern log::log log;
2018-12-30 00:27:58 +01:00
}
2018-12-30 00:27:58 +01:00
#include "error.h"
#include "path.h"
#include "iov.h"
#include "op.h"
#include "opts.h"
#include "dev.h"
2018-12-30 00:27:58 +01:00
#include "fd.h"
2020-08-24 17:49:41 +02:00
#include "map.h"
2019-04-08 02:29:23 +02:00
#include "wait.h"
2018-12-30 00:27:58 +01:00
#include "read.h"
#include "write.h"
#include "sync.h"
#include "aio.h"
#include "select.h"
2018-12-30 00:27:58 +01:00
#include "stdin.h"
#include "support.h"
2018-12-30 00:27:58 +01:00
namespace ircd::fs
{
// Observers
bool exists(const string_view &path);
bool is_dir(const string_view &path);
bool is_reg(const string_view &path);
2020-10-20 07:22:33 +02:00
bool is_exec(const string_view &path);
2017-12-21 01:33:12 +01:00
size_t size(const string_view &path);
std::vector<std::string> ls(const string_view &path);
2018-12-30 00:27:58 +01:00
std::vector<std::string> ls_r(const string_view &path);
2018-12-30 00:27:58 +01:00
// Modifiers
bool rename(std::nothrow_t, const string_view &old, const string_view &new_);
2018-12-30 00:27:58 +01:00
bool rename(const string_view &old, const string_view &new_);
bool remove(std::nothrow_t, const string_view &path);
bool remove(const string_view &path);
bool mkdir(const string_view &path);
}
2018-12-30 00:27:58 +01:00
/// Filesystem interface init / fini held by ircd::main().
struct [[gnu::visibility("hidden")]]
ircd::fs::init
{
2022-09-06 20:02:02 +02:00
std::optional<aio::init> _aio_;
init();
~init() noexcept;
};