Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
VILLASframework
VILLAScommon
Commits
b232fbf8
Commit
b232fbf8
authored
Mar 26, 2019
by
Steffen Vogel
🎅🏼
Browse files
refactor: use C-style commenting everywhere
parent
ff302030
Changes
11
Show whitespace changes
Inline
Side-by-side
lib/compat.c
View file @
b232fbf8
...
...
@@ -36,7 +36,7 @@ size_t json_dumpb(const json_t *json, char *buffer, size_t size, size_t flags)
if
(
!
str
)
return
0
;
len
=
strlen
(
str
);
/
/
not \0 terminated
len
=
strlen
(
str
);
/
*
not \0 terminated
*/
if
(
buffer
&&
len
<=
size
)
memcpy
(
buffer
,
str
,
len
);
...
...
lib/hist.c
View file @
b232fbf8
...
...
@@ -99,7 +99,7 @@ void hist_put(struct hist *h, double value)
h
->
_m
[
0
]
=
h
->
_m
[
1
]
+
(
value
-
h
->
_m
[
1
])
/
h
->
total
;
h
->
_s
[
0
]
=
h
->
_s
[
1
]
+
(
value
-
h
->
_m
[
1
])
*
(
value
-
h
->
_m
[
0
]);
/
/ s
et up for next iteration
/
* S
et up for next iteration
*/
h
->
_m
[
1
]
=
h
->
_m
[
0
];
h
->
_s
[
1
]
=
h
->
_s
[
0
];
}
...
...
lib/kernel/kernel.c
View file @
b232fbf8
...
...
@@ -134,12 +134,12 @@ int kernel_module_load(const char *module)
pid_t
pid
=
fork
();
switch
(
pid
)
{
case
-
1
:
/
/
error
case
-
1
:
/
*
error
*/
return
-
1
;
case
0
:
/
/
child
case
0
:
/
*
child
*/
execlp
(
"modprobe"
,
"modprobe"
,
module
,
(
char
*
)
0
);
exit
(
EXIT_FAILURE
);
/
/
exec never returns
exit
(
EXIT_FAILURE
);
/
*
exec never returns
*/
default:
wait
(
&
ret
);
...
...
lib/kernel/pci.c
View file @
b232fbf8
...
...
@@ -50,8 +50,7 @@ int pci_init(struct pci *p)
}
while
((
e
=
readdir
(
dp
)))
{
// ignore special entries
/* Ignore special entries */
if
((
strcmp
(
e
->
d_name
,
"."
)
==
0
)
||
(
strcmp
(
e
->
d_name
,
".."
)
==
0
)
)
continue
;
...
...
@@ -244,8 +243,7 @@ int pci_device_compare(const struct pci_device *d, const struct pci_device *f)
if
((
f
->
id
.
class_code
!=
0
)
||
(
f
->
id
.
class_code
!=
d
->
id
.
class_code
))
return
1
;
// found
return
0
;
return
0
;
/* found */
}
struct
pci_device
*
pci_lookup_device
(
struct
pci
*
p
,
struct
pci_device
*
f
)
...
...
@@ -276,7 +274,8 @@ size_t pci_get_regions(const struct pci_device *d, struct pci_region** regions)
size_t
len
=
0
;
int
region
=
0
;
// cap to 8 regions, just because we don't know how many may exist
/* Cap to 8 regions, just because we don't know how many may exist. */
while
(
region
<
8
&&
(
bytesRead
=
getline
(
&
line
,
&
len
,
f
))
!=
-
1
)
{
unsigned
long
long
tokens
[
3
];
char
*
s
=
line
;
...
...
@@ -285,7 +284,7 @@ size_t pci_get_regions(const struct pci_device *d, struct pci_region** regions)
tokens
[
i
]
=
strtoull
(
s
,
&
end
,
16
);
if
(
s
==
end
)
{
printf
(
"Error parsing line %d of %s
\n
"
,
region
+
1
,
sysfs
);
tokens
[
0
]
=
tokens
[
1
]
=
0
;
/
/ m
ark invalid
tokens
[
0
]
=
tokens
[
1
]
=
0
;
/
* M
ark invalid
*/
break
;
}
s
=
end
;
...
...
@@ -293,12 +292,12 @@ size_t pci_get_regions(const struct pci_device *d, struct pci_region** regions)
free
(
line
);
/
/ r
equired for getline() to allocate a new buffer on the next iteration
/
* R
equired for getline() to allocate a new buffer on the next iteration
. */
line
=
NULL
;
len
=
0
;
if
(
tokens
[
0
]
!=
tokens
[
1
])
{
/
/ t
his is a valid region
/
* T
his is a valid region
*/
cur_region
->
num
=
region
;
cur_region
->
start
=
tokens
[
0
];
cur_region
->
end
=
tokens
[
1
];
...
...
lib/kernel/rt.cpp
View file @
b232fbf8
...
...
@@ -129,6 +129,6 @@ bool isPreemptible()
#endif
/* __linux__ */
}
/
/
namespace villas
}
/
/
namespace kernel
}
/
/
namespace rt
}
/
*
namespace villas
*/
}
/
*
namespace kernel
*/
}
/
*
namespace rt
*/
lib/kernel/vfio.c
View file @
b232fbf8
...
...
@@ -22,23 +22,23 @@
#include
<villas/kernel/pci.h>
static
const
char
*
vfio_pci_region_names
[]
=
{
"PCI_BAR0"
,
/
/
VFIO_PCI_BAR0_REGION_INDEX
,
"PCI_BAR1"
,
/
/
VFIO_PCI_BAR1_REGION_INDEX
,
"PCI_BAR2"
,
/
/
VFIO_PCI_BAR2_REGION_INDEX
,
"PCI_BAR3"
,
/
/
VFIO_PCI_BAR3_REGION_INDEX
,
"PCI_BAR4"
,
/
/
VFIO_PCI_BAR4_REGION_INDEX
,
"PCI_BAR5"
,
/
/
VFIO_PCI_BAR5_REGION_INDEX
,
"PCI_ROM"
,
/
/
VFIO_PCI_ROM_REGION_INDEX
,
"PCI_CONFIG"
,
/
/
VFIO_PCI_CONFIG_REGION_INDEX
,
"PCI_VGA"
/
/
VFIO_PCI_INTX_IRQ_INDEX
,
"PCI_BAR0"
,
/
*
VFIO_PCI_BAR0_REGION_INDEX
*/
"PCI_BAR1"
,
/
*
VFIO_PCI_BAR1_REGION_INDEX
*/
"PCI_BAR2"
,
/
*
VFIO_PCI_BAR2_REGION_INDEX
*/
"PCI_BAR3"
,
/
*
VFIO_PCI_BAR3_REGION_INDEX
*/
"PCI_BAR4"
,
/
*
VFIO_PCI_BAR4_REGION_INDEX
*/
"PCI_BAR5"
,
/
*
VFIO_PCI_BAR5_REGION_INDEX
*/
"PCI_ROM"
,
/
*
VFIO_PCI_ROM_REGION_INDEX
*/
"PCI_CONFIG"
,
/
*
VFIO_PCI_CONFIG_REGION_INDEX
*/
"PCI_VGA"
/
*
VFIO_PCI_INTX_IRQ_INDEX
*/
};
static
const
char
*
vfio_pci_irq_names
[]
=
{
"PCI_INTX"
,
/
/
VFIO_PCI_INTX_IRQ_INDEX
,
"PCI_MSI"
,
/
/
VFIO_PCI_MSI_IRQ_INDEX
,
"PCI_MSIX"
,
/
/
VFIO_PCI_MSIX_IRQ_INDEX
,
"PCI_ERR"
,
/
/
VFIO_PCI_ERR_IRQ_INDEX
,
"PCI_REQ"
/
/
VFIO_PCI_REQ_IRQ_INDEX
,
"PCI_INTX"
,
/
*
VFIO_PCI_INTX_IRQ_INDEX
*/
"PCI_MSI"
,
/
*
VFIO_PCI_MSI_IRQ_INDEX
*/
"PCI_MSIX"
,
/
*
VFIO_PCI_MSIX_IRQ_INDEX
*/
"PCI_ERR"
,
/
*
VFIO_PCI_ERR_IRQ_INDEX
*/
"PCI_REQ"
/
*
VFIO_PCI_REQ_IRQ_INDEX
*/
};
/* Helpers */
...
...
lib/kernel/vfio.cpp
View file @
b232fbf8
...
...
@@ -52,23 +52,23 @@
using
namespace
villas
;
static
const
char
*
vfio_pci_region_names
[]
=
{
"PCI_BAR0"
,
/
/
VFIO_PCI_BAR0_REGION_INDEX
,
"PCI_BAR1"
,
/
/
VFIO_PCI_BAR1_REGION_INDEX
,
"PCI_BAR2"
,
/
/
VFIO_PCI_BAR2_REGION_INDEX
,
"PCI_BAR3"
,
/
/
VFIO_PCI_BAR3_REGION_INDEX
,
"PCI_BAR4"
,
/
/
VFIO_PCI_BAR4_REGION_INDEX
,
"PCI_BAR5"
,
/
/
VFIO_PCI_BAR5_REGION_INDEX
,
"PCI_ROM"
,
/
/
VFIO_PCI_ROM_REGION_INDEX
,
"PCI_CONFIG"
,
/
/
VFIO_PCI_CONFIG_REGION_INDEX
,
"PCI_VGA"
/
/
VFIO_PCI_INTX_IRQ_INDEX
,
"PCI_BAR0"
,
/
*
VFIO_PCI_BAR0_REGION_INDEX
*/
"PCI_BAR1"
,
/
*
VFIO_PCI_BAR1_REGION_INDEX
*/
"PCI_BAR2"
,
/
*
VFIO_PCI_BAR2_REGION_INDEX
*/
"PCI_BAR3"
,
/
*
VFIO_PCI_BAR3_REGION_INDEX
*/
"PCI_BAR4"
,
/
*
VFIO_PCI_BAR4_REGION_INDEX
*/
"PCI_BAR5"
,
/
*
VFIO_PCI_BAR5_REGION_INDEX
*/
"PCI_ROM"
,
/
*
VFIO_PCI_ROM_REGION_INDEX
*/
"PCI_CONFIG"
,
/
*
VFIO_PCI_CONFIG_REGION_INDEX
*/
"PCI_VGA"
/
*
VFIO_PCI_INTX_IRQ_INDEX
*/
};
static
const
char
*
vfio_pci_irq_names
[]
=
{
"PCI_INTX"
,
/
/
VFIO_PCI_INTX_IRQ_INDEX
,
"PCI_MSI"
,
/
/
VFIO_PCI_MSI_IRQ_INDEX
,
"PCI_MSIX"
,
/
/
VFIO_PCI_MSIX_IRQ_INDEX
,
"PCI_ERR"
,
/
/
VFIO_PCI_ERR_IRQ_INDEX
,
"PCI_REQ"
/
/
VFIO_PCI_REQ_IRQ_INDEX
,
"PCI_INTX"
,
/
*
VFIO_PCI_INTX_IRQ_INDEX
*/
"PCI_MSI"
,
/
*
VFIO_PCI_MSI_IRQ_INDEX
*/
"PCI_MSIX"
,
/
*
VFIO_PCI_MSIX_IRQ_INDEX
*/
"PCI_ERR"
,
/
*
VFIO_PCI_ERR_IRQ_INDEX
*/
"PCI_REQ"
/
*
VFIO_PCI_REQ_IRQ_INDEX
*/
};
namespace
villas
{
...
...
@@ -243,7 +243,7 @@ VfioContainer::attachDevice(const char* name, int index)
logger
->
debug
(
"Device has {} regions"
,
device
->
info
.
num_regions
);
logger
->
debug
(
"Device has {} IRQs"
,
device
->
info
.
num_irqs
);
/
/ r
eserve slots already so that we can use the []-operator for access
/
* R
eserve slots already so that we can use the []-operator for access
*/
device
->
irqs
.
resize
(
device
->
info
.
num_irqs
);
device
->
regions
.
resize
(
device
->
info
.
num_regions
);
device
->
mappings
.
resize
(
device
->
info
.
num_regions
);
...
...
@@ -383,11 +383,12 @@ VfioContainer::memoryMap(uintptr_t virt, uintptr_t phys, size_t length)
logger
->
debug
(
"DMA map size={:#x}, iova={:#x}, vaddr={:#x}"
,
dmaMap
.
size
,
dmaMap
.
iova
,
dmaMap
.
vaddr
);
/
/ m
apping successful, advance IOVA allocator
/
* M
apping successful, advance IOVA allocator
*/
this
->
iova_next
+=
iovaIncrement
;
// we intentionally don't return the actual mapped length, the users are
// only guaranteed to have their demanded memory mapped correctly
/* We intentionally don't return the actual mapped length, the users are
* only guaranteed to have their demanded memory mapped correctly
*/
return
dmaMap
.
iova
;
}
...
...
@@ -423,14 +424,14 @@ VfioContainer::getOrAttachGroup(int index)
{
Logger
logger
=
logging
.
get
(
"kernel:vfio"
);
/
/ s
earch if group with index already exists
/
* S
earch if group with index already exists
*/
for
(
auto
&
group
:
groups
)
{
if
(
group
->
index
==
index
)
{
return
*
group
;
}
}
/
/ g
roup not yet part of this container, so acquire ownership
/
* G
roup not yet part of this container, so acquire ownership
*/
auto
group
=
VfioGroup
::
attach
(
*
this
,
index
);
if
(
not
group
)
{
logger
->
error
(
"Failed to attach to IOMMU group: {}"
,
index
);
...
...
@@ -439,7 +440,7 @@ VfioContainer::getOrAttachGroup(int index)
logger
->
debug
(
"Attached new group {} to VFIO container"
,
index
);
}
/
/ p
ush to our list
/
* P
ush to our list
*/
groups
.
push_back
(
std
::
move
(
group
));
return
*
groups
.
back
();
...
...
@@ -837,5 +838,5 @@ VfioGroup::attach(VfioContainer& container, int groupIndex)
return
group
;
}
}
/
/
namespace villas
}
/
*
namespace villas
*/
lib/log.cpp
View file @
b232fbf8
...
...
@@ -47,7 +47,7 @@ Log::Log(Level lvl) :
setLevel
(
level
);
setPattern
(
pattern
);
/
/
Default sink
/
*
Default sink
*/
sink
=
std
::
make_shared
<
spdlog
::
sinks
::
stderr_color_sink_mt
>
();
sinks
->
add_sink
(
sink
);
...
...
lib/memory.cpp
View file @
b232fbf8
...
...
@@ -53,7 +53,7 @@ HostRam::HostRamAllocator::allocateBlock(size_t size)
auto
&
mm
=
MemoryManager
::
get
();
/
/ a
ssemble name for this block
/
* A
ssemble name for this block
*/
std
::
stringstream
name
;
name
<<
std
::
showbase
<<
std
::
hex
<<
reinterpret_cast
<
uintptr_t
>
(
addr
);
...
...
@@ -78,7 +78,7 @@ LinearAllocator::LinearAllocator(MemoryManager::AddressSpaceId memoryAddrSpaceId
internalOffset
(
internalOffset
),
allocationCount
(
0
)
{
/
/ m
ake sure to start at aligned offset, reduce size in case we need padding
/
* M
ake sure to start at aligned offset, reduce size in case we need padding
*/
if
(
const
size_t
paddingBytes
=
getAlignmentPadding
(
internalOffset
))
{
assert
(
paddingBytes
<
memorySize
);
...
...
@@ -86,7 +86,7 @@ LinearAllocator::LinearAllocator(MemoryManager::AddressSpaceId memoryAddrSpaceId
memorySize
-=
paddingBytes
;
}
/
/ d
eallocation callback
/
* D
eallocation callback
*/
free
=
[
&
](
MemoryBlock
*
mem
)
{
logger
->
debug
(
"Deallocating memory block at local addr {:#x} (addr space {})"
,
mem
->
getOffset
(),
mem
->
getAddrSpaceId
());
...
...
@@ -97,7 +97,7 @@ LinearAllocator::LinearAllocator(MemoryManager::AddressSpaceId memoryAddrSpaceId
if
(
allocationCount
==
0
)
{
logger
->
debug
(
"All allocations are deallocated now, freeing memory"
);
/
/ a
ll allocations have been deallocated, free all memory
/
* A
ll allocations have been deallocated, free all memory
*/
nextFreeAddress
=
0
;
}
...
...
@@ -126,28 +126,28 @@ LinearAllocator::allocateBlock(size_t size)
throw
std
::
bad_alloc
();
}
/
/ a
ssign address
/
* A
ssign address
*/
const
uintptr_t
localAddr
=
nextFreeAddress
+
internalOffset
;
/
/ r
eserve memory
/
* R
eserve memory
*/
nextFreeAddress
+=
size
;
/
/ m
ake sure it is aligned
/
* M
ake sure it is aligned
*/
if
(
const
size_t
paddingBytes
=
getAlignmentPadding
(
nextFreeAddress
))
{
nextFreeAddress
+=
paddingBytes
;
/
/ i
f next free address is outside this block due to padding, cap it
/
* I
f next free address is outside this block due to padding, cap it
*/
nextFreeAddress
=
std
::
min
(
nextFreeAddress
,
memorySize
);
}
auto
&
mm
=
MemoryManager
::
get
();
/
/ a
ssemble name for this block
/
* A
ssemble name for this block
*/
std
::
stringstream
blockName
;
blockName
<<
std
::
showbase
<<
std
::
hex
<<
localAddr
;
/
/ c
reate address space
/
* C
reate address space
*/
auto
addrSpaceName
=
mm
.
getSlaveAddrSpaceName
(
getName
(),
blockName
.
str
());
auto
addrSpaceId
=
mm
.
getOrCreateAddressSpace
(
addrSpaceName
);
...
...
@@ -157,10 +157,10 @@ LinearAllocator::allocateBlock(size_t size)
std
::
unique_ptr
<
MemoryBlock
,
MemoryBlock
::
deallocator_fn
>
mem
(
new
MemoryBlock
(
localAddr
,
size
,
addrSpaceId
),
this
->
free
);
/
/ m
ount block into the memory graph
/
* M
ount block into the memory graph
*/
insertMemoryBlock
(
*
mem
);
/
/ i
ncrease the allocation count
/
* I
ncrease the allocation count
*/
allocationCount
++
;
return
mem
;
...
...
@@ -233,13 +233,13 @@ HostDmaRam::HostDmaRamAllocator::~HostDmaRamAllocator()
auto
translation
=
mm
.
getTranslationFromProcess
(
getAddrSpaceId
());
baseVirt
=
reinterpret_cast
<
void
*>
(
translation
.
getLocalAddr
(
0
));
}
catch
(
const
std
::
out_of_range
&
)
{
/
/ n
ot mapped, nothing to do
/
* N
ot mapped, nothing to do
*/
return
;
}
logger
->
debug
(
"Unmapping {}"
,
getName
());
/
/ t
ry to unmap it
/
* T
ry to unmap it
*/
if
(
::
munmap
(
baseVirt
,
getSize
())
!=
0
)
{
logger
->
warn
(
"munmap() failed for {:p} of size {:#x}"
,
baseVirt
,
getSize
());
...
...
@@ -301,4 +301,4 @@ HostDmaRam::HostDmaRamAllocator&HostDmaRam::getAllocator(int num)
return
*
allocator
;
}
}
/
/
namespace villas
}
/
*
namespace villas
*/
lib/memory_manager.cpp
View file @
b232fbf8
...
...
@@ -48,14 +48,14 @@ MemoryManager::AddressSpaceId
MemoryManager
::
getOrCreateAddressSpace
(
std
::
string
name
)
{
try
{
/
/ t
ry fast lookup
/
* T
ry fast lookup
*/
return
addrSpaceLookup
.
at
(
name
);
}
catch
(
const
std
::
out_of_range
&
)
{
/
/ d
oes not yet exist, create
/
* D
oes not yet exist, create
*/
std
::
shared_ptr
<
AddressSpace
>
addrSpace
(
new
AddressSpace
);
addrSpace
->
name
=
name
;
/
/ c
ache it for the next access
/
* C
ache it for the next access
*/
addrSpaceLookup
[
name
]
=
memoryGraph
.
addVertex
(
addrSpace
);
return
addrSpaceLookup
[
name
];
...
...
@@ -104,7 +104,7 @@ MemoryManager::findPath(MemoryManager::AddressSpaceId fromAddrSpaceId,
auto
fromAddrSpace
=
memoryGraph
.
getVertex
(
fromAddrSpaceId
);
auto
toAddrSpace
=
memoryGraph
.
getVertex
(
toAddrSpaceId
);
/
/ f
ind a path through the memory graph
/
* F
ind a path through the memory graph
*/
MemoryGraph
::
Path
pathGraph
;
if
(
not
memoryGraph
.
getPath
(
fromAddrSpaceId
,
toAddrSpaceId
,
pathGraph
,
pathCheckFunc
))
{
...
...
@@ -126,7 +126,7 @@ MemoryTranslation
MemoryManager
::
getTranslation
(
MemoryManager
::
AddressSpaceId
fromAddrSpaceId
,
MemoryManager
::
AddressSpaceId
toAddrSpaceId
)
{
/
/ f
ind a path through the memory graph
/
* F
ind a path through the memory graph
*/
MemoryGraph
::
Path
path
;
if
(
not
memoryGraph
.
getPath
(
fromAddrSpaceId
,
toAddrSpaceId
,
path
,
pathCheckFunc
))
{
...
...
@@ -138,10 +138,10 @@ MemoryManager::getTranslation(MemoryManager::AddressSpaceId fromAddrSpaceId,
throw
std
::
out_of_range
(
"no translation found"
);
}
/
/ s
tart with an identity mapping
/
* S
tart with an identity mapping
*/
MemoryTranslation
translation
(
0
,
0
,
SIZE_MAX
);
/
/ i
terate through path and merge all mappings into a single translation
/
* I
terate through path and merge all mappings into a single translation
*/
for
(
auto
&
mappingId
:
path
)
{
auto
mapping
=
memoryGraph
.
getEdge
(
mappingId
);
translation
+=
getTranslationFromMapping
(
*
mapping
);
...
...
@@ -153,11 +153,12 @@ MemoryManager::getTranslation(MemoryManager::AddressSpaceId fromAddrSpaceId,
bool
MemoryManager
::
pathCheck
(
const
MemoryGraph
::
Path
&
path
)
{
/
/ s
tart with an identity mapping
/
* S
tart with an identity mapping
*/
MemoryTranslation
translation
(
0
,
0
,
SIZE_MAX
);
// Try to add all mappings together to a common translation. If this fails
// there is a non-overlapping window
/* Try to add all mappings together to a common translation. If this fails
* there is a non-overlapping window.
*/
for
(
auto
&
mappingId
:
path
)
{
auto
mapping
=
memoryGraph
.
getEdge
(
mappingId
);
try
{
...
...
@@ -191,7 +192,7 @@ MemoryTranslation::operator+=(const MemoryTranslation& other)
{
Logger
logger
=
logging
.
get
(
"MemoryTranslation"
);
/
/ s
et level to debug to enable debug output
/
* S
et level to debug to enable debug output
*/
logger
->
set_level
(
spdlog
::
level
::
info
);
const
uintptr_t
this_dst_high
=
this
->
dst
+
this
->
size
;
...
...
@@ -206,7 +207,7 @@ MemoryTranslation::operator+=(const MemoryTranslation& other)
logger
->
debug
(
"this_dst_high: {:#x}"
,
this_dst_high
);
logger
->
debug
(
"other_src_high: {:#x}"
,
other_src_high
);
/
/ m
ake sure there is a common memory area
/
* M
ake sure there is a common memory area
*/
assertExcept
(
other
.
src
<
this_dst_high
,
MemoryManager
::
InvalidTranslation
());
assertExcept
(
this
->
dst
<
other_src_high
,
MemoryManager
::
InvalidTranslation
());
...
...
@@ -227,23 +228,25 @@ MemoryTranslation::operator+=(const MemoryTranslation& other)
logger
->
debug
(
"diff_hi: {:#x}"
,
diff_hi
);
logger
->
debug
(
"diff_lo: {:#x}"
,
diff_lo
);
/
/ n
ew size of aperture, can only stay or shrink
/
* N
ew size of aperture, can only stay or shrink
*/
this
->
size
=
(
hi
-
lo
)
-
diff_hi
-
diff_lo
;
/
/ n
ew translation will come out other's destination (by default)
/
* N
ew translation will come out other's destination (by default)
*/
this
->
dst
=
other
.
dst
;
/
/ t
he source stays the same and can only increase with merged translations
/
* T
he source stays the same and can only increase with merged translations
*/
//this->src = this->src;
if
(
otherSrcIsSmaller
)
{
// other mapping starts at lower addresses, so we actually arrive at
// higher addresses
/* Other mapping starts at lower addresses, so we actually arrive at
* higher addresses
*/
this
->
dst
+=
diff_lo
;
}
else
{
// other mapping starts at higher addresses than this, so we have to
// increase the start
// NOTE: for addresses equality, this just adds 0
/* Other mapping starts at higher addresses than this, so we have to
* increase the start
* NOTE: for addresses equality, this just adds 0
*/
this
->
src
+=
diff_lo
;
}
...
...
@@ -254,4 +257,4 @@ MemoryTranslation::operator+=(const MemoryTranslation& other)
return
*
this
;
}
}
/
/
namespace villas
}
/
*
namespace villas
*/
lib/utils.cpp
View file @
b232fbf8
...
...
@@ -49,11 +49,11 @@ tokenize(std::string s, std::string delimiter)
const
size_t
tokenLength
=
curentPos
-
lastPos
;
tokens
.
push_back
(
s
.
substr
(
lastPos
,
tokenLength
));
/
/ a
dvance in string
/
* A
dvance in string
*/
lastPos
=
curentPos
+
delimiter
.
length
();
}
/
/ c
heck if there's a last token behind the last delimiter
/
* C
heck if there's a last token behind the last delimiter
. */
if
(
lastPos
!=
s
.
length
())
{
const
size_t
lastTokenLength
=
s
.
length
()
-
lastPos
;
tokens
.
push_back
(
s
.
substr
(
lastPos
,
lastTokenLength
));
...
...
@@ -171,5 +171,5 @@ void killme(int sig)
}
}
/
/
namespace utils
}
/
/
namespace villas
}
/
*
namespace utils
*/
}
/
*
namespace villas
*/
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment