History log of /haiku/src/kits/storage/Statable.cpp
Revision Date Author Comments
# ee4b6bdf 09-Nov-2021 Augustin Cavalier <waddlesplash@gmail.com>

Storage: Initialize stat structure before using it.

Normally we are only reading or writing from one field in the stat,
and so we do not need to worry about initializing the others. However,
in the case of timestamps, we use only the "tv_sec" field, and so
the "tv_nsec" field was getting passed to filesystem drivers with
bogus data (on x86_64 at least, very large values.)

This went largely unnoticed, despite being used in every Tracker copy
operation, because BFS only uses the lower bits of tv_nsec.
But NTFS and others use the whole field, leading to timestamps
far in the future.

This may fix some of the issues on the bugtracker about timestamp
problems in filesystems other than BFS (and slight inaccuracies in
BFS timestamps on copies, too.)

Change-Id: I5fdbd264fb145af57b7bf2f7b491c6943024811e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4707
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# a30a4a41 18-Jun-2014 John Scipione <jscipione@gmail.com>

Style fixes to Storage Kit classes.

No functional changes intended.

* Some variable renaming for clarity and consistency.
* Pointer style fixes.
* Added private method documentation back to cpp files for some methods.


# 5bff846d 19-Feb-2013 John Scipione <jscipione@gmail.com>

Move BStatable docs to Haiku Book.


# cee04e80 08-Feb-2010 Artur Wyszynski <aljen-mlists@o2.pl>

Fixed various errors/warnings reported by cppcheck:
* memory leaks
* resource leaks
* added const's to getters
* removed a few reundant conditions


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35433 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 42c9b01a 25-May-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* {BEntry,BNode}::GetStat() were still passing the BeOS struct stat size to
the syscall. Anything beyond st_mtim was therefore not filled in. Fixes
the incorrectly shown creation times in Tracker.
* The BStatable::GetStat() solution was not sufficient yet. We still have to
provide the old GetStat() symbol for BNode and BEntry, since those could be
used by old applications/libraries. We also still have to implement the old
GetStat() slots in the derived classes, but don't need to implement it in
the base class (was purely virtual before and is private now).
* The old BStatable::_OhSoStatable1() slot function was not implemented
correctly. Calling the virtual function at the vtable slot obviously results
in an infinite recursion. The correct implementation would make use of the
Perform() method, but Be didn't provide one for BStatable, so we have to use
the old GetStat() method. Fixed #3960.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30851 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bcfe344c 22-May-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Made our struct stat POSIX compliant again -- the time_t fields have been
replaced by timespec fields. Via macros the structure is still source
compatible with the old one.
* Introduced header <compat/sys/stat.h> that defines the old stat structure
(as stat_beos) and conversion functions
* Introduced versions for [l,f]stat().
* Added symbol versions for BDirectory::GetStatFor() for sake of binary
compatibility.
* BStatable::GetStat(): Renamed the old method, changed its parameter to
stat_beos*, and and made it private. Added a new version (using up a
reserved vtable slot). It remains source and binary compatible.
* BRefFilter::Filter(): Changed the struct stat* parameter to struct stat_beos*
for sake of binary compatibility. This breaks source compatibility, though,
which we can't help, since the class doesn't have reserved vtable slots.
* Fixed several issues with the stat structure change, mostly adjusted uses of
BRefFilter.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30830 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ed1589a5 04-May-2007 Axel Dörfler <axeld@pinc-software.de>

Fixed binary compatibility problem I introduced yesterday.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21031 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e5bc3cb9 04-May-2007 Axel Dörfler <axeld@pinc-software.de>

Added virtual desctructor to calm down GCC 4.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21021 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b38c9e18 02-Feb-2005 Axel Dörfler <axeld@pinc-software.de>

Now uses the new B_STAT_* constants rather than the one from fs_interface.h
(which will be removed soon).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11232 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ef4fc754 02-Oct-2004 Ingo Weinhold <ingo_weinhold@gmx.de>

Must use <fs_interface.h>, not <fsproto.h>.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9161 a95241bf-73f2-0310-859d-f6bbb57e9c96


# db10640d 28-Aug-2004 Ingo Weinhold <ingo_weinhold@gmx.de>

Got rid of the Storage Kit's kernel abstraction layer, which was
unfortunately quite slow and made some things more complicated than they
needed to be.
Implemented a few missing things (e.g. BSymLink and node locking).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8694 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f28fc025 14-Aug-2004 Ingo Weinhold <ingo_weinhold@gmx.de>

Removed superfluous GetStat() in the setter methods.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8570 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 17e6de7a 03-Aug-2003 shadow303 <shadow303@nowhere.fake>

gcc 3 fixes


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4227 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 09d84e61 12-Aug-2002 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

+ Changed StorageKit namespace to BPrivate::Storage
+ Changed Sniffer namespace to BPrivate::Storage::Sniffer


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@714 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 52a38012 08-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

