Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
51eed733
Commit
51eed733
authored
Jul 16, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
cfb6df9a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
6 deletions
+33
-6
wcfs/__init__.py
wcfs/__init__.py
+33
-6
No files found.
wcfs/__init__.py
View file @
51eed733
...
@@ -89,7 +89,14 @@ class Conn(object):
...
@@ -89,7 +89,14 @@ class Conn(object):
# ._filemu threading.Lock
# ._filemu threading.Lock
# ._filetab {} foid -> _File
# ._filetab {} foid -> _File
def
__init__
(
wconn
):
def
__init__
(
wconn
,
wc
,
at
):
# XXX support !isolated mode
wconn
.
_wc
=
wc
wconn
.
at
=
at
wconn
.
_wlink
=
WatchLink
(
wc
)
wconn
.
_filemu
=
threading
.
Lock
()
wconn
.
_filetab
=
{}
# XXX wg.go(wconn._pinner, xxxctx)
# XXX wg.go(wconn._pinner, xxxctx)
# _File represent isolated file view under Conn.
# _File represent isolated file view under Conn.
...
@@ -112,6 +119,11 @@ class _Mapping(object):
...
@@ -112,6 +119,11 @@ class _Mapping(object):
# XXX property .blk_stop = blk_start + len(mem) // blksize & assert len(mem) % blksize == 0
# XXX property .blk_stop = blk_start + len(mem) // blksize & assert len(mem) % blksize == 0
# connect creates new Conn viewing WCFS state as of @at.
@
func
(
WCFS
)
def
connect
(
wc
,
at
):
# -> Conn
return
Conn
(
wc
,
at
)
# _pinner receives pin messages from wcfs and adjusts wconn mappings.
# _pinner receives pin messages from wcfs and adjusts wconn mappings.
@
func
(
Conn
)
@
func
(
Conn
)
def
_pinner
(
wconn
,
ctx
):
def
_pinner
(
wconn
,
ctx
):
...
@@ -134,7 +146,7 @@ def _pinner(wconn, ctx):
...
@@ -134,7 +146,7 @@ def _pinner(wconn, ctx):
continue
continue
# FIXME check if virtmem did not mapped RW page into this block already
# FIXME check if virtmem did not mapped RW page into this block already
mmap
.
pin
(
req
.
blk
,
req
.
at
)
mmap
.
mmapblk
(
req
.
blk
,
req
.
at
)
# update f.pinned
# update f.pinned
if
req
.
at
is
None
:
if
req
.
at
is
None
:
...
@@ -179,14 +191,30 @@ def mmap(wconn, foid, offset, size): # -> Mapping XXX offset, size -> blko
...
@@ -179,14 +191,30 @@ def mmap(wconn, foid, offset, size): # -> Mapping XXX offset, size -> blko
for
blk
,
rev
in
f
.
pin
.
items
():
# XXX keep f.pin ↑blk and use binary search?
for
blk
,
rev
in
f
.
pin
.
items
():
# XXX keep f.pin ↑blk and use binary search?
if
not
(
blk_start
<=
blk
&&
blk
<
blk_stop
):
if
not
(
blk_start
<=
blk
&&
blk
<
blk_stop
):
continue
# blk out of this mapping
continue
# blk out of this mapping
mmap
.
pin
(
blk
,
rev
)
mmap
.
mmapblk
(
blk
,
rev
)
f
.
mmaps
.
append
(
mmap
)
# XXX keep f.mmaps ↑blk_start
f
.
mmaps
.
append
(
mmap
)
# XXX keep f.mmaps ↑blk_start
return
mmap
return
mmap
# remmap_blk remmapfs file[blk] in its place again.
# virtmem calls this to remmap a block after RW dirty page was e.g. discarded.
@
func
(
_Mapping
)
def
remmap_blk
(
mmap
,
blk
):
# XXX locking
assert
(
mmap
.
blk_start
<=
blk
<
mmap
.
blk_stop
)
blkrev
=
mmap
.
pinned
.
get
(
blk
,
None
)
# rev | @head
mmap
.
mmapblk
(
blk
,
blkrev
)
# unmap is removes mapping memory from address space.
# virtmem calls this when VMA is unmapped.
@
func
(
_Mapping
):
def
unmap
(
mmap
):
# XXX locking
mm
.
unmap
(
mmap
.
mem
)
mmap
.
mem
=
None
# XXX Watch
# WatchLink represents /head/watch link opened on wcfs.
# WatchLink represents /head/watch link opened on wcfs.
#
#
...
@@ -232,7 +260,6 @@ class WatchLink(object):
...
@@ -232,7 +260,6 @@ class WatchLink(object):
# XXX back -> tWatchLink ?
# XXX back -> tWatchLink ?
wlink
.
_watching
=
{}
# {} foid -> tWatch
wlink
.
_watching
=
{}
# {} foid -> tWatch
# ---- WatchLink message IO ----
def
_closeTX
(
wlink
):
def
_closeTX
(
wlink
):
if
wlink
.
_txclosed
:
if
wlink
.
_txclosed
:
...
...
Write
Preview
Markdown
is supported
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