Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlite: Initial port #417

Open
wants to merge 22 commits into
base: loader
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ src/components/lib/ck/share
doc/dev_manual/composite_dev_manual.pdf
doc/dev_manual/resources/*.pdf
system_binaries/cos_build-*
.vscode
8 changes: 7 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
[submodule "src/components/lib/ps/ps"]
path = src/components/lib/ps/ps
url = https://github.com/gwsystems/ps.git
url = https://github.com/msdx321/ps.git
[submodule "src/components/lib/ck/ck"]
path = src/components/lib/ck/ck
url = https://github.com/gwsystems/ck.git
[submodule "src/components/lib/sqlite/sqlite"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll want to move this into gwsystems. Remember, we want the main branch of the repo be unmodifed, and have a cos branch that we pull in as a submodule. That way we have a path for updating the code as upstream changes.

path = src/components/lib/sqlite/sqlite
url = https://github.com/msdx321/sqlite.git
[submodule "src/components/lib/lwext4/lwext4"]
path = src/components/lib/lwext4/lwext4
url = https://github.com/msdx321/lwext4.git
43 changes: 43 additions & 0 deletions composition_scripts/ext4_test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[system]
description = "Simplest system with both capability manager and scheduler, from unit_schedcomp.sh"

[[components]]
name = "booter"
img = "no_interface.llbooter"
implements = [{interface = "init"}, {interface = "addr"}]
deps = [{srv = "kernel", interface = "init", variant = "kernel"}]
constructor = "kernel"

[[components]]
name = "capmgr"
img = "capmgr.simple"
deps = [{srv = "booter", interface = "init"}, {srv = "booter", interface = "addr"}]
implements = [{interface = "capmgr"}, {interface = "init"}, {interface = "memmgr"}, {interface = "capmgr_create"}]
constructor = "booter"

[[components]]
name = "sched"
img = "sched.root_fprr"
deps = [{srv = "capmgr", interface = "init"}, {srv = "capmgr", interface = "capmgr"}, {srv = "capmgr", interface = "memmgr"}]
implements = [{interface = "sched"}, {interface = "init"}]
constructor = "booter"

[[components]]
name = "blockdev"
img = "blockdev.ramdisk"
deps = [{srv = "sched", interface = "init"}, {srv = "capmgr", interface = "capmgr_create"}, {srv = "capmgr", interface = "memmgr"}]
implements = [{interface = "blockdev"}]
constructor = "booter"

[[components]]
name = "filesystem"
img = "filesystem.ext4"
deps = [{srv = "sched", interface = "init"}, {srv = "capmgr", interface = "capmgr_create"}, {srv = "blockdev", interface = "blockdev"}, {srv = "capmgr", interface = "memmgr"}]
implements = [{interface = "filesystem"}]
constructor = "booter"

[[components]]
name = "ext4_tests"
img = "tests.ext4_tests"
deps = [{srv = "sched", interface = "init"}, {srv = "capmgr", interface = "capmgr_create"}, {srv = "filesystem", interface = "filesystem"}, {srv = "capmgr", interface = "memmgr"}]
constructor = "booter"
36 changes: 36 additions & 0 deletions composition_scripts/ramdisk_test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[system]
description = "Simplest system with both capability manager and scheduler, from unit_schedcomp.sh"

[[components]]
name = "booter"
img = "no_interface.llbooter"
implements = [{interface = "init"}, {interface = "addr"}]
deps = [{srv = "kernel", interface = "init", variant = "kernel"}]
constructor = "kernel"

[[components]]
name = "capmgr"
img = "capmgr.simple"
deps = [{srv = "booter", interface = "init"}, {srv = "booter", interface = "addr"}]
implements = [{interface = "capmgr"}, {interface = "init"}, {interface = "memmgr"}, {interface = "capmgr_create"}]
constructor = "booter"

[[components]]
name = "sched"
img = "sched.root_fprr"
deps = [{srv = "capmgr", interface = "init"}, {srv = "capmgr", interface = "capmgr"}, {srv = "capmgr", interface = "memmgr"}]
implements = [{interface = "sched"}, {interface = "init"}]
constructor = "booter"

[[components]]
name = "blockdev"
img = "blockdev.ramdisk"
deps = [{srv = "sched", interface = "init"}, {srv = "capmgr", interface = "capmgr_create"}, {srv = "capmgr", interface = "memmgr"}]
implements = [{interface = "blockdev"}]
constructor = "booter"

[[components]]
name = "ramdisk_tests"
img = "tests.ramdisk_tests"
deps = [{srv = "sched", interface = "init"}, {srv = "capmgr", interface = "capmgr_create"}, {srv = "blockdev", interface = "blockdev"}, {srv = "capmgr", interface = "memmgr"}]
constructor = "booter"
29 changes: 29 additions & 0 deletions composition_scripts/sqlite_tests.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[system]
description = "Simple test of sqlite."

[[components]]
name = "booter"
img = "no_interface.llbooter"
implements = [{interface = "init"}, {interface = "addr"}]
deps = [{srv = "kernel", interface = "init", variant = "kernel"}]
constructor = "kernel"

[[components]]
name = "capmgr"
img = "capmgr.simple"
deps = [{srv = "booter", interface = "init"}, {srv = "booter", interface = "addr"}]
implements = [{interface = "capmgr"}, {interface = "init"}, {interface = "memmgr"}, {interface = "capmgr_create"}]
constructor = "booter"

[[components]]
name = "sched"
img = "sched.root_fprr"
deps = [{srv = "capmgr", interface = "init"}, {srv = "capmgr", interface = "capmgr"}, {srv = "capmgr", interface = "memmgr"}]
implements = [{interface = "sched"}, {interface = "init"}]
constructor = "booter"

[[components]]
name = "sqlite_tests"
img = "tests.sqlite_tests"
deps = [{srv = "sched", interface = "init"}, {srv = "sched", interface = "sched"}, {srv = "capmgr", interface = "capmgr_create"}, {srv = "capmgr", interface = "memmgr"}, {srv = "capmgr", interface = "capmgr"}]
constructor = "booter"
18 changes: 18 additions & 0 deletions src/components/implementation/blockdev/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Required variables used to drive the compilation process. It is OK
# for many of these to be empty.
#
# The set of interfaces that this component exports for use by other
# components. This is a list of the interface names.
INTERFACE_EXPORTS = blockdev
# The interfaces this component is dependent on for compilation (this
# is a list of directory names in interface/)
INTERFACE_DEPENDENCIES = memmgr
# The library dependencies this component is reliant on for
# compilation/linking (this is a list of directory names in lib/)
LIBRARY_DEPENDENCIES = component
# Note: Both the interface and library dependencies should be
# *minimal*. That is to say that removing a dependency should cause
# the build to fail. The build system does not validate this
# minimality; that's on you!

include Makefile.subdir
18 changes: 18 additions & 0 deletions src/components/implementation/blockdev/ramdisk/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Required variables used to drive the compilation process. It is OK
# for many of these to be empty.
#
# The set of interfaces that this component exports for use by other
# components. This is a list of the interface names.
INTERFACE_EXPORTS = blockdev
# The interfaces this component is dependent on for compilation (this
# is a list of directory names in interface/)
INTERFACE_DEPENDENCIES = memmgr
# The library dependencies this component is reliant on for
# compilation/linking (this is a list of directory names in lib/)
LIBRARY_DEPENDENCIES = component
# Note: Both the interface and library dependencies should be
# *minimal*. That is to say that removing a dependency should cause
# the build to fail. The build system does not validate this
# minimality; that's on you!

include Makefile.subsubdir
9 changes: 9 additions & 0 deletions src/components/implementation/blockdev/ramdisk/doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## blockdev

This is the skeleton interface used by the `mkcomponent.sh` script to aid in the creation of a new component.
It provides no functionality, and should never be depended on!
This documentation should be *replaced* in the documentation for a new component.

### Description

### Usage and Assumptions
45 changes: 45 additions & 0 deletions src/components/implementation/blockdev/ramdisk/ramdisk.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#include <cos_component.h>
#include <llprint.h>
#include <memmgr.h>

#define BLOCKDEV_RAMDISK_BSIZE 4096
#define BLOCKDEV_RAMDISK_SIZE 16 * 1024 * 1024

typedef struct block {
char c[BLOCKDEV_RAMDISK_BSIZE];
} blk;

blk *ram_backend;

unsigned int
blockdev_bread(void *buf, unsigned long offset, unsigned long length)
{
memcpy(buf, &ram_backend[offset], length * BLOCKDEV_RAMDISK_BSIZE);
return 0;
}

unsigned int
blockdev_bwrite(const void *buf, unsigned long offset, unsigned long length)
{
memcpy(&ram_backend[offset], buf, length * BLOCKDEV_RAMDISK_BSIZE);
return 0;
}

void
cos_init(void)
{
ram_backend = (blk *)memmgr_heap_page_allocn(BLOCKDEV_RAMDISK_SIZE / 4096);
return;
}

void
cos_parallel_init(coreid_t cid, int init_core, int ncores)
{
return;
}

void
parallel_main(coreid_t cid)
{
return;
}
18 changes: 18 additions & 0 deletions src/components/implementation/filesystem/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Required variables used to drive the compilation process. It is OK
# for many of these to be empty.
#
# The set of interfaces that this component exports for use by other
# components. This is a list of the interface names.
INTERFACE_EXPORTS = filesystem
# The interfaces this component is dependent on for compilation (this
# is a list of directory names in interface/)
INTERFACE_DEPENDENCIES = blockdev
# The library dependencies this component is reliant on for
# compilation/linking (this is a list of directory names in lib/)
LIBRARY_DEPENDENCIES = component
# Note: Both the interface and library dependencies should be
# *minimal*. That is to say that removing a dependency should cause
# the build to fail. The build system does not validate this
# minimality; that's on you!

include Makefile.subdir
18 changes: 18 additions & 0 deletions src/components/implementation/filesystem/ext4/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Required variables used to drive the compilation process. It is OK
# for many of these to be empty.
#
# The set of interfaces that this component exports for use by other
# components. This is a list of the interface names.
INTERFACE_EXPORTS = filesystem
# The interfaces this component is dependent on for compilation (this
# is a list of directory names in interface/)
INTERFACE_DEPENDENCIES = blockdev memmgr
# The library dependencies this component is reliant on for
# compilation/linking (this is a list of directory names in lib/)
LIBRARY_DEPENDENCIES = component lwext4 posix libc ps
# Note: Both the interface and library dependencies should be
# *minimal*. That is to say that removing a dependency should cause
# the build to fail. The build system does not validate this
# minimality; that's on you!

include Makefile.subsubdir
9 changes: 9 additions & 0 deletions src/components/implementation/filesystem/ext4/doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## filesystem

This is the skeleton interface used by the `mkcomponent.sh` script to aid in the creation of a new component.
It provides no functionality, and should never be depended on!
This documentation should be *replaced* in the documentation for a new component.

### Description

### Usage and Assumptions
Loading