From 4fe0808ebedd7812cf7097d4d6c3d697e8cebb68 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 28 Apr 2024 19:51:25 +0200 Subject: [PATCH] lib: Convert push_file_id_16 to take uint8_t instead of char All callers had a cast from uint8_t to char, avoid those. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- source3/lib/file_id.c | 2 +- source3/lib/file_id.h | 2 +- source3/lib/xattr_tdb.c | 4 ++-- source3/modules/vfs_acl_tdb.c | 6 +++--- source3/modules/vfs_default.c | 4 ++-- source3/modules/vfs_streams_depot.c | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/source3/lib/file_id.c b/source3/lib/file_id.c index 545437afefa..5499320f615 100644 --- a/source3/lib/file_id.c +++ b/source3/lib/file_id.c @@ -46,7 +46,7 @@ char *file_id_str_buf(struct file_id fid, struct file_id_buf *dst) push a 16 byte version of a file id into a buffer. This ignores the extid and is needed when dev/inodes are stored in persistent storage (tdbs). */ -void push_file_id_16(char *buf, const struct file_id *id) +void push_file_id_16(uint8_t *buf, const struct file_id *id) { SIVAL(buf, 0, id->devid&0xFFFFFFFF); SIVAL(buf, 4, id->devid>>32); diff --git a/source3/lib/file_id.h b/source3/lib/file_id.h index 255b1ddc5c5..90f074528c2 100644 --- a/source3/lib/file_id.h +++ b/source3/lib/file_id.h @@ -37,7 +37,7 @@ char *file_id_str_buf(struct file_id fid, struct file_id_buf *dst); /* an allocated string for a file_id structure */ -void push_file_id_16(char *buf, const struct file_id *id); +void push_file_id_16(uint8_t *buf, const struct file_id *id); void push_file_id_24(char *buf, const struct file_id *id); void pull_file_id_24(const char *buf, struct file_id *id); diff --git a/source3/lib/xattr_tdb.c b/source3/lib/xattr_tdb.c index 564cdd80965..8c1cc7398c1 100644 --- a/source3/lib/xattr_tdb.c +++ b/source3/lib/xattr_tdb.c @@ -109,7 +109,7 @@ static NTSTATUS xattr_tdb_load_attrs(TALLOC_CTX *mem_ctx, TDB_DATA data; /* For backwards compatibility only store the dev/inode. */ - push_file_id_16((char *)id_buf, id); + push_file_id_16(id_buf, id); status = dbwrap_fetch(db_ctx, mem_ctx, make_tdb_data(id_buf, sizeof(id_buf)), @@ -137,7 +137,7 @@ static struct db_record *xattr_tdb_lock_attrs(TALLOC_CTX *mem_ctx, uint8_t id_buf[16]; /* For backwards compatibility only store the dev/inode. */ - push_file_id_16((char *)id_buf, id); + push_file_id_16(id_buf, id); return dbwrap_fetch_locked(db_ctx, mem_ctx, make_tdb_data(id_buf, sizeof(id_buf))); } diff --git a/source3/modules/vfs_acl_tdb.c b/source3/modules/vfs_acl_tdb.c index bccb1ab0bec..5ecba7ba757 100644 --- a/source3/modules/vfs_acl_tdb.c +++ b/source3/modules/vfs_acl_tdb.c @@ -102,7 +102,7 @@ static NTSTATUS acl_tdb_delete(vfs_handle_struct *handle, uint8_t id_buf[16]; /* For backwards compatibility only store the dev/inode. */ - push_file_id_16((char *)id_buf, &id); + push_file_id_16(id_buf, &id); status = dbwrap_delete(db, make_tdb_data(id_buf, sizeof(id_buf))); return status; @@ -131,7 +131,7 @@ static NTSTATUS fget_acl_blob(TALLOC_CTX *ctx, id = vfs_file_id_from_sbuf(handle->conn, &fsp->fsp_name->st); /* For backwards compatibility only store the dev/inode. */ - push_file_id_16((char *)id_buf, &id); + push_file_id_16(id_buf, &id); status = dbwrap_fetch(db, ctx, @@ -179,7 +179,7 @@ static NTSTATUS store_acl_blob_fsp(vfs_handle_struct *handle, id = vfs_file_id_from_sbuf(handle->conn, &fsp->fsp_name->st); /* For backwards compatibility only store the dev/inode. */ - push_file_id_16((char *)id_buf, &id); + push_file_id_16(id_buf, &id); status = dbwrap_store( db, make_tdb_data(id_buf, sizeof(id_buf)), data, 0); diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 8db4fd7817a..379802fc547 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -1496,9 +1496,9 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle, } /* For backwards compatibility only store the dev/inode. */ - push_file_id_16((char *)return_data, &fsp->file_id); + push_file_id_16(return_data, &fsp->file_id); memcpy(return_data+16,create_volume_objectid(fsp->conn,objid),16); - push_file_id_16((char *)return_data+32, &fsp->file_id); + push_file_id_16(return_data + 32, &fsp->file_id); memset(return_data+48, 0, 16); *_out_data = return_data; return NT_STATUS_OK; diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c index f9701cc66ed..1221b2c2be2 100644 --- a/source3/modules/vfs_streams_depot.c +++ b/source3/modules/vfs_streams_depot.c @@ -215,7 +215,7 @@ static char *stream_dir(vfs_handle_struct *handle, id = SMB_VFS_FILE_ID_CREATE(handle->conn, &base_sbuf_tmp); - push_file_id_16((char *)id_buf, &id); + push_file_id_16(id_buf, &id); hash = hash_fn(data_blob_const(id_buf, sizeof(id_buf))); -- 2.47.3