Disk ARchive: filesystem_hard_link_write.hpp Source File

| Disk ARchive 2.8.3 Full featured and portable backup and archiving tool

Loading...
Searching...
No Matches
filesystem_hard_link_write.hpp
Go to the documentation of this file.
1/*********************************************************************/
2// dar - disk archive - a backup/restoration program
3// Copyright (C) 2002-2026 Denis Corbin
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18//
19// to contact the author, see the AUTHOR file
20/*********************************************************************/
21
25
26#ifndef FILESYSTEM_HARD_LINK_WRITE_HPP
27#define FILESYSTEM_HARD_LINK_WRITE_HPP
28
29#include "../my_config.h"
30
31extern "C"
32{
33#if HAVE_UNISTD_H
34#include <unistd.h>
35#endif
36
37#if HAVE_SYS_STAT_H
38#include <sys/stat.h>
39#endif
40} // end extern "C"
41
42#include <map>
43#include "catalogue.hpp"
44#include "infinint.hpp"
45#include "fsa_family.hpp"
46#include "cat_all_entrees.hpp"
47
48#include <set>
49
50namespace libdar
51{
54
56
57 class filesystem_hard_link_write : protected mem_ui
58 {
59 // this class is not to be used directly
60 // it only provides routines to its inherited classes
61
62 public:
63 filesystem_hard_link_write(const std::shared_ptr<user_interaction> & dialog): mem_ui(dialog) { corres_write.clear(); };
64 filesystem_hard_link_write(const filesystem_hard_link_write & ref) = delete;
65 filesystem_hard_link_write(filesystem_hard_link_write && ref) = delete;
66 filesystem_hard_link_write & operator = (const filesystem_hard_link_write & ref) = delete;
67 filesystem_hard_link_write & operator = (filesystem_hard_link_write && ref) = delete;
68 ~filesystem_hard_link_write() = default;
69
70 void write_hard_linked_target_if_not_set(const cat_mirage *ref, const std::string & chemin);
71 // if a hard linked inode has not been restored (no change, or less recent than the one on filesystem)
72 // it is necessary to inform filesystem, where to hard link on, any future hard_link
73 // that could be necessary to restore.
74
76 bool known_etiquette(const infinint & eti);
77
79
82 void clear_corres_if_pointing_to(const infinint & ligne, const std::string & path);
83
84 protected:
85 void corres_reset() { corres_write.clear(); };
86
88
91 void make_file(const cat_nomme * ref,
92 const path & ou);
93
95
103 bool raw_set_ea(const cat_nomme *e,
104 const ea_attributs & list_ea,
105 const std::string & spot,
106 const mask & ea_mask);
107 // check whether the inode for which to restore EA is not a hard link to
108 // an already restored inode. if not, it calls the proper ea_filesystem call to restore EA
109
111
115 bool raw_clear_ea_set(const cat_nomme *e, const std::string & path);
116
117
118 private:
119 struct corres_ino_ea
120 {
121 std::string chemin;
122 bool ea_restored;
123 };
124
125 std::map <infinint, corres_ino_ea> corres_write;
126 };
127
129
130} // end of namespace
131
132#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:48
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::mem_ui
mem_ui(const std::shared_ptr< user_interaction > &dialog)
constructor
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
my_config.h
include macro defined by the configure script and some specific additional ones
libdar
libdar namespace encapsulate all libdar symbols
Definition archive.hpp:47