Академический Документы
Профессиональный Документы
Культура Документы
* volume.h - Exports for NTFS volume handling. Originated from the Linux-NTFS p
roject.
*
* Copyright (c) 2000-2004 Anton Altaparmakov
* Copyright (c) 2004-2005 Richard Russon
* Copyright (c) 2005-2006 Yura Pakhuchiy
* Copyright (c) 2005-2009 Szabolcs Szakacsits
* Copyright (c) 2010
Jean-Pierre Andre
*
* 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
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program/include file is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program (in the main directory of the NTFS-3G
* distribution in the file COPYING); if not, write to the Free Software
* Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _NTFS_VOLUME_H
#define _NTFS_VOLUME_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
/* Do not #include <sys/mount.h> here : conflicts with <linux/fs.h> */
#ifdef HAVE_MNTENT_H
#include <mntent.h>
#endif
/* Forward declaration */
typedef struct _ntfs_volume ntfs_volume;
#include
#include
#include
#include
#include
#include
#include
"param.h"
"types.h"
"support.h"
"device.h"
"inode.h"
"attrib.h"
"index.h"
/**
* enum ntfs_mount_flags *
* Flags for the ntfs_mount() function.
*/
enum {
NTFS_MNT_NONE
NTFS_MNT_RDONLY
NTFS_MNT_FORENSIC
NTFS_MNT_EXCLUSIVE
NTFS_MNT_RECOVER
NTFS_MNT_IGNORE_HIBERFILE
= 0x00000000,
= 0x00000001,
= 0x04000000, /* No modification during
* mount. */
= 0x08000000,
= 0x10000000,
= 0x20000000,
};
typedef unsigned long ntfs_mount_flags;
/**
* enum ntfs_mounted_flags *
* Flags returned by the ntfs_check_if_mounted() function.
*/
typedef enum {
NTFS_MF_MOUNTED
= 1,
/* Device is mounted. */
NTFS_MF_ISROOT
= 2,
/* Device is mounted as system root. */
NTFS_MF_READONLY
= 4,
/* Device is mounted read-only. */
} ntfs_mounted_flags;
extern int ntfs_check_if_mounted(const char *file, unsigned long *mnt_flags);
typedef enum {
NTFS_VOLUME_OK
NTFS_VOLUME_SYNTAX_ERROR
NTFS_VOLUME_NOT_NTFS
NTFS_VOLUME_CORRUPT
NTFS_VOLUME_HIBERNATED
NTFS_VOLUME_UNCLEAN_UNMOUNT
NTFS_VOLUME_LOCKED
NTFS_VOLUME_RAID
NTFS_VOLUME_UNKNOWN_REASON
NTFS_VOLUME_NO_PRIVILEGE
NTFS_VOLUME_OUT_OF_MEMORY
NTFS_VOLUME_FUSE_ERROR
NTFS_VOLUME_INSECURE
} ntfs_volume_status;
=
=
=
=
=
=
=
=
=
=
=
=
=
0,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22
/**
* enum ntfs_volume_state_bits *
* Defined bits for the state field in the ntfs_volume structure.
*/
typedef enum {
NV_ReadOnly,
/* 1: Volume is read-only. */
NV_CaseSensitive,
/* 1: Volume is mounted case-sensitive. */
NV_LogFileEmpty,
/* 1: $logFile journal is empty. */
NV_ShowSysFiles,
/* 1: Show NTFS metafiles. */
NV_ShowHidFiles,
/* 1: Show files marked hidden. */
NV_HideDotFiles,
/* 1: Set hidden flag on dot files */
NV_Compression,
/* 1: allow compression */
NV_NoFixupWarn,
/* 1: Do not log fixup errors */
} ntfs_volume_state_bits;
#define test_nvol_flag(nv, flag)
#define set_nvol_flag(nv, flag)
#define clear_nvol_flag(nv, flag)
test_bit(NV_##flag, (nv)->state)
set_bit(NV_##flag, (nv)->state)
clear_bit(NV_##flag, (nv)->state)
#define NVolReadOnly(nv)
#define NVolSetReadOnly(nv)
#define NVolClearReadOnly(nv)
test_nvol_flag(nv, ReadOnly)
set_nvol_flag(nv, ReadOnly)
clear_nvol_flag(nv, ReadOnly)
#define NVolCaseSensitive(nv)
#define NVolSetCaseSensitive(nv)
#define NVolClearCaseSensitive(nv)
test_nvol_flag(nv, CaseSensitive)
set_nvol_flag(nv, CaseSensitive)
clear_nvol_flag(nv, CaseSensitive)
#define NVolLogFileEmpty(nv)
#define NVolSetLogFileEmpty(nv)
#define NVolClearLogFileEmpty(nv)
test_nvol_flag(nv, LogFileEmpty)
set_nvol_flag(nv, LogFileEmpty)
clear_nvol_flag(nv, LogFileEmpty)
#define NVolShowSysFiles(nv)
#define NVolSetShowSysFiles(nv)
#define NVolClearShowSysFiles(nv)
test_nvol_flag(nv, ShowSysFiles)
set_nvol_flag(nv, ShowSysFiles)
clear_nvol_flag(nv, ShowSysFiles)
#define NVolShowHidFiles(nv)
#define NVolSetShowHidFiles(nv)
#define NVolClearShowHidFiles(nv)
test_nvol_flag(nv, ShowHidFiles)
set_nvol_flag(nv, ShowHidFiles)
clear_nvol_flag(nv, ShowHidFiles)
#define NVolHideDotFiles(nv)
#define NVolSetHideDotFiles(nv)
#define NVolClearHideDotFiles(nv)
test_nvol_flag(nv, HideDotFiles)
set_nvol_flag(nv, HideDotFiles)
clear_nvol_flag(nv, HideDotFiles)
#define NVolCompression(nv)
#define NVolSetCompression(nv)
#define NVolClearCompression(nv)
test_nvol_flag(nv, Compression)
set_nvol_flag(nv, Compression)
clear_nvol_flag(nv, Compression)
#define NVolNoFixupWarn(nv)
#define NVolSetNoFixupWarn(nv)
#define NVolClearNoFixupWarn(nv)
test_nvol_flag(nv, NoFixupWarn)
set_nvol_flag(nv, NoFixupWarn)
clear_nvol_flag(nv, NoFixupWarn)
/*
* NTFS
* NTFS
* NTFS
* NTFS
*/
version
version
version
version
#define
#define
#define
#define
#define
NTFS_V1_1(major,
NTFS_V1_2(major,
NTFS_V2_X(major,
NTFS_V3_0(major,
NTFS_V3_1(major,
1.1
2.x
3.0
3.1
and 1.2
is used
is used
is used
minor)
minor)
minor)
minor)
minor)
((major)
((major)
((major)
((major)
((major)
==
==
==
==
==
1 &&
1 &&
2)
3 &&
3 &&
(minor) == 1)
(minor) == 2)
(minor) == 0)
(minor) == 1)
ntfs_inode *vol_ni;
u8 major_ver;
u8 minor_ver;
le16 flags;
/*
/*
/*
/*
u16 sector_size;
/* Byte size of a sector. */
u8 sector_size_bits;
/* Log(2) of the byte size of a sector. */
u32 cluster_size;
/* Byte size of a cluster. */
u32 mft_record_size;
/* Byte size of a mft record. */
u32 indx_record_size; /* Byte size of a INDX record. */
u8 cluster_size_bits; /* Log(2) of the byte size of a cluster. */
u8 mft_record_size_bits;/* Log(2) of the byte size of a mft record. */
u8 indx_record_size_bits;/* Log(2) of the byte size of a INDX record. */
/* Variables used by the cluster and mft allocators. */
u8 mft_zone_multiplier; /* Initial mft zone multiplier. */
u8 full_zones;
/* cluster zones which are full */
s64 mft_data_pos;
/* Mft record number at which to allocate the
next mft record. */
LCN mft_zone_start;
/* First cluster of the mft zone. */
LCN mft_zone_end;
/* First cluster beyond the mft zone. */
LCN mft_zone_pos;
/* Current position in the mft zone. */
LCN data1_zone_pos;
/* Current position in the first data zone. */
LCN data2_zone_pos;
/* Current position in the second data zone. */
s64 nr_clusters;
u32 upcase_len;
ntfschar *locase;
ATTR_DEF *attrdef;
s32 attrdef_len;
s64 free_clusters;
s64 free_mft_records;
BOOL efs_raw;
#ifdef XATTR_MAPPINGS
struct XATTRMAPPING
#endif /* XATTR_MAPPINGS */
#if CACHE_INODE_SIZE
struct CACHE_HEADER
#endif
#if CACHE_NIDATA_SIZE
struct CACHE_HEADER
#endif
#if CACHE_LOOKUP_SIZE
struct CACHE_HEADER
#endif
#if CACHE_SECURID_SIZE
struct CACHE_HEADER
#endif
#if CACHE_LEGACY_SIZE
struct CACHE_HEADER
#endif
*xattr_mapping;
*xinode_cache;
*nidata_cache;
*lookup_cache;
*securid_cache;
*legacy_cache;
};
extern const char *ntfs_home;
extern ntfs_volume *ntfs_volume_alloc(void);
extern ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev,
ntfs_mount_flags flags);
extern ntfs_volume *ntfs_device_mount(struct ntfs_device *dev,
ntfs_mount_flags flags);
extern ntfs_volume *ntfs_mount(const char *name, ntfs_mount_flags flags);
extern int ntfs_umount(ntfs_volume *vol, const BOOL force);
extern int ntfs_version_is_supported(ntfs_volume *vol);
extern int ntfs_volume_check_hiberfile(ntfs_volume *vol, int verbose);
extern int ntfs_logfile_reset(ntfs_volume *vol);
extern int ntfs_volume_write_flags(ntfs_volume *vol, const le16 flags);
extern int ntfs_volume_error(int err);
extern void ntfs_mount_error(const char *vol, const char *mntpoint, int err);