Add NTFS_MNT_INTERIX mount option to make libntfs recognize Interix files.

At present it influence only on ntfs_filldir(), but we can have ntfs_stat() and
other functions on which it will make more influence later.
edge.strict_endians
Yura Pakhuchiy 2007-09-27 15:58:42 +03:00
parent f24415abaa
commit 2b1ef811e6
3 changed files with 20 additions and 5 deletions

View File

@ -62,6 +62,7 @@ typedef enum {
NTFS_MNT_CASE_SENSITIVE = 4,
NTFS_MNT_NOT_EXCLUSIVE = 8,
NTFS_MNT_FORCE = 16,
NTFS_MNT_INTERIX = 32,
} ntfs_mount_flags;
/**
@ -91,6 +92,8 @@ typedef enum {
it. */
NV_ForensicMount, /* 1: Mount is forensic, i.e. no modifications
are to be done by mount/umount. */
NV_Interix, /* 1: Make libntfs recognize Interix special
files. */
} ntfs_volume_state_bits;
#define test_nvol_flag(nv, flag) test_bit(NV_##flag, (nv)->state)
@ -117,6 +120,10 @@ typedef enum {
#define NVolSetForensicMount(nv) set_nvol_flag(nv, ForensicMount)
#define NVolClearForensicMount(nv) clear_nvol_flag(nv, ForensicMount)
#define NVolInterix(nv) test_nvol_flag(nv, Interix)
#define NVolSetInterix(nv) set_nvol_flag(nv, Interix)
#define NVolClearInterix(nv) clear_nvol_flag(nv, Interix)
/*
* NTFS version 1.1 and 1.2 are used by Windows NT4.
* NTFS version 2.x is used by Windows 2000 Beta

View File

@ -597,6 +597,7 @@ static const ntfschar dotdot[3] = { const_cpu_to_le16('.'),
/**
* ntfs_filldir - ntfs specific filldir method
* @vol: ntfs volume with wjich we are working
* @pos: current position in directory
* @ie: current index entry
* @dirent: context for filldir callback supplied by the caller
@ -605,7 +606,7 @@ static const ntfschar dotdot[3] = { const_cpu_to_le16('.'),
* Pass information specifying the current directory entry @ie to the @filldir
* callback.
*/
static int ntfs_filldir(s64 *pos, INDEX_ENTRY *ie,
static int ntfs_filldir(ntfs_volume *vol, s64 *pos, INDEX_ENTRY *ie,
void *dirent, ntfs_filldir_t filldir)
{
FILE_NAME_ATTR *fn = &ie->key.file_name;
@ -618,8 +619,12 @@ static int ntfs_filldir(s64 *pos, INDEX_ENTRY *ie,
return 0;
if (ie->key.file_name.file_attributes & FILE_ATTR_I30_INDEX_PRESENT)
dt_type = NTFS_DT_DIR;
else
dt_type = NTFS_DT_REG;
else {
if (NVolInterix(vol) && fn->file_attributes & FILE_ATTR_SYSTEM)
dt_type = NTFS_DT_UNKNOWN;
else
dt_type = NTFS_DT_REG;
}
return filldir(dirent, fn->file_name, fn->file_name_length,
fn->file_name_type, *pos,
le64_to_cpu(ie->indexed_file), dt_type);
@ -857,7 +862,7 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos,
* Submit the directory entry to ntfs_filldir(), which will
* invoke the filldir() callback as appropriate.
*/
rc = ntfs_filldir(pos, ie, dirent, filldir);
rc = ntfs_filldir(vol, pos, ie, dirent, filldir);
if (rc)
goto err_out;
}
@ -1015,7 +1020,7 @@ find_next_index_buffer:
* Submit the directory entry to ntfs_filldir(), which will
* invoke the filldir() callback as appropriate.
*/
rc = ntfs_filldir(pos, ie, dirent, filldir);
rc = ntfs_filldir(vol, pos, ie, dirent, filldir);
if (rc)
goto err_out;
}

View File

@ -475,6 +475,8 @@ ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev,
NVolSetReadOnly(vol);
if (flags & NTFS_MNT_CASE_SENSITIVE)
NVolSetCaseSensitive(vol);
if (flags & NTFS_MNT_INTERIX)
NVolSetInterix(vol);
ntfs_log_debug("Reading bootsector... ");
if (dev->d_ops->open(dev, NVolReadOnly(vol) ? O_RDONLY :
((flags & NTFS_MNT_NOT_EXCLUSIVE) ? O_RDWR :
@ -869,6 +871,7 @@ static long ntfs_volume_get_nr_free_clusters(ntfs_volume *vol)
* NTFS_MNT_FORENSIC - mount for forensic purposes, i.e. do not do
* any writing at all during the mount, i.e. no
* journal emptying, no dirty bit setting, etc.
* NTFS_MNT_INTERIX - make libntfs recognize special Interix files
*
* The function opens the device @dev and verifies that it contains a valid
* bootsector. Then, it allocates an ntfs_volume structure and initializes