Adapted to ntfs-3g-2009.1.1

N2009_11_14_FIXES
jpandre 2009-01-23 11:11:44 +00:00
parent 638228121d
commit 11216c6942
6 changed files with 87 additions and 14 deletions

View File

@ -23,8 +23,8 @@
# Autoconf
AC_PREREQ(2.59)
AC_INIT([ntfs-3g],[1.5222-RC],[ntfs-3g-devel@lists.sf.net])
LIBNTFS_3G_VERSION="47"
AC_INIT([ntfs-3g],[2009.1.1],[ntfs-3g-devel@lists.sf.net])
LIBNTFS_3G_VERSION="48"
AC_CONFIG_SRCDIR([src/ntfs-3g.c])
# Environment

View File

@ -3,6 +3,7 @@
*
* Copyright (c) 2002 Richard Russon
* Copyright (c) 2002-2004 Anton Altaparmakov
* Copyright (c) 2008-2009 Szabolcs Szakacsits
*
* This program/include file is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
@ -26,6 +27,13 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifndef PATH_MAX
#define PATH_MAX 4096
#endif
#ifndef HAVE_FFS
extern int ffs(int i);

View File

@ -381,6 +381,7 @@ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type,
{
ntfs_attr_search_ctx *ctx;
ntfs_attr *na = NULL;
ntfschar *newname = NULL;
ATTR_RECORD *a;
BOOL cs;
@ -398,6 +399,7 @@ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type,
name = ntfs_ucsndup(name, name_len);
if (!name)
goto err_out;
newname = name;
}
ctx = ntfs_attr_get_search_ctx(ni, NULL);
@ -415,6 +417,7 @@ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type,
a->name_offset)), a->name_length);
if (!name)
goto put_err_out;
newname = name;
name_len = a->name_length;
} else {
name = AT_UNNAMED;
@ -476,6 +479,7 @@ out:
put_err_out:
ntfs_attr_put_search_ctx(ctx);
err_out:
free(newname);
free(na);
na = NULL;
goto out;

View File

@ -2,8 +2,8 @@
* unistr.c - Unicode string handling. Originated from the Linux-NTFS project.
*
* Copyright (c) 2000-2004 Anton Altaparmakov
* Copyright (c) 2002-2008 Szabolcs Szakacsits
* Copyright (c) 2008 Jean-Pierre Andre
* Copyright (c) 2002-2009 Szabolcs Szakacsits
* Copyright (c) 2008-2009 Jean-Pierre Andre
* Copyright (c) 2008 Bernhard Kaindl
*
* This program/include file is free software; you can redistribute it and/or
@ -45,6 +45,7 @@
#include <locale.h>
#endif
#include "compat.h"
#include "attrib.h"
#include "types.h"
#include "unistr.h"

View File

@ -2,7 +2,7 @@
* volume.c - NTFS volume handling code. Originated from the Linux-NTFS project.
*
* Copyright (c) 2000-2006 Anton Altaparmakov
* Copyright (c) 2002-2008 Szabolcs Szakacsits
* Copyright (c) 2002-2009 Szabolcs Szakacsits
* Copyright (c) 2004-2005 Richard Russon
*
* This program/include file is free software; you can redistribute it and/or
@ -53,6 +53,7 @@
#include <locale.h>
#endif
#include "compat.h"
#include "volume.h"
#include "attrib.h"
#include "mft.h"
@ -66,10 +67,6 @@
#include "logging.h"
#include "misc.h"
#ifndef PATH_MAX
#define PATH_MAX 4096
#endif
const char *ntfs_home =
"Ntfs-3g news, support and information: http://ntfs-3g.org\n";

View File

@ -3,8 +3,9 @@
*
* Copyright (c) 2005-2007 Yura Pakhuchiy
* Copyright (c) 2005 Yuval Fledel
* Copyright (c) 2006-2008 Szabolcs Szakacsits
* Copyright (c) 2006-2009 Szabolcs Szakacsits
* Copyright (c) 2007-2009 Jean-Pierre Andre
* Copyright (c) 2009 Erik Larsson
*
* This file is originated from the Linux-NTFS project.
*
@ -96,10 +97,6 @@
#include "logging.h"
#include "misc.h"
#ifndef PATH_MAX
#define PATH_MAX 4096
#endif
typedef enum {
FSTYPE_NONE,
FSTYPE_UNKNOWN,
@ -379,6 +376,66 @@ static void set_fuse_error(int *err)
*err = -errno;
}
#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)
{
int res = 0;
ntfs_inode *ni;
char *path = NULL;
ntfschar *stream_name;
int stream_name_len;
stream_name_len = ntfs_fuse_parse_path(org_path, &path, &stream_name);
if (stream_name_len < 0)
return stream_name_len;
memset(bkuptime, 0, sizeof(struct timespec));
memset(crtime, 0, sizeof(struct timespec));
ni = ntfs_pathname_to_inode(ctx->vol, NULL, path);
if (!ni) {
res = -errno;
goto exit;
}
/* We have no backup timestamp in NTFS. */
crtime->tv_sec = ni->creation_time;
exit:
if (ntfs_inode_close(ni))
set_fuse_error(&res);
free(path);
if (stream_name_len)
free(stream_name);
return res;
}
int ntfs_macfuse_setcrtime(const char *path, const struct timespec *tv)
{
ntfs_inode *ni;
int res = 0;
if (ntfs_fuse_is_named_data_stream(path))
return -EINVAL; /* n/a for named data streams. */
ni = ntfs_pathname_to_inode(ctx->vol, NULL, path);
if (!ni)
return -errno;
if (tv) {
ni->creation_time = tv->tv_sec;
ntfs_fuse_update_times(ni, NTFS_UPDATE_CTIME);
}
if (ntfs_inode_close(ni))
set_fuse_error(&res);
return res;
}
#endif /* defined(__APPLE__) || defined(__DARWIN__) */
static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf)
{
int res = 0;
@ -2626,6 +2683,12 @@ static struct fuse_operations ntfs_3g_ops = {
.removexattr = ntfs_fuse_removexattr,
.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,
#endif /* defined(__APPLE__) || defined(__DARWIN__) */
};
static int ntfs_fuse_init(void)