Loading...
Searching...
No Matches
filesystem_hard_link_write.hpp
Go to the documentation of this file.
/*********************************************************************/
// dar - disk archive - a backup/restoration program
// Copyright (C) 2002-2024 Denis Corbin
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// to contact the author, see the AUTHOR file
/*********************************************************************/
#ifndef FILESYSTEM_HARD_LINK_WRITE_HPP
#define FILESYSTEM_HARD_LINK_WRITE_HPP
#include "../my_config.h"
extern "C"
{
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#if HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
} // end extern "C"
#include <map>
#include "catalogue.hpp"
#include "infinint.hpp"
#include "fsa_family.hpp"
#include "cat_all_entrees.hpp"
#include <set>
namespace libdar
{
class filesystem_hard_link_write : protected mem_ui
{
// this class is not to be used directly
// it only provides routines to its inherited classes
public:
filesystem_hard_link_write(const std::shared_ptr<user_interaction> & dialog): mem_ui(dialog) { corres_write.clear(); };
filesystem_hard_link_write(const filesystem_hard_link_write & ref) = delete;
filesystem_hard_link_write(filesystem_hard_link_write && ref) = delete;
filesystem_hard_link_write & operator = (const filesystem_hard_link_write & ref) = delete;
filesystem_hard_link_write & operator = (filesystem_hard_link_write && ref) = delete;
~filesystem_hard_link_write() = default;
void write_hard_linked_target_if_not_set(const cat_mirage *ref, const std::string & chemin);
// if a hard linked inode has not been restored (no change, or less recent than the one on filesystem)
// it is necessary to inform filesystem, where to hard link on, any future hard_link
// that could be necessary to restore.
bool known_etiquette(const infinint & eti);
void clear_corres_if_pointing_to(const infinint & ligne, const std::string & path);
protected:
void corres_reset() { corres_write.clear(); };
void make_file(const cat_nomme * ref,
const path & ou);
bool raw_set_ea(const cat_nomme *e,
const ea_attributs & list_ea,
const std::string & spot,
const mask & ea_mask);
// check whether the inode for which to restore EA is not a hard link to
// an already restored inode. if not, it calls the proper ea_filesystem call to restore EA
bool raw_clear_ea_set(const cat_nomme *e, const std::string & path);
private:
struct corres_ino_ea
{
std::string chemin;
bool ea_restored;
};
std::map <infinint, corres_ino_ea> corres_write;
};
} // end of namespace
#endif
cat_all_entrees.hpp
include file gathering all entree found in a catalogue
catalogue.hpp
here is defined the classe used to manage catalogue of archives
libdar::cat_mirage
the hard link implementation, cat_mirage is the named entry owned by a directory it points to a commo...
Definition cat_mirage.hpp:48
libdar::cat_nomme
the base class for all entry that have a name
Definition cat_nomme.hpp:45
libdar::ea_attributs
the class ea_attributs manages the set of EA that can be associated to an inode
Definition ea.hpp:49
libdar::filesystem_hard_link_write
keep trace of already written inodes to restore hard links
Definition filesystem_hard_link_write.hpp:58
libdar::filesystem_hard_link_write::raw_clear_ea_set
bool raw_clear_ea_set(const cat_nomme *e, const std::string &path)
remove EA set from filesystem's file, allows subsequent raw_set_ea
libdar::filesystem_hard_link_write::clear_corres_if_pointing_to
void clear_corres_if_pointing_to(const infinint &ligne, const std::string &path)
forget everything about a hard link if the path used to build subsequent hard links is the one given ...
libdar::filesystem_hard_link_write::known_etiquette
bool known_etiquette(const infinint &eti)
libdar::filesystem_hard_link_write::raw_set_ea
bool raw_set_ea(const cat_nomme *e, const ea_attributs &list_ea, const std::string &spot, const mask &ea_mask)
add the given EA matching the given mask to the file pointed to by "e" and spot
libdar::filesystem_hard_link_write::make_file
void make_file(const cat_nomme *ref, const path &ou)
generate inode or make a hard link on an already restored or existing inode.
libdar::infinint
the arbitrary large positive integer class
Definition real_infinint.hpp:62
libdar::mask
the generic class, parent of all masks
Definition mask.hpp:62
libdar::mem_ui
class mem_ui to keep a copy of a user_interaction object
Definition mem_ui.hpp:55
libdar::path
the class path is here to manipulate paths in the Unix notation: using'/'
Definition path.hpp:51
fsa_family.hpp
filesystem specific attributes available families and fsa_scope definition
infinint.hpp
switch module to limitint (32 ou 64 bits integers) or infinint
libdar
libdar namespace encapsulate all libdar symbols
Definition archive.hpp:47