new : allow compression in default setup

With the default mount options, compression of new files are now done
if the parent directory is marked for compression. The mount option
"compression" is not needed any more, but the option "nocompression"
can be used to disable compression of new files.

The default option also applies to applications using libntfs-3g with
no mount command.
edge.strict_endians
Jean-Pierre André 2011-10-20 18:55:32 +02:00
parent 69549be496
commit 59ecea5c80
4 changed files with 12 additions and 1 deletions

View File

@ -44,7 +44,7 @@ enum {
*/
/* default option for compression */
#define DEFAULT_COMPRESSION FALSE
#define DEFAULT_COMPRESSION 1
/* (log2 of) number of clusters in a compression block for new files */
#define STANDARD_COMPRESSION_UNIT 4
/* maximum cluster size for allowing compression for new files */

View File

@ -54,6 +54,7 @@
#include <locale.h>
#endif
#include "param.h"
#include "compat.h"
#include "volume.h"
#include "attrib.h"
@ -501,6 +502,12 @@ ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long flags)
NVolSetShowSysFiles(vol);
NVolSetShowHidFiles(vol);
NVolClearHideDotFiles(vol);
/* set default compression */
#if DEFAULT_COMPRESSION
NVolSetCompression(vol);
#else
NVolClearCompression(vol);
#endif
if (flags & MS_RDONLY)
NVolSetReadOnly(vol);

View File

@ -3433,6 +3433,8 @@ static int ntfs_open(const char *device)
NDevSetSync(ctx->vol->dev);
if (ctx->compression)
NVolSetCompression(ctx->vol);
else
NVolClearCompression(ctx->vol);
#ifdef HAVE_SETXATTR
/* archivers must see hidden files */
if (ctx->efs_raw)

View File

@ -3350,6 +3350,8 @@ static int ntfs_open(const char *device)
NDevSetSync(ctx->vol->dev);
if (ctx->compression)
NVolSetCompression(ctx->vol);
else
NVolClearCompression(ctx->vol);
#ifdef HAVE_SETXATTR
/* archivers must see hidden files */
if (ctx->efs_raw)