1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

smbd: Remove unused "sbuf" argument from ReadDirName()

Nobody used that anymore, most callers had passed in NULL anyway.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2023-06-20 12:25:45 +02:00 committed by Jeremy Allison
parent f36bdcc0ca
commit daf6f2f7a1
10 changed files with 27 additions and 42 deletions

View File

@ -264,9 +264,7 @@ static int ceph_snap_enum_snapdir(struct vfs_handle_struct *handle,
sc_data->num_volumes = 0;
sc_data->labels = NULL;
while ((dname = ReadDirName(dir_hnd, NULL, &talloced))
!= NULL)
{
while ((dname = ReadDirName(dir_hnd, &talloced)) != NULL) {
if (ISDOT(dname) || ISDOTDOT(dname)) {
TALLOC_FREE(talloced);
continue;
@ -587,9 +585,7 @@ static int ceph_snap_gmt_convert_dir(struct vfs_handle_struct *handle,
goto err_out;
}
while ((dname = ReadDirName(dir_hnd, NULL, &talloced))
!= NULL)
{
while ((dname = ReadDirName(dir_hnd, &talloced)) != NULL) {
struct smb_filename *smb_fname = NULL;
struct smb_filename *atname = NULL;
time_t snap_secs = 0;

View File

@ -5224,9 +5224,7 @@ static bool fruit_get_num_bands(vfs_handle_struct *handle,
nbands = 0;
while ((dname = ReadDirName(dir_hnd, NULL, &talloced))
!= NULL)
{
while ((dname = ReadDirName(dir_hnd, &talloced)) != NULL) {
if (ISDOT(dname) || ISDOTDOT(dname)) {
continue;
}
@ -5365,9 +5363,7 @@ static uint64_t fruit_disk_free(vfs_handle_struct *handle,
return UINT64_MAX;
}
while ((dname = ReadDirName(dir_hnd, NULL, &talloced))
!= NULL)
{
while ((dname = ReadDirName(dir_hnd, &talloced)) != NULL) {
ok = fruit_tmsize_do_dirent(handle, &state, dname);
if (!ok) {
TALLOC_FREE(talloced);

View File

@ -195,7 +195,7 @@ static int shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle,
SHADOW_COPY_LABEL *tlabels;
int ret;
dname = ReadDirName(dir_hnd, NULL, &talloced);
dname = ReadDirName(dir_hnd, &talloced);
if (dname == NULL) {
break;
}

View File

@ -563,9 +563,7 @@ static NTSTATUS walk_streams(vfs_handle_struct *handle,
return status;
}
while ((dname = ReadDirName(dir_hnd, NULL, &talloced))
!= NULL)
{
while ((dname = ReadDirName(dir_hnd, &talloced)) != NULL) {
if (ISDOT(dname) || ISDOTDOT(dname)) {
TALLOC_FREE(talloced);
continue;

View File

@ -968,7 +968,7 @@ NTSTATUS recursive_rmdir(TALLOC_CTX *ctx,
dirfsp = dir_hnd_fetch_fsp(dir_hnd);
while ((dname = ReadDirName(dir_hnd, NULL, &talloced))) {
while ((dname = ReadDirName(dir_hnd, &talloced))) {
struct smb_filename *atname = NULL;
struct smb_filename *smb_dname_full = NULL;
char *fullname = NULL;
@ -1054,7 +1054,7 @@ NTSTATUS recursive_rmdir(TALLOC_CTX *ctx,
if (do_break) {
break;
}
}
}
TALLOC_FREE(dir_hnd);
return status;
}
@ -1169,8 +1169,7 @@ static NTSTATUS rmdir_internals(TALLOC_CTX *ctx, struct files_struct *fsp)
dirfsp = dir_hnd_fetch_fsp(dir_hnd);
while ((dname = ReadDirName(
dir_hnd, NULL, &talloced)) != NULL) {
while ((dname = ReadDirName(dir_hnd, &talloced)) != NULL) {
struct smb_filename *smb_dname_full = NULL;
struct smb_filename *direntry_fname = NULL;
char *fullname = NULL;
@ -1318,8 +1317,7 @@ static NTSTATUS rmdir_internals(TALLOC_CTX *ctx, struct files_struct *fsp)
/* Do a recursive delete. */
RewindDir(dir_hnd);
while ((dname = ReadDirName(
dir_hnd, NULL, &talloced)) != NULL) {
while ((dname = ReadDirName(dir_hnd, &talloced)) != NULL) {
struct smb_filename *direntry_fname = NULL;
struct smb_filename *smb_dname_full = NULL;
char *fullname = NULL;

View File

@ -407,7 +407,7 @@ char *dptr_ReadDirName(TALLOC_CTX *ctx, struct dptr_struct *dptr)
if (dptr->has_wild) {
const char *name_temp = NULL;
char *talloced = NULL;
name_temp = ReadDirName(dir_hnd, &st, &talloced);
name_temp = ReadDirName(dir_hnd, &talloced);
if (name_temp == NULL) {
return NULL;
}
@ -1249,9 +1249,11 @@ static NTSTATUS OpenDir_fsp(
Don't check for veto or invisible files.
********************************************************************/
const char *ReadDirName(struct smb_Dir *dir_hnd,
SMB_STRUCT_STAT *sbuf, char **ptalloced)
const char *ReadDirName(struct smb_Dir *dir_hnd, char **ptalloced)
{
struct stat_ex st = {
.st_ex_nlink = 0,
};
const char *n;
char *talloced = NULL;
connection_struct *conn = dir_hnd->conn;
@ -1267,7 +1269,11 @@ const char *ReadDirName(struct smb_Dir *dir_hnd,
return n;
}
while ((n = vfs_readdirname(conn, dir_hnd->fsp, dir_hnd->dir, sbuf, &talloced))) {
while ((n = vfs_readdirname(conn,
dir_hnd->fsp,
dir_hnd->dir,
&st,
&talloced))) {
/* Ignore . and .. - we've already returned them. */
if (ISDOT(n) || ISDOTDOT(n)) {
TALLOC_FREE(talloced);
@ -1425,7 +1431,7 @@ NTSTATUS can_delete_directory_fsp(files_struct *fsp)
return status;
}
while ((dname = ReadDirName(dir_hnd, NULL, &talloced))) {
while ((dname = ReadDirName(dir_hnd, &talloced))) {
struct smb_filename *smb_dname_full = NULL;
struct smb_filename *direntry_fname = NULL;
char *fullname = NULL;

View File

@ -323,7 +323,7 @@ NTSTATUS get_real_filename_full_scan_at(struct files_struct *dirfsp,
}
/* now scan for matching names */
while ((dname = ReadDirName(cur_dir, NULL, &talloced))) {
while ((dname = ReadDirName(cur_dir, &talloced))) {
/* Is it dot or dot dot. */
if (ISDOT(dname) || ISDOTDOT(dname)) {

View File

@ -1538,9 +1538,7 @@ static size_t count_dfs_links(TALLOC_CTX *ctx,
goto out;
}
while ((dname = ReadDirName(dir_hnd, NULL, &talloced))
!= NULL)
{
while ((dname = ReadDirName(dir_hnd, &talloced)) != NULL) {
struct smb_filename *smb_dname =
synthetic_smb_fname(frame,
dname,
@ -1680,9 +1678,7 @@ static int form_junctions(TALLOC_CTX *ctx,
goto out;
}
while ((dname = ReadDirName(dir_hnd, NULL, &talloced))
!= NULL)
{
while ((dname = ReadDirName(dir_hnd, &talloced)) != NULL) {
struct smb_filename *smb_dname = NULL;
if (cnt >= jn_remain) {

View File

@ -216,8 +216,7 @@ NTSTATUS OpenDir_from_pathref(TALLOC_CTX *mem_ctx,
const char *mask,
uint32_t attr,
struct smb_Dir **_dir_hnd);
const char *ReadDirName(struct smb_Dir *dir_hnd,
SMB_STRUCT_STAT *sbuf, char **talloced);
const char *ReadDirName(struct smb_Dir *dir_hnd, char **talloced);
void RewindDir(struct smb_Dir *dir_hnd);
NTSTATUS can_delete_directory(struct connection_struct *conn,
const char *dirname);

View File

@ -202,9 +202,7 @@ static NTSTATUS cmd_readdir(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc
return NT_STATUS_UNSUCCESSFUL;
}
dname = ReadDirName(vfs->currentdir,
NULL,
&talloced);
dname = ReadDirName(vfs->currentdir, &talloced);
if (dname == NULL) {
printf("readdir: NULL\n");
return NT_STATUS_OK;
@ -2154,9 +2152,7 @@ static NTSTATUS cmd_translate_name(struct vfs_state *vfs, TALLOC_CTX *mem_ctx,
while (true) {
/* ReadDirName() returns Windows "encoding" */
dname = ReadDirName(vfs->currentdir,
NULL,
&dname_talloced);
dname = ReadDirName(vfs->currentdir, &dname_talloced);
if (dname == NULL) {
break;
}