implement fdatasync
Change-Id: I2aefc1acebce93a2c53a6d3be5eef3b9e69480ec Reviewed-on: https://review.haiku-os.org/c/haiku/+/8507 Tested-by: Commit checker robot <[email protected]> Reviewed-by: nephele nephele <[email protected]> Reviewed-by: Jérôme Duval <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
258fce50e0
commit
8e086795b2
@@ -62,7 +62,7 @@ extern int _kern_open_dir_entry_ref(dev_t device, ino_t inode,
|
|||||||
extern int _kern_open_dir(int fd, const char *path);
|
extern int _kern_open_dir(int fd, const char *path);
|
||||||
extern int _kern_open_parent_dir(int fd, char *name,
|
extern int _kern_open_parent_dir(int fd, char *name,
|
||||||
size_t nameLength);
|
size_t nameLength);
|
||||||
extern status_t _kern_fsync(int fd);
|
extern status_t _kern_fsync(int fd, bool dataOnly);
|
||||||
extern off_t _kern_seek(int fd, off_t pos, int seekType);
|
extern off_t _kern_seek(int fd, off_t pos, int seekType);
|
||||||
extern status_t _kern_create_dir_entry_ref(dev_t device, ino_t inode,
|
extern status_t _kern_create_dir_entry_ref(dev_t device, ino_t inode,
|
||||||
const char *name, int perms);
|
const char *name, int perms);
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ struct fs_vnode_ops {
|
|||||||
uint8 event, selectsync* sync);
|
uint8 event, selectsync* sync);
|
||||||
status_t (*deselect)(fs_volume* volume, fs_vnode* vnode, void* cookie,
|
status_t (*deselect)(fs_volume* volume, fs_vnode* vnode, void* cookie,
|
||||||
uint8 event, selectsync* sync);
|
uint8 event, selectsync* sync);
|
||||||
status_t (*fsync)(fs_volume* volume, fs_vnode* vnode);
|
status_t (*fsync)(fs_volume* volume, fs_vnode* vnode, bool dataOnly);
|
||||||
|
|
||||||
status_t (*read_symlink)(fs_volume* volume, fs_vnode* link, char* buffer,
|
status_t (*read_symlink)(fs_volume* volume, fs_vnode* link, char* buffer,
|
||||||
size_t* _bufferSize);
|
size_t* _bufferSize);
|
||||||
|
|||||||
@@ -72,7 +72,7 @@
|
|||||||
#define _POSIX_SPAWN (200809L)
|
#define _POSIX_SPAWN (200809L)
|
||||||
#define _POSIX_SPIN_LOCKS (-1)
|
#define _POSIX_SPIN_LOCKS (-1)
|
||||||
#define _POSIX_SPORADIC_SERVER (-1)
|
#define _POSIX_SPORADIC_SERVER (-1)
|
||||||
#define _POSIX_SYNCHRONIZED_IO (-1) /* missing fdatasync() */
|
#define _POSIX_SYNCHRONIZED_IO (200809L)
|
||||||
#define _POSIX_THREAD_ATTR_STACKADDR (200809L)
|
#define _POSIX_THREAD_ATTR_STACKADDR (200809L)
|
||||||
#define _POSIX_THREAD_ATTR_STACKSIZE (200809L)
|
#define _POSIX_THREAD_ATTR_STACKSIZE (200809L)
|
||||||
#define _POSIX_THREAD_CPUTIME (200809L)
|
#define _POSIX_THREAD_CPUTIME (200809L)
|
||||||
@@ -401,6 +401,7 @@ extern off_t lseek(int fd, off_t offset, int whence);
|
|||||||
|
|
||||||
extern void sync(void);
|
extern void sync(void);
|
||||||
extern int fsync(int fd);
|
extern int fsync(int fd);
|
||||||
|
extern int fdatasync(int fd);
|
||||||
|
|
||||||
extern int chown(const char *path, uid_t owner, gid_t group);
|
extern int chown(const char *path, uid_t owner, gid_t group);
|
||||||
extern int fchown(int fd, uid_t owner, gid_t group);
|
extern int fchown(int fd, uid_t owner, gid_t group);
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ struct fssh_fs_vnode_ops {
|
|||||||
fssh_fs_cookie cookie, uint8_t event, fssh_selectsync *sync);
|
fssh_fs_cookie cookie, uint8_t event, fssh_selectsync *sync);
|
||||||
fssh_status_t (*deselect)(fssh_fs_volume *volume, fssh_fs_vnode *vnode,
|
fssh_status_t (*deselect)(fssh_fs_volume *volume, fssh_fs_vnode *vnode,
|
||||||
fssh_fs_cookie cookie, uint8_t event, fssh_selectsync *sync);
|
fssh_fs_cookie cookie, uint8_t event, fssh_selectsync *sync);
|
||||||
fssh_status_t (*fsync)(fssh_fs_volume *volume, fssh_fs_vnode *vnode);
|
fssh_status_t (*fsync)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, bool dataOnly);
|
||||||
|
|
||||||
fssh_status_t (*read_symlink)(fssh_fs_volume *volume, fssh_fs_vnode *link,
|
fssh_status_t (*read_symlink)(fssh_fs_volume *volume, fssh_fs_vnode *link,
|
||||||
char *buffer, fssh_size_t *_bufferSize);
|
char *buffer, fssh_size_t *_bufferSize);
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ int _user_open_dir_entry_ref(dev_t device, ino_t inode,
|
|||||||
int _user_open_dir(int fd, const char *path);
|
int _user_open_dir(int fd, const char *path);
|
||||||
int _user_open_parent_dir(int fd, char *name, size_t nameLength);
|
int _user_open_parent_dir(int fd, char *name, size_t nameLength);
|
||||||
status_t _user_fcntl(int fd, int op, size_t argument);
|
status_t _user_fcntl(int fd, int op, size_t argument);
|
||||||
status_t _user_fsync(int fd);
|
status_t _user_fsync(int fd, bool dataOnly);
|
||||||
status_t _user_flock(int fd, int op);
|
status_t _user_flock(int fd, int op);
|
||||||
status_t _user_read_stat(int fd, const char *path, bool traverseLink,
|
status_t _user_read_stat(int fd, const char *path, bool traverseLink,
|
||||||
struct stat *stat, size_t statSize);
|
struct stat *stat, size_t statSize);
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ extern int _kern_open_dir(int fd, const char *path);
|
|||||||
extern int _kern_open_parent_dir(int fd, char *name,
|
extern int _kern_open_parent_dir(int fd, char *name,
|
||||||
size_t nameLength);
|
size_t nameLength);
|
||||||
extern status_t _kern_fcntl(int fd, int op, size_t argument);
|
extern status_t _kern_fcntl(int fd, int op, size_t argument);
|
||||||
extern status_t _kern_fsync(int fd);
|
extern status_t _kern_fsync(int fd, bool dataOnly);
|
||||||
extern status_t _kern_flock(int fd, int op);
|
extern status_t _kern_flock(int fd, int op);
|
||||||
extern off_t _kern_seek(int fd, off_t pos, int seekType);
|
extern off_t _kern_seek(int fd, off_t pos, int seekType);
|
||||||
extern status_t _kern_create_dir_entry_ref(dev_t device, ino_t inode,
|
extern status_t _kern_create_dir_entry_ref(dev_t device, ino_t inode,
|
||||||
|
|||||||
@@ -849,7 +849,7 @@ bfs_set_flags(fs_volume* _volume, fs_vnode* _node, void* _cookie, int flags)
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
bfs_fsync(fs_volume* _volume, fs_vnode* _node)
|
bfs_fsync(fs_volume* _volume, fs_vnode* _node, bool dataOnly)
|
||||||
{
|
{
|
||||||
FUNCTION();
|
FUNCTION();
|
||||||
|
|
||||||
|
|||||||
@@ -422,7 +422,7 @@ bindfs_deselect(fs_volume* fsVolume, fs_vnode* fsNode, void* cookie,
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
bindfs_fsync(fs_volume* fsVolume, fs_vnode* fsNode)
|
bindfs_fsync(fs_volume* fsVolume, fs_vnode* fsNode, bool dataOnly)
|
||||||
{
|
{
|
||||||
Volume* volume = (Volume*)fsVolume->private_volume;
|
Volume* volume = (Volume*)fsVolume->private_volume;
|
||||||
Node* node = (Node*)fsNode->private_node;
|
Node* node = (Node*)fsNode->private_node;
|
||||||
@@ -432,7 +432,7 @@ bindfs_fsync(fs_volume* fsVolume, fs_vnode* fsNode)
|
|||||||
|
|
||||||
FETCH_SOURCE_VOLUME_AND_NODE(volume, node->ID());
|
FETCH_SOURCE_VOLUME_AND_NODE(volume, node->ID());
|
||||||
|
|
||||||
return sourceNode->ops->fsync(sourceVolume, sourceNode);
|
return sourceNode->ops->fsync(sourceVolume, sourceNode, dataOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1675,7 +1675,7 @@ cdda_free_cookie(fs_volume* _volume, fs_vnode* _node, void* _cookie)
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
cdda_fsync(fs_volume* _volume, fs_vnode* _node)
|
cdda_fsync(fs_volume* _volume, fs_vnode* _node, bool dataOnly)
|
||||||
{
|
{
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -576,7 +576,7 @@ ext2_set_flags(fs_volume* _volume, fs_vnode* _node, void* _cookie, int flags)
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
ext2_fsync(fs_volume* _volume, fs_vnode* _node)
|
ext2_fsync(fs_volume* _volume, fs_vnode* _node, bool dataOnly)
|
||||||
{
|
{
|
||||||
Inode* inode = (Inode*)_node->private_node;
|
Inode* inode = (Inode*)_node->private_node;
|
||||||
return inode->Sync();
|
return inode->Sync();
|
||||||
|
|||||||
@@ -1175,7 +1175,7 @@ dosfs_get_file_map(fs_volume* volume, fs_vnode* vnode, off_t position, size_t le
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
dosfs_fsync(fs_volume* volume, fs_vnode* vnode)
|
dosfs_fsync(fs_volume* volume, fs_vnode* vnode, bool dataOnly)
|
||||||
{
|
{
|
||||||
struct vnode* bsdNode = reinterpret_cast<struct vnode*>(vnode->private_node);
|
struct vnode* bsdNode = reinterpret_cast<struct vnode*>(vnode->private_node);
|
||||||
|
|
||||||
|
|||||||
@@ -1262,13 +1262,13 @@ overlay_deselect(fs_volume *volume, fs_vnode *vnode, void *cookie, uint8 event,
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
overlay_fsync(fs_volume *volume, fs_vnode *vnode)
|
overlay_fsync(fs_volume *volume, fs_vnode *vnode, bool dataOnly)
|
||||||
{
|
{
|
||||||
OverlayInode *node = (OverlayInode *)vnode->private_node;
|
OverlayInode *node = (OverlayInode *)vnode->private_node;
|
||||||
fs_vnode *superVnode = node->SuperVnode();
|
fs_vnode *superVnode = node->SuperVnode();
|
||||||
|
|
||||||
if (superVnode->ops->fsync != NULL)
|
if (superVnode->ops->fsync != NULL)
|
||||||
return superVnode->ops->fsync(volume->super_volume, superVnode);
|
return superVnode->ops->fsync(volume->super_volume, superVnode, dataOnly);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -255,14 +255,14 @@ overlay_deselect(fs_volume *volume, fs_vnode *vnode, void *cookie, uint8 event,
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
overlay_fsync(fs_volume *volume, fs_vnode *vnode)
|
overlay_fsync(fs_volume *volume, fs_vnode *vnode, bool dataOnly)
|
||||||
{
|
{
|
||||||
DO_LOG("%s\n", "fsync");
|
DO_LOG("%s\n", "fsync");
|
||||||
|
|
||||||
status_t result = B_UNSUPPORTED;
|
status_t result = B_UNSUPPORTED;
|
||||||
fs_vnode *superVnode = (fs_vnode *)vnode->private_node;
|
fs_vnode *superVnode = (fs_vnode *)vnode->private_node;
|
||||||
if (superVnode->ops->fsync != NULL)
|
if (superVnode->ops->fsync != NULL)
|
||||||
result = superVnode->ops->fsync(volume->super_volume, superVnode);
|
result = superVnode->ops->fsync(volume->super_volume, superVnode, dataOnly);
|
||||||
|
|
||||||
DO_LOG("fsync result: %#" B_PRIx32 "\n", result);
|
DO_LOG("fsync result: %#" B_PRIx32 "\n", result);
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -1770,7 +1770,7 @@ overlay_deselect(fs_volume *volume, fs_vnode *vnode, void *cookie, uint8 event,
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
overlay_fsync(fs_volume *volume, fs_vnode *vnode)
|
overlay_fsync(fs_volume *volume, fs_vnode *vnode, bool dataOnly)
|
||||||
{
|
{
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -492,7 +492,7 @@ nfs4_set_flags(fs_volume* volume, fs_vnode* vnode, void* _cookie, int flags)
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
nfs4_fsync(fs_volume* volume, fs_vnode* vnode)
|
nfs4_fsync(fs_volume* volume, fs_vnode* vnode, bool dataOnly)
|
||||||
{
|
{
|
||||||
VnodeToInode* vti = reinterpret_cast<VnodeToInode*>(vnode->private_node);
|
VnodeToInode* vti = reinterpret_cast<VnodeToInode*>(vnode->private_node);
|
||||||
TRACE("volume = %p, vnode = %" B_PRIi64 "\n", volume, vti->ID());
|
TRACE("volume = %p, vnode = %" B_PRIi64 "\n", volume, vti->ID());
|
||||||
|
|||||||
@@ -942,7 +942,7 @@ fs_write(fs_volume* _volume, fs_vnode* _node, void* _cookie, off_t pos,
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
fs_fsync(fs_volume* _volume, fs_vnode* _node)
|
fs_fsync(fs_volume* _volume, fs_vnode* _node, bool dataOnly)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
vnode* node = (vnode*)_node->private_node;
|
vnode* node = (vnode*)_node->private_node;
|
||||||
|
|||||||
@@ -351,7 +351,7 @@ ramfs_set_flags(fs_volume* /*fs*/, fs_vnode* /*node*/, void* /*cookie*/,
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
ramfs_fsync(fs_volume* /*fs*/, fs_vnode* /*node*/)
|
ramfs_fsync(fs_volume* /*fs*/, fs_vnode* /*node*/, bool dataOnly)
|
||||||
{
|
{
|
||||||
FUNCTION_START();
|
FUNCTION_START();
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
@@ -344,7 +344,7 @@ userlandfs_deselect(fs_volume* fsVolume, fs_vnode* fsNode, void* cookie,
|
|||||||
|
|
||||||
// userlandfs_fsync
|
// userlandfs_fsync
|
||||||
static status_t
|
static status_t
|
||||||
userlandfs_fsync(fs_volume* fsVolume, fs_vnode* fsNode)
|
userlandfs_fsync(fs_volume* fsVolume, fs_vnode* fsNode, bool dataOnly)
|
||||||
{
|
{
|
||||||
Volume* volume = (Volume*)fsVolume->private_volume;
|
Volume* volume = (Volume*)fsVolume->private_volume;
|
||||||
PRINT(("userlandfs_fsync(%p, %p)\n", volume, fsNode->private_node));
|
PRINT(("userlandfs_fsync(%p, %p)\n", volume, fsNode->private_node));
|
||||||
|
|||||||
@@ -552,7 +552,7 @@ HaikuKernelVolume::FSync(void* _node)
|
|||||||
|
|
||||||
if (!node->ops->fsync)
|
if (!node->ops->fsync)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
return node->ops->fsync(&fVolume, node);
|
return node->ops->fsync(&fVolume, node, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadSymlink
|
// ReadSymlink
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ BNode::Unlock()
|
|||||||
status_t
|
status_t
|
||||||
BNode::Sync()
|
BNode::Sync()
|
||||||
{
|
{
|
||||||
return (fCStatus != B_OK) ? B_FILE_ERROR : _kern_fsync(fFd);
|
return (fCStatus != B_OK) ? B_FILE_ERROR : _kern_fsync(fFd, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -823,7 +823,7 @@ _kern_dup(int fd)
|
|||||||
|
|
||||||
// _kern_fsync
|
// _kern_fsync
|
||||||
status_t
|
status_t
|
||||||
_kern_fsync(int fd)
|
_kern_fsync(int fd, bool dataOnly)
|
||||||
{
|
{
|
||||||
// get the descriptor
|
// get the descriptor
|
||||||
FileDescriptor *descriptor
|
FileDescriptor *descriptor
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ BNode::Unlock()
|
|||||||
status_t
|
status_t
|
||||||
BNode::Sync()
|
BNode::Sync()
|
||||||
{
|
{
|
||||||
return (fCStatus != B_OK) ? B_FILE_ERROR : _kern_fsync(fFd);
|
return (fCStatus != B_OK) ? B_FILE_ERROR : _kern_fsync(fFd, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1189,7 +1189,7 @@ devfs_free_cookie(fs_volume* _volume, fs_vnode* _vnode, void* _cookie)
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
devfs_fsync(fs_volume* _volume, fs_vnode* _v)
|
devfs_fsync(fs_volume* _volume, fs_vnode* _v, bool dataOnly)
|
||||||
{
|
{
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1113,7 +1113,7 @@ fifo_free_cookie(fs_volume* _volume, fs_vnode* _node, void* _cookie)
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
fifo_fsync(fs_volume* _volume, fs_vnode* _node)
|
fifo_fsync(fs_volume* _volume, fs_vnode* _node, bool dataOnly)
|
||||||
{
|
{
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -631,7 +631,7 @@ rootfs_free_cookie(fs_volume* _volume, fs_vnode* _v, void* _cookie)
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
rootfs_fsync(fs_volume* _volume, fs_vnode* _v)
|
rootfs_fsync(fs_volume* _volume, fs_vnode* _v, bool dataOnly)
|
||||||
{
|
{
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -988,7 +988,7 @@ free_vnode(struct vnode* vnode, bool reenter)
|
|||||||
// will be discarded
|
// will be discarded
|
||||||
|
|
||||||
if (!vnode->IsRemoved() && HAS_FS_CALL(vnode, fsync))
|
if (!vnode->IsRemoved() && HAS_FS_CALL(vnode, fsync))
|
||||||
FS_CALL_NO_PARAMS(vnode, fsync);
|
FS_CALL(vnode, fsync, false);
|
||||||
|
|
||||||
// Note: If this vnode has a cache attached, there will still be two
|
// Note: If this vnode has a cache attached, there will still be two
|
||||||
// references to that cache at this point. The last one belongs to the vnode
|
// references to that cache at this point. The last one belongs to the vnode
|
||||||
@@ -6416,9 +6416,9 @@ common_fcntl(int fd, int op, size_t argument, bool kernel)
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
common_sync(int fd, bool kernel)
|
common_sync(int fd, bool dataOnly, bool kernel)
|
||||||
{
|
{
|
||||||
FUNCTION(("common_fsync: entry. fd %d kernel %d\n", fd, kernel));
|
FUNCTION(("common_sync: entry. fd %d kernel %d, data only %d\n", fd, kernel, dataOnly));
|
||||||
|
|
||||||
struct vnode* vnode;
|
struct vnode* vnode;
|
||||||
FileDescriptorPutter descriptor(get_fd_and_vnode(fd, &vnode, kernel));
|
FileDescriptorPutter descriptor(get_fd_and_vnode(fd, &vnode, kernel));
|
||||||
@@ -6427,7 +6427,7 @@ common_sync(int fd, bool kernel)
|
|||||||
|
|
||||||
status_t status;
|
status_t status;
|
||||||
if (HAS_FS_CALL(vnode, fsync))
|
if (HAS_FS_CALL(vnode, fsync))
|
||||||
status = FS_CALL_NO_PARAMS(vnode, fsync);
|
status = FS_CALL(vnode, fsync, dataOnly);
|
||||||
else
|
else
|
||||||
status = B_UNSUPPORTED;
|
status = B_UNSUPPORTED;
|
||||||
|
|
||||||
@@ -8439,9 +8439,9 @@ _kern_fcntl(int fd, int op, size_t argument)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
_kern_fsync(int fd)
|
_kern_fsync(int fd, bool dataOnly)
|
||||||
{
|
{
|
||||||
return common_sync(fd, true);
|
return common_sync(fd, dataOnly, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -9272,9 +9272,9 @@ _user_fcntl(int fd, int op, size_t argument)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
_user_fsync(int fd)
|
_user_fsync(int fd, bool dataOnly)
|
||||||
{
|
{
|
||||||
return common_sync(fd, false);
|
return common_sync(fd, dataOnly, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,14 @@
|
|||||||
int
|
int
|
||||||
fsync(int fd)
|
fsync(int fd)
|
||||||
{
|
{
|
||||||
RETURN_AND_SET_ERRNO_TEST_CANCEL(_kern_fsync(fd));
|
RETURN_AND_SET_ERRNO_TEST_CANCEL(_kern_fsync(fd, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
fdatasync(int fd)
|
||||||
|
{
|
||||||
|
RETURN_AND_SET_ERRNO_TEST_CANCEL(_kern_fsync(fd, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ int _kern_open_dir_entry_ref(fssh_dev_t device, fssh_ino_t inode,
|
|||||||
const char *name);
|
const char *name);
|
||||||
int _kern_open_dir(int fd, const char *path);
|
int _kern_open_dir(int fd, const char *path);
|
||||||
fssh_status_t _kern_fcntl(int fd, int op, uint32_t argument);
|
fssh_status_t _kern_fcntl(int fd, int op, uint32_t argument);
|
||||||
fssh_status_t _kern_fsync(int fd);
|
fssh_status_t _kern_fsync(int fd, bool dataOnly);
|
||||||
fssh_status_t _kern_lock_node(int fd);
|
fssh_status_t _kern_lock_node(int fd);
|
||||||
fssh_status_t _kern_unlock_node(int fd);
|
fssh_status_t _kern_unlock_node(int fd);
|
||||||
fssh_status_t _kern_create_dir_entry_ref(fssh_dev_t device, fssh_ino_t inode,
|
fssh_status_t _kern_create_dir_entry_ref(fssh_dev_t device, fssh_ino_t inode,
|
||||||
|
|||||||
@@ -638,7 +638,7 @@ free_vnode(struct vnode *vnode, bool reenter)
|
|||||||
// will be discarded
|
// will be discarded
|
||||||
|
|
||||||
if (!vnode->remove && HAS_FS_CALL(vnode, fsync))
|
if (!vnode->remove && HAS_FS_CALL(vnode, fsync))
|
||||||
FS_CALL_NO_PARAMS(vnode, fsync);
|
FS_CALL(vnode, fsync, false);
|
||||||
|
|
||||||
if (!vnode->unpublished) {
|
if (!vnode->unpublished) {
|
||||||
if (vnode->remove)
|
if (vnode->remove)
|
||||||
@@ -3619,7 +3619,7 @@ common_fcntl(int fd, int op, uint32_t argument, bool kernel)
|
|||||||
|
|
||||||
|
|
||||||
static fssh_status_t
|
static fssh_status_t
|
||||||
common_sync(int fd, bool kernel)
|
common_sync(int fd, bool dataOnly, bool kernel)
|
||||||
{
|
{
|
||||||
struct file_descriptor *descriptor;
|
struct file_descriptor *descriptor;
|
||||||
struct vnode *vnode;
|
struct vnode *vnode;
|
||||||
@@ -3632,7 +3632,7 @@ common_sync(int fd, bool kernel)
|
|||||||
return FSSH_B_FILE_ERROR;
|
return FSSH_B_FILE_ERROR;
|
||||||
|
|
||||||
if (HAS_FS_CALL(vnode, fsync))
|
if (HAS_FS_CALL(vnode, fsync))
|
||||||
status = FS_CALL_NO_PARAMS(vnode, fsync);
|
status = FS_CALL(vnode, fsync, dataOnly);
|
||||||
else
|
else
|
||||||
status = FSSH_EOPNOTSUPP;
|
status = FSSH_EOPNOTSUPP;
|
||||||
|
|
||||||
@@ -4904,7 +4904,7 @@ fs_sync(fssh_dev_t device)
|
|||||||
put_vnode(previousVnode);
|
put_vnode(previousVnode);
|
||||||
|
|
||||||
if (HAS_FS_CALL(vnode, fsync))
|
if (HAS_FS_CALL(vnode, fsync))
|
||||||
FS_CALL_NO_PARAMS(vnode, fsync);
|
FS_CALL(vnode, fsync, false);
|
||||||
|
|
||||||
// the next vnode might change until we lock the vnode list again,
|
// the next vnode might change until we lock the vnode list again,
|
||||||
// but this vnode won't go away since we keep a reference to it.
|
// but this vnode won't go away since we keep a reference to it.
|
||||||
@@ -5245,7 +5245,7 @@ _kern_fcntl(int fd, int op, uint32_t argument)
|
|||||||
fssh_status_t
|
fssh_status_t
|
||||||
_kern_fsync(int fd)
|
_kern_fsync(int fd)
|
||||||
{
|
{
|
||||||
return common_sync(fd, true);
|
return common_sync(fd, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user