3030#include < string_view>
3131#include < vector>
3232
33- #include < sys/stat.h>
34-
3533#include < folly/small_vector.h>
3634
3735#include " dwarfs/entry_interface.h"
36+ #include " dwarfs/file_stat.h"
3837
3938namespace dwarfs {
4039
@@ -68,16 +67,16 @@ class entry : public entry_interface {
6867 public:
6968 enum type_t { E_FILE, E_DIR, E_LINK, E_DEVICE, E_OTHER };
7069
71- entry (const std::string& name, std::shared_ptr<entry> parent,
72- const struct ::stat & st);
70+ entry (std::string const & name, std::shared_ptr<entry> parent,
71+ file_stat const & st);
7372
7473 bool has_parent () const ;
7574 std::shared_ptr<entry> parent () const ;
76- void set_name (const std::string& name);
75+ void set_name (std::string const & name);
7776 std::string path () const override ;
7877 std::string dpath () const override ;
79- const std::string& name () const override { return name_; }
80- size_t size () const override { return stat_.st_size ; }
78+ std::string const & name () const override { return name_; }
79+ size_t size () const override { return stat_.size ; }
8180 virtual type_t type () const = 0;
8281 std::string type_string () const override ;
8382 bool is_directory () const override ;
@@ -88,11 +87,11 @@ class entry : public entry_interface {
8887 void update (global_entry_data& data) const ;
8988 virtual void accept (entry_visitor& v, bool preorder = false ) = 0;
9089 virtual void scan (os_access& os, progress& prog) = 0;
91- const struct ::stat & status () const { return stat_; }
90+ file_stat const & status () const { return stat_; }
9291 void set_entry_index (uint32_t index) { entry_index_ = index; }
9392 std::optional<uint32_t > const & entry_index () const { return entry_index_; }
94- uint64_t raw_inode_num () const { return stat_.st_ino ; }
95- uint64_t num_hard_links () const { return stat_.st_nlink ; }
93+ uint64_t raw_inode_num () const { return stat_.ino ; }
94+ uint64_t num_hard_links () const { return stat_.nlink ; }
9695 virtual void set_inode_num (uint32_t ino) = 0;
9796 virtual std::optional<uint32_t > const & inode_num () const = 0;
9897
@@ -110,19 +109,19 @@ class entry : public entry_interface {
110109 uint64_t get_ctime () const override ;
111110 void set_ctime (uint64_t ctime) override ;
112111
113- void override_size (size_t size) { stat_.st_size = size; }
112+ void override_size (size_t size) { stat_.size = size; }
114113
115114 private:
116115 std::string name_;
117116 std::weak_ptr<entry> parent_;
118- struct ::stat stat_;
117+ file_stat stat_;
119118 std::optional<uint32_t > entry_index_;
120119};
121120
122121class file : public entry {
123122 public:
124123 file (const std::string& name, std::shared_ptr<entry> parent,
125- const struct ::stat & st)
124+ file_stat const & st)
126125 : entry(name, std::move(parent), st) {}
127126
128127 type_t type () const override ;
0 commit comments