vfs: check userland buffers before reading them.
[haiku.git] / headers / os / storage / Statable.h
blob699ba0f73545b17bfcfd18044e4e862feda6bcb8
1 /*
2 * Copyright 2002-2014 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef _STATABLE_H
6 #define _STATABLE_H
9 #include <SupportDefs.h>
11 #include <sys/types.h>
12 #include <sys/stat.h>
15 struct node_ref;
16 struct stat_beos;
17 class BVolume;
20 class BStatable {
21 public:
22 #if __GNUC__ > 3
23 virtual ~BStatable();
24 #endif
26 private:
27 virtual status_t _GetStat(struct stat_beos* stat) const = 0;
28 // provided for BeOS compatibility
30 public:
31 virtual status_t GetStat(struct stat* stat) const = 0;
33 bool IsFile() const;
34 bool IsDirectory() const;
35 bool IsSymLink() const;
37 status_t GetNodeRef(node_ref* ref) const;
39 status_t GetOwner(uid_t* owner) const;
40 status_t SetOwner(uid_t owner);
42 status_t GetGroup(gid_t* group) const;
43 status_t SetGroup(gid_t group);
45 status_t GetPermissions(mode_t* permissions) const;
46 status_t SetPermissions(mode_t permissions);
48 status_t GetSize(off_t* size) const;
50 status_t GetModificationTime(time_t* mtime) const;
51 status_t SetModificationTime(time_t mtime);
53 status_t GetCreationTime(time_t* ctime) const;
54 status_t SetCreationTime(time_t ctime);
56 status_t GetAccessTime(time_t* atime) const;
57 status_t SetAccessTime(time_t atime);
59 status_t GetVolume(BVolume* volume) const;
61 class Private;
63 private:
64 friend class BEntry;
65 friend class BNode;
66 friend class Private;
68 virtual void _OhSoStatable2();
69 virtual void _OhSoStatable3();
70 uint32 _reserved[4];
72 virtual status_t set_stat(struct stat &st, uint32 what) = 0;
75 #endif // _STATABLE_H