summaryrefslogtreecommitdiffstats
path: root/gluster/swift/common/fs_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'gluster/swift/common/fs_utils.py')
-rw-r--r--gluster/swift/common/fs_utils.py42
1 files changed, 40 insertions, 2 deletions
diff --git a/gluster/swift/common/fs_utils.py b/gluster/swift/common/fs_utils.py
index a93fa6b..9f698df 100644
--- a/gluster/swift/common/fs_utils.py
+++ b/gluster/swift/common/fs_utils.py
@@ -19,10 +19,10 @@ import errno
import stat
import random
import time
+import xattr
from collections import defaultdict
from itertools import repeat
import ctypes
-import os.path as _os_path
from eventlet import sleep
from swift.common.utils import load_libc_function
from gluster.swift.common.exceptions import FileOrDirNotFoundError, \
@@ -30,7 +30,41 @@ from gluster.swift.common.exceptions import FileOrDirNotFoundError, \
from swift.common.exceptions import DiskFileNoSpace
-os_path = _os_path
+def do_exists(path):
+ return os.path.exists(path)
+
+
+def do_touch(path):
+ with open(path, 'a'):
+ os.utime(path, None)
+
+
+def do_getctime(path):
+ return os.path.getctime(path)
+
+
+def do_getmtime(path):
+ return os.path.getmtime(path)
+
+
+def do_isdir(path):
+ return os.path.isdir(path)
+
+
+def do_getsize(path):
+ return os.path.getsize(path)
+
+
+def do_getxattr(path, key):
+ return xattr.getxattr(path, key)
+
+
+def do_setxattr(path, key, value):
+ xattr.setxattr(path, key, value)
+
+
+def do_removexattr(path, key):
+ xattr.removexattr(path, key)
def do_walk(*args, **kwargs):
@@ -212,6 +246,10 @@ def do_open(path, flags, **kwargs):
return fd
+def do_dup(fd):
+ return os.dup(fd)
+
+
def do_close(fd):
try:
os.close(fd)