1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-28 01:58:17 +03:00

smbd: Remove "file_sync_all" function

Replace with a call to files_forall. Why? I just came across this
function that only has one pretty obscure user. This does not justify
a full library function, IMHO at least.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Volker Lendecke 2018-09-13 06:21:37 +02:00
parent 41f2d1d1bd
commit aa30fd54a2
3 changed files with 18 additions and 18 deletions

View File

@ -454,22 +454,6 @@ bool file_find_subpath(files_struct *dir_fsp)
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.
****************************************************************************/

View File

@ -402,7 +402,6 @@ struct files_struct *file_find_one_fsp_from_lease_key(
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);

View File

@ -5267,6 +5267,23 @@ void reply_lseek(struct smb_request *req)
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.
****************************************************************************/
@ -5292,7 +5309,7 @@ void reply_flush(struct smb_request *req)
}
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)) {