The Pedigree Project  0.1
Disk.cc
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 #include "pedigree/kernel/machine/Disk.h"
21 #include "pedigree/kernel/utilities/String.h"
22 
23 Disk::Disk()
24 {
25  m_SpecificType = "Generic Disk";
26 }
27 
28 Disk::Disk(Device *p) : Device(p)
29 {
30 }
31 
32 Disk::~Disk()
33 {
34 }
35 
37 {
38  return Device::Disk;
39 }
40 
41 Disk::SubType Disk::getSubType()
42 {
43  return ATA;
44 }
45 
47 {
48  str = "Generic disk";
49 }
50 
51 void Disk::dump(String &str)
52 {
53  str = "Generic disk";
54 }
55 
56 uintptr_t Disk::read(uint64_t location)
57 {
58  return ~0;
59 }
60 
61 void Disk::write(uint64_t location)
62 {
63 }
64 
65 void Disk::align(uint64_t location)
66 {
67 }
68 
69 size_t Disk::getSize() const
70 {
71  return 0;
72 }
73 
74 size_t Disk::getBlockSize() const
75 {
76  return 0;
77 }
78 
79 void Disk::pin(uint64_t location)
80 {
81 }
82 
83 void Disk::unpin(uint64_t location)
84 {
85 }
86 
88 {
89  return false;
90 }
91 
92 void Disk::flush(uint64_t location)
93 {
94 }
String m_SpecificType
Definition: Device.h:372
virtual void pin(uint64_t location)
Pins a cache page.
Definition: Disk.cc:79
A disk device - a block device in UNIX terms.
Definition: Device.h:54
virtual void flush(uint64_t location)
Flush a cached page to disk.
Definition: Disk.cc:92
Definition: String.h:49
Definition: Device.h:43
virtual uintptr_t read(uint64_t location)
Definition: Disk.cc:56
virtual size_t getSize() const
Gets the size of the disk.
Definition: Disk.cc:69
virtual Type getType()
Definition: Disk.cc:36
virtual size_t getBlockSize() const
Gets the block size of the disk.
Definition: Disk.cc:74
virtual void dump(String &str)
Definition: Disk.cc:51
virtual void write(uint64_t location)
Definition: Disk.cc:61
virtual bool cacheIsCritical()
Whether or not the cache is critical and cannot be flushed or deleted.
Definition: Disk.cc:87
virtual void getName(String &str)
Definition: Disk.cc:46
virtual void unpin(uint64_t location)
Definition: Disk.cc:83
Type
Definition: Device.h:50
virtual void align(uint64_t location)
Sets the page boundary alignment after a specific location on the disk.
Definition: Disk.cc:65