The Pedigree Project 0.1
Iso9660File.h
1/*
2 * Copyright (c) 2008-2014, Pedigree Developers
3 *
4 * Please see the CONTRIB file in the root of the source tree for a full
5 * list of contributors.
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20#ifndef ISO9660FILE_H
21#define ISO9660FILE_H
22
23#include "pedigree/kernel/TargetInfo.h"
24#include "pedigree/kernel/processor/types.h"
25#include "pedigree/kernel/time/Time.h"
26#include "pedigree/kernel/utilities/String.h"
27
28#include "Iso9660Filesystem.h"
29#include "iso9660.h"
30#include "modules/system/vfs/File.h"
31
32class Iso9660File : public File {
33 friend class Iso9660Directory;
34
35 private:
38 Iso9660File& operator=(const File&);
39 Iso9660File& operator=(const Iso9660File&);
40
41 public:
43 Iso9660File(String name, Time::Timestamp accessedTime, Time::Timestamp modifiedTime,
44 Time::Timestamp creationTime, uintptr_t inode, class Iso9660Filesystem* pFs,
45 size_t size, Iso9660DirRecord& record, File* pParent = 0)
46 : File(name, accessedTime, modifiedTime, creationTime, inode, pFs, size, pParent),
47 m_pFs(pFs),
48 m_Dir(record) {
49 cacheState().fill.setDirtyTracking(Cache::DirtyTracking::Explicit);
51 }
52 ~Iso9660File() override {
53 shutdownFillCacheWriteback();
54 }
55
56 bool prepareSharedMapping(size_t offset, size_t length) override;
57
58 inline Iso9660DirRecord& getDirRecord() {
59 return m_Dir;
60 }
61
62 protected:
63 bool readPage(uint64_t location, uintptr_t destination) override;
64 bool prepareWrite(uint64_t location, uint64_t size) override;
65 uintptr_t readBlock(uint64_t location) override;
66 bool pinBlock(uint64_t location) override;
67 void unpinBlock(uint64_t location) override;
68
69 size_t getBlockSize() const override {
70 return TargetInfo::getPageSize() < 2048 ? TargetInfo::getPageSize() : 2048;
71 }
72
73 private:
74 // Filesystem object
75 Iso9660Filesystem* m_pFs;
76
77 // Our internal directory information (info about *this* directory, not the
78 // child)
79 Iso9660DirRecord m_Dir;
80};
81
82#endif
void setDirtyTracking(DirtyTracking tracking)
Definition Cache.cc:2268
Definition File.h:74
void enableFillCacheWriteback()
Definition File.cc:1652
uintptr_t readBlock(uint64_t location) override
void unpinBlock(uint64_t location) override
Iso9660File(String name, Time::Timestamp accessedTime, Time::Timestamp modifiedTime, Time::Timestamp creationTime, uintptr_t inode, class Iso9660Filesystem *pFs, size_t size, Iso9660DirRecord &record, File *pParent=0)
Definition Iso9660File.h:43
bool pinBlock(uint64_t location) override
size_t getBlockSize() const override
Definition Iso9660File.h:69
bool readPage(uint64_t location, uintptr_t destination) override
Iso9660File(const Iso9660File &)
bool prepareSharedMapping(size_t offset, size_t length) override
static constexpr size_t getPageSize() noexcept
Definition TargetInfo.h:40