It is accomplished ...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a30a4a41f948ebb03b95dab065a27a584ac0c97a 18-Jun-2014 John Scipione <jscipione@gmail.com>

Style fixes to Storage Kit classes.

No functional changes intended.

* Some variable renaming for clarity and consistency.
* Pointer style fixes.
* Added private method documentation back to cpp files for some methods.


# 5bff846db2dfe4bb2a575c8a25cb18e2afd5eb2b 19-Feb-2013 John Scipione <jscipione@gmail.com>

Move BStatable docs to Haiku Book.


# cee04e8074ec61fd8c6dac3539c5b821c3618888 08-Feb-2010 Artur Wyszynski <aljen-mlists@o2.pl>

Fixed various errors/warnings reported by cppcheck:
* memory leaks
* resource leaks
* added const's to getters
* removed a few reundant conditions


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35433 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 42c9b01aa624559ecb44976c02d02f3a1b355ae9 25-May-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* {BEntry,BNode}::GetStat() were still passing the BeOS struct stat size to
the syscall. Anything beyond st_mtim was therefore not filled in. Fixes
the incorrectly shown creation times in Tracker.
* The BStatable::GetStat() solution was not sufficient yet. We still have to
provide the old GetStat() symbol for BNode and BEntry, since those could be
used by old applications/libraries. We also still have to implement the old
GetStat() slots in the derived classes, but don't need to implement it in
the base class (was purely virtual before and is private now).
* The old BStatable::_OhSoStatable1() slot function was not implemented
correctly. Calling the virtual function at the vtable slot obviously results
in an infinite recursion. The correct implementation would make use of the
Perform() method, but Be didn't provide one for BStatable, so we have to use
the old GetStat() method. Fixed #3960.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30851 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bcfe344c537cb0dcee183c5a9afb4c362f5abe86 22-May-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Made our struct stat POSIX compliant again -- the time_t fields have been
replaced by timespec fields. Via macros the structure is still source
compatible with the old one.
* Introduced header <compat/sys/stat.h> that defines the old stat structure
(as stat_beos) and conversion functions
* Introduced versions for [l,f]stat().
* Added symbol versions for BDirectory::GetStatFor() for sake of binary
compatibility.
* BStatable::GetStat(): Renamed the old method, changed its parameter to
stat_beos*, and and made it private. Added a new version (using up a
reserved vtable slot). It remains source and binary compatible.
* BRefFilter::Filter(): Changed the struct stat* parameter to struct stat_beos*
for sake of binary compatibility. This breaks source compatibility, though,
which we can't help, since the class doesn't have reserved vtable slots.
* Fixed several issues with the stat structure change, mostly adjusted uses of
BRefFilter.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30830 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ed1589a5684f36489626c67f20c1d70551f12b3d 04-May-2007 Axel Dörfler <axeld@pinc-software.de>

Fixed binary compatibility problem I introduced yesterday.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21031 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e5bc3cb9b465ab2e988fa89d139782da81c513dd 04-May-2007 Axel Dörfler <axeld@pinc-software.de>

Added virtual desctructor to calm down GCC 4.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21021 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b38c9e18bfdd8d0a7f9360005598c0facade2709 02-Feb-2005 Axel Dörfler <axeld@pinc-software.de>

Now uses the new B_STAT_* constants rather than the one from fs_interface.h
(which will be removed soon).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11232 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ef4fc75459e2c589e8790d5de96f8b950ddaf0f0 02-Oct-2004 Ingo Weinhold <ingo_weinhold@gmx.de>

Must use <fs_interface.h>, not <fsproto.h>.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9161 a95241bf-73f2-0310-859d-f6bbb57e9c96


# db10640de90f7f9519ba2da9577b7c1af3c64f6b 28-Aug-2004 Ingo Weinhold <ingo_weinhold@gmx.de>

Got rid of the Storage Kit's kernel abstraction layer, which was
unfortunately quite slow and made some things more complicated than they
needed to be.
Implemented a few missing things (e.g. BSymLink and node locking).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8694 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f28fc0257e7de7a8680716606022ef98e5dafc29 14-Aug-2004 Ingo Weinhold <ingo_weinhold@gmx.de>

Removed superfluous GetStat() in the setter methods.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8570 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 17e6de7a37c5c61f45eb724de108daa70905cb8f 03-Aug-2003 shadow303 <shadow303@nowhere.fake>

gcc 3 fixes


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4227 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 09d84e61b6c2629d253dce1e7d7e944943d3e40e 12-Aug-2002 Tyler Dauwalder <tylerdauwalder@nowhere.fake>

+ Changed StorageKit namespace to BPrivate::Storage
+ Changed Sniffer namespace to BPrivate::Storage::Sniffer


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@714 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 52a380120846174213ccce9c4aab0dda17c72083 08-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

It is accomplished ...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10 a95241bf-73f2-0310-859d-f6bbb57e9c96