2 * Copyright 2012 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * Paweł Dziepak, pdziepak@quarnos.org
16 #include <SupportDefs.h>
17 #include <util/KernelReferenceable.h>
20 #define NFS4_FHSIZE 128
24 uint8 fData
[NFS4_FHSIZE
];
27 inline FileHandle(const FileHandle
& fh
);
28 inline FileHandle
& operator=(const FileHandle
& fh
);
31 inline bool operator==(const FileHandle
& handle
) const;
32 inline bool operator!=(const FileHandle
& handle
) const;
33 inline bool operator>(const FileHandle
& handle
) const;
34 inline bool operator<(const FileHandle
& handle
) const;
39 struct InodeName
: public SinglyLinkedListLinkImpl
<InodeName
> {
40 InodeName(InodeNames
* parent
, const char* name
);
47 struct InodeNames
: public KernelReferenceable
{
51 status_t
AddName(InodeNames
* parent
, const char* name
);
52 bool RemoveName(InodeNames
* parent
,
56 SinglyLinkedList
<InodeName
> fNames
;
63 // Complete information needed to identify a file in any situation.
64 // Unfortunately just a FileHandle is not enough even when they are persistent
65 // since OPEN requires both parent FileHandle and file name (just like LOOKUP).
76 FileInfo(const FileInfo
& fi
);
77 FileInfo
& operator=(const FileInfo
& fi
);
79 status_t
UpdateFileHandles(FileSystem
* fs
);
86 inline bool operator==(const FileSystemId
& fsid
) const;
87 inline bool operator!=(const FileSystemId
& fsid
) const;
92 FileHandle::FileHandle()
100 FileHandle::FileHandle(const FileHandle
& fh
)
104 memcpy(fData
, fh
.fData
, fSize
);
109 FileHandle::operator=(const FileHandle
& fh
)
112 memcpy(fData
, fh
.fData
, fSize
);
118 FileHandle::operator==(const FileHandle
& handle
) const
120 if (fSize
!= handle
.fSize
)
122 return memcmp(fData
, handle
.fData
, fSize
) == 0;
127 FileHandle::operator!=(const FileHandle
& handle
) const
129 return !operator==(handle
);
134 FileHandle::operator>(const FileHandle
& handle
) const
136 if (fSize
> handle
.fSize
)
138 return memcmp(fData
, handle
.fData
, fSize
) > 0;
143 FileHandle::operator<(const FileHandle
& handle
) const
145 if (fSize
< handle
.fSize
)
147 return memcmp(fData
, handle
.fData
, fSize
) < 0;
152 FileSystemId::operator==(const FileSystemId
& fsid
) const
154 return fMajor
== fsid
.fMajor
&& fMinor
== fsid
.fMinor
;
159 FileSystemId::operator!=(const FileSystemId
& fsid
) const
161 return !operator==(fsid
);
165 #endif // FILEHINFO_H