Import backup from 2004-06-10

This commit is contained in:
josh committed 2017-07-25 22:23:47 -04:00
1 parent b54b8191c4
commit 9a8d2c29cb
6 files changed
+265 -247

No files matched your search

+23 -21
View File
@@ -47,27 +47,6 @@ Device::Device(string aname, dword amajor, dword aminor, char atype, word apermi
}
}
Device::Device(const Device & orig)
{
minor = orig.minor;
permissions = orig.permissions;
type = orig.type;
switch (type)
{
case 'b':
case 'c':
default:
major = orig.major;
break;
case 'l':
link = new string(*orig.link);
break;
case 'd':
folder = new DeviceFolder(*(DeviceFolder *)orig.folder);
break;
}
}
Device::~Device()
{
switch (type)
@@ -81,11 +60,34 @@ Device::~Device()
}
}
Device::Device(const Device & orig)
{
name = orig.name;
permissions = orig.permissions;
type = orig.type;
switch (type)
{
case 'b':
case 'c':
default:
major = orig.major;
minor = orig.minor;
break;
case 'l':
link = new string(*orig.link);
break;
case 'd':
folder = new DeviceFolder(*(DeviceFolder *)orig.folder);
break;
}
}
Device & Device::operator=(const Device & orig)
{
if (&orig != this)
{
this->~Device();
name = orig.name;
permissions = orig.permissions;
type = orig.type;
switch (type)
+2 -1
View File
@@ -53,7 +53,7 @@ int DeviceFolder::addDevice(Device dev)
{
int i = 0;
LinkedList<Device>::iterator it = devices.begin();
while ((*it).name < dev.name && it != devices.end())
while (it != devices.end() && (*it).name < dev.name)
{
it++;
i++;
@@ -81,6 +81,7 @@ int DeviceFolder::mklink(string name, string link)
int DeviceFolder::mknod(string name, dword major, dword minor, char type, word permissions)
{
Device dev(name, major, minor, type, permissions);
printf("Well, we got here successfully.\n");
return addDevice(dev);
}
+9 -3
View File
@@ -3,7 +3,7 @@
// device filesystem for HOS
// Author: Josh Holtrop
// Date: 06/03/04
// Modified: 06/08/04
// Modified: 06/10/04
#include "devfs.h"
#include "Device.h"
@@ -14,14 +14,20 @@ DeviceFolder *dev;
void devfs_init(string mountPoint)
{
printf("I'm going to make a new DeviceFolder\n");
dev = new DeviceFolder();
printf("I'm going to make a new Device\n");
Device device("aDevice", 3, 1, 'b', 0644);
printf("I'm going to add hda1 to devfs\n");
dev->mknod("hda1", 3, 1, 'b', 0632);
/* dev->mkdir("test", 0644);
dev->mkdir("test1", 0755);
dev->mkdir("test1", 0644);
dev->mknod("hda1", 3, 1, 'b', 0632);
dev->mknod("psmouse", 4, 1, 'c', 0677);
dev->mklink("root", "hda1");
*/ dev->ls();
*/
printf("I'm going to list the devices i know about:\n");
dev->ls();
// vfs_mount("devfs", mountPoint, 0755, 0, 0);
}