Skip to content

Commit

Permalink
Solved various #warning TODO lines throughout the codebase.
Browse files Browse the repository at this point in the history
Added loopback network server to intel/pc configuration.
  • Loading branch information
nieklinnenbank committed Mar 15, 2016
1 parent 3bac49c commit 7a17783
Show file tree
Hide file tree
Showing 17 changed files with 25 additions and 25 deletions.
1 change: 1 addition & 0 deletions config/intel/pc/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ stdio /console/tty0 /console/tty0
#
/server/time/server &
/server/filesystem/tmp/server /tmp &
/server/network/loopback/server &

#
# Serial console
Expand Down
1 change: 0 additions & 1 deletion lib/liballoc/SplitAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ Allocator::Result SplitAllocator::allocate(Address addr)

Allocator::Result SplitAllocator::allocateLow(Size size, Address *addr, Size align)
{
#warning Size parameter should return the actual size on output too. Like the default allocate()
return m_alloc->allocate(&size, addr, align, 0);
}

Expand Down
6 changes: 2 additions & 4 deletions lib/liballoc/SplitAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ class SplitAllocator : public Allocator
/**
* Allocate from lower memory.
*
* @param size Amount of memory in bytes to allocate on input.
* On output, the amount of memory in bytes actually allocated.
* @param size Amount of memory in bytes to allocate.
* @param addr Output parameter which contains the address
* allocated on success.
* @param align Alignment of the required memory or use ZERO for default.
Expand All @@ -96,8 +95,7 @@ class SplitAllocator : public Allocator
/**
* Allocate from high memory.
*
* @param size Amount of memory in bytes to allocate on input.
* On output, the amount of memory in bytes actually allocated.
* @param size Amount of memory in bytes to allocate.
* @param addr Output parameter which contains the address
* allocated on success.
* @param align Alignment of the required memory or use ZERO for default.
Expand Down
4 changes: 1 addition & 3 deletions lib/libarch/MemoryContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ MemoryContext::Result MemoryContext::mapRange(Memory::Range *range)
{
Result r = Success;

#warning should make the allocation responsibility by the caller?
// Allocate physical pages, if needed.
if (!range->phys)
m_alloc->allocate(&range->size, &range->phys);
Expand All @@ -65,7 +64,6 @@ MemoryContext::Result MemoryContext::mapRegion(MemoryMap::Region region,
Size size,
Memory::Access access)
{
#warning Unused function!
Memory::Range range;
Result r;

Expand Down Expand Up @@ -129,7 +127,7 @@ MemoryContext::Result MemoryContext::findFree(Size size, MemoryMap::Region regio
Memory::Range r = m_map->range(region);
Size currentSize = 0;
Address addr = r.virt, currentAddr = r.virt, tmp;

while (addr < r.virt+r.size && currentSize < size)
{
// TODO: check for success instead. error codes may change.
Expand Down
1 change: 1 addition & 0 deletions lib/libarch/intel/IntelAPIC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ IntController::Result IntelAPIC::sendStartupIPI(uint cpuId, Address addr)
m_io.write(IntCommand1, cfg);

// Wait 1 milisecond
#warning FIX this.
// TODO: this is difficult in the current implementation, because
// the *userspace* instance of this class does not have
// m_frequency set.. better solution is that libarch provides a Timer
Expand Down
1 change: 0 additions & 1 deletion lib/libfs/DeviceServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ void DeviceServer::registerInterrupt(Device *dev, Size vector)
void DeviceServer::interruptHandler(Size vector)
{
List<Device *> *lst = m_interrupts.at(vector);
Error ret;

// Do we have any Devices with this interrupt vector?
if (lst)
Expand Down
2 changes: 1 addition & 1 deletion lib/libmpi/MPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ int MPI_Init(int *argc, char ***argv)
snprintf(cmd, 512, "%s -a %x -c %d",
programPath, memChannelBase.phys, coreCount);

for (Size j = 1; j < *argc; j++)
for (int j = 1; j < *argc; j++)
{
strcat(cmd, " ");
strcat(cmd, (*argv)[j]);
Expand Down
2 changes: 1 addition & 1 deletion lib/libnet/Ethernet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Error Ethernet::process(NetworkQueue::Packet *pkt, Size offset)
return m_ipv4->process(pkt, offset + sizeof(Ethernet::Header));

default:
DEBUG("dropped unknown ethernet type: " << (void *) ether->type);
DEBUG("dropped unknown ethernet type: " << (int) ether->type);
break;
}
return EINVAL;
Expand Down
1 change: 0 additions & 1 deletion lib/libnet/ICMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ Error ICMP::sendPacket(IPV4::Address ip, ICMP::Header *header)
{
DEBUG("");

Ethernet::Address ethAddr;
NetworkQueue::Packet *pkt;
Error r;

Expand Down
3 changes: 2 additions & 1 deletion lib/libnet/IPV4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Error IPV4::getTransmitPacket(NetworkQueue::Packet **pkt,
hdr->versionIHL = (sizeof(Header) / sizeof(u32)) | (4 << 4);
hdr->typeOfService = 0;
hdr->length = cpu_to_be16(size + sizeof(Header));
hdr->identification = cpu_to_be16(m_id++);
hdr->identification = cpu_to_be16(m_id);
hdr->fragmentOffset = cpu_to_be16(0x4000); // dont fragment flag
hdr->timeToLive = 64;
hdr->protocol = type;
Expand All @@ -150,6 +150,7 @@ Error IPV4::getTransmitPacket(NetworkQueue::Packet **pkt,
hdr->checksum = 0;
hdr->checksum = checksum(hdr, sizeof(Header));
(*pkt)->size += sizeof(Header);
m_id++;

// Success
return ESUCCESS;
Expand Down
2 changes: 2 additions & 0 deletions lib/libposix/Runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ void setupRandomizer()
void setupChannels()
{
ChannelClient *client = new ChannelClient();
(void) client;

ChannelClient::instance->setRegistry(new ChannelRegistry());
}

Expand Down
2 changes: 1 addition & 1 deletion lib/libposix/unistd/forkexec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ int forkexec(const char *path, const char *argv[])
// this process can read the libexec data once, and then let coreserver create a process for it.

// Map program regions into virtual memory of the new process
for (int i = 0; i < numRegions; i++)
for (Size i = 0; i < numRegions; i++)
{
// Copy executable memory from this region
range.virt = regions[i].virt;
Expand Down
2 changes: 1 addition & 1 deletion lib/libposix/unistd/spawn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ int spawn(Address program, Size programSize, const char *command)
// this process can read the libexec data once, and then let coreserver create a process for it.

// Map program regions into virtual memory of the new process
for (int i = 0; i < numRegions; i++)
for (Size i = 0; i < numRegions; i++)
{
// Copy executable memory from this region
range.virt = regions[i].virt;
Expand Down
7 changes: 6 additions & 1 deletion lib/libstd/ArgumentParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,12 @@ ArgumentParser::Result ArgumentParser::registerPositional(const char *name,
const char *description,
Size count)
{
#warning TODO: check that only the last positional can have count==0
// Check that only the last positional can have count zero.
if (m_positionals.count() &&
m_positionals.at(m_positionals.count() - 1)->getCount() == 0)
{
return AlreadyExists;
}
Argument *arg = new Argument(name);
arg->setDescription(description);
arg->setCount(count);
Expand Down
3 changes: 2 additions & 1 deletion lib/libstd/ArgumentParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class ArgumentParser
{
Success,
InvalidArgument,
NotFound
NotFound,
AlreadyExists
};

/**
Expand Down
8 changes: 3 additions & 5 deletions lib/libusb/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
Import('build_env')

env = build_env.Clone()

if env['ARCH'] == 'arm':
env.UseLibraries(['libstd', 'libarch', 'libfs', 'libipc', 'libposix'])
env.UseServers([])
env.TargetLibrary('libusb', [ Glob('*.cpp') ])
env.UseLibraries(['libstd', 'libarch', 'libfs', 'libipc', 'libposix'])
env.UseServers([])
env.TargetLibrary('libusb', [ Glob('*.cpp') ])
4 changes: 1 addition & 3 deletions server/network/loopback/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,4 @@ env = build_env.Clone()
env.UseServers(['log', 'filesystem', 'core'])
env.UseLibraries([ 'libposix', 'liballoc', 'libstd', 'libarch',
'libexec', 'libipc', 'libfs', 'libusb', 'libnet' ])

if env['ARCH'] == 'arm':
env.TargetProgram('server', [ Glob('*.cpp') ])
env.TargetProgram('server', [ Glob('*.cpp') ])

0 comments on commit 7a17783

Please sign in to comment.