|
33 | 33 | import os |
34 | 34 | import stat |
35 | 35 |
|
36 | | -from fuse import ( |
| 36 | +from refuse.high import ( |
37 | 37 | FUSE, |
38 | 38 | fuse_get_context, |
39 | 39 | FuseOSError, |
40 | | - Operations, |
41 | | - UTIME_NOW, |
42 | | - UTIME_OMIT, |
| 40 | + Operations |
43 | 41 | ) |
44 | | -try: |
45 | | - from fuse import __features__ as fuse_features |
46 | | -except ImportError: |
47 | | - fuse_features = {} |
48 | 42 |
|
49 | 43 | from .defaults import ( |
50 | 44 | FUSE_ALLOWOTHER_DEFAULT, |
@@ -109,13 +103,7 @@ class _loggedfs(Operations): |
109 | 103 |
|
110 | 104 |
|
111 | 105 | flag_utime_omit_ok = 1 |
112 | | - |
113 | | - |
114 | | - requested_features = { |
115 | | - 'nanosecond_int': True, |
116 | | - 'utime_omit_none': True, |
117 | | - 'utime_now_auto': True |
118 | | - } |
| 106 | + use_ns = True |
119 | 107 |
|
120 | 108 |
|
121 | 109 | _ST_FIELDS = tuple(i for i in dir(os.stat_result) if i.startswith('st_')) |
@@ -210,13 +198,6 @@ def __init__(self, |
210 | 198 | 'LoggedFS-python using configuration file %s' % log_configfile |
211 | 199 | )) |
212 | 200 |
|
213 | | - for flag_name in self.requested_features.keys(): |
214 | | - setattr( |
215 | | - self, |
216 | | - 'flag_' + flag_name, |
217 | | - self.requested_features[flag_name] and fuse_features.get(flag_name, False) |
218 | | - ) |
219 | | - |
220 | 201 | if len(kwargs) > 0: |
221 | 202 | raise ValueError('unknown keyword argument(s)') |
222 | 203 |
|
@@ -317,10 +298,7 @@ def getattr(self, path, fip): |
317 | 298 | ret_dict = {key: getattr(st, key) for key in self._ST_FIELDS} |
318 | 299 |
|
319 | 300 | for key in ['st_atime', 'st_ctime', 'st_mtime']: |
320 | | - if self.flag_nanosecond_int: |
321 | | - ret_dict[key] = ret_dict.pop(key + '_ns') |
322 | | - else: |
323 | | - ret_dict.pop(key + '_ns') |
| 301 | + ret_dict[key] = ret_dict.pop(key + '_ns') |
324 | 302 |
|
325 | 303 | return ret_dict |
326 | 304 |
|
@@ -488,26 +466,17 @@ def unlink(self, path): |
488 | 466 | def utimens(self, path, times = None): |
489 | 467 |
|
490 | 468 | def _fix_time_(atime, mtime): |
491 | | - if any(val in (atime, mtime) for val in [UTIME_OMIT, None]): |
| 469 | + if None in (atime, mtime): |
492 | 470 | st = os.lstat(relpath, dir_fd = self._root_path_fd) |
493 | | - if atime in [UTIME_OMIT, None]: |
| 471 | + if atime is None: |
494 | 472 | atime = st.st_atime_ns |
495 | | - if mtime in [UTIME_OMIT, None]: |
| 473 | + if mtime is None: |
496 | 474 | mtime = st.st_mtime_ns |
497 | | - if UTIME_NOW in (atime, mtime): |
498 | | - now = time.time_ns() |
499 | | - if atime == UTIME_NOW: |
500 | | - atime = now |
501 | | - if mtime == UTIME_NOW: |
502 | | - mtime = now |
503 | 475 | return (atime, mtime) |
504 | 476 |
|
505 | 477 | relpath = self._rel_path(path) |
506 | 478 |
|
507 | | - if self.flag_nanosecond_int: |
508 | | - os.utime(relpath, ns = _fix_time_(*times), dir_fd = self._root_path_fd, follow_symlinks = False) |
509 | | - else: |
510 | | - os.utime(relpath, times = times, dir_fd = self._root_path_fd, follow_symlinks = False) |
| 479 | + os.utime(relpath, ns = _fix_time_(*times), dir_fd = self._root_path_fd, follow_symlinks = False) |
511 | 480 |
|
512 | 481 |
|
513 | 482 | @event(format_pattern = '{param_buf_len} bytes to {param_path} at offset {param_offset} (fh={param_fip})') |
|
0 commit comments