Import backup from 2004-06-08

This commit is contained in:
josh committed 2017-07-25 22:23:47 -04:00
1 parent 802a07ebfe
commit fdf6b71a91
12 files changed
+222 -138

No files matched your search

+46 -1
View File
@@ -3,8 +3,53 @@
// Device object for use in devfs
// Author: Josh Holtrop
// Date: 06/03/04
// Modified: 06/03/04
// Modified: 06/08/04
#include "Device.h"
#include "DeviceFolder.h"
#include "hos_defines.h"
#include "lang/string.h"
Device::Device()
{
major = minor = permissions = 0;
}
Device::Device(string aname)
{
major = minor = permissions = 0;
name = aname;
}
//Types:
// l = link, call setLink()
// d = directory, automatically initializes a new DeviceFolder object
// b = block device
// c = char device
Device::Device(string aname, dword amajor, dword aminor, char atype, word apermissions)
{
name = aname;
permissions = apermissions;
type = atype;
switch (type)
{
case 'd':
folder = new DeviceFolder();
break;
case 'l':
break;
case 'b':
case 'c':
major = amajor;
minor = aminor;
break;
}
}
void Device::setLink(string alink)
{
if (type == 'l')
link = new string(alink);
}
+14 -10
View File
@@ -3,7 +3,7 @@
// Device object for use in devfs
// Author: Josh Holtrop
// Date: 06/03/04
// Modified: 06/03/04
// Modified: 06/08/04
#ifndef __HOS_DEVICE__
#define __HOS_DEVICE__ __HOS_DEVICE__
@@ -19,19 +19,23 @@
class Device
{
private:
public:
string name;
union
{
dword myMajor;
LinkedList<Device> *folder;
dword major;
//can't be DeviceFolder * because not then Device & DeviceFolder are inter-dependent
void *folder;
string *link;
};
dword myMinor;
word permissions; //9-bit permissions | (type << 12)
string myName;
public:
// Device();
// Device(string name, dword major, dword minor, char type);
dword minor;
word permissions;
char type;
Device();
Device(string aname);
Device(string aname, dword amajor, dword aminor, char atype, word apermissions);
void setLink(string alink);
};
#endif
+29
View File
@@ -9,3 +9,32 @@
#include "Device.h"
#include "lang/LinkedList.h"
DeviceFolder::DeviceFolder()
{
}
int Device::addDevice(Device dev)
{
}
int Device::mkdir(string name, word permissions)
{
Device dev(name, 0, 0, 'd', permissions);
return addDevice(dev);
}
int Device::mklink(string name, string link)
{
Device dev(name, 0, 0, 'l', 0777);
dev.setLink(link);
return addDevice(dev);
}
int Device::mknod(string name, dword major, dword minor, char type, word permissions)
{
Device dev(name, major, minor, type, permissions);
return addDevice(dev);
}
+7 -3
View File
@@ -13,10 +13,14 @@
class DeviceFolder
{
public:
private:
LinkedList<Device> devices;
LinkedList<DeviceFolder> folders;
// DeviceFolder();
int addDevice(Device name);
public:
DeviceFolder();
int mkdir(string name, word permissions);
int mklink(string name, string link);
int mknod(string name, dword major, dword minor, char type, word permissions);
};
#endif
+4 -2
View File
@@ -3,17 +3,19 @@
// device filesystem for HOS
// Author: Josh Holtrop
// Date: 06/03/04
// Modified: 06/03/04
// Modified: 06/08/04
#include "devfs.h"
#include "Device.h"
#include "DeviceFolder.h"
#include "kio.h"
DeviceFolder *dev;
void devfs_init()
void devfs_init(string mountPoint)
{
dev = new DeviceFolder();
// vfs_mount("devfs", mountPoint, 0755, 0, 0);
}
+3 -2
View File
@@ -3,14 +3,15 @@
// device filesystem for HOS
// Author: Josh Holtrop
// Date: 06/03/04
// Modified: 06/03/04
// Modified: 06/08/04
#ifndef __HOS_DEVFS__
#define __HOS_DEVFS__ __HOS_DEVFS__
#include "Device.h"
#include "DeviceFolder.h"
void devfs_init();
void devfs_init(string mountPoint);
#endif
+6 -2
View File
@@ -12,12 +12,16 @@
#include "lang/string.h"
#include "devfs.h"
#include "kio.h"
//#include "DeviceFolder.h"
//LinkedList<Mount> mntList;
//LinkedList<Mount> *mntList;
void vfs_init()
{
printf("%u\n", sizeof(string));
//mntList = new LinkedList<Mount>;
printf("%u\n", sizeof(Device));
printf("%u\n", sizeof(DeviceFolder));
devfs_init("/dev");
}