Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ pycscope.*
build
dist
doc/_build
.idea/
publish.sh
test/
2 changes: 1 addition & 1 deletion gluster/gfapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# later), or the GNU General Public License, version 2 (GPLv2), in all
# cases as published by the Free Software Foundation.

__version__ = '1.2'
__version__ = '1.4'

from .gfapi import File, Dir, DirEntry, Volume
__all__ = ['File', 'Dir', 'DirEntry', 'Volume']
92 changes: 66 additions & 26 deletions gluster/gfapi/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# later), or the GNU General Public License, version 2 (GPLv2), in all
# cases as published by the Free Software Foundation.

import sys
import ctypes
from ctypes.util import find_library
from ctypes import sizeof
Expand Down Expand Up @@ -67,24 +68,54 @@


class Stat (ctypes.Structure):
_fields_ = [
("st_dev", ctypes.c_ulong),
("st_ino", ctypes.c_ulong),
("st_nlink", ctypes.c_ulong),
("st_mode", ctypes.c_uint),
("st_uid", ctypes.c_uint),
("st_gid", ctypes.c_uint),
("st_rdev", ctypes.c_ulong),
("st_size", ctypes.c_ulong),
("st_blksize", ctypes.c_ulong),
("st_blocks", ctypes.c_ulong),
("st_atime", ctypes.c_ulong),
("st_atimensec", ctypes.c_ulong),
("st_mtime", ctypes.c_ulong),
("st_mtimensec", ctypes.c_ulong),
("st_ctime", ctypes.c_ulong),
("st_ctimensec", ctypes.c_ulong),
]
if sys.platform == 'darwin':
_fields_ = [
("st_dev", ctypes.c_int32),
("st_mode", ctypes.c_uint16),
("st_ino", ctypes.c_uint32),
("st_nlink", ctypes.c_uint16),
("st_uid", ctypes.c_uint),
("st_gid", ctypes.c_uint),
("st_rdev", ctypes.c_uint32),

("st_atime", ctypes.c_long),
("st_atimensec", ctypes.c_long),
("st_mtime", ctypes.c_long),
("st_mtimensec", ctypes.c_long),
("st_ctime", ctypes.c_long),
("st_ctimensec", ctypes.c_long),
("st_birthtime", ctypes.c_long),
("st_birthtimespec", ctypes.c_long),

("st_size", ctypes.c_int64),
("st_blocks", ctypes.c_int64),
("st_blksize", ctypes.c_int32),

("st_flags", ctypes.c_uint32),
("st_gen", ctypes.c_uint32),
("st_lspare", ctypes.c_int32),
("st_qspare1", ctypes.c_int64),
("st_qspare2", ctypes.c_int64),
]
else:
_fields_ = [
("st_dev", ctypes.c_ulong),
("st_ino", ctypes.c_ulong),
("st_nlink", ctypes.c_ulong),
("st_mode", ctypes.c_uint),
("st_uid", ctypes.c_uint),
("st_gid", ctypes.c_uint),
("st_rdev", ctypes.c_ulong),
("st_size", ctypes.c_ulong),
("st_blksize", ctypes.c_ulong),
("st_blocks", ctypes.c_ulong),
("st_atime", ctypes.c_ulong),
("st_atimensec", ctypes.c_ulong),
("st_mtime", ctypes.c_ulong),
("st_mtimensec", ctypes.c_ulong),
("st_ctime", ctypes.c_ulong),
("st_ctimensec", ctypes.c_ulong),
]


class Statvfs (ctypes.Structure):
Expand All @@ -105,14 +136,23 @@ class Statvfs (ctypes.Structure):


class Dirent (ctypes.Structure):
_fields_ = [
("d_ino", ctypes.c_ulong),
("d_off", ctypes.c_ulong),
("d_reclen", ctypes.c_ushort),
("d_type", ctypes.c_char),
("d_name", ctypes.c_char * 256),
]

if sys.platform == 'darwin':
_fields_ = [
("d_ino", ctypes.c_ulong),
("d_off", ctypes.c_ulong),
("d_reclen", ctypes.c_uint16),
("d_namelen", ctypes.c_uint16),
("d_type", ctypes.c_uint8),
("d_name", ctypes.c_char * 256),
]
else:
_fields_ = [
("d_ino", ctypes.c_ulong),
("d_off", ctypes.c_ulong),
("d_reclen", ctypes.c_ushort),
("d_type", ctypes.c_char),
("d_name", ctypes.c_char * 256),
]

class Timespec (ctypes.Structure):
_fields_ = [
Expand Down