2017-04-11 08:53:46 -04:00
|
|
|
/*
|
2026-02-23 13:22:21 -06:00
|
|
|
ISC License
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2026, Antonio SJ Musumeci <trapexit@spawn.link>
|
2017-04-11 08:53:46 -04:00
|
|
|
|
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
|
purpose with or without fee is hereby granted, provided that the above
|
|
|
|
|
copyright notice and this permission notice appear in all copies.
|
|
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-06-30 11:15:20 -04:00
|
|
|
#pragma once
|
2017-04-11 08:53:46 -04:00
|
|
|
|
2026-02-26 21:19:39 -06:00
|
|
|
#include "assert.hpp"
|
2019-09-24 10:27:46 -04:00
|
|
|
#include "fh.hpp"
|
|
|
|
|
|
2025-12-14 14:56:34 -06:00
|
|
|
#include "base_types.h"
|
2025-09-29 00:17:51 -04:00
|
|
|
|
2020-12-19 15:06:08 -05:00
|
|
|
|
2019-09-24 10:27:46 -04:00
|
|
|
class DirInfo : public FH
|
2017-04-11 08:53:46 -04:00
|
|
|
{
|
|
|
|
|
public:
|
2026-04-13 18:55:56 -05:00
|
|
|
static u64 to_fh(const DirInfo*);
|
2025-09-29 00:17:51 -04:00
|
|
|
static DirInfo *from_fh(const u64 fh);
|
2025-09-17 23:51:16 -04:00
|
|
|
|
|
|
|
|
public:
|
2025-09-29 00:17:51 -04:00
|
|
|
u64 to_fh() const;
|
2025-09-17 23:51:16 -04:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
DirInfo(const fs::path &fusepath_)
|
2019-09-24 10:27:46 -04:00
|
|
|
: FH(fusepath_)
|
2017-04-11 08:53:46 -04:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
};
|
2025-09-17 23:51:16 -04:00
|
|
|
|
2026-04-13 18:55:56 -05:00
|
|
|
inline
|
|
|
|
|
u64
|
|
|
|
|
DirInfo::to_fh(const DirInfo *di_)
|
|
|
|
|
{
|
|
|
|
|
return reinterpret_cast<u64>(di_);
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-17 23:51:16 -04:00
|
|
|
inline
|
2026-03-01 13:58:06 -06:00
|
|
|
u64
|
2025-09-17 23:51:16 -04:00
|
|
|
DirInfo::to_fh() const
|
|
|
|
|
{
|
2026-04-13 18:55:56 -05:00
|
|
|
return to_fh(this);
|
2025-09-17 23:51:16 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline
|
|
|
|
|
DirInfo*
|
2025-09-29 00:17:51 -04:00
|
|
|
DirInfo::from_fh(const u64 fh_)
|
2025-09-17 23:51:16 -04:00
|
|
|
{
|
2026-04-13 18:55:56 -05:00
|
|
|
return reinterpret_cast<DirInfo*>(fh_);
|
2025-09-17 23:51:16 -04:00
|
|
|
}
|