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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
wendelin.core
Commits
5ba6d8c3
Commit
5ba6d8c3
authored
Oct 09, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
aba9907d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
1 deletion
+42
-1
wcfs/wcfs.go
wcfs/wcfs.go
+15
-1
wcfs/zblk.go
wcfs/zblk.go
+27
-0
No files found.
wcfs/wcfs.go
View file @
5ba6d8c3
...
@@ -469,9 +469,23 @@ func (bfroot *BigFileRoot) Mkdir(name string, mode uint32, fctx *fuse.Context) (
...
@@ -469,9 +469,23 @@ func (bfroot *BigFileRoot) Mkdir(name string, mode uint32, fctx *fuse.Context) (
func
(
bfdata
*
BigFileData
)
GetAttr
(
out
*
fuse
.
Attr
,
_
nodefs
.
File
,
fctx
*
fuse
.
Context
)
fuse
.
Status
{
func
(
bfdata
*
BigFileData
)
GetAttr
(
out
*
fuse
.
Attr
,
_
nodefs
.
File
,
fctx
*
fuse
.
Context
)
fuse
.
Status
{
// XXX locking
// XXX locking
bf
:=
bfdata
.
bigfile
zbf
:=
bfdata
.
bigfile
.
zbf
// XXX better ctx = transaction.PutIntoContext(ctx, txn)
ctx
,
cancel
:=
xcontext
.
Merge
(
asctx
(
fctx
),
bf
.
txnCtx
)
defer
cancel
()
size
,
err
:=
zbf
.
Size
(
ctx
)
if
err
!=
nil
{
log
.
Errorf
(
"%s"
,
err
)
// XXX errctx
return
fuse
.
EIO
// XXX extract EFBIG when it is the cause?
}
out
.
Mode
=
fuse
.
S_IFREG
|
0444
out
.
Mode
=
fuse
.
S_IFREG
|
0444
out
.
Size
=
111
// FIXME -> zbf.Size() (= zbf.blktab.MaxKey() * zbf.blk
size)
out
.
Size
=
uint64
(
size
)
// .Blocks
// .Blocks
// .Blksize
// FIXME lastChange should cover all bigfile data, not only ZBigFile itself
// FIXME lastChange should cover all bigfile data, not only ZBigFile itself
//mtime := &bfdata.lastChange.Time().Time
//mtime := &bfdata.lastChange.Time().Time
...
...
wcfs/zblk.go
View file @
5ba6d8c3
...
@@ -42,6 +42,7 @@ import (
...
@@ -42,6 +42,7 @@ import (
"reflect"
"reflect"
"sort"
"sort"
"sync"
"sync"
"syscall"
"golang.org/x/sync/errgroup"
"golang.org/x/sync/errgroup"
...
@@ -402,6 +403,32 @@ func (bf *ZBigFile) LoadBlk(ctx context.Context, blk int64) (_ []byte, err error
...
@@ -402,6 +403,32 @@ func (bf *ZBigFile) LoadBlk(ctx context.Context, blk int64) (_ []byte, err error
return
blkdata
,
nil
return
blkdata
,
nil
}
}
// Size returns whole file size.
func
(
bf
*
ZBigFile
)
Size
(
ctx
context
.
Context
)
(
_
int64
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"bigfile %s: size"
,
bf
.
POid
())
err
=
bf
.
PActivate
(
ctx
)
if
err
!=
nil
{
return
0
,
err
}
defer
bf
.
PDeactivate
()
tailblk
,
ok
,
err
:=
bf
.
blktab
.
MaxKey
(
ctx
)
if
err
!=
nil
{
return
0
,
err
}
if
!
ok
{
return
0
,
nil
}
size
:=
(
tailblk
+
1
)
*
bf
.
blksize
if
size
/
bf
.
blksize
!=
tailblk
+
1
{
return
0
,
syscall
.
EFBIG
// overflow
}
return
size
,
nil
}
// ----------------------------------------
// ----------------------------------------
...
...
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