Changes by: cha0smaster
Update of /cvsroot/linux-ntfs/ntfsprogs/libntfs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8321/libntfs
Modified Files:
attrib.c volume.c
Log Message:
* Fix bug with updating atime on read-only volumes. (Thanks to Szaka and Anton)
* Add MS_NOATIME to ntfs_mount. (By Yuval's request)
Index: attrib.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/libntfs/attrib.c,v
retrieving revision 1.196
retrieving revision 1.197
diff -u -p -r1.196 -r1.197
--- attrib.c 14 Nov 2005 15:31:23 -0000 1.196
+++ attrib.c 15 Nov 2005 16:31:40 -0000 1.197
@@ -770,8 +770,10 @@ s64 ntfs_attr_pread(ntfs_attr *na, const
errno = EACCES;
return -1;
}
+ vol = na->ni->vol;
/* Update access time if accessing unnamed data attribute. */
- if (na->type == AT_DATA && na->name == AT_UNNAMED) {
+ if (!NVolReadOnly(vol) && !NVolNoATime(vol) && na->type == AT_DATA &&
+ na->name == AT_UNNAMED) {
na->ni->last_access_time = time(NULL);
NInoFileNameSetDirty(na->ni);
NInoSetDirty(na->ni);
@@ -784,7 +786,6 @@ s64 ntfs_attr_pread(ntfs_attr *na, const
return 0;
count = na->data_size - pos;
}
- vol = na->ni->vol;
/* If it is a resident attribute, get the value from the mft record. */
if (!NAttrNonResident(na)) {
ntfs_attr_search_ctx *ctx;
Index: volume.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/libntfs/volume.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -p -r1.66 -r1.67
--- volume.c 13 Nov 2005 19:25:05 -0000 1.66
+++ volume.c 15 Nov 2005 16:31:40 -0000 1.67
@@ -384,7 +384,7 @@ error_exit:
/**
* ntfs_volume_startup - allocate and setup an ntfs volume
* @dev: device to open
- * @rwflag: optional mount flags
+ * @flags: optional mount flags
*
* Load, verify, and parse bootsector; load and setup $MFT and $MFTMirr. After
* calling this function, the volume is setup sufficiently to call all read
@@ -393,7 +393,7 @@ 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 rwflag)
+ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long flags)
{
LCN mft_zone_size, mft_lcn;
s64 br;
@@ -429,8 +429,10 @@ ntfs_volume *ntfs_volume_startup(struct
}
ntfs_upcase_table_build(vol->upcase,
vol->upcase_len * sizeof(ntfschar));
- if ((rwflag & MS_RDONLY) == MS_RDONLY)
+ if (flags & MS_RDONLY)
NVolSetReadOnly(vol);
+ if (flags & MS_NOATIME)
+ NVolSetNoATime(vol);
ntfs_log_debug("Reading bootsector... ");
if (dev->d_ops->open(dev, NVolReadOnly(vol) ? O_RDONLY: O_RDWR)) {
ntfs_log_debug(FAILED);
@@ -730,15 +732,16 @@ out:
/**
* ntfs_device_mount - open ntfs volume
* @dev: device to open
- * @rwflag: optional mount flags
+ * @flags: optional mount flags
*
* This function mounts an ntfs volume. @dev should describe the device which
* to mount as the ntfs volume.
*
- * @rwflags is an optional second parameter. The same flags are used as for
- * the mount system call (man 2 mount). Currently only the following flag
- * is implemented:
+ * @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
+ * are implemented:
* MS_RDONLY - mount volume read-only
+ * MS_NOATIME - do not update access time
*
* The function opens the device @dev and verifies that it contains a valid
* bootsector. Then, it allocates an ntfs_volume structure and initializes
@@ -749,7 +752,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 rwflag)
+ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long flags)
{
s64 l;
#ifndef NTFS_DISABLE_DEBUG_LOGGING
@@ -767,7 +770,7 @@ ntfs_volume *ntfs_device_mount(struct nt
int i, j, eo;
u32 u;
- vol = ntfs_volume_startup(dev, rwflag);
+ vol = ntfs_volume_startup(dev, flags);
if (!vol) {
ntfs_log_perror("Failed to startup volume");
return NULL;
@@ -1101,7 +1104,7 @@ ntfs_volume *ntfs_device_mount(struct nt
* Check for dirty logfile and hibernated Windows.
* We care only about read-write mounts.
*/
- if (!(rwflag & MS_RDONLY)) {
+ if (!(flags & MS_RDONLY)) {
if (ntfs_volume_check_logfile(vol) < 0)
goto error_exit;
if (ntfs_volume_check_hiberfile(vol) < 0)
@@ -1125,15 +1128,16 @@ error_exit:
/**
* ntfs_mount - open ntfs volume
* @name: name of device/file to open
- * @rwflag: optional mount flags
+ * @flags: optional mount flags
*
* This function mounts an ntfs volume. @name should contain the name of the
* device/file to mount as the ntfs volume.
*
- * @rwflags is an optional second parameter. The same flags are used as for
- * the mount system call (man 2 mount). Currently only the following flag
- * is implemented:
+ * @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
+ * are implemented:
* MS_RDONLY - mount volume read-only
+ * MS_NOATIME - do not update access time
*
* 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
@@ -1148,7 +1152,7 @@ error_exit:
* soon as the function returns.
*/
ntfs_volume *ntfs_mount(const char *name __attribute__((unused)),
- unsigned long rwflag __attribute__((unused)))
+ unsigned long flags __attribute__((unused)))
{
#ifndef NO_NTFS_DEVICE_DEFAULT_IO_OPS
struct ntfs_device *dev;
@@ -1159,7 +1163,7 @@ ntfs_volume *ntfs_mount(const char *name
if (!dev)
return NULL;
/* Call ntfs_device_mount() to do the actual mount. */
- vol = ntfs_device_mount(dev, rwflag);
+ vol = ntfs_device_mount(dev, flags);
if (!vol) {
int eo = errno;
ntfs_device_free(dev);
|