summaryrefslogtreecommitdiff
path: root/Source/Kernel/VFS/Part.ns.cpp
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-11-29 12:30:07 +0100
committerAlexis211 <alexis211@gmail.com>2009-11-29 12:30:07 +0100
commit74dea7d492d6d352bfacb147b1c08ad0cf0a8b29 (patch)
treef613c8395b75a68e51d69c24eb3acdb0816ad509 /Source/Kernel/VFS/Part.ns.cpp
parentd3e4ef59cbb45f02e07fe17fb7c58cba3c737900 (diff)
parenta913d4c2cb4daf10c0eac4d548fccb26b2a9f099 (diff)
downloadMelon-74dea7d492d6d352bfacb147b1c08ad0cf0a8b29.tar.gz
Melon-74dea7d492d6d352bfacb147b1c08ad0cf0a8b29.zip
Merge branch 'mountpoints' of github.com:Alexis211/Melon into mountpoints
Diffstat (limited to 'Source/Kernel/VFS/Part.ns.cpp')
-rw-r--r--Source/Kernel/VFS/Part.ns.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/Source/Kernel/VFS/Part.ns.cpp b/Source/Kernel/VFS/Part.ns.cpp
index 6408dbd..9ead6b5 100644
--- a/Source/Kernel/VFS/Part.ns.cpp
+++ b/Source/Kernel/VFS/Part.ns.cpp
@@ -56,4 +56,36 @@ u32int getDeviceID(BlockDevice* dev) {
return (u32int) - 1;
}
+BlockDevice* dev(String _class, u32int idx) {
+ if (_class.empty()) return devices[idx];
+ for (u32int i = 0; i < devices.size(); i++) {
+ String devclass = devices[i]->getClass();
+ if (devclass == _class or (devclass.size() > _class.size() and devclass.substr(0, _class.size()) == _class)) {
+ if (idx == 0) {
+ return devices[i];
+ } else {
+ idx--;
+ }
+ }
+ }
+ return NULL;
+}
+
+Partition* part(BlockDevice* dev, u32int idx) {
+ for (u32int i = 0; i < partitions.size(); i++) {
+ if (partitions[i]->getDevice() == dev) {
+ if (idx == 0) {
+ return partitions[i];
+ } else {
+ idx--;
+ }
+ }
+ }
+ return NULL;
+}
+
+String partIdentifier(Partition* p) {
+ return String("d") += String::number(getDeviceID(p->getDevice())) += String("p") += String::number(p->getPartNumber());
+}
+
}