Applied patches for Mac OS X (Erik Larsson)

PERMISSION_HANDLING_BRANCH
jpandre 2009-11-18 16:37:15 +00:00
parent bf82fc305b
commit ad25d7a0ac
3 changed files with 41 additions and 20 deletions

View File

@ -44,6 +44,9 @@
#ifdef HAVE_SETXATTR
#include <sys/xattr.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#include <unistd.h>
#include <pwd.h>

View File

@ -409,12 +409,6 @@ static void set_fuse_error(int *err)
}
#if defined(__APPLE__) || defined(__DARWIN__)
static void *ntfs_macfuse_init(struct fuse_conn_info *conn)
{
FUSE_ENABLE_XTIMES(conn);
return NULL;
}
static int ntfs_macfuse_getxtimes(const char *org_path,
struct timespec *bkuptime, struct timespec *crtime)
{
@ -495,29 +489,34 @@ int ntfs_macfuse_setchgtime(const char *path, const struct timespec *tv)
if (ntfs_fuse_is_named_data_stream(path))
return -EINVAL; /* n/a for named data streams. */
ni = ntfs_pathname_to_inode(ctx-&gt;vol, NULL, path);
ni = ntfs_pathname_to_inode(ctx->vol, NULL, path);
if (!ni)
return -errno;
if (tv) {
ni-&gt;last_mft_change_time = tv-&gt;tv_sec;
ni->last_mft_change_time = tv->tv_sec;
ntfs_fuse_update_times(ni, 0);
}
if (ntfs_inode_close(ni))
set_fuse_error(&amp;res);
set_fuse_error(&res);
return res;
}
#else /* defined(__APPLE__) || defined(__DARWIN__) */
#ifdef FUSE_CAP_DONT_MASK
#endif /* defined(__APPLE__) || defined(__DARWIN__) */
#if defined(FUSE_CAP_DONT_MASK) || (defined(__APPLE__) || defined(__DARWIN__))
static void *ntfs_init(struct fuse_conn_info *conn)
{
#if defined(__APPLE__) || defined(__DARWIN__)
FUSE_ENABLE_XTIMES(conn);
#endif
#ifdef FUSE_CAP_DONT_MASK
/* request umask not to be enforced by fuse */
conn->want |= FUSE_CAP_DONT_MASK;
#endif /* defined FUSE_CAP_DONT_MASK */
return NULL;
}
#endif
#endif /* defined(__APPLE__) || defined(__DARWIN__) */
#endif /* defined(FUSE_CAP_DONT_MASK) || (defined(__APPLE__) || defined(__DARWIN__)) */
static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf)
{
@ -3182,17 +3181,15 @@ static struct fuse_operations ntfs_3g_ops = {
.listxattr = ntfs_fuse_listxattr,
#endif /* HAVE_SETXATTR */
#if defined(__APPLE__) || defined(__DARWIN__)
.init = ntfs_macfuse_init,
/* MacFUSE extensions. */
.getxtimes = ntfs_macfuse_getxtimes,
.setcrtime = ntfs_macfuse_setcrtime,
.setbkuptime = ntfs_macfuse_setbkuptime,
.setchgtime = ntfs_macfuse_setchgtime,
#else /* defined(__APPLE__) || defined(__DARWIN__) */
#ifdef FUSE_CAP_DONT_MASK
#endif /* defined(__APPLE__) || defined(__DARWIN__) */
#if defined(FUSE_CAP_DONT_MASK) || (defined(__APPLE__) || defined(__DARWIN__))
.init = ntfs_init
#endif
#endif /* defined(__APPLE__) || defined(__DARWIN__) */
};
static int ntfs_fuse_init(void)

View File

@ -149,6 +149,9 @@
*
* Nov 2009, version 1.3.9
* - allowed security descriptors up to 64K
*
* Nov 2009, version 1.3.10
* - applied patches for MacOSX from Erik Larsson
*/
/*
@ -172,7 +175,7 @@
* General parameters which may have to be adapted to needs
*/
#define AUDT_VERSION "1.3.9"
#define AUDT_VERSION "1.3.10"
#define GET_FILE_SECURITY "ntfs_get_file_security"
#define SET_FILE_SECURITY "ntfs_set_file_security"
@ -234,7 +237,12 @@
*/
#include <sys/stat.h>
#ifdef HAVE_ENDIAN_H
#include <endian.h>
#endif
#ifdef HAVE_MACHINE_ENDIAN_H
#include <machine/endian.h>
#endif
#include <unistd.h>
#include <dlfcn.h>
#endif /* STSC */
@ -259,7 +267,11 @@
#endif /* HAVE_CONFIG_H */
#ifdef HAVE_SETXATTR
#if defined(__APPLE__) || defined(__DARWIN__)
#include <sys/xattr.h>
#else
#include <attr/xattr.h>
#endif
#else
#warning "The extended attribute package is not available"
#endif /* HAVE_SETXATTR */
@ -5002,6 +5014,15 @@ BOOL singleshow(const char *path)
return (err);
}
static ssize_t ntfs_getxattr(const char *path, const char *name, void *value, size_t size)
{
#if defined(__APPLE__) || defined(__DARWIN__)
return getxattr(path, name, value, size, 0, 0);
#else
return getxattr(path, name, value, size);
#endif
}
/*
* Display all the parameters associated to a mounted file
*/
@ -5030,14 +5051,14 @@ void showmounted(const char *fullname)
printname(stdout,fullname);
printf("\n");
attrsz = getxattr(fullname,"system.ntfs_acl",attr,MAXATTRSZ);
attrsz = ntfs_getxattr(fullname,"system.ntfs_acl",attr,MAXATTRSZ);
if (attrsz > 0) {
if (opt_v) {
hexdump(attr,attrsz,8);
printf("Computed hash : 0x%08lx\n",
(unsigned long)hash((le32*)attr,attrsz));
}
if (getxattr(fullname,"system.ntfs_attrib",&attrib,4) != 4) {
if (ntfs_getxattr(fullname,"system.ntfs_attrib",&attrib,4) != 4) {
printf("** Could not get file attrib\n");
errors++;
} else