sys/kern: quiet -Wwrite-strings

Quiet a variety of Wwrite-strings warnings in sys/kern at low-impact
sites.  This patch avoids addressing certain others which would need to
plumb const through structure definitions.

Reviewed by:	kib, markj
Differential Revision:	https://reviews.freebsd.org/D23798
This commit is contained in:
Ryan Libby 2020-02-23 03:32:16 +00:00
parent 2782c00c04
commit fe20aaec0a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=358258
9 changed files with 15 additions and 13 deletions

View File

@ -98,7 +98,7 @@ static char *consbuf; /* buffer used by `consmsgbuf' */
static struct callout conscallout; /* callout for outputting to constty */
struct msgbuf consmsgbuf; /* message buffer for console tty */
static u_char console_pausing; /* pause after each line during probe */
static char *console_pausestr=
static const char console_pausestr[] =
"<pause; press any key to proceed to next line or '.' to end pause mode>";
struct tty *constty; /* pointer to console "window" tty */
static struct mtx cnputs_mtx; /* Mutex for cnputs(). */
@ -510,7 +510,7 @@ cnputc(int c)
{
struct cn_device *cnd;
struct consdev *cn;
char *cp;
const char *cp;
#ifdef EARLY_PRINTF
if (early_putc != NULL) {
@ -571,7 +571,7 @@ cnputsn(const char *p, size_t n)
}
void
cnputs(char *p)
cnputs(const char *p)
{
cnputsn(p, strlen(p));
}

View File

@ -1765,7 +1765,7 @@ SYSCTL_STRING(_kern, OID_AUTO, module_path, CTLFLAG_RWTUN, linker_path,
TUNABLE_STR("module_path", linker_path, sizeof(linker_path));
static char *linker_ext_list[] = {
static const char * const linker_ext_list[] = {
"",
".ko",
NULL
@ -1782,7 +1782,8 @@ linker_lookup_file(const char *path, int pathlen, const char *name,
{
struct nameidata nd;
struct thread *td = curthread; /* XXX */
char *result, **cpp, *sep;
const char * const *cpp, *sep;
char *result;
int error, len, extlen, reclen, flags;
enum vtype type;
@ -1838,8 +1839,9 @@ linker_hints_lookup(const char *path, int pathlen, const char *modname,
struct ucred *cred = td ? td->td_ucred : NULL;
struct nameidata nd;
struct vattr vattr, mattr;
const char *best, *sep;
u_char *hints = NULL;
u_char *cp, *recptr, *bufend, *result, *best, *pathbuf, *sep;
u_char *cp, *recptr, *bufend, *result, *pathbuf;
int error, ival, bestver, *intp, found, flags, clen, blen;
ssize_t reclen;

View File

@ -1714,7 +1714,7 @@ dump_finish(struct dumperinfo *di, struct kerneldumpheader *kdh)
void
dump_init_header(const struct dumperinfo *di, struct kerneldumpheader *kdh,
char *magic, uint32_t archver, uint64_t dumplen)
const char *magic, uint32_t archver, uint64_t dumplen)
{
size_t dstsize;

View File

@ -3181,7 +3181,7 @@ proc_wkilled(struct proc *p)
* Kill the current process for stated reason.
*/
void
killproc(struct proc *p, char *why)
killproc(struct proc *p, const char *why)
{
PROC_LOCK_ASSERT(p, MA_OWNED);

View File

@ -405,7 +405,7 @@ link_elf_init(void* arg)
Elf_Size *ctors_sizep;
caddr_t modptr, baseptr, sizeptr;
elf_file_t ef;
char *modname;
const char *modname;
linker_add_class(&link_elf_class);

View File

@ -78,7 +78,7 @@ typedef int b_sync_t(struct bufobj *, int waitfor);
typedef void b_bdflush_t(struct bufobj *, struct buf *);
struct buf_ops {
char *bop_name;
const char *bop_name;
b_write_t *bop_write;
b_strategy_t *bop_strategy;
b_sync_t *bop_sync;

View File

@ -374,7 +374,7 @@ int dump_append(struct dumperinfo *, void *, vm_offset_t, size_t);
int dump_write(struct dumperinfo *, void *, vm_offset_t, off_t, size_t);
int dump_finish(struct dumperinfo *di, struct kerneldumpheader *kdh);
void dump_init_header(const struct dumperinfo *di, struct kerneldumpheader *kdh,
char *magic, uint32_t archver, uint64_t dumplen);
const char *magic, uint32_t archver, uint64_t dumplen);
#endif /* _KERNEL */

View File

@ -136,7 +136,7 @@ int cncheckc(void);
int cngetc(void);
void cngets(char *, size_t, int);
void cnputc(int);
void cnputs(char *);
void cnputs(const char *);
void cnputsn(const char *, size_t);
int cnunavailable(void);
void constty_set(struct tty *tp);

View File

@ -384,7 +384,7 @@ sigallowstop(int prev)
int cursig(struct thread *td);
void execsigs(struct proc *p);
void gsignal(int pgid, int sig, ksiginfo_t *ksi);
void killproc(struct proc *p, char *why);
void killproc(struct proc *p, const char *why);
ksiginfo_t * ksiginfo_alloc(int wait);
void ksiginfo_free(ksiginfo_t *ksi);
int pksignal(struct proc *p, int sig, ksiginfo_t *ksi);