diff --git a/ChangeLog b/ChangeLog index 765e5efa..04476d83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -64,7 +64,9 @@ xx/xx/2006 - x.xx.x - . - Change malloc() calls to ntfs_malloc(). (Szaka) - ntfsmount: require FUSE version >= 2.6.0 for build. Fixes fusermount lookup problem and allows to drop compatibility code. (Yura) - - Rewrite ntfs_attr_add() algorithm. (Yura) + - Rewrite ntfs_attr_add() algorithm to be faster and cleverer. (Yura) + - Rename MS_{RDONLY,NOATIME} to NTFS_MNT_{RDONLY,NOATIME}. Introduce + NTFS_MNT_CASE_SENSITIVE. (Yura) 21/06/2006 - 1.13.1 - Various fixes. diff --git a/include/ntfs/volume.h b/include/ntfs/volume.h index 0ce254ca..ba8cf3e3 100644 --- a/include/ntfs/volume.h +++ b/include/ntfs/volume.h @@ -41,25 +41,6 @@ #include #endif -/* - * Under Cygwin, DJGPP and FreeBSD we do not have MS_RDONLY and MS_NOATIME, - * so we define them ourselves. - */ -#ifndef MS_RDONLY -#define MS_RDONLY 1 -#endif -/* - * Solaris defines MS_RDONLY but not MS_NOATIME thus we need to carefully - * define MS_NOATIME. - */ -#ifndef MS_NOATIME -#if (MS_RDONLY != 1) -# define MS_NOATIME 1 -#else -# define MS_NOATIME 2 -#endif -#endif - /* Forward declaration */ typedef struct _ntfs_volume ntfs_volume; @@ -72,13 +53,24 @@ typedef struct _ntfs_volume ntfs_volume; /** * enum ntfs_mount_flags - * + * Flags for the ntfs_mount() function. + */ +typedef enum { + NTFS_MNT_RDONLY = 1, + NTFS_MNT_NOATIME = 2, + NTFS_MNT_CASE_SENSITIVE = 4, +} 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_mount_flags; +} ntfs_mounted_flags; extern int ntfs_check_if_mounted(const char *file, unsigned long *mnt_flags); @@ -214,13 +206,13 @@ struct _ntfs_volume { extern ntfs_volume *ntfs_volume_alloc(void); extern ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, - unsigned long flags); + ntfs_mount_flags flags); extern ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, - unsigned long flags); + ntfs_mount_flags flags); extern int ntfs_device_umount(ntfs_volume *vol, const BOOL force); -extern ntfs_volume *ntfs_mount(const char *name, unsigned long 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); diff --git a/libntfs/dir.c b/libntfs/dir.c index f96fb32d..d92581ae 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -126,10 +126,11 @@ u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni, const ntfschar *uname, return -1; /* Find the index root attribute in the mft record. */ - if (ntfs_attr_lookup(AT_INDEX_ROOT, NTFS_INDEX_I30, 4, CASE_SENSITIVE, 0, NULL, - 0, ctx)) { - ntfs_log_perror("Index root attribute missing in directory inode " - "0x%llx", (unsigned long long)dir_ni->mft_no); + if (ntfs_attr_lookup(AT_INDEX_ROOT, NTFS_INDEX_I30, 4, CASE_SENSITIVE, + 0, NULL, 0, ctx)) { + ntfs_log_perror("Index root attribute missing in directory " + "inode 0x%llx", (unsigned long long)dir_ni-> + mft_no); goto put_err_out; } /* Get to the index root value. */ @@ -263,9 +264,9 @@ found_it: /* Open the index allocation attribute. */ ia_na = ntfs_attr_open(dir_ni, AT_INDEX_ALLOCATION, NTFS_INDEX_I30, 4); if (!ia_na) { - ntfs_log_perror("Failed to open index allocation attribute. Directory " - "inode 0x%llx is corrupt or driver bug", - (unsigned long long)dir_ni->mft_no); + ntfs_log_perror("Failed to open index allocation attribute. " + "Directory inode 0x%llx is corrupt or driver " + "bug", (unsigned long long)dir_ni->mft_no); goto put_err_out; } @@ -302,28 +303,30 @@ descend_into_child_node: } if (sle64_to_cpu(ia->index_block_vcn) != vcn) { - ntfs_log_debug("Actual VCN (0x%llx) of index buffer is different " - "from expected VCN (0x%llx).\n", + ntfs_log_debug("Actual VCN (0x%llx) of index buffer is " + "different from expected VCN (0x%llx).\n", (long long)sle64_to_cpu(ia->index_block_vcn), (long long)vcn); errno = EIO; goto close_err_out; } if (le32_to_cpu(ia->index.allocated_size) + 0x18 != index_block_size) { - ntfs_log_debug("Index buffer (VCN 0x%llx) of directory inode 0x%llx " - "has a size (%u) differing from the directory " - "specified size (%u).\n", (long long)vcn, - (unsigned long long)dir_ni->mft_no, - (unsigned) le32_to_cpu(ia->index.allocated_size) + 0x18, - (unsigned)index_block_size); + ntfs_log_debug("Index buffer (VCN 0x%llx) of directory inode " + "0x%llx has a size (%u) differing from the " + "directory specified size (%u).\n", + (long long)vcn, (unsigned long long)dir_ni-> + mft_no, (unsigned)le32_to_cpu(ia->index. + allocated_size) + 0x18, (unsigned) + index_block_size); errno = EIO; goto close_err_out; } index_end = (u8*)&ia->index + le32_to_cpu(ia->index.index_length); if (index_end > (u8*)ia + index_block_size) { - ntfs_log_debug("Size of index buffer (VCN 0x%llx) of directory inode " - "0x%llx exceeds maximum size.\n", - (long long)vcn, (unsigned long long)dir_ni->mft_no); + ntfs_log_debug("Size of index buffer (VCN 0x%llx) of directory " + "inode 0x%llx exceeds maximum size.\n", + (long long)vcn, (unsigned long long)dir_ni-> + mft_no); errno = EIO; goto close_err_out; } @@ -444,8 +447,9 @@ found_it2: */ if (ie->flags & INDEX_ENTRY_NODE) { if ((ia->index.flags & NODE_MASK) == LEAF_NODE) { - ntfs_log_debug("Index entry with child node found in a leaf " - "node in directory inode 0x%llx.\n", + ntfs_log_debug("Index entry with child node found in a " + "leaf node in directory inode " + "0x%llx.\n", (unsigned long long)dir_ni->mft_no); errno = EIO; goto close_err_out; @@ -455,7 +459,8 @@ found_it2: if (vcn >= 0) goto descend_into_child_node; ntfs_log_debug("Negative child node vcn in directory inode " - "0x%llx.\n", (unsigned long long)dir_ni->mft_no); + "0x%llx.\n", (unsigned long long)dir_ni-> + mft_no); errno = EIO; goto close_err_out; } @@ -700,8 +705,9 @@ static MFT_REF ntfs_mft_get_parent_ref(ntfs_inode *ni) goto err_out; } if (ctx->attr->non_resident) { - ntfs_log_debug("File name attribute must be resident. Corrupt inode " - "0x%llx.\n", (unsigned long long)ni->mft_no); + ntfs_log_debug("File name attribute must be resident. " + "Corrupt inode 0x%llx.\n", + (unsigned long long)ni->mft_no); goto io_err_out; } fn = (FILE_NAME_ATTR*)((u8*)ctx->attr + @@ -824,10 +830,11 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, /* Get the offset into the index root attribute. */ ir_pos = (int)*pos; /* Find the index root attribute in the mft record. */ - if (ntfs_attr_lookup(AT_INDEX_ROOT, NTFS_INDEX_I30, 4, CASE_SENSITIVE, 0, NULL, - 0, ctx)) { - ntfs_log_debug("Index root attribute missing in directory inode " - "0x%llx.\n", (unsigned long long)dir_ni->mft_no); + if (ntfs_attr_lookup(AT_INDEX_ROOT, NTFS_INDEX_I30, 4, CASE_SENSITIVE, + 0, NULL, 0, ctx)) { + ntfs_log_debug("Index root attribute missing in directory " + "inode 0x%llx.\n", (unsigned long long)dir_ni-> + mft_no); goto dir_err_out; } /* Get to the index root value. */ @@ -868,7 +875,8 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, * or signals an error (both covered by the rc test). */ for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->length))) { - ntfs_log_debug("In index root, offset 0x%x.\n", (u8*)ie - (u8*)ir); + ntfs_log_debug("In index root, offset 0x%x.\n", + (u8*)ie - (u8*)ir); /* Bounds checks. */ if ((u8*)ie < (u8*)ctx->mrec || (u8*)ie + sizeof(INDEX_ENTRY_HEADER) > index_end || @@ -965,7 +973,8 @@ find_next_index_buffer: if (br != bmp_buf_size) { if (br != -1) errno = EIO; - ntfs_log_perror("Failed to read from index bitmap attribute"); + ntfs_log_perror("Failed to read from index bitmap " + "attribute"); goto err_out; } } @@ -985,18 +994,19 @@ find_next_index_buffer: ia_start = ia_pos & ~(s64)(index_block_size - 1); if (sle64_to_cpu(ia->index_block_vcn) != ia_start >> index_vcn_size_bits) { - ntfs_log_debug("Actual VCN (0x%llx) of index buffer is different " - "from expected VCN (0x%llx) in inode 0x%llx.\n", + ntfs_log_debug("Actual VCN (0x%llx) of index buffer is " + "different from expected VCN (0x%llx) in " + "inode 0x%llx.\n", (long long)sle64_to_cpu(ia->index_block_vcn), (long long)ia_start >> index_vcn_size_bits, (unsigned long long)dir_ni->mft_no); goto dir_err_out; } if (le32_to_cpu(ia->index.allocated_size) + 0x18 != index_block_size) { - ntfs_log_debug("Index buffer (VCN 0x%llx) of directory inode 0x%llx " - "has a size (%u) differing from the directory " - "specified size (%u).\n", (long long)ia_start >> - index_vcn_size_bits, + ntfs_log_debug("Index buffer (VCN 0x%llx) of directory inode " + "0x%llx has a size (%u) differing from the " + "directory specified size (%u).\n", + (long long)ia_start >> index_vcn_size_bits, (unsigned long long)dir_ni->mft_no, (unsigned) le32_to_cpu(ia->index.allocated_size) + 0x18, (unsigned)index_block_size); @@ -1004,8 +1014,8 @@ find_next_index_buffer: } index_end = (u8*)&ia->index + le32_to_cpu(ia->index.index_length); if (index_end > (u8*)ia + index_block_size) { - ntfs_log_debug("Size of index buffer (VCN 0x%llx) of directory inode " - "0x%llx exceeds maximum size.\n", + ntfs_log_debug("Size of index buffer (VCN 0x%llx) of directory " + "inode 0x%llx exceeds maximum size.\n", (long long)ia_start >> index_vcn_size_bits, (unsigned long long)dir_ni->mft_no); goto dir_err_out; @@ -1026,8 +1036,9 @@ find_next_index_buffer: sizeof(INDEX_ENTRY_HEADER) > index_end || (u8*)ie + le16_to_cpu(ie->key_length) > index_end) { - ntfs_log_debug("Index entry out of bounds in directory inode " - "0x%llx.\n", (unsigned long long)dir_ni->mft_no); + ntfs_log_debug("Index entry out of bounds in directory " + "inode 0x%llx.\n", (unsigned long long) + dir_ni->mft_no); goto dir_err_out; } /* The last entry cannot contain a name. */ @@ -1058,10 +1069,11 @@ done: ntfs_attr_close(ia_na); #ifdef DEBUG if (!rc) - ntfs_log_debug("EOD, *pos 0x%llx, returning 0.\n", (long long)*pos); + ntfs_log_debug("EOD, *pos 0x%llx, returning 0.\n", + (long long)*pos); else - ntfs_log_debug("filldir returned %i, *pos 0x%llx, returning 0.\n", - rc, (long long)*pos); + ntfs_log_debug("filldir returned %i, *pos 0x%llx, " + "returning 0.\n", rc, (long long)*pos); #endif return 0; dir_err_out: @@ -1483,8 +1495,8 @@ int ntfs_delete(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) * WIN32_AND_DOS namespace, then simply remove it from index and inode. * If filename in DOS or in WIN32 namespace, then remove DOS name first, * only then remove WIN32 name. Mark WIN32 name as POSIX name to prevent - * chkdsk to complain about DOS name absentation, in case if DOS name - * had been successfully deleted, but WIN32 name removing failed. + * chkdsk to complain about DOS name absence in case if DOS name had + * been successfully deleted, but WIN32 name remove failed. */ actx = ntfs_attr_get_search_ctx(ni, NULL); if (!actx) @@ -1530,10 +1542,11 @@ search: } if (errno) { /* - * If case sensitive search failed, then try once again - * ignoring case. + * If case sensitive search failed and volume mounted case + * insensitive, then try once again ignoring case. */ - if (errno == ENOENT && case_sensitive_match) { + if (errno == ENOENT && !NVolCaseSensitive(ni->vol) && + case_sensitive_match) { case_sensitive_match = FALSE; ntfs_attr_reinit_search_ctx(actx); ntfs_log_trace("Restart search. Ignore case."); @@ -1556,7 +1569,7 @@ search: /* * Do not allow non-empty directory deletion if hard links count * is 1 (always) or 2 (in case if filename in DOS namespace, - * because we delete it first in filen which have both WIN32 and + * because we delete it first in file which have both WIN32 and * DOS names). */ if ((na->data_size != sizeof(INDEX_ROOT) + sizeof( @@ -1598,7 +1611,7 @@ search: /* Remove FILE_NAME from inode. */ if (ntfs_attr_record_rm(actx)) goto err_out; - /* Decerement hard link count. */ + /* Decrement hard link count. */ ni->mrec->link_count = cpu_to_le16(le16_to_cpu( ni->mrec->link_count) - 1); ntfs_inode_mark_dirty(ni); @@ -1611,7 +1624,7 @@ search: goto search; } else ntfs_log_trace("Deleted.\n"); - /* TODO: Update object id, quota and securiry indexes if required. */ + /* TODO: Update object id, quota and security indexes if required. */ /* * If hard link count is not equal to zero then we are done. In other * case there are no reference to this inode left, so we should free all @@ -1687,8 +1700,8 @@ err_out: * @name: unicode name of the new link * @name_len: length of the name in unicode characters * - * NOTE: At present we allow creating hardlinks to directories, we use them - * in a temporary state during rename. But it's defenitely bad idea to have + * NOTE: At present we allow creating hard links to directories, we use them + * in a temporary state during rename. But it's definitely bad idea to have * hard links to directories as a result of operation. * FIXME: Create internal __ntfs_link that allows hard links to a directories * and external ntfs_link that do not. Write ntfs_rename that uses __ntfs_link. @@ -1705,7 +1718,7 @@ int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) if (!ni || !dir_ni || !name || !name_len || ni->mft_no == dir_ni->mft_no) { err = EINVAL; - ntfs_log_perror("ntfs_link wrong arguments"); + ntfs_log_error("Invalid arguments."); goto err_out; } /* Create FILE_NAME attribute. */ diff --git a/libntfs/gnome-vfs-method.c b/libntfs/gnome-vfs-method.c index 28e5d8b7..523fa3d9 100644 --- a/libntfs/gnome-vfs-method.c +++ b/libntfs/gnome-vfs-method.c @@ -162,7 +162,8 @@ static GnomeVFSResult libntfs_gnomevfs_uri_parent_init( return GNOME_VFS_ERROR_INVALID_URI; } - if (!(volume = ntfs_mount(uri->parent->text, MS_RDONLY))) { + if (!(volume = ntfs_mount(uri->parent->text, + NTFS_MNT_RDONLY))) { g_free(uri_parent_string); return GNOME_VFS_ERROR_WRONG_FORMAT; } diff --git a/libntfs/volume.c b/libntfs/volume.c index 4930e73d..9f1fe896 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -117,7 +117,7 @@ static void __ntfs_volume_release(ntfs_volume *v) if (NDevDirty(dev)) dev->d_ops->sync(dev); if (dev->d_ops->close(dev)) - ntfs_log_perror("Eeek! Failed to close the device. Error: "); + ntfs_log_perror("Failed to close the device. Error: "); } free(v->vol_name); free(v->upcase); @@ -399,7 +399,8 @@ error_exit: * Return the allocated volume structure on success and NULL on error with * errno set to the error code. */ -ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long flags) +ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, + ntfs_mount_flags flags) { LCN mft_zone_size, mft_lcn; s64 br; @@ -435,10 +436,12 @@ ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long flags) ntfs_upcase_table_build(vol->upcase, vol->upcase_len * sizeof(ntfschar)); - if (flags & MS_RDONLY) + if (flags & NTFS_MNT_RDONLY) NVolSetReadOnly(vol); - if (flags & MS_NOATIME) + if (flags & NTFS_MNT_NOATIME) NVolSetNoATime(vol); + if (flags & NTFS_MNT_CASE_SENSITIVE) + NVolSetCaseSensitive(vol); ntfs_log_debug("Reading bootsector... "); if (dev->d_ops->open(dev, NVolReadOnly(vol) ? O_RDONLY: O_RDWR)) { ntfs_log_debug(FAILED); @@ -746,11 +749,13 @@ out: * This function mounts an ntfs volume. @dev should describe the device which * to mount as the ntfs volume. * - * @flags is an optional second parameter. The same flags are used as for - * the mount system call (man 2 mount). Currently only the following flags + * @flags is an optional second parameter. Some flags are similar to flags used + * as for the mount system call (man 2 mount). Currently the following flags * are implemented: - * MS_RDONLY - mount volume read-only - * MS_NOATIME - do not update access time + * NTFS_MNT_RDONLY - mount volume read-only + * NTFS_MNT_NOATIME - do not update access time + * NTFS_MNT_CASE_SENSITIVE - treat filenames as case sensitive even if + * they are not in POSIX namespace * * The function opens the device @dev and verifies that it contains a valid * bootsector. Then, it allocates an ntfs_volume structure and initializes @@ -761,7 +766,7 @@ out: * Return the allocated volume structure on success and NULL on error with * errno set to the error code. */ -ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long flags) +ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, ntfs_mount_flags flags) { s64 l; #ifndef NTFS_DISABLE_DEBUG_LOGGING @@ -936,8 +941,8 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long flags) l = ntfs_attr_pread(na, 0, na->data_size, vol->upcase); if (l != na->data_size) { ntfs_log_debug(FAILED); - ntfs_log_debug("Amount of data read does not correspond to expected " - "length!\n"); + ntfs_log_debug("Amount of data read does not correspond to " + "expected length!\n"); errno = EIO; goto error_exit; } @@ -990,8 +995,8 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long flags) le16_to_cpu(a->value_offset) + le32_to_cpu( a->value_length) > le32_to_cpu(a->length)) { ntfs_log_debug(FAILED); - ntfs_log_debug("Error: Attribute $VOLUME_INFORMATION in $Volume is " - "corrupt!\n"); + ntfs_log_debug("Error: Attribute $VOLUME_INFORMATION in " + "$Volume is corrupt!\n"); errno = EIO; goto error_exit; } @@ -1009,9 +1014,10 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long flags) ctx)) { if (errno != ENOENT) { ntfs_log_debug(FAILED); - ntfs_log_debug("Error: Lookup of $VOLUME_NAME attribute in " - "$Volume failed. This probably means " - "something is corrupt. Run chkdsk.\n"); + ntfs_log_debug("Error: Lookup of $VOLUME_NAME " + "attribute in $Volume failed. " + "This probably means something is " + "corrupt. Run chkdsk.\n"); goto error_exit; } /* @@ -1044,8 +1050,8 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long flags) */ vol->vol_name = NULL; if (ntfs_ucstombs(vname, u, &vol->vol_name, 0) == -1) { - ntfs_log_perror("Error: Volume name could not be converted " - "to current locale"); + ntfs_log_perror("Error: Volume name could not be " + "converted to current locale"); ntfs_log_debug("Forcing name into ASCII by replacing " "non-ASCII characters with underscores.\n"); vol->vol_name = ntfs_malloc(u + 1); @@ -1083,8 +1089,8 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long flags) /* Check we don't overflow 32-bits. */ if (na->data_size > 0xffffffffLL) { ntfs_log_debug(FAILED); - ntfs_log_debug("Error: Attribute definition table is too big (max " - "32-bit allowed).\n"); + ntfs_log_debug("Error: Attribute definition table is too big " + "(max 32-bit allowed).\n"); errno = EINVAL; goto error_exit; } @@ -1098,8 +1104,8 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long flags) l = ntfs_attr_pread(na, 0, na->data_size, vol->attrdef); if (l != na->data_size) { ntfs_log_debug(FAILED); - ntfs_log_debug("Amount of data read does not correspond to expected " - "length!\n"); + ntfs_log_debug("Amount of data read does not correspond to " + "expected length!\n"); errno = EIO; goto error_exit; } @@ -1112,7 +1118,7 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long flags) * Check for dirty logfile and hibernated Windows. * We care only about read-write mounts. */ - if (!(flags & MS_RDONLY)) { + if (!(flags & NTFS_MNT_RDONLY)) { if (ntfs_volume_check_logfile(vol) < 0) goto error_exit; if (ntfs_volume_check_hiberfile(vol) < 0) @@ -1141,11 +1147,13 @@ error_exit: * This function mounts an ntfs volume. @name should contain the name of the * device/file to mount as the ntfs volume. * - * @flags is an optional second parameter. The same flags are used as for - * the mount system call (man 2 mount). Currently only the following flags + * @flags is an optional second parameter. Some flags are similar to flags used + * as for the mount system call (man 2 mount). Currently the following flags * are implemented: - * MS_RDONLY - mount volume read-only - * MS_NOATIME - do not update access time + * NTFS_MNT_RDONLY - mount volume read-only + * NTFS_MNT_NOATIME - do not update access time + * NTFS_MNT_CASE_SENSITIVE - treat filenames as case sensitive even if + * they are not in POSIX namespace * * The function opens the device or file @name and verifies that it contains a * valid bootsector. Then, it allocates an ntfs_volume structure and initializes @@ -1160,7 +1168,7 @@ error_exit: * soon as the function returns. */ ntfs_volume *ntfs_mount(const char *name __attribute__((unused)), - unsigned long flags __attribute__((unused))) + ntfs_mount_flags flags __attribute__((unused))) { #ifndef NO_NTFS_DEVICE_DEFAULT_IO_OPS struct ntfs_device *dev; @@ -1378,7 +1386,7 @@ int ntfs_check_if_mounted(const char *file __attribute__((unused)), * Version 1.1 and 1.2 are used by Windows NT3.x and NT4. * Version 2.x is used by Windows 2000 Betas. * Version 3.0 is used by Windows 2000. - * Version 3.1 is used by Windows XP, Windows Server 2003 and Longhorn. + * Version 3.1 is used by Windows XP, Windows Server 2003 and Vista. * * Return 0 if NTFS version is supported otherwise -1 with errno set. * diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c index b744237a..d584bd4f 100644 --- a/ntfsprogs/ntfscat.c +++ b/ntfsprogs/ntfscat.c @@ -399,7 +399,7 @@ int main(int argc, char *argv[]) utils_set_locale(); - vol = utils_mount_volume(opts.device, MS_RDONLY, opts.force); + vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY, opts.force); if (!vol) { ntfs_log_perror("ERROR: couldn't mount volume"); return 1; diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 08dc6ad2..474fa881 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -1593,7 +1593,7 @@ static s64 open_volume(void) { s64 device_size; - mount_volume(MS_RDONLY); + mount_volume(NTFS_MNT_RDONLY); device_size = ntfs_device_size_get(vol->dev, 1); if (device_size <= 0) @@ -1825,7 +1825,7 @@ int main(int argc, char **argv) /* 'force' again mount for dirty volumes (e.g. after resize). FIXME: use mount flags to avoid potential side-effects in future */ opt.force++; - mount_volume(MS_NOATIME); + mount_volume(NTFS_MNT_NOATIME); free(lcn_bitmap.bm); setup_lcn_bitmap(); diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index d7c13f8a..d72f5e8f 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -492,7 +492,7 @@ int main(int argc, char *argv[]) utils_set_locale(); - vol = utils_mount_volume(opts.device, MS_RDONLY, opts.force); + vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY, opts.force); if (!vol) return 1; diff --git a/ntfsprogs/ntfscmp.c b/ntfsprogs/ntfscmp.c index 6b8cd1f2..53361dc6 100644 --- a/ntfsprogs/ntfscmp.c +++ b/ntfsprogs/ntfscmp.c @@ -939,7 +939,7 @@ static ntfs_volume *mount_volume(const char *volume) "You must 'umount' it first.\n", volume); } - vol = ntfs_mount(volume, MS_RDONLY); + vol = ntfs_mount(volume, NTFS_MNT_RDONLY); if (vol == NULL) { int err = errno; diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index c96024b2..74d327cd 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -344,7 +344,7 @@ int main(int argc, char *argv[]) } if (opts.noaction) - flags = MS_RDONLY; + flags = NTFS_MNT_RDONLY; vol = utils_mount_volume(opts.device, flags, opts.force); if (!vol) { diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c index 4e21a525..1db17ee9 100644 --- a/ntfsprogs/ntfsdecrypt.c +++ b/ntfsprogs/ntfsdecrypt.c @@ -1315,7 +1315,7 @@ int main(int argc, char *argv[]) return 1; } /* Mount the ntfs volume. */ - vol = utils_mount_volume(opts.device, MS_RDONLY, opts.force); + vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY, opts.force); if (!vol) { ntfs_log_error("Failed to mount ntfs volume. Aborting.\n"); ntfs_rsa_private_key_release(rsa_key); diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index d6500379..2597dcfd 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -197,7 +197,7 @@ static int logfile_open(BOOL is_volume, const char *filename, ntfs_inode *ni; ntfs_attr *na; - vol = ntfs_mount(filename, MS_RDONLY); + vol = ntfs_mount(filename, NTFS_MNT_RDONLY); if (!vol) log_err_exit(NULL, "Failed to mount %s: %s\n", filename, strerror(errno)); diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 41ba6304..d8754524 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -2204,7 +2204,7 @@ int main(int argc, char **argv) utils_set_locale(); - vol = utils_mount_volume(opts.device, MS_RDONLY, opts.force); + vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY, opts.force); if (!vol) { printf("Failed to open '%s': %s\n", opts.device, strerror(errno)); diff --git a/ntfsprogs/ntfslabel.c b/ntfsprogs/ntfslabel.c index f219eb6a..2d1eccae 100644 --- a/ntfsprogs/ntfslabel.c +++ b/ntfsprogs/ntfslabel.c @@ -394,8 +394,8 @@ int main(int argc, char **argv) if (!opts.label) opts.noaction++; - vol = utils_mount_volume(opts.device, opts.noaction ? MS_RDONLY : 0, - opts.force); + vol = utils_mount_volume(opts.device, opts.noaction ? + NTFS_MNT_RDONLY : 0, opts.force); if (!vol) return 1; diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index 40f291b6..a5c6cc20 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -651,7 +651,7 @@ int main(int argc, char **argv) utils_set_locale(); - vol = utils_mount_volume(opts.device, MS_RDONLY, opts.force); + vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY, opts.force); if (!vol) { // FIXME: Print error... (AIA) return 2; diff --git a/ntfsprogs/ntfsmftalloc.c b/ntfsprogs/ntfsmftalloc.c index c10899e9..81699857 100644 --- a/ntfsprogs/ntfsmftalloc.c +++ b/ntfsprogs/ntfsmftalloc.c @@ -313,7 +313,7 @@ int main(int argc, char **argv) /* Mount the device. */ if (opts.no_action) { ntfs_log_quiet("Running in READ-ONLY mode!\n"); - ul = MS_RDONLY; + ul = NTFS_MNT_RDONLY; } else ul = 0; vol = ntfs_mount(dev_name, ul); diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 2492b197..61381242 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -1410,8 +1410,9 @@ static int ntfs_fuse_mount(const char *device) { ntfs_volume *vol; - vol = utils_mount_volume(device, ((ctx->ro) ? MS_RDONLY : 0) | - ((ctx->noatime) ? MS_NOATIME : 0), ctx->force); + vol = utils_mount_volume(device, ((ctx->ro) ? NTFS_MNT_RDONLY : 0) | + ((ctx->noatime) ? NTFS_MNT_NOATIME : 0) | + NTFS_MNT_CASE_SENSITIVE, ctx->force); if (!vol) { ntfs_log_error("Mount failed.\n"); return -1; diff --git a/ntfsprogs/ntfsmove.c b/ntfsprogs/ntfsmove.c index e590802d..c7e1bc2b 100644 --- a/ntfsprogs/ntfsmove.c +++ b/ntfsprogs/ntfsmove.c @@ -875,7 +875,7 @@ int main(int argc, char *argv[]) utils_set_locale(); if (opts.noaction) - flags |= MS_RDONLY; + flags |= NTFS_MNT_RDONLY; vol = utils_mount_volume(opts.device, flags, opts.force); if (!vol) { diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 1c592ab2..47d59aae 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -484,7 +484,7 @@ static int parse_options(int argc, char **argv) opt.info++; break; case 'n': - opt.ro_flag = MS_RDONLY; + opt.ro_flag = NTFS_MNT_RDONLY; break; case 'P': opt.show_progress = 0; @@ -520,7 +520,7 @@ static int parse_options(int argc, char **argv) err++; } if (opt.info) { - opt.ro_flag = MS_RDONLY; + opt.ro_flag = NTFS_MNT_RDONLY; if (opt.bytes) { printf(NERR_PREFIX "Options --info and --size " "can't be used together.\n"); @@ -2237,7 +2237,7 @@ static ntfs_volume *mount_volume(void) "You must 'umount' it first.\n", opt.volume); } - if (!(vol = ntfs_mount(opt.volume, opt.ro_flag | MS_NOATIME))) { + if (!(vol = ntfs_mount(opt.volume, opt.ro_flag | NTFS_MNT_NOATIME))) { int err = errno; diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index c121eae1..9f48e64b 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -1027,7 +1027,7 @@ int main(int argc, char *argv[]) #endif if (opts.noaction) - flags |= MS_RDONLY; + flags |= NTFS_MNT_RDONLY; //ntfs_log_set_levels (NTFS_LOG_LEVEL_DEBUG | NTFS_LOG_LEVEL_TRACE); //ntfs_log_set_levels (NTFS_LOG_LEVEL_DEBUG); diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index c771c04c..69c20beb 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -738,7 +738,7 @@ int main(int argc, char **argv) /* Mount the device. */ if (opts.no_action) { ntfs_log_quiet("Running in READ-ONLY mode!\n"); - ul = MS_RDONLY; + ul = NTFS_MNT_RDONLY; } else ul = 0; vol = ntfs_mount(dev_name, ul); diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index b18d149b..4718a96a 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -2123,7 +2123,7 @@ int main(int argc, char *argv[]) utils_set_locale(); - vol = utils_mount_volume(opts.device, MS_RDONLY, opts.force); + vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY, opts.force); if (!vol) return 1; diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index da713ca0..3f66f92d 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -1340,7 +1340,7 @@ int main(int argc, char *argv[]) print_summary(); if (opts.info || opts.noaction) - flags = MS_RDONLY; + flags = NTFS_MNT_RDONLY; vol = utils_mount_volume(opts.device, flags, opts.force); if (!vol)