µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
file-system.h
Go to the documentation of this file.
1/*
2 * This file is part of the µOS++ distribution.
3 * (https://github.com/micro-os-plus)
4 * Copyright (c) 2015 Liviu Ionescu.
5 *
6 * Permission is hereby granted, free of charge, to any person
7 * obtaining a copy of this software and associated documentation
8 * files (the "Software"), to deal in the Software without
9 * restriction, including without limitation the rights to use,
10 * copy, modify, merge, publish, distribute, sublicense, and/or
11 * sell copies of the Software, and to permit persons to whom
12 * the Software is furnished to do so, subject to the following
13 * conditions:
14 *
15 * The above copyright notice and this permission notice shall be
16 * included in all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 * OTHER DEALINGS IN THE SOFTWARE.
26 */
27
28#ifndef CMSIS_PLUS_POSIX_IO_FILE_SYSTEM_H_
29#define CMSIS_PLUS_POSIX_IO_FILE_SYSTEM_H_
30
31// ----------------------------------------------------------------------------
32
33#if defined(__cplusplus)
34
35// ----------------------------------------------------------------------------
36
37#if defined(OS_USE_OS_APP_CONFIG_H)
38#include <cmsis-plus/os-app-config.h>
39#endif
40
43
45
47
48#include <mutex>
49#include <cstdarg>
50#include <sys/stat.h>
51#include <utime.h>
52
53// ----------------------------------------------------------------------------
54
55#define FF_MOUNT_FLAGS_HAS_VOLUME (1)
56
57// ----------------------------------------------------------------------------
58
59#pragma GCC diagnostic push
60
61#if defined(__clang__)
62#pragma clang diagnostic ignored "-Wc++98-compat"
63#endif
64
65// ----------------------------------------------------------------------------
66
67namespace os
68{
69 namespace posix
70 {
71 // ------------------------------------------------------------------------
72
73 class io;
74 class file;
75 class directory;
76 class block_device;
77
78 class file_system_impl;
79
85 // ------------------------------------------------------------------------
86 // ----- Non-io, global file system functions -----
87 int
88 mkdir (const char* path, mode_t mode);
89
90 int
91 rmdir (const char* path);
92
93 void
94 sync (void);
95
96 // ------------------------------------------------------------------------
97 // ----- Non-io, file functions -----
98
99 int
100 chmod (const char* path, mode_t mode);
101
102 int
103 stat (const char* path, struct stat* buf);
104
105 int
106 truncate (const char* path, off_t length);
107
108 int
109 rename (const char* existing, const char* _new);
110
111 int
112 unlink (const char* path);
113
114 int
115 utime (const char* path, const struct utimbuf* times);
116
117 int
118 statvfs (const char* path, struct statvfs* buf);
119
125 directory*
126 opendir (const char* dirname);
127
132 // ========================================================================
139 {
140 // ----------------------------------------------------------------------
141
146 friend int
147 mkdir (const char* path, mode_t mode);
148
149 friend int
150 rmdir (const char* path);
151
152 friend void
153 sync (void);
154
155 friend int
156 chmod (const char* path, mode_t mode);
157
158 friend int
159 stat (const char* path, struct stat* buf);
160
161 friend int
162 truncate (const char* path, off_t length);
163
164 friend int
165 rename (const char* existing, const char* _new);
166
167 friend int
168 unlink (const char* path);
169
170 friend int
171 utime (const char* path, const struct utimbuf* times);
172
173 friend int
174 statvfs (const char* path, struct statvfs* buf);
175
180 // ----------------------------------------------------------------------
186 public:
187
188 file_system (file_system_impl& impl, const char* name);
189
194 // The rule of five.
195 file_system (const file_system&) = delete;
196 file_system (file_system&&) = delete;
198 operator= (const file_system&) = delete;
200 operator= (file_system&&) = delete;
201
206 virtual
207 ~file_system ();
208
213 // ----------------------------------------------------------------------
219 public:
220
221 int
222 mkfs (int options, ...);
223
224 virtual int
225 vmkfs (int options, std::va_list args);
226
227 int
228 mount (const char* path = nullptr, unsigned int flags = 0, ...);
229
242 virtual int
243 vmount (const char* path, unsigned int flags, std::va_list args);
244
253 virtual int
254 umount (int unsigned flags = 0);
255
256 static file_system*
257 identify_mounted (const char** path1, const char** path2 = nullptr);
258
259 // ----------------------------------------------------------------------
260
261 file*
262 open (const char* path = nullptr, int oflag = 0, ...);
263
264 virtual file*
265 vopen (const char* path, int oflag, std::va_list args);
266
267 // http://pubs.opengroup.org/onlinepubs/9699919799/functions/opendir.html
268 virtual directory*
269 opendir (const char* dirpath);
270
271 // ----------------------------------------------------------------------
272 // Also called from namespace friend functions.
273
274 virtual int
275 mkdir (const char* path, mode_t mode);
276
277 virtual int
278 rmdir (const char* path);
279
280 virtual void
281 sync (void);
282
283 virtual int
284 chmod (const char* path, mode_t mode);
285
286 virtual int
287 stat (const char* path, struct stat* buf);
288
289 virtual int
290 truncate (const char* path, off_t length);
291
292 virtual int
293 rename (const char* existing, const char* _new);
294
295 virtual int
296 unlink (const char* path);
297
298 virtual int
299 utime (const char* path, const struct utimbuf* times);
300
301 virtual int
302 statvfs (struct statvfs* buf);
303
304 public:
305
306 // ----------------------------------------------------------------------
307 // Support functions.
308
309 const char*
311
312 const char*
313 name (void) const;
314
315 void
316 add_deferred_file (file* fil);
317
318 void
320
322 utils::double_list_links, &file::deferred_links_>;
323
325 utils::double_list_links, &directory::deferred_links_>;
326
328 deferred_files_list (void);
329
332
333 // ----------------------------------------------------------------------
334
335 template<typename T>
336 T*
337 allocate_file (void);
338
339 template<typename T>
340 T*
341 allocate_directory (void);
342
343 template<typename T, typename L>
344 T*
345 allocate_file (L& locker);
346
347 template<typename T, typename L>
348 T*
349 allocate_directory (L& locker);
350
351 template<typename T>
352 void
353 deallocate_files (void);
354
355 template<typename T>
356 void
358
359 // ----------------------------------------------------------------------
360 // Support functions.
361
363 device (void) const;
364
366 impl (void) const;
367
372 // ----------------------------------------------------------------------
373 protected:
374
379 const char* name_ = nullptr;
380
381 file_system_impl& impl_;
382
383 deferred_files_list_t deferred_files_list_;
384
385 deferred_directories_list_t deferred_directories_list_;
386
387 const char* mounted_path_ = nullptr;
388
393 // ----------------------------------------------------------------------
394 public:
395
400 // Intrusive node used to link this file system to the
401 // mount manager list.
402 // Must be public. The constructor clears the pointers.
403 utils::double_list_links mount_manager_links_;
404
409 // ----------------------------------------------------------------------
410 protected:
411
416 // Statics.
417 using mounted_list = utils::intrusive_list<file_system,
418 utils::double_list_links, &file_system::mount_manager_links_>;
419 static mounted_list mounted_list__;
420
421 static file_system* mounted_root__;
422
426 };
427
428 // ========================================================================
429
431 {
432 // ----------------------------------------------------------------------
433
434 friend class file_system;
435
441 public:
442
444
449 // The rule of five.
450 file_system_impl (const file_system_impl&) = delete;
453 operator= (const file_system_impl&) = delete;
455 operator= (file_system_impl&&) = delete;
456
461 virtual
463
468 // ----------------------------------------------------------------------
474 public:
475
476 virtual int
477 do_vmkfs (int options, std::va_list args) = 0;
478
479 virtual int
480 do_vmount (unsigned int flags, std::va_list args) = 0;
481
482 virtual int
483 do_umount (unsigned int flags) = 0;
484
485 virtual file*
486 do_vopen (class file_system& fs, const char* path, int oflag,
487 std::va_list args) = 0;
488
489 virtual directory*
490 do_opendir (class file_system& fs, const char* dirname) = 0;
491
492 virtual int
493 do_mkdir (const char* path, mode_t mode) = 0;
494
495 virtual int
496 do_rmdir (const char* path) = 0;
497
498 virtual void
499 do_sync (void) = 0;
500
501 virtual int
502 do_chmod (const char* path, mode_t mode) = 0;
503
504 virtual int
505 do_stat (const char* path, struct stat* buf) = 0;
506
507 virtual int
508 do_truncate (const char* path, off_t length) = 0;
509
510 virtual int
511 do_rename (const char* existing, const char* _new) = 0;
512
513 virtual int
514 do_unlink (const char* path) = 0;
515
516 virtual int
517 do_utime (const char* path, const struct utimbuf* times) = 0;
518
519 virtual int
520 do_statvfs (struct statvfs* buf) = 0;
521
522 // ----------------------------------------------------------------------
523 // Support functions.
524
526 device (void) const;
527
532 // ----------------------------------------------------------------------
533 protected:
534
539 block_device& device_;
540
541 file_system* fs_ = nullptr;
542
546 };
547
548 // ========================================================================
549
550 template<typename T>
552 {
553 // --------------------------------------------------------------------
554
555 public:
556
557 using value_type = T;
558
559 // --------------------------------------------------------------------
560
566 public:
567
568 template<typename ... Args>
570 Args&&... args);
571
576 // The rule of five.
580 operator= (const file_system_implementable&) = delete;
582 operator= (file_system_implementable&&) = delete;
583
588 virtual
589 ~file_system_implementable () override;
590
595 // --------------------------------------------------------------------
601 public:
602
603 // Support functions.
604
606 impl (void) const;
607
612 // --------------------------------------------------------------------
613 protected:
614
619 value_type impl_instance_;
620
624 };
625
626 // ========================================================================
627
628 template<typename T, typename L>
630 {
631 // --------------------------------------------------------------------
632
633 public:
634
635 using value_type = T;
636 using lockable_type = L;
637
638 // --------------------------------------------------------------------
639
645 public:
646
647 template<typename ... Args>
649 lockable_type& locker, Args&&... args);
650
655 // The rule of five.
659 operator= (const file_system_lockable&) = delete;
661 operator= (file_system_lockable&&) = delete;
662
667 virtual
668 ~file_system_lockable () override;
669
674 // --------------------------------------------------------------------
680 public:
681
694 virtual int
695 vmount (const char* path, unsigned int flags, std::va_list args)
696 override;
697
706 virtual int
707 umount (int unsigned flags = 0) override;
708
709 // --------------------------------------------------------------------
710
711 virtual file*
712 vopen (const char* path, int oflag, std::va_list args) override;
713
714 // http://pubs.opengroup.org/onlinepubs/9699919799/functions/opendir.html
715 virtual directory*
716 opendir (const char* dirpath) override;
717
718 // --------------------------------------------------------------------
719
720 virtual int
721 mkdir (const char* path, mode_t mode) override;
722
723 virtual int
724 rmdir (const char* path) override;
725
726 virtual void
727 sync (void) override;
728
729 virtual int
730 chmod (const char* path, mode_t mode) override;
731
732 virtual int
733 stat (const char* path, struct stat* buf) override;
734
735 virtual int
736 truncate (const char* path, off_t length) override;
737
738 virtual int
739 rename (const char* existing, const char* _new) override;
740
741 virtual int
742 unlink (const char* path) override;
743
744 virtual int
745 utime (const char* path, const struct utimbuf* times) override;
746
747 virtual int
748 statvfs (struct statvfs* buf) override;
749
750 // --------------------------------------------------------------------
751 // Support functions.
752
754 impl (void) const;
755
760 // --------------------------------------------------------------------
761 protected:
762
767 value_type impl_instance_;
768
772 };
773
774 // ==========================================================================
775 } /* namespace posix */
776} /* namespace os */
777
778// ===== Inline & template implementations ====================================
779
780namespace os
781{
782 namespace posix
783 {
784 // ========================================================================
785
786 inline const char*
787 file_system::name (void) const
788 {
789 return name_;
790 }
791
792 inline file_system_impl&
793 file_system::impl (void) const
794 {
795 return static_cast<file_system_impl&> (impl_);
796 }
797
798 inline block_device&
800 {
801 return impl ().device ();
802 }
803
804 inline void
806 {
807 deferred_files_list_.link (*fil);
808 }
809
810 inline void
812 {
813 deferred_directories_list_.link (*dir);
814 }
815
818 {
819 return deferred_files_list_;
820 }
821
824 {
825 return deferred_directories_list_;
826 }
827
828 template<typename T>
829 T*
831 {
832 using file_type = T;
833
834 file_type* fil;
835
836 if (deferred_files_list_.empty ())
837 {
838 fil = new file_type (*this);
839 }
840 else
841 {
842 fil = static_cast<file_type*> (deferred_files_list_.unlink_head ());
843
844 // Call the constructor before reusing the object,
845 fil->~file_type ();
846
847 // Placement new, run only the constructor.
848 new (fil) file_type (*this);
849
850 deallocate_files<file_type> ();
851 }
852 return fil;
853 }
854
855 template<typename T, typename L>
856 T*
858 {
859 using file_type = T;
860
861 file_type* fil;
862
863 if (deferred_files_list_.empty ())
864 {
865 fil = new file_type (*this, locker);
866 }
867 else
868 {
869 fil = static_cast<file_type*> (deferred_files_list_.unlink_head ());
870
871 // Call the constructor before reusing the object,
872 fil->~file_type ();
873
874 // Placement new, run only the constructor.
875 new (fil) file_type (*this, locker);
876
877 deallocate_files<file_type> ();
878 }
879 return fil;
880 }
881
882 template<typename T>
883 void
885 {
886 using file_type = T;
887
888 // Deallocate all remaining elements in the list.
889 while (!deferred_files_list_.empty ())
890 {
891 file_type* f =
892 static_cast<file_type*> (deferred_files_list_.unlink_head ());
893
894 // Call the destructor and the deallocator.
895 delete f;
896 }
897 }
898
899 template<typename T>
900 T*
902 {
903 using directory_type = T;
904
905 directory_type* dir;
906
907 if (deferred_directories_list_.empty ())
908 {
909 dir = new directory_type (*this);
910 }
911 else
912 {
913 dir =
914 static_cast<directory_type*> (deferred_directories_list_.unlink_head ());
915
916 // Call the constructor before reusing the object,
917 dir->~directory_type ();
918
919 // Placement new, run only the constructor.
920 new (dir) directory_type (*this);
921
922 deallocate_directories<directory_type> ();
923 }
924 return dir;
925 }
926
927 template<typename T, typename L>
928 T*
930 {
931 using directory_type = T;
932
933 directory_type* dir;
934
935 if (deferred_directories_list_.empty ())
936 {
937 dir = new directory_type (*this, locker);
938 }
939 else
940 {
941 dir =
942 static_cast<directory_type*> (deferred_directories_list_.unlink_head ());
943
944 // Call the constructor before reusing the object,
945 dir->~directory_type ();
946
947 // Placement new, run only the constructor.
948 new (dir) directory_type (*this, locker);
949
950 deallocate_directories<directory_type> ();
951 }
952 return dir;
953 }
954
955 template<typename T>
956 void
958 {
959 using directory_type = T;
960
961 // Deallocate all remaining elements in the list.
962 while (!deferred_directories_list_.empty ())
963 {
964 directory_type* d =
965 static_cast<directory_type*> (deferred_directories_list_.unlink_head ());
966
967 // Call the destructor and the deallocator.
968 delete d;
969 }
970 }
971
972 // ========================================================================
973
974 inline block_device&
976 {
977 return device_;
978 }
979
980 // ========================================================================
981
982 template<typename T>
983 template<typename ... Args>
985 const char* name, block_device& device, Args&&... args) :
987 { impl_instance_, name }, //
988 impl_instance_
989 { device, std::forward<Args>(args)... }
990 {
991#if defined(OS_TRACE_POSIX_IO_FILE_SYSTEM)
992 trace::printf ("file_system_implementable::%s(\"%s\")=@%p\n",
993 __func__, name_, this);
994#endif
995 }
996
997 template<typename T>
999 {
1000#if defined(OS_TRACE_POSIX_IO_FILE_SYSTEM)
1001 trace::printf ("file_system_implementable::%s() @%p %s\n", __func__,
1002 this, name_);
1003#endif
1004 }
1005
1006 template<typename T>
1009 {
1010 return static_cast<value_type&> (impl_);
1011 }
1012
1013 // ========================================================================
1014
1015 template<typename T, typename L>
1016 template<typename ... Args>
1019 lockable_type& locker,
1020 Args&&... args) :
1022 { impl_instance_, name }, //
1023 impl_instance_
1024 { device, locker, std::forward<Args>(args)... }
1025 {
1026#if defined(OS_TRACE_POSIX_IO_FILE_SYSTEM)
1027 trace::printf ("file_system_lockable::%s()=%p\n", __func__, this);
1028#endif
1029 }
1030
1031 template<typename T, typename L>
1033 {
1034#if defined(OS_TRACE_POSIX_IO_FILE_SYSTEM)
1035 trace::printf ("file_system_lockable::%s() @%p\n", __func__, this);
1036#endif
1037 }
1038
1039 // ------------------------------------------------------------------------
1040
1041 template<typename T, typename L>
1042 int
1043 file_system_lockable<T, L>::vmount (const char* path, unsigned int flags,
1044 std::va_list args)
1045 {
1046 std::lock_guard<L> lock
1047 { impl_instance_.locker () };
1048
1049 return file_system::vmount (path, flags, args);
1050 }
1051
1057 template<typename T, typename L>
1058 int
1060 {
1061 std::lock_guard<L> lock
1062 { impl_instance_.locker () };
1063
1064 return file_system::umount (flags);
1065 }
1066
1067 // ------------------------------------------------------------------------
1068
1069 template<typename T, typename L>
1070 file*
1071 file_system_lockable<T, L>::vopen (const char* path, int oflag,
1072 std::va_list args)
1073 {
1074 std::lock_guard<L> lock
1075 { impl_instance_.locker () };
1076
1077 return file_system::vopen (path, oflag, args);
1078 }
1079
1080 template<typename T, typename L>
1081 directory*
1083 {
1084 std::lock_guard<L> lock
1085 { impl_instance_.locker () };
1086
1087 return file_system::opendir (dirpath);
1088 }
1089
1090 // ------------------------------------------------------------------------
1091
1092 template<typename T, typename L>
1093 int
1094 file_system_lockable<T, L>::mkdir (const char* path, mode_t mode)
1095 {
1096 std::lock_guard<L> lock
1097 { impl_instance_.locker () };
1098
1099 return file_system::mkdir (path, mode);
1100 }
1101
1102 template<typename T, typename L>
1103 int
1105 {
1106 std::lock_guard<L> lock
1107 { impl_instance_.locker () };
1108
1109 return file_system::rmdir (path);
1110 }
1111
1112 template<typename T, typename L>
1113 void
1115 {
1116 std::lock_guard<L> lock
1117 { impl_instance_.locker () };
1118
1119 return file_system::sync ();
1120 }
1121
1122 // ------------------------------------------------------------------------
1123
1124 template<typename T, typename L>
1125 int
1126 file_system_lockable<T, L>::chmod (const char* path, mode_t mode)
1127 {
1128 std::lock_guard<L> lock
1129 { impl_instance_.locker () };
1130
1131 return file_system::chmod (path, mode);
1132 }
1133
1134 template<typename T, typename L>
1135 int
1136 file_system_lockable<T, L>::stat (const char* path, struct stat* buf)
1137 {
1138 std::lock_guard<L> lock
1139 { impl_instance_.locker () };
1140
1141 return file_system::stat (path, buf);
1142 }
1143
1144 template<typename T, typename L>
1145 int
1146 file_system_lockable<T, L>::truncate (const char* path, off_t length)
1147 {
1148 std::lock_guard<L> lock
1149 { impl_instance_.locker () };
1150
1151 return file_system::truncate (path, length);
1152 }
1153
1154 template<typename T, typename L>
1155 int
1157 const char* _new)
1158 {
1159 std::lock_guard<L> lock
1160 { impl_instance_.locker () };
1161
1162 return file_system::rename (existing, _new);
1163 }
1164
1165 template<typename T, typename L>
1166 int
1168 {
1169 std::lock_guard<L> lock
1170 { impl_instance_.locker () };
1171
1172 return file_system::unlink (path);
1173 }
1174
1175 // http://pubs.opengroup.org/onlinepubs/9699919799/functions/utime.html
1176 template<typename T, typename L>
1177 int
1179 const struct utimbuf* times)
1180 {
1181 std::lock_guard<L> lock
1182 { impl_instance_.locker () };
1183
1184 return file_system::utime (path, times);
1185 }
1186
1187 template<typename T, typename L>
1188 int
1190 {
1191 std::lock_guard<L> lock
1192 { impl_instance_.locker () };
1193
1194 return file_system::statvfs (buf);
1195 }
1196
1197 template<typename T, typename L>
1200 {
1201 return static_cast<value_type&> (impl_);
1202 }
1203
1204// ==========================================================================
1205 } /* namespace posix */
1206} /* namespace os */
1207
1208#pragma GCC diagnostic pop
1209
1210// ----------------------------------------------------------------------------
1211
1212#endif /* __cplusplus */
1213
1214// ----------------------------------------------------------------------------
1215
1216#endif /* CMSIS_PLUS_POSIX_IO_FILE_SYSTEM_H_ */
Block device class.
Base device class.
Definition device.h:78
Directory class.
Definition directory.h:81
virtual int do_rename(const char *existing, const char *_new)=0
virtual int do_mkdir(const char *path, mode_t mode)=0
virtual int do_unlink(const char *path)=0
virtual int do_umount(unsigned int flags)=0
virtual void do_sync(void)=0
virtual int do_truncate(const char *path, off_t length)=0
virtual int do_vmkfs(int options, std::va_list args)=0
virtual int do_chmod(const char *path, mode_t mode)=0
block_device & device(void) const
virtual int do_vmount(unsigned int flags, std::va_list args)=0
virtual int do_stat(const char *path, struct stat *buf)=0
virtual file * do_vopen(class file_system &fs, const char *path, int oflag, std::va_list args)=0
virtual directory * do_opendir(class file_system &fs, const char *dirname)=0
virtual int do_statvfs(struct statvfs *buf)=0
virtual int do_utime(const char *path, const struct utimbuf *times)=0
virtual int do_rmdir(const char *path)=0
value_type & impl(void) const
virtual ~file_system_implementable() override
file_system_implementable(const char *name, block_device &device, Args &&... args)
virtual file * vopen(const char *path, int oflag, std::va_list args) override
virtual directory * opendir(const char *dirpath) override
virtual int vmount(const char *path, unsigned int flags, std::va_list args) override
Mount file system.
virtual void sync(void) override
value_type & impl(void) const
file_system_lockable(const char *name, block_device &device, lockable_type &locker, Args &&... args)
virtual int stat(const char *path, struct stat *buf) override
virtual int utime(const char *path, const struct utimbuf *times) override
virtual int mkdir(const char *path, mode_t mode) override
virtual int unlink(const char *path) override
virtual int chmod(const char *path, mode_t mode) override
virtual ~file_system_lockable() override
virtual int umount(int unsigned flags=0) override
Unmount file system.
virtual int truncate(const char *path, off_t length) override
virtual int rename(const char *existing, const char *_new) override
virtual int statvfs(struct statvfs *buf) override
virtual int rmdir(const char *path) override
File system class.
int mount(const char *path=nullptr, unsigned int flags=0,...)
deferred_directories_list_t & deferred_directories_list(void)
virtual int truncate(const char *path, off_t length)
file * open(const char *path=nullptr, int oflag=0,...)
virtual int mkdir(const char *path, mode_t mode)
virtual int rename(const char *existing, const char *_new)
void add_deferred_directory(directory *dir)
virtual void sync(void)
virtual int utime(const char *path, const struct utimbuf *times)
block_device & device(void) const
virtual int unlink(const char *path)
virtual int statvfs(struct statvfs *buf)
virtual int stat(const char *path, struct stat *buf)
static file_system * identify_mounted(const char **path1, const char **path2=nullptr)
int mkfs(int options,...)
virtual int chmod(const char *path, mode_t mode)
virtual int vmount(const char *path, unsigned int flags, std::va_list args)
Mount file system.
virtual file * vopen(const char *path, int oflag, std::va_list args)
virtual int umount(int unsigned flags=0)
Unmount file system.
virtual int rmdir(const char *path)
deferred_files_list_t & deferred_files_list(void)
void add_deferred_file(file *fil)
const char * name(void) const
void deallocate_files(void)
file_system_impl & impl(void) const
const char * mounted_path(void)
virtual int vmkfs(int options, std::va_list args)
void deallocate_directories(void)
virtual directory * opendir(const char *dirpath)
File class.
Definition file.h:75
List of intrusive nodes.
Definition lists.h:721
int printf(const char *format,...)
Write a formatted string to the trace device.
Definition trace.cpp:74
clock_t times(struct tms *buf)
int unlink(const char *path)
int utime(const char *path, const struct utimbuf *times)
int rmdir(const char *path)
int rename(const char *existing, const char *_new)
int stat(const char *path, struct stat *buf)
int chmod(const char *path, mode_t mode)
int truncate(const char *path, off_t length)
void sync(void)
directory * opendir(const char *dirname)
Open directory.
int mkdir(const char *path, mode_t mode)
System namespace.