From 0acf72bf2f35e9f06ba36a565e49820a316fdf11 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 11 Feb 2022 09:37:35 +0100 Subject: [PATCH] smbd: Introduce fsp_is_alternate_stream() To me this is more descriptive than "fsp->base_fsp != NULL". If this turns out to be a performance problem, I would go and make this a static inline in smbd/proto.h. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison (backported from commit 21b380ca133417df096e2b262a5da41faff186ea) [slow@samba.org: only backport the function, skip all changed callers] --- source3/smbd/files.c | 5 +++++ source3/smbd/proto.h | 1 + 2 files changed, 6 insertions(+) diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 3f90c2e247e..2930ceb18f6 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -1487,3 +1487,8 @@ void fsp_set_base_fsp(struct files_struct *fsp, struct files_struct *base_fsp) fsp->base_fsp->stream_fsp = fsp; } } + +bool fsp_is_alternate_stream(const struct files_struct *fsp) +{ + return (fsp->base_fsp != NULL); +} diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index d937d3d9615..9539a3c2d4c 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -438,6 +438,7 @@ NTSTATUS fsp_set_smb_fname(struct files_struct *fsp, const struct smb_filename *smb_fname_in); size_t fsp_fullbasepath(struct files_struct *fsp, char *buf, size_t buflen); void fsp_set_base_fsp(struct files_struct *fsp, struct files_struct *base_fsp); +bool fsp_is_alternate_stream(const struct files_struct *fsp); NTSTATUS create_internal_fsp(connection_struct *conn, const struct smb_filename *smb_fname, -- 2.11.4.GIT