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:
Gerasim Troeglazov 2009-09-13 04:41:59 +00:00
parent b48e7fc842
commit 615e223aae
5 changed files with 41 additions and 7 deletions

View File

@ -94,6 +94,16 @@ get_node_type(ntfs_inode* ni, int* _type)
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
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;
ns->flags |= B_FS_IS_READONLY;
}
// if (ns->noatime)
// mnt_flags |= MS_NOATIME;
// TODO: this does not take read-only volumes into account!
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);
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);
} else
result = errno;
}
@ -1022,7 +1032,8 @@ fs_read(fs_volume *_vol, fs_vnode *_dir, void *_cookie, off_t offset, void *buf,
}
*len = total;
fs_ntfs_update_times(_vol, ni, NTFS_UPDATE_ATIME);
exit:
if (na)
ntfs_attr_close(na);
@ -1117,6 +1128,9 @@ fs_write(fs_volume *_vol, fs_vnode *_dir, void *_cookie, off_t offset,
}
*len = total;
if (total > 0)
fs_ntfs_update_times(_vol, ni, NTFS_UPDATE_MCTIME);
ERRPRINT(("fs_write - OK\n"));
exit:
@ -1339,7 +1353,9 @@ fs_create_symlink(fs_volume *_vol, fs_vnode *_dir, const char *name,
}
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));
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));
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);
} else

View File

@ -52,6 +52,7 @@
extern fs_vnode_ops gNTFSVnodeOps;
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,
void **_cookie);

View File

@ -136,16 +136,31 @@ status_t
fs_closedir( fs_volume *_vol, fs_vnode *_node, void *cookie )
{
nspace *ns = (nspace*)_vol->private_volume;
vnode *node = (vnode*)_node->private_node;
int result = B_NO_ERROR;
ntfs_inode *ni=NULL;
LOCK_VOL(ns);
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");
UNLOCK_VOL(ns);
return B_NO_ERROR;
return result;
}
status_t

View File

@ -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_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

View File

@ -1107,4 +1107,3 @@ err_out:
errno = eo;
return ERR_MREF(-1);
}