Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-fuse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Antoine Lambert
swh-fuse
Commits
0dd35220
Commit
0dd35220
authored
4 years ago
by
Thibault Allançon
Browse files
Options
Downloads
Patches
Plain Diff
fuse: remove unnecessary inode2path
parent
c1bfbcec
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
swh/fuse/fuse.py
+1
-16
1 addition, 16 deletions
swh/fuse/fuse.py
with
1 addition
and
16 deletions
swh/fuse/fuse.py
+
1
−
16
View file @
0dd35220
...
...
@@ -36,8 +36,6 @@ class Fuse(pyfuse3.Operations):
self
.
root
=
Root
(
fuse
=
self
)
self
.
_inode2path
:
Dict
[
int
,
Path
]
=
{
self
.
root
.
inode
:
root_path
}
self
.
time_ns
:
int
=
time
.
time_ns
()
# start time, used as timestamp
self
.
gid
=
os
.
getgid
()
self
.
uid
=
os
.
getuid
()
...
...
@@ -70,14 +68,6 @@ class Fuse(pyfuse3.Operations):
except
KeyError
:
raise
pyfuse3
.
FUSEError
(
errno
.
ENOENT
)
def
inode2path
(
self
,
inode
:
int
)
->
Path
:
"""
Return the path matching a given inode
"""
try
:
return
self
.
_inode2path
[
inode
]
except
KeyError
:
raise
pyfuse3
.
FUSEError
(
errno
.
ENOENT
)
async
def
get_metadata
(
self
,
swhid
:
SWHID
)
->
Any
:
"""
Retrieve metadata for a given SWHID using Software Heritage API
"""
...
...
@@ -149,10 +139,8 @@ class Fuse(pyfuse3.Operations):
# opendir() uses inode as directory handle
inode
=
fh
direntry
=
self
.
inode2entry
(
inode
)
path
=
self
.
inode2path
(
inode
)
# TODO: add cache on direntry list?
direntry
=
self
.
inode2entry
(
inode
)
next_id
=
offset
+
1
i
=
0
async
for
entry
in
direntry
:
...
...
@@ -167,7 +155,6 @@ class Fuse(pyfuse3.Operations):
next_id
+=
1
self
.
_inode2entry
[
attrs
.
st_ino
]
=
entry
self
.
_inode2path
[
attrs
.
st_ino
]
=
Path
(
path
,
entry
.
name
)
async
def
open
(
self
,
inode
:
int
,
_flags
:
int
,
_ctx
:
pyfuse3
.
RequestContext
...
...
@@ -193,13 +180,11 @@ class Fuse(pyfuse3.Operations):
"""
Look up a directory entry by name and get its attributes
"""
name
=
os
.
fsdecode
(
name
)
path
=
Path
(
self
.
inode2path
(
parent_inode
),
name
)
parent_entry
=
self
.
inode2entry
(
parent_inode
)
async
for
entry
in
parent_entry
:
if
name
==
entry
.
name
:
attr
=
await
self
.
get_attrs
(
entry
)
self
.
_inode2path
[
attr
.
st_ino
]
=
path
return
attr
logging
.
error
(
f
"
Unknown name during lookup:
'
{
name
}
'"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment