2 * Copyright 2011, Jérôme Duval, korli@users.berlios.de.
3 * Copyright 2008, Axel Dörfler, axeld@pinc-software.de.
4 * This file may be used under the terms of the MIT License.
16 # define TRACEI(x...) dprintf("\33[34mbtrfs:\33[0m " x)
18 # define TRACEI(x...) ;
24 Inode(Volume
* volume
, ino_t id
);
29 ino_t
ID() const { return fID
; }
31 rw_lock
* Lock() { return& fLock
; }
33 status_t
UpdateNodeFromDisk();
35 bool IsDirectory() const
36 { return S_ISDIR(Mode()); }
38 { return S_ISREG(Mode()); }
39 bool IsSymLink() const
40 { return S_ISLNK(Mode()); }
41 status_t
CheckPermissions(int accessMode
) const;
43 mode_t
Mode() const { return fNode
.Mode(); }
44 off_t
Size() const { return fNode
.Size(); }
45 uid_t
UserID() const { return fNode
.UserID(); }
46 gid_t
GroupID() const { return fNode
.GroupID(); }
47 void GetChangeTime(struct timespec
& timespec
) const
48 { fNode
.GetChangeTime(timespec
); }
49 void GetModificationTime(struct timespec
& timespec
) const
50 { fNode
.GetModificationTime(timespec
); }
51 void GetCreationTime(struct timespec
& timespec
) const
52 { fNode
.GetCreationTime(timespec
); }
53 void GetAccessTime(struct timespec
& timespec
) const
54 { fNode
.GetCreationTime(timespec
); }
56 Volume
* GetVolume() const { return fVolume
; }
58 status_t
FindBlock(off_t logical
, off_t
& physical
,
59 off_t
* _length
= NULL
);
60 status_t
ReadAt(off_t pos
, uint8
* buffer
, size_t* length
);
61 status_t
FillGapWithZeros(off_t start
, off_t end
);
63 void* FileCache() const { return fCache
; }
64 void* Map() const { return fMap
; }
66 status_t
FindParent(ino_t
* id
);
68 Inode(Volume
* volume
);
70 Inode
& operator=(const Inode
&);
85 // The Vnode class provides a convenience layer upon get_vnode(), so that
86 // you don't have to call put_vnode() anymore, which may make code more
87 // readable in some cases
91 Vnode(Volume
* volume
, ino_t id
)
117 if (fInode
!= NULL
) {
118 put_vnode(fInode
->GetVolume()->FSVolume(), fInode
->ID());
124 status_t
SetTo(Volume
* volume
, ino_t id
)
128 return fStatus
= get_vnode(volume
->FSVolume(), id
, (void**)&fInode
);
131 status_t
Get(Inode
** _inode
)
139 TRACEI("Vnode::Keep()\n");