Added support for updating the access and change time to the file/directory. +alphabranch (forgot to add to the previous commit)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33111 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -94,6 +94,16 @@ get_node_type(ntfs_inode* ni, int* _type)
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
fs_ntfs_update_times(fs_volume *vol, ntfs_inode *ni, ntfs_time_update_flags mask)
|
||||||
|
{
|
||||||
|
nspace *ns = (nspace*)vol->private_volume;
|
||||||
|
|
||||||
|
if (ns->noatime)
|
||||||
|
mask &= ~NTFS_UPDATE_ATIME;
|
||||||
|
|
||||||
|
ntfs_inode_update_times(ni, mask);
|
||||||
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
fs_identify_partition(int fd, partition_data *partition, void **_cookie)
|
fs_identify_partition(int fd, partition_data *partition, void **_cookie)
|
||||||
@@ -213,8 +223,6 @@ fs_mount(fs_volume *_vol, const char *device, ulong flags, const char *args,
|
|||||||
mountFlags |= MS_RDONLY;
|
mountFlags |= MS_RDONLY;
|
||||||
ns->flags |= B_FS_IS_READONLY;
|
ns->flags |= B_FS_IS_READONLY;
|
||||||
}
|
}
|
||||||
// if (ns->noatime)
|
|
||||||
// mnt_flags |= MS_NOATIME;
|
|
||||||
|
|
||||||
// TODO: this does not take read-only volumes into account!
|
// TODO: this does not take read-only volumes into account!
|
||||||
ns->ntvol = utils_mount_volume(device, mountFlags, true);
|
ns->ntvol = utils_mount_volume(device, mountFlags, true);
|
||||||
@@ -931,8 +939,10 @@ fs_create(fs_volume *_vol, fs_vnode *_dir, const char *name, int omode,
|
|||||||
S_IFREG, 0);
|
S_IFREG, 0);
|
||||||
|
|
||||||
ntfs_mark_free_space_outdated(ns);
|
ntfs_mark_free_space_outdated(ns);
|
||||||
|
fs_ntfs_update_times(_vol, ni, NTFS_UPDATE_MCTIME);
|
||||||
|
|
||||||
notify_entry_created(ns->id, MREF(bi->mft_no), name, *_vnid);
|
notify_entry_created(ns->id, MREF(bi->mft_no), name, *_vnid);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
result = errno;
|
result = errno;
|
||||||
}
|
}
|
||||||
@@ -1022,7 +1032,8 @@ fs_read(fs_volume *_vol, fs_vnode *_dir, void *_cookie, off_t offset, void *buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
*len = total;
|
*len = total;
|
||||||
|
fs_ntfs_update_times(_vol, ni, NTFS_UPDATE_ATIME);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
if (na)
|
if (na)
|
||||||
ntfs_attr_close(na);
|
ntfs_attr_close(na);
|
||||||
@@ -1117,6 +1128,9 @@ fs_write(fs_volume *_vol, fs_vnode *_dir, void *_cookie, off_t offset,
|
|||||||
}
|
}
|
||||||
|
|
||||||
*len = total;
|
*len = total;
|
||||||
|
if (total > 0)
|
||||||
|
fs_ntfs_update_times(_vol, ni, NTFS_UPDATE_MCTIME);
|
||||||
|
|
||||||
ERRPRINT(("fs_write - OK\n"));
|
ERRPRINT(("fs_write - OK\n"));
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
@@ -1339,7 +1353,9 @@ fs_create_symlink(fs_volume *_vol, fs_vnode *_dir, const char *name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
put_vnode(_vol, MREF(sym->mft_no));
|
put_vnode(_vol, MREF(sym->mft_no));
|
||||||
|
fs_ntfs_update_times(_vol, sym, NTFS_UPDATE_CTIME);
|
||||||
|
fs_ntfs_update_times(_vol, bi, NTFS_UPDATE_MCTIME);
|
||||||
|
|
||||||
notify_entry_created(ns->id, MREF( bi->mft_no ), name, MREF(sym->mft_no));
|
notify_entry_created(ns->id, MREF( bi->mft_no ), name, MREF(sym->mft_no));
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
@@ -1420,6 +1436,7 @@ fs_mkdir(fs_volume *_vol, fs_vnode *_dir, const char *name, int perms)
|
|||||||
put_vnode(_vol, MREF(ni->mft_no));
|
put_vnode(_vol, MREF(ni->mft_no));
|
||||||
|
|
||||||
ntfs_mark_free_space_outdated(ns);
|
ntfs_mark_free_space_outdated(ns);
|
||||||
|
fs_ntfs_update_times(_vol, ni, NTFS_UPDATE_MCTIME);
|
||||||
|
|
||||||
notify_entry_created(ns->id, MREF(bi->mft_no), name, vnid);
|
notify_entry_created(ns->id, MREF(bi->mft_no), name, vnid);
|
||||||
} else
|
} else
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
extern fs_vnode_ops gNTFSVnodeOps;
|
extern fs_vnode_ops gNTFSVnodeOps;
|
||||||
extern fs_volume_ops gNTFSVolumeOps;
|
extern fs_volume_ops gNTFSVolumeOps;
|
||||||
|
|
||||||
|
void fs_ntfs_update_times(fs_volume *vol, ntfs_inode *ni, ntfs_time_update_flags mask);
|
||||||
|
|
||||||
float fs_identify_partition(int fd, partition_data *partition,
|
float fs_identify_partition(int fd, partition_data *partition,
|
||||||
void **_cookie);
|
void **_cookie);
|
||||||
|
|||||||
@@ -136,16 +136,31 @@ status_t
|
|||||||
fs_closedir( fs_volume *_vol, fs_vnode *_node, void *cookie )
|
fs_closedir( fs_volume *_vol, fs_vnode *_node, void *cookie )
|
||||||
{
|
{
|
||||||
nspace *ns = (nspace*)_vol->private_volume;
|
nspace *ns = (nspace*)_vol->private_volume;
|
||||||
|
vnode *node = (vnode*)_node->private_node;
|
||||||
|
int result = B_NO_ERROR;
|
||||||
|
ntfs_inode *ni=NULL;
|
||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
ERRPRINT("fs_closedir - ENTER\n");
|
ERRPRINT("fs_closedir - ENTER\n");
|
||||||
|
|
||||||
|
ni = ntfs_inode_open(ns->ntvol, node->vnid);
|
||||||
|
if(ni==NULL) {
|
||||||
|
result = ENOENT;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
fs_ntfs_update_times(_vol, ni, NTFS_UPDATE_ATIME);
|
||||||
|
|
||||||
|
exit:
|
||||||
|
if(ni)
|
||||||
|
ntfs_inode_close(ni);
|
||||||
|
|
||||||
ERRPRINT("fs_closedir - EXIT\n");
|
ERRPRINT("fs_closedir - EXIT\n");
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
return B_NO_ERROR;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
|
|||||||
@@ -38,4 +38,6 @@ status_t fs_opendir(fs_volume *volume, fs_vnode *vnode, void** cookie);
|
|||||||
status_t fs_readdir(fs_volume *volume, fs_vnode *vnode, void *_cookie, struct dirent *buf, size_t bufsize, uint32 *num );
|
status_t fs_readdir(fs_volume *volume, fs_vnode *vnode, void *_cookie, struct dirent *buf, size_t bufsize, uint32 *num );
|
||||||
status_t fs_rewinddir(fs_volume *volume, fs_vnode *vnode, void *cookie);
|
status_t fs_rewinddir(fs_volume *volume, fs_vnode *vnode, void *cookie);
|
||||||
|
|
||||||
|
extern void fs_ntfs_update_times(fs_volume *vol, ntfs_inode *ni, ntfs_time_update_flags mask);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1107,4 +1107,3 @@ err_out:
|
|||||||
errno = eo;
|
errno = eo;
|
||||||
return ERR_MREF(-1);
|
return ERR_MREF(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user