Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pyfs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pyfs
Commits
2cf1bee5
Commit
2cf1bee5
authored
Jan 12, 2012
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fs.expose.fuse: compatability with 64bit inodes on OSX.
This fixes issue 98; thanks dmarkey and anatol.pomozov.
parent
315ea957
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
9 deletions
+59
-9
fs/expose/fuse/__init__.py
+13
-2
fs/expose/fuse/fuse_ctypes.py
+46
-7
No files found.
fs/expose/fuse/__init__.py
View file @
2cf1bee5
...
@@ -478,10 +478,21 @@ def unmount(path):
...
@@ -478,10 +478,21 @@ def unmount(path):
This function shells out to the 'fusermount' program to unmount a
This function shells out to the 'fusermount' program to unmount a
FUSE filesystem. It works, but it would probably be better to use the
FUSE filesystem. It works, but it would probably be better to use the
'unmount' method on the MountProcess class if you have it.
'unmount' method on the MountProcess class if you have it.
On darwin, "diskutil umount <path>" is called
On freebsd, "umount <path>" is called
"""
"""
if
sys
.
platform
==
"darwin"
:
args
=
[
"diskutil"
,
"umount"
,
path
]
elif
"freebsd"
in
sys
.
platform
:
args
=
[
"umount"
,
path
]
else
:
args
=
[
"fusermount"
,
"-u"
,
path
]
for
num_tries
in
xrange
(
3
):
for
num_tries
in
xrange
(
3
):
p
=
subprocess
.
Popen
([
"fusermount"
,
"-u"
,
path
],
stderr
=
subprocess
.
PIPE
)
p
=
subprocess
.
Popen
(
args
,
stderr
=
subprocess
.
PIPE
,
(
stdout
,
stderr
)
=
p
.
communicate
()
stdout
=
subprocess
.
PIPE
)
(
stdout
,
stderr
)
=
p
.
communicate
()
if
p
.
returncode
==
0
:
if
p
.
returncode
==
0
:
return
return
if
"not mounted"
in
stderr
:
if
"not mounted"
in
stderr
:
...
...
fs/expose/fuse/fuse_ctypes.py
View file @
2cf1bee5
...
@@ -22,6 +22,27 @@ from platform import machine, system
...
@@ -22,6 +22,27 @@ from platform import machine, system
from
stat
import
S_IFDIR
from
stat
import
S_IFDIR
from
traceback
import
print_exc
from
traceback
import
print_exc
_system
=
system
()
_machine
=
machine
()
# Locate the fuse shared library.
# On OSX this can be provided by a number of different packages
# with slightly incompatible interfaces.
if
_system
==
'Darwin'
:
_libfuse_path
=
find_library
(
'fuse4x'
)
or
find_library
(
'fuse'
)
else
:
_libfuse_path
=
find_library
(
'fuse'
)
if
not
_libfuse_path
:
raise
EnvironmentError
(
'Unable to find libfuse'
)
if
_system
==
'Darwin'
:
_libiconv
=
CDLL
(
find_library
(
'iconv'
),
RTLD_GLOBAL
)
# libfuse dependency
_libfuse
=
CDLL
(
_libfuse_path
)
# Check whether OSX is using the legacy "macfuse" system.
# This has a different struct layout than the newer fuse4x system.
if
_system
==
'Darwin'
and
hasattr
(
_libfuse
,
'macfuse_version'
):
_system
=
'Darwin-MacFuse'
class
c_timespec
(
Structure
):
class
c_timespec
(
Structure
):
_fields_
=
[(
'tv_sec'
,
c_long
),
(
'tv_nsec'
,
c_long
)]
_fields_
=
[(
'tv_sec'
,
c_long
),
(
'tv_nsec'
,
c_long
)]
...
@@ -32,9 +53,7 @@ class c_utimbuf(Structure):
...
@@ -32,9 +53,7 @@ class c_utimbuf(Structure):
class
c_stat
(
Structure
):
class
c_stat
(
Structure
):
pass
# Platform dependent
pass
# Platform dependent
_system
=
system
()
if
_system
in
(
'Darwin'
,
'Darwin-MacFuse'
,
'FreeBSD'
):
if
_system
in
(
'Darwin'
,
'FreeBSD'
):
_libiconv
=
CDLL
(
find_library
(
"iconv"
),
RTLD_GLOBAL
)
# libfuse dependency
ENOTSUP
=
45
ENOTSUP
=
45
c_dev_t
=
c_int32
c_dev_t
=
c_int32
c_fsblkcnt_t
=
c_ulong
c_fsblkcnt_t
=
c_ulong
...
@@ -48,6 +67,29 @@ if _system in ('Darwin', 'FreeBSD'):
...
@@ -48,6 +67,29 @@ if _system in ('Darwin', 'FreeBSD'):
c_size_t
,
c_int
,
c_uint32
)
c_size_t
,
c_int
,
c_uint32
)
getxattr_t
=
CFUNCTYPE
(
c_int
,
c_char_p
,
c_char_p
,
POINTER
(
c_byte
),
getxattr_t
=
CFUNCTYPE
(
c_int
,
c_char_p
,
c_char_p
,
POINTER
(
c_byte
),
c_size_t
,
c_uint32
)
c_size_t
,
c_uint32
)
# OSX with fuse4x uses 64-bit inodes and so has a different
# struct layout. Other darwinish platforms use 32-bit inodes.
if
_system
==
'Darwin'
:
c_stat
.
_fields_
=
[
(
'st_dev'
,
c_dev_t
),
(
'st_mode'
,
c_mode_t
),
(
'st_nlink'
,
c_uint16
),
(
'st_ino'
,
c_uint64
),
(
'st_uid'
,
c_uid_t
),
(
'st_gid'
,
c_gid_t
),
(
'st_rdev'
,
c_dev_t
),
(
'st_atimespec'
,
c_timespec
),
(
'st_mtimespec'
,
c_timespec
),
(
'st_ctimespec'
,
c_timespec
),
(
'st_birthtimespec'
,
c_timespec
),
(
'st_size'
,
c_off_t
),
(
'st_blocks'
,
c_int64
),
(
'st_blksize'
,
c_int32
),
(
'st_flags'
,
c_int32
),
(
'st_gen'
,
c_int32
),
(
'st_lspare'
,
c_int32
),
(
'st_qspare'
,
c_int64
)]
else
:
c_stat
.
_fields_
=
[
c_stat
.
_fields_
=
[
(
'st_dev'
,
c_dev_t
),
(
'st_dev'
,
c_dev_t
),
(
'st_ino'
,
c_uint32
),
(
'st_ino'
,
c_uint32
),
...
@@ -62,6 +104,7 @@ if _system in ('Darwin', 'FreeBSD'):
...
@@ -62,6 +104,7 @@ if _system in ('Darwin', 'FreeBSD'):
(
'st_size'
,
c_off_t
),
(
'st_size'
,
c_off_t
),
(
'st_blocks'
,
c_int64
),
(
'st_blocks'
,
c_int64
),
(
'st_blksize'
,
c_int32
)]
(
'st_blksize'
,
c_int32
)]
elif
_system
==
'Linux'
:
elif
_system
==
'Linux'
:
ENOTSUP
=
95
ENOTSUP
=
95
c_dev_t
=
c_ulonglong
c_dev_t
=
c_ulonglong
...
@@ -239,10 +282,6 @@ def set_st_attrs(st, attrs):
...
@@ -239,10 +282,6 @@ def set_st_attrs(st, attrs):
setattr
(
st
,
key
,
val
)
setattr
(
st
,
key
,
val
)
_libfuse_path
=
find_library
(
'fuse'
)
if
not
_libfuse_path
:
raise
EnvironmentError
(
'Unable to find libfuse'
)
_libfuse
=
CDLL
(
_libfuse_path
)
_libfuse
.
fuse_get_context
.
restype
=
POINTER
(
fuse_context
)
_libfuse
.
fuse_get_context
.
restype
=
POINTER
(
fuse_context
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment