diff options
author | Angelos Evripiotis <jevripiotis@bloomberg.net> | 2019-06-11 14:10:39 +0100 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-06-18 09:45:00 +0000 |
commit | 8af4e3a8830d29456f2cd24b0e779ebe592a0b60 (patch) | |
tree | 6d49a643e1426eb1b9cf5285c37e633541e9446c | |
parent | 415fcbd52e1387692660155f53881d0268b8c3dc (diff) | |
download | buildstream-8af4e3a8830d29456f2cd24b0e779ebe592a0b60.tar.gz |
_fuse/fuse: make create() match SafeHardlinkOps
Make the base-class fuse.Operations class match the subclass
SafeHardlinkOps.
Remove the complication of worrying about raw_fi mode - we already
rely on it being inactive.
Remove ambiguity from FUSE.create() - we only support the non-raw_fi
case. In separate work, we may want to remove raw_fi completely.
Update Operations.create() to use a 'flags' param explicitly, rather
than the more confusing dual-meaning of the 'fi' param.
-rw-r--r-- | src/buildstream/_fuse/fuse.py | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/src/buildstream/_fuse/fuse.py b/src/buildstream/_fuse/fuse.py index 5c97cc466..41e126ef5 100644 --- a/src/buildstream/_fuse/fuse.py +++ b/src/buildstream/_fuse/fuse.py @@ -453,6 +453,9 @@ class FUSE(object): This gives you access to direct_io, keep_cache, etc. ''' + # Note that in BuildStream we're assuming that raw_fi is always False. + assert not raw_fi, "raw_fi is not supported in BuildStream." + self.operations = operations self.raw_fi = raw_fi self.encoding = encoding @@ -754,15 +757,14 @@ class FUSE(object): fi = fip.contents path = path.decode(self.encoding) - if self.raw_fi: - return self.operations('create', path, mode, fi) - else: - # This line is different from upstream to fix issues - # reading file opened with O_CREAT|O_RDWR. - # See issue #143. - fi.fh = self.operations('create', path, mode, fi.flags) - # END OF MODIFICATION - return 0 + assert not self.raw_fi + + # This line is different from upstream to fix issues + # reading file opened with O_CREAT|O_RDWR. + # See issue #143. + fi.fh = self.operations('create', path, mode, fi.flags) + # END OF MODIFICATION + return 0 def ftruncate(self, path, length, fip): if self.raw_fi: @@ -838,14 +840,7 @@ class Operations(object): def chown(self, path, uid, gid): raise FuseOSError(EROFS) - def create(self, path, mode, fi=None): - ''' - When raw_fi is False (default case), fi is None and create should - return a numerical file handle. - - When raw_fi is True the file handle should be set directly by create - and return 0. - ''' + def create(self, path, mode, flags): raise FuseOSError(EROFS) |