git: 169641f7dd9f - main - imgact_elf: Add const to a few struct image_params pointers
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 05 Mar 2024 04:53:40 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=169641f7dd9f0fc23a158716b5ad81e5d5056661
commit 169641f7dd9f0fc23a158716b5ad81e5d5056661
Author: Alex Richardson <arichardson@FreeBSD.org>
AuthorDate: 2024-03-05 04:51:49 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-03-05 04:51:49 +0000
imgact_elf: Add const to a few struct image_params pointers
This makes it more obvious which functions modify fields in this struct.
Reviewed by: imp, kib
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D44214
---
sys/kern/imgact_elf.c | 21 +++++++++++----------
sys/sys/imgact_elf.h | 6 +++---
2 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index 8f85a4f5e18a..3863f0a2fdae 100644
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -88,8 +88,9 @@ static Elf_Brandinfo *__elfN(get_brandinfo)(struct image_params *imgp,
const char *interp, int32_t *osrel, uint32_t *fctl0);
static int __elfN(load_file)(struct proc *p, const char *file, u_long *addr,
u_long *entry);
-static int __elfN(load_section)(struct image_params *imgp, vm_ooffset_t offset,
- caddr_t vmaddr, size_t memsz, size_t filsz, vm_prot_t prot);
+static int __elfN(load_section)(const struct image_params *imgp,
+ vm_ooffset_t offset, caddr_t vmaddr, size_t memsz, size_t filsz,
+ vm_prot_t prot);
static int __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp);
static bool __elfN(freebsd_trans_osrel)(const Elf_Note *note,
int32_t *osrel);
@@ -545,9 +546,9 @@ __elfN(map_partial)(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
}
static int
-__elfN(map_insert)(struct image_params *imgp, vm_map_t map, vm_object_t object,
- vm_ooffset_t offset, vm_offset_t start, vm_offset_t end, vm_prot_t prot,
- int cow)
+__elfN(map_insert)(const struct image_params *imgp, vm_map_t map,
+ vm_object_t object, vm_ooffset_t offset, vm_offset_t start, vm_offset_t end,
+ vm_prot_t prot, int cow)
{
struct sf_buf *sf;
vm_offset_t off;
@@ -616,9 +617,9 @@ __elfN(map_insert)(struct image_params *imgp, vm_map_t map, vm_object_t object,
return (KERN_SUCCESS);
}
-static int
-__elfN(load_section)(struct image_params *imgp, vm_ooffset_t offset,
- caddr_t vmaddr, size_t memsz, size_t filsz, vm_prot_t prot)
+static int __elfN(load_section)(const struct image_params *imgp,
+ vm_ooffset_t offset, caddr_t vmaddr, size_t memsz, size_t filsz,
+ vm_prot_t prot)
{
struct sf_buf *sf;
size_t map_len;
@@ -721,7 +722,7 @@ __elfN(load_section)(struct image_params *imgp, vm_ooffset_t offset,
}
static int
-__elfN(load_sections)(struct image_params *imgp, const Elf_Ehdr *hdr,
+__elfN(load_sections)(const struct image_params *imgp, const Elf_Ehdr *hdr,
const Elf_Phdr *phdr, u_long rbase, u_long *base_addrp)
{
vm_prot_t prot;
@@ -2711,7 +2712,7 @@ __elfN(note_procstat_auxv)(void *arg, struct sbuf *sb, size_t *sizep)
#define MAX_NOTES_LOOP 4096
bool
-__elfN(parse_notes)(struct image_params *imgp, Elf_Note *checknote,
+__elfN(parse_notes)(const struct image_params *imgp, Elf_Note *checknote,
const char *note_vendor, const Elf_Phdr *pnote,
bool (*cb)(const Elf_Note *, void *, bool *), void *cb_arg)
{
diff --git a/sys/sys/imgact_elf.h b/sys/sys/imgact_elf.h
index 3ddb438e14fc..92995d2f2dc3 100644
--- a/sys/sys/imgact_elf.h
+++ b/sys/sys/imgact_elf.h
@@ -123,9 +123,9 @@ void __elfN(prepare_notes)(struct thread *, struct note_info_list *,
void __elfN(size_segments)(struct thread *, struct sseg_closure *, int);
size_t __elfN(register_note)(struct thread *, struct note_info_list *,
int, outfunc_t, void *);
-bool __elfN(parse_notes)(struct image_params *, Elf_Note *, const char *,
- const Elf_Phdr *, bool (*)(const Elf_Note *, void *, bool *),
- void *);
+bool __elfN(parse_notes)(const struct image_params *, Elf_Note *,
+ const char *, const Elf_Phdr *,
+ bool (*)(const Elf_Note *, void *, bool *), void *);
/* Machine specific function to dump per-thread information. */
void __elfN(dump_thread)(struct thread *, void *, size_t *);