return false;
}
-/****************************************************************************
- Sync open files on a connection.
-****************************************************************************/
-
-void file_sync_all(connection_struct *conn)
-{
- files_struct *fsp, *next;
-
- for (fsp=conn->sconn->files; fsp; fsp=next) {
- next=fsp->next;
- if ((conn == fsp->conn) && (fsp->fh->fd != -1)) {
- sync_file(conn, fsp, True /* write through */);
- }
- }
-}
-
/****************************************************************************
Free up a fsp.
****************************************************************************/
struct smbd_server_connection *sconn,
const struct smb2_lease_key *lease_key);
bool file_find_subpath(files_struct *dir_fsp);
-void file_sync_all(connection_struct *conn);
void fsp_free(files_struct *fsp);
void file_free(struct smb_request *req, files_struct *fsp);
files_struct *file_fsp(struct smb_request *req, uint16_t fid);
return;
}
+static struct files_struct *file_sync_one_fn(struct files_struct *fsp,
+ void *private_data)
+{
+ connection_struct *conn = talloc_get_type_abort(
+ private_data, connection_struct);
+
+ if (conn != fsp->conn) {
+ return NULL;
+ }
+ if (fsp->fh->fd == -1) {
+ return NULL;
+ }
+ sync_file(conn, fsp, True /* write through */);
+
+ return NULL;
+}
+
/****************************************************************************
Reply to a flush.
****************************************************************************/
}
if (!fsp) {
- file_sync_all(conn);
+ files_forall(req->sconn, file_sync_one_fn, conn);
} else {
NTSTATUS status = sync_file(conn, fsp, True);
if (!NT_STATUS_IS_OK(status)) {