Skip to content

Commit 793859d

Browse files
committed
Merge branch 'dev' of github.com:fwsGonzo/IncludeOS into dev
2 parents dd329d2 + dc31adc commit 793859d

88 files changed

Lines changed: 2703 additions & 1538 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
![IncludeOS](./doc/IncludeOS_logo.png)
1+
![IncludeOS Logo](./doc/logo.png)
22
================================================
33

4+
**Update**: Looking for [Acorn](https://github.com/includeos/acorn/), the innovative web server appliance we [demoed at CppCon](https://www.youtube.com/watch?v=t4etEwG2_LY)? Built using [Mana](https://github.com/includeos/mana), the new C++ Web Application Framework for IncludeOS. Both [Acorn](https://github.com/includeos/acorn/) and [Mana](https://github.com/includeos/mana) are free and open source, check them out right here on GitHub!
5+
46
IncludeOS is an includable, minimal [unikernel](https://en.wikipedia.org/wiki/Unikernel) operating system for C++ services running in the cloud. Starting a program with `#include <os>` will literally include a tiny operating system into your service during link-time.
57

68
The build system will:
@@ -42,10 +44,12 @@ A longer list of features and limitations is on the [wiki feature list](https://
4244

4345
### Install libraries
4446

47+
**NOTE:** The script will install packages and create a network bridge, and thus will ask for sudo access.
48+
4549
```
4650
$ git clone https://github.com/hioa-cs/IncludeOS
4751
$ cd IncludeOS
48-
$ sudo ./install.sh
52+
$ ./install.sh
4953
```
5054

5155
**The script will:**
@@ -57,8 +61,6 @@ A longer list of features and limitations is on the [wiki feature list](https://
5761
* Build the vmbuilder, which turns your service into a bootable image.
5862
* Copy `vmbuild` and `qemu-ifup` from the repo, over to `$INCLUDEOS_HOME`.
5963

60-
**NOTE:** The script will install packages, and thus will require sudo access.
61-
6264
Detailed installation instructions for [Vagrant](https://github.com/hioa-cs/IncludeOS/wiki/Vagrant), [OS X](https://github.com/hioa-cs/IncludeOS/wiki/OS-X) and [Ubuntu](https://github.com/hioa-cs/IncludeOS/wiki/Ubuntu) are available in the Wiki, as well as instructions for [building everything from source](https://github.com/hioa-cs/IncludeOS/wiki/Ubuntu#b-completely-build-everything-from-source-slow).
6365

6466
### Testing the installation

api/common

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,11 @@
3838
#warning "This project is targeted at the i386 architecture"
3939
#endif
4040

41-
/* Unused parameters */
42-
#ifdef __GNUC__
43-
# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
44-
#else
45-
# define UNUSED(x) UNUSED_ ## x
46-
#endif
47-
4841
/* BOCHS Break point */
4942
#define BREAK __asm__ volatile("xchg %bx,%bx");
5043

5144
/* debugging macros */
5245
#include "debug"
53-
#include "warn"
5446
#include "info"
5547

5648
#define LIKELY(x) __builtin_expect(!!(x), 1)

api/debug_new

Lines changed: 0 additions & 122 deletions
This file was deleted.

api/debug_shared

Lines changed: 0 additions & 61 deletions
This file was deleted.

api/fs/fat.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,12 @@ namespace fs
178178
// initialize filesystem by providing base sector
179179
void init(const void* base_sector);
180180
// return a list of entries from directory entries at @sector
181-
typedef std::function<void(error_t, dirvec_t)> on_internal_ls_func;
181+
typedef delegate<void(error_t, dirvec_t)> on_internal_ls_func;
182182
void int_ls(uint32_t sector, dirvec_t, on_internal_ls_func);
183183
bool int_dirent(uint32_t sector, const void* data, dirvector&);
184184

185185
// tree traversal
186-
typedef std::function<void(error_t, dirvec_t)> cluster_func;
186+
typedef delegate<void(error_t, dirvec_t)> cluster_func;
187187
// async tree traversal
188188
void traverse(std::shared_ptr<Path> path, cluster_func callback);
189189
// sync version
@@ -213,7 +213,7 @@ namespace fs
213213
uint32_t root_cluster; // index of root cluster
214214
uint32_t data_index; // index of first data sector (relative to partition)
215215
uint32_t data_sectors; // number of data sectors
216-
216+
217217
// simplistic cache for stat results
218218
std::map<std::string, FileSystem::Dirent> stat_cache;
219219
};

api/fs/filesystem.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include <string>
2525
#include <vector>
2626
#include <cstdint>
27-
#include <functional>
27+
#include <delegate>
2828

2929
#ifndef likely
3030
#define likely(x) __builtin_expect(!!(x), 1)
@@ -43,10 +43,10 @@ namespace fs {
4343
using dirvec_t = std::shared_ptr<dirvector>;
4444
using buffer_t = std::shared_ptr<uint8_t>;
4545

46-
using on_mount_func = std::function<void(error_t)>;
47-
using on_ls_func = std::function<void(error_t, dirvec_t)>;
48-
using on_read_func = std::function<void(error_t, buffer_t, uint64_t)>;
49-
using on_stat_func = std::function<void(error_t, const Dirent&)>;
46+
using on_mount_func = delegate<void(error_t)>;
47+
using on_ls_func = delegate<void(error_t, dirvec_t)>;
48+
using on_read_func = delegate<void(error_t, buffer_t, uint64_t)>;
49+
using on_stat_func = delegate<void(error_t, const Dirent&)>;
5050

5151
enum Enttype {
5252
FILE,

api/hw/mac_addr.hpp

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
// This file is a part of the IncludeOS unikernel - www.includeos.org
2+
//
3+
// Copyright 2015-2016 Oslo and Akershus University College of Applied Sciences
4+
// and Alfred Bratterud
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
#pragma once
18+
19+
#ifndef HW_MAC_ADDR_HPP
20+
#define HW_MAC_ADDR_HPP
21+
22+
namespace hw {
23+
// MAC address
24+
union MAC_addr {
25+
// no. parts in a MAC address
26+
static constexpr size_t PARTS_LEN = 6;
27+
// The parts of the MAC address
28+
uint8_t part[PARTS_LEN];
29+
30+
struct {
31+
uint16_t minor;
32+
uint32_t major;
33+
} __attribute__((packed));
34+
35+
MAC_addr() noexcept : part{} {}
36+
37+
MAC_addr(const uint8_t a, const uint8_t b, const uint8_t c,
38+
const uint8_t d, const uint8_t e, const uint8_t f) noexcept
39+
: part{a,b,c,d,e,f}
40+
{}
41+
42+
MAC_addr& operator=(const MAC_addr cpy) noexcept {
43+
minor = cpy.minor;
44+
major = cpy.major;
45+
return *this;
46+
}
47+
48+
/**
49+
* @brief Hex representation of a MAC address
50+
*
51+
* @return hex string representation
52+
*/
53+
std::string hex_str() const {
54+
char hex_addr[18];
55+
snprintf(hex_addr, sizeof(hex_addr), "%02x:%02x:%02x:%02x:%02x:%02x",
56+
part[0], part[1], part[2],
57+
part[3], part[4], part[5]);
58+
return hex_addr;
59+
}
60+
61+
/**
62+
* @brief String representation of a MAC address
63+
* @note default is hex
64+
* @return string representation of the MAC address
65+
*/
66+
std::string str() const
67+
{ return hex_str(); }
68+
69+
std::string to_string() const
70+
{ return str(); }
71+
72+
operator std::string () const
73+
{ return str(); }
74+
75+
/** Check for equality */
76+
bool operator==(const MAC_addr mac) const noexcept
77+
{
78+
return strncmp(
79+
reinterpret_cast<const char*>(part),
80+
reinterpret_cast<const char*>(mac.part),
81+
PARTS_LEN) == 0;
82+
}
83+
84+
} __attribute__((packed)); //< union addr
85+
}
86+
87+
#endif

0 commit comments

Comments
 (0)