From: Volker Lendecke Date: Wed, 15 May 2024 15:10:24 +0000 (+0200) Subject: smbd: Modernize a few DEBUGs X-Git-Tag: tdb-1.4.11~628 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=477dec3770bbb30616b5e58f397f7541dc520abb;p=thirdparty%2Fsamba.git smbd: Modernize a few DEBUGs Signed-off-by: Volker Lendecke Reviewed-by: Andrew Bartlett --- diff --git a/source3/locking/posix.c b/source3/locking/posix.c index eedbbc1c58b..80d67745369 100644 --- a/source3/locking/posix.c +++ b/source3/locking/posix.c @@ -1048,9 +1048,11 @@ bool release_posix_lock_windows_flavour(files_struct *fsp, struct lock_list *ulist = NULL; struct lock_list *ul = NULL; - DEBUG(5, ("release_posix_lock_windows_flavour: File %s, offset = %ju, " - "count = %ju\n", fsp_str_dbg(fsp), - (uintmax_t)u_offset, (uintmax_t)u_count)); + DBG_INFO("File %s, offset = %" PRIu64 ", " + "count = %" PRIu64 "\n", + fsp_str_dbg(fsp), + u_offset, + u_count); /* Remember the number of locks we have on this dev/ino pair. */ decrement_lock_ref_count(fsp); @@ -1065,12 +1067,12 @@ bool release_posix_lock_windows_flavour(files_struct *fsp, } if ((ul_ctx = talloc_init("release_posix_lock")) == NULL) { - DEBUG(0,("release_posix_lock_windows_flavour: unable to init talloc context.\n")); + DBG_ERR("unable to init talloc context.\n"); return False; } if ((ul = talloc(ul_ctx, struct lock_list)) == NULL) { - DEBUG(0,("release_posix_lock_windows_flavour: unable to talloc unlock list.\n")); + DBG_ERR("unable to talloc unlock list.\n"); talloc_destroy(ul_ctx); return False; } @@ -1112,12 +1114,14 @@ bool release_posix_lock_windows_flavour(files_struct *fsp, if (deleted_lock_type == WRITE_LOCK && (!ulist || ulist->next != NULL || ulist->start != offset || ulist->size != count)) { - DEBUG(5, ("release_posix_lock_windows_flavour: downgrading " - "lock to READ: offset = %ju, count = %ju\n", - (uintmax_t)offset, (uintmax_t)count )); + DBG_INFO("downgrading lock to READ: offset = %" PRIu64 + ", count = %" PRIu64 "\n", + offset, + count); if (!posix_fcntl_lock(fsp,F_SETLK,offset,count,F_RDLCK)) { - DEBUG(0,("release_posix_lock_windows_flavour: downgrade of lock failed with error %s !\n", strerror(errno) )); + DBG_ERR("downgrade of lock failed with error %s !\n", + strerror(errno)); talloc_destroy(ul_ctx); return False; } @@ -1131,9 +1135,10 @@ bool release_posix_lock_windows_flavour(files_struct *fsp, offset = ulist->start; count = ulist->size; - DEBUG(5, ("release_posix_lock_windows_flavour: Real unlock: " - "offset = %ju, count = %ju\n", - (uintmax_t)offset, (uintmax_t)count )); + DBG_INFO("Real unlock: offset = %" PRIu64 ", count = %" PRIu64 + "\n", + offset, + count); if (!posix_fcntl_lock(fsp,F_SETLK,offset,count,F_UNLCK)) { ret = False; diff --git a/source3/smbd/smb2_read.c b/source3/smbd/smb2_read.c index bac78e4c77a..576a2c555dc 100644 --- a/source3/smbd/smb2_read.c +++ b/source3/smbd/smb2_read.c @@ -220,9 +220,9 @@ static int smb2_sendfile_send_data(struct smbd_smb2_read_state *state) hdr, in_offset, in_length); - DEBUG(10,("smb2_sendfile_send_data: SMB_VFS_SENDFILE returned %d on file %s\n", - (int)nread, - fsp_str_dbg(fsp) )); + DBG_DEBUG("SMB_VFS_SENDFILE returned %zd on file %s\n", + nread, + fsp_str_dbg(fsp)); if (nread == -1) { saved_errno = errno; @@ -251,21 +251,22 @@ static int smb2_sendfile_send_data(struct smbd_smb2_read_state *state) nread = fake_sendfile(xconn, fsp, in_offset, in_length); if (nread == -1) { saved_errno = errno; - DEBUG(0,("smb2_sendfile_send_data: fake_sendfile " - "failed for file %s (%s) for client %s. " - "Terminating\n", - fsp_str_dbg(fsp), strerror(saved_errno), - smbXsrv_connection_dbg(xconn))); + DBG_ERR("fake_sendfile failed for file %s " + "(%s) for client %s. Terminating\n", + fsp_str_dbg(fsp), + strerror(saved_errno), + smbXsrv_connection_dbg(xconn)); *pstatus = map_nt_error_from_unix_common(saved_errno); return 0; } goto out; } - DEBUG(0,("smb2_sendfile_send_data: sendfile failed for file " - "%s (%s) for client %s. Terminating\n", - fsp_str_dbg(fsp), strerror(saved_errno), - smbXsrv_connection_dbg(xconn))); + DBG_ERR("sendfile failed for file " + "%s (%s) for client %s. Terminating\n", + fsp_str_dbg(fsp), + strerror(saved_errno), + smbXsrv_connection_dbg(xconn)); *pstatus = map_nt_error_from_unix_common(saved_errno); return 0; } else if (nread == 0) { @@ -276,9 +277,9 @@ static int smb2_sendfile_send_data(struct smbd_smb2_read_state *state) * fallback to the normal read path so the header gets * the correct byte count. */ - DEBUG(3, ("send_file_readX: sendfile sent zero bytes " - "falling back to the normal read: %s\n", - fsp_str_dbg(fsp))); + DBG_NOTICE("sendfile sent zero bytes " + "falling back to the normal read: %s\n", + fsp_str_dbg(fsp)); goto normal_read; } @@ -293,21 +294,21 @@ normal_read: (const char *)hdr->data, hdr->length); if (ret != hdr->length) { saved_errno = errno; - DEBUG(0,("smb2_sendfile_send_data: write_data failed for file " - "%s (%s) for client %s. Terminating\n", - fsp_str_dbg(fsp), strerror(saved_errno), - smbXsrv_connection_dbg(xconn))); + DBG_ERR("write_data failed for file " + "%s (%s) for client %s. Terminating\n", + fsp_str_dbg(fsp), + strerror(saved_errno), + smbXsrv_connection_dbg(xconn)); *pstatus = map_nt_error_from_unix_common(saved_errno); return 0; } nread = fake_sendfile(xconn, fsp, in_offset, in_length); if (nread == -1) { - saved_errno = errno; - DEBUG(0,("smb2_sendfile_send_data: fake_sendfile " - "failed for file %s (%s) for client %s. " - "Terminating\n", - fsp_str_dbg(fsp), strerror(saved_errno), - smbXsrv_connection_dbg(xconn))); + DBG_ERR("fake_sendfile failed for file %s (%s) for client %s. " + "Terminating\n", + fsp_str_dbg(fsp), + strerror(saved_errno), + smbXsrv_connection_dbg(xconn)); *pstatus = map_nt_error_from_unix_common(saved_errno); return 0; } @@ -319,12 +320,12 @@ normal_read: hdr->length, in_length); if (ret == -1) { saved_errno = errno; - DEBUG(0,("%s: sendfile_short_send " - "failed for file %s (%s) for client %s. " - "Terminating\n", - __func__, - fsp_str_dbg(fsp), strerror(saved_errno), - smbXsrv_connection_dbg(xconn))); + DBG_ERR("sendfile_short_send " + "failed for file %s (%s) for client %s. " + "Terminating\n", + fsp_str_dbg(fsp), + strerror(saved_errno), + smbXsrv_connection_dbg(xconn)); *pstatus = map_nt_error_from_unix_common(saved_errno); return 0; } diff --git a/source3/smbd/smb2_trans2.c b/source3/smbd/smb2_trans2.c index 304fdda654f..2172af3d275 100644 --- a/source3/smbd/smb2_trans2.c +++ b/source3/smbd/smb2_trans2.c @@ -476,9 +476,10 @@ static NTSTATUS get_ea_list_from_fsp(TALLOC_CTX *mem_ctx, *pea_total_len += 4 + strlen(dos_ea_name) + 1 + listp->ea.value.length; - DEBUG(10,("get_ea_list_from_file: total_len = %u, %s, val len " - "= %u\n", (unsigned int)*pea_total_len, dos_ea_name, - (unsigned int)listp->ea.value.length)); + DBG_DEBUG("total_len = %zu, %s, val len = %zu\n", + *pea_total_len, + dos_ea_name, + listp->ea.value.length); DLIST_ADD_END(ea_list_head, listp); @@ -489,8 +490,7 @@ static NTSTATUS get_ea_list_from_fsp(TALLOC_CTX *mem_ctx, *pea_total_len += 4; } - DEBUG(10, ("get_ea_list_from_file: total_len = %u\n", - (unsigned int)*pea_total_len)); + DBG_DEBUG("total_len = %zu\n", *pea_total_len); *ea_list = ea_list_head; return NT_STATUS_OK; @@ -1165,8 +1165,7 @@ static NTSTATUS smbd_marshall_dir_entry(TALLOC_CTX *ctx, } space_remaining -= pad; - DEBUG(10,("smbd_marshall_dir_entry: space_remaining = %d\n", - space_remaining )); + DBG_DEBUG("space_remaining = %d\n", space_remaining); pdata += pad; p = pdata; @@ -1177,7 +1176,7 @@ static NTSTATUS smbd_marshall_dir_entry(TALLOC_CTX *ctx, switch (info_level) { case SMB_FIND_INFO_STANDARD: - DEBUG(10,("smbd_marshall_dir_entry: SMB_FIND_INFO_STANDARD\n")); + DBG_DEBUG("SMB_FIND_INFO_STANDARD\n"); if(requires_resume_key) { SIVAL(p,0,reskey); p += 4; @@ -1216,7 +1215,7 @@ static NTSTATUS smbd_marshall_dir_entry(TALLOC_CTX *ctx, break; case SMB_FIND_EA_SIZE: - DEBUG(10,("smbd_marshall_dir_entry: SMB_FIND_EA_SIZE\n")); + DBG_DEBUG("SMB_FIND_EA_SIZE\n"); if (requires_resume_key) { SIVAL(p,0,reskey); p += 4; @@ -1262,7 +1261,7 @@ static NTSTATUS smbd_marshall_dir_entry(TALLOC_CTX *ctx, struct ea_list *file_list = NULL; size_t ea_len = 0; - DEBUG(10,("smbd_marshall_dir_entry: SMB_FIND_EA_LIST\n")); + DBG_DEBUG("SMB_FIND_EA_LIST\n"); if (!name_list) { return NT_STATUS_INVALID_PARAMETER; } @@ -1325,7 +1324,7 @@ static NTSTATUS smbd_marshall_dir_entry(TALLOC_CTX *ctx, } case SMB_FIND_FILE_BOTH_DIRECTORY_INFO: - DEBUG(10,("smbd_marshall_dir_entry: SMB_FIND_FILE_BOTH_DIRECTORY_INFO\n")); + DBG_DEBUG("SMB_FIND_FILE_BOTH_DIRECTORY_INFO\n"); was_8_3 = mangle_is_8_3(fname, True, conn->params); p += 4; SIVAL(p,0,reskey); p += 4; @@ -1395,7 +1394,7 @@ static NTSTATUS smbd_marshall_dir_entry(TALLOC_CTX *ctx, break; case SMB_FIND_FILE_DIRECTORY_INFO: - DEBUG(10,("smbd_marshall_dir_entry: SMB_FIND_FILE_DIRECTORY_INFO\n")); + DBG_DEBUG("SMB_FIND_FILE_DIRECTORY_INFO\n"); p += 4; SIVAL(p,0,reskey); p += 4; put_long_date_full_timespec(conn->ts_res,p,&create_date_ts); p += 8; @@ -1434,7 +1433,7 @@ static NTSTATUS smbd_marshall_dir_entry(TALLOC_CTX *ctx, break; case SMB_FIND_FILE_FULL_DIRECTORY_INFO: - DEBUG(10,("smbd_marshall_dir_entry: SMB_FIND_FILE_FULL_DIRECTORY_INFO\n")); + DBG_DEBUG("SMB_FIND_FILE_FULL_DIRECTORY_INFO\n"); p += 4; SIVAL(p,0,reskey); p += 4; put_long_date_full_timespec(conn->ts_res,p,&create_date_ts); p += 8; @@ -1477,7 +1476,7 @@ static NTSTATUS smbd_marshall_dir_entry(TALLOC_CTX *ctx, break; case SMB_FIND_FILE_NAMES_INFO: - DEBUG(10,("smbd_marshall_dir_entry: SMB_FIND_FILE_NAMES_INFO\n")); + DBG_DEBUG("SMB_FIND_FILE_NAMES_INFO\n"); p += 4; SIVAL(p,0,reskey); p += 4; p += 4; @@ -1512,7 +1511,7 @@ static NTSTATUS smbd_marshall_dir_entry(TALLOC_CTX *ctx, break; case SMB_FIND_ID_FULL_DIRECTORY_INFO: - DEBUG(10,("smbd_marshall_dir_entry: SMB_FIND_ID_FULL_DIRECTORY_INFO\n")); + DBG_DEBUG("SMB_FIND_ID_FULL_DIRECTORY_INFO\n"); p += 4; SIVAL(p,0,reskey); p += 4; put_long_date_full_timespec(conn->ts_res,p,&create_date_ts); p += 8; @@ -1557,7 +1556,7 @@ static NTSTATUS smbd_marshall_dir_entry(TALLOC_CTX *ctx, break; case SMB_FIND_ID_BOTH_DIRECTORY_INFO: - DEBUG(10,("smbd_marshall_dir_entry: SMB_FIND_ID_BOTH_DIRECTORY_INFO\n")); + DBG_DEBUG("SMB_FIND_ID_BOTH_DIRECTORY_INFO\n"); was_8_3 = mangle_is_8_3(fname, True, conn->params); p += 4; SIVAL(p,0,reskey); p += 4; @@ -1684,7 +1683,7 @@ static NTSTATUS smbd_marshall_dir_entry(TALLOC_CTX *ctx, /* Begin of SMB_QUERY_FILE_UNIX_BASIC */ if (info_level == SMB_FIND_FILE_UNIX) { - DEBUG(10,("smbd_marshall_dir_entry: SMB_FIND_FILE_UNIX\n")); + DBG_DEBUG("SMB_FIND_FILE_UNIX\n"); p = store_file_unix_basic(conn, p, NULL, &smb_fname->st); status = srvstr_push(base_data, flags2, p, @@ -1694,7 +1693,7 @@ static NTSTATUS smbd_marshall_dir_entry(TALLOC_CTX *ctx, return status; } } else { - DEBUG(10,("smbd_marshall_dir_entry: SMB_FIND_FILE_UNIX_INFO2\n")); + DBG_DEBUG("SMB_FIND_FILE_UNIX_INFO2\n"); p = store_file_unix_basic_info2(conn, p, NULL, &smb_fname->st); nameptr = p;