Skip to content

Commit d119595

Browse files
benzearichardweinberger
authored andcommitted
um: Switch printk calls to adhere to correct coding style
This means having the string literal in one line and using __func__ where appropriate. Signed-off-by: Benjamin Berg <benjamin@sipsolutions.net> Signed-off-by: Richard Weinberger <richard@nod.at>
1 parent 8f88c73 commit d119595

File tree

3 files changed

+69
-75
lines changed

3 files changed

+69
-75
lines changed

arch/um/kernel/exec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ void flush_thread(void)
2929

3030
ret = unmap(&current->mm->context.id, 0, TASK_SIZE, 1, &data);
3131
if (ret) {
32-
printk(KERN_ERR "flush_thread - clearing address space failed, "
33-
"err = %d\n", ret);
32+
printk(KERN_ERR "%s - clearing address space failed, err = %d\n",
33+
__func__, ret);
3434
force_sig(SIGKILL);
3535
}
3636
get_safe_registers(current_pt_regs()->regs.gp,

arch/um/os-Linux/skas/mem.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr)
6060
printk(UM_KERN_ERR "Registers - \n");
6161
for (i = 0; i < MAX_REG_NR; i++)
6262
printk(UM_KERN_ERR "\t%d\t0x%lx\n", i, syscall_regs[i]);
63-
panic("do_syscall_stub : PTRACE_SETREGS failed, errno = %d\n",
64-
-n);
63+
panic("%s : PTRACE_SETREGS failed, errno = %d\n",
64+
__func__, -n);
6565
}
6666

6767
err = ptrace(PTRACE_CONT, pid, 0, 0);
@@ -81,20 +81,17 @@ static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr)
8181
offset = *((unsigned long *) mm_idp->stack + 1);
8282
if (offset) {
8383
data = (unsigned long *)(mm_idp->stack + offset - STUB_DATA);
84-
printk(UM_KERN_ERR "do_syscall_stub : ret = %ld, offset = %ld, "
85-
"data = %p\n", ret, offset, data);
84+
printk(UM_KERN_ERR "%s : ret = %ld, offset = %ld, data = %p\n",
85+
__func__, ret, offset, data);
8686
syscall = (unsigned long *)((unsigned long)data + data[0]);
87-
printk(UM_KERN_ERR "do_syscall_stub: syscall %ld failed, "
88-
"return value = 0x%lx, expected return value = 0x%lx\n",
89-
syscall[0], ret, syscall[7]);
90-
printk(UM_KERN_ERR " syscall parameters: "
91-
"0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n",
87+
printk(UM_KERN_ERR "%s: syscall %ld failed, return value = 0x%lx, expected return value = 0x%lx\n",
88+
__func__, syscall[0], ret, syscall[7]);
89+
printk(UM_KERN_ERR " syscall parameters: 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n",
9290
syscall[1], syscall[2], syscall[3],
9391
syscall[4], syscall[5], syscall[6]);
9492
for (n = 1; n < data[0]/sizeof(long); n++) {
9593
if (n == 1)
96-
printk(UM_KERN_ERR " additional syscall "
97-
"data:");
94+
printk(UM_KERN_ERR " additional syscall data:");
9895
if (n % 4 == 1)
9996
printk("\n" UM_KERN_ERR " ");
10097
printk(" 0x%lx", data[n]);

arch/um/os-Linux/skas/process.c

Lines changed: 59 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ void wait_stub_done(int pid)
118118

119119
err = ptrace(PTRACE_CONT, pid, 0, 0);
120120
if (err) {
121-
printk(UM_KERN_ERR "wait_stub_done : continue failed, "
122-
"errno = %d\n", errno);
121+
printk(UM_KERN_ERR "%s : continue failed, errno = %d\n",
122+
__func__, errno);
123123
fatal_sigsegv();
124124
}
125125
}
@@ -130,11 +130,10 @@ void wait_stub_done(int pid)
130130
bad_wait:
131131
err = ptrace_dump_regs(pid);
132132
if (err)
133-
printk(UM_KERN_ERR "Failed to get registers from stub, "
134-
"errno = %d\n", -err);
135-
printk(UM_KERN_ERR "wait_stub_done : failed to wait for SIGTRAP, "
136-
"pid = %d, n = %d, errno = %d, status = 0x%x\n", pid, n, errno,
137-
status);
133+
printk(UM_KERN_ERR "Failed to get registers from stub, errno = %d\n",
134+
-err);
135+
printk(UM_KERN_ERR "%s : failed to wait for SIGTRAP, pid = %d, n = %d, errno = %d, status = 0x%x\n",
136+
__func__, pid, n, errno, status);
138137
fatal_sigsegv();
139138
}
140139

@@ -195,15 +194,15 @@ static void handle_trap(int pid, struct uml_pt_regs *regs,
195194
err = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_NR_OFFSET,
196195
__NR_getpid);
197196
if (err < 0) {
198-
printk(UM_KERN_ERR "handle_trap - nullifying syscall "
199-
"failed, errno = %d\n", errno);
197+
printk(UM_KERN_ERR "%s - nullifying syscall failed, errno = %d\n",
198+
__func__, errno);
200199
fatal_sigsegv();
201200
}
202201

203202
err = ptrace(PTRACE_SYSCALL, pid, 0, 0);
204203
if (err < 0) {
205-
printk(UM_KERN_ERR "handle_trap - continuing to end of "
206-
"syscall failed, errno = %d\n", errno);
204+
printk(UM_KERN_ERR "%s - continuing to end of syscall failed, errno = %d\n",
205+
__func__, errno);
207206
fatal_sigsegv();
208207
}
209208

@@ -212,11 +211,10 @@ static void handle_trap(int pid, struct uml_pt_regs *regs,
212211
(WSTOPSIG(status) != SIGTRAP + 0x80)) {
213212
err = ptrace_dump_regs(pid);
214213
if (err)
215-
printk(UM_KERN_ERR "Failed to get registers "
216-
"from process, errno = %d\n", -err);
217-
printk(UM_KERN_ERR "handle_trap - failed to wait at "
218-
"end of syscall, errno = %d, status = %d\n",
219-
errno, status);
214+
printk(UM_KERN_ERR "Failed to get registers from process, errno = %d\n",
215+
-err);
216+
printk(UM_KERN_ERR "%s - failed to wait at end of syscall, errno = %d, status = %d\n",
217+
__func__, errno, status);
220218
fatal_sigsegv();
221219
}
222220
}
@@ -256,8 +254,8 @@ static int userspace_tramp(void *stack)
256254
addr = mmap64((void *) STUB_CODE, UM_KERN_PAGE_SIZE,
257255
PROT_EXEC, MAP_FIXED | MAP_PRIVATE, fd, offset);
258256
if (addr == MAP_FAILED) {
259-
printk(UM_KERN_ERR "mapping mmap stub at 0x%lx failed, "
260-
"errno = %d\n", STUB_CODE, errno);
257+
printk(UM_KERN_ERR "mapping mmap stub at 0x%lx failed, errno = %d\n",
258+
STUB_CODE, errno);
261259
exit(1);
262260
}
263261

@@ -267,8 +265,7 @@ static int userspace_tramp(void *stack)
267265
UM_KERN_PAGE_SIZE, PROT_READ | PROT_WRITE,
268266
MAP_FIXED | MAP_SHARED, fd, offset);
269267
if (addr == MAP_FAILED) {
270-
printk(UM_KERN_ERR "mapping segfault stack "
271-
"at 0x%lx failed, errno = %d\n",
268+
printk(UM_KERN_ERR "mapping segfault stack at 0x%lx failed, errno = %d\n",
272269
STUB_DATA, errno);
273270
exit(1);
274271
}
@@ -286,8 +283,8 @@ static int userspace_tramp(void *stack)
286283
sa.sa_sigaction = (void *) v;
287284
sa.sa_restorer = NULL;
288285
if (sigaction(SIGSEGV, &sa, NULL) < 0) {
289-
printk(UM_KERN_ERR "userspace_tramp - setting SIGSEGV "
290-
"handler failed - errno = %d\n", errno);
286+
printk(UM_KERN_ERR "%s - setting SIGSEGV handler failed - errno = %d\n",
287+
__func__, errno);
291288
exit(1);
292289
}
293290
}
@@ -322,8 +319,8 @@ int start_userspace(unsigned long stub_stack)
322319
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
323320
if (stack == MAP_FAILED) {
324321
err = -errno;
325-
printk(UM_KERN_ERR "start_userspace : mmap failed, "
326-
"errno = %d\n", errno);
322+
printk(UM_KERN_ERR "%s : mmap failed, errno = %d\n",
323+
__func__, errno);
327324
return err;
328325
}
329326

@@ -336,40 +333,40 @@ int start_userspace(unsigned long stub_stack)
336333
pid = clone(userspace_tramp, (void *) sp, flags, (void *) stub_stack);
337334
if (pid < 0) {
338335
err = -errno;
339-
printk(UM_KERN_ERR "start_userspace : clone failed, "
340-
"errno = %d\n", errno);
336+
printk(UM_KERN_ERR "%s : clone failed, errno = %d\n",
337+
__func__, errno);
341338
return err;
342339
}
343340

344341
do {
345342
CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED | __WALL));
346343
if (n < 0) {
347344
err = -errno;
348-
printk(UM_KERN_ERR "start_userspace : wait failed, "
349-
"errno = %d\n", errno);
345+
printk(UM_KERN_ERR "%s : wait failed, errno = %d\n",
346+
__func__, errno);
350347
goto out_kill;
351348
}
352349
} while (WIFSTOPPED(status) && (WSTOPSIG(status) == SIGALRM));
353350

354351
if (!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGSTOP)) {
355352
err = -EINVAL;
356-
printk(UM_KERN_ERR "start_userspace : expected SIGSTOP, got "
357-
"status = %d\n", status);
353+
printk(UM_KERN_ERR "%s : expected SIGSTOP, got status = %d\n",
354+
__func__, status);
358355
goto out_kill;
359356
}
360357

361358
if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL,
362359
(void *) PTRACE_O_TRACESYSGOOD) < 0) {
363360
err = -errno;
364-
printk(UM_KERN_ERR "start_userspace : PTRACE_OLDSETOPTIONS "
365-
"failed, errno = %d\n", errno);
361+
printk(UM_KERN_ERR "%s : PTRACE_OLDSETOPTIONS failed, errno = %d\n",
362+
__func__, errno);
366363
goto out_kill;
367364
}
368365

369366
if (munmap(stack, UM_KERN_PAGE_SIZE) < 0) {
370367
err = -errno;
371-
printk(UM_KERN_ERR "start_userspace : munmap failed, "
372-
"errno = %d\n", errno);
368+
printk(UM_KERN_ERR "%s : munmap failed, errno = %d\n",
369+
__func__, errno);
373370
goto out_kill;
374371
}
375372

@@ -403,14 +400,14 @@ void userspace(struct uml_pt_regs *regs, unsigned long *aux_fp_regs)
403400
* just kill the process.
404401
*/
405402
if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp)) {
406-
printk(UM_KERN_ERR "userspace - ptrace set regs "
407-
"failed, errno = %d\n", errno);
403+
printk(UM_KERN_ERR "%s - ptrace set regs failed, errno = %d\n",
404+
__func__, errno);
408405
fatal_sigsegv();
409406
}
410407

411408
if (put_fp_registers(pid, regs->fp)) {
412-
printk(UM_KERN_ERR "userspace - ptrace set fp regs "
413-
"failed, errno = %d\n", errno);
409+
printk(UM_KERN_ERR "%s - ptrace set fp regs failed, errno = %d\n",
410+
__func__, errno);
414411
fatal_sigsegv();
415412
}
416413

@@ -421,28 +418,28 @@ void userspace(struct uml_pt_regs *regs, unsigned long *aux_fp_regs)
421418
singlestepping(NULL));
422419

423420
if (ptrace(op, pid, 0, 0)) {
424-
printk(UM_KERN_ERR "userspace - ptrace continue "
425-
"failed, op = %d, errno = %d\n", op, errno);
421+
printk(UM_KERN_ERR "%s - ptrace continue failed, op = %d, errno = %d\n",
422+
__func__, op, errno);
426423
fatal_sigsegv();
427424
}
428425

429426
CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED | __WALL));
430427
if (err < 0) {
431-
printk(UM_KERN_ERR "userspace - wait failed, "
432-
"errno = %d\n", errno);
428+
printk(UM_KERN_ERR "%s - wait failed, errno = %d\n",
429+
__func__, errno);
433430
fatal_sigsegv();
434431
}
435432

436433
regs->is_user = 1;
437434
if (ptrace(PTRACE_GETREGS, pid, 0, regs->gp)) {
438-
printk(UM_KERN_ERR "userspace - PTRACE_GETREGS failed, "
439-
"errno = %d\n", errno);
435+
printk(UM_KERN_ERR "%s - PTRACE_GETREGS failed, errno = %d\n",
436+
__func__, errno);
440437
fatal_sigsegv();
441438
}
442439

443440
if (get_fp_registers(pid, regs->fp)) {
444-
printk(UM_KERN_ERR "userspace - get_fp_registers failed, "
445-
"errno = %d\n", errno);
441+
printk(UM_KERN_ERR "%s - get_fp_registers failed, errno = %d\n",
442+
__func__, errno);
446443
fatal_sigsegv();
447444
}
448445

@@ -494,8 +491,8 @@ void userspace(struct uml_pt_regs *regs, unsigned long *aux_fp_regs)
494491
unblock_signals_trace();
495492
break;
496493
default:
497-
printk(UM_KERN_ERR "userspace - child stopped "
498-
"with signal %d\n", sig);
494+
printk(UM_KERN_ERR "%s - child stopped with signal %d\n",
495+
__func__, sig);
499496
fatal_sigsegv();
500497
}
501498
pid = userspace_pid[0];
@@ -555,15 +552,15 @@ int copy_context_skas0(unsigned long new_stack, int pid)
555552
err = ptrace_setregs(pid, thread_regs);
556553
if (err < 0) {
557554
err = -errno;
558-
printk(UM_KERN_ERR "copy_context_skas0 : PTRACE_SETREGS "
559-
"failed, pid = %d, errno = %d\n", pid, -err);
555+
printk(UM_KERN_ERR "%s : PTRACE_SETREGS failed, pid = %d, errno = %d\n",
556+
__func__, pid, -err);
560557
return err;
561558
}
562559

563560
err = put_fp_registers(pid, thread_fp_regs);
564561
if (err < 0) {
565-
printk(UM_KERN_ERR "copy_context_skas0 : put_fp_registers "
566-
"failed, pid = %d, err = %d\n", pid, err);
562+
printk(UM_KERN_ERR "%s : put_fp_registers failed, pid = %d, err = %d\n",
563+
__func__, pid, err);
567564
return err;
568565
}
569566

@@ -574,17 +571,17 @@ int copy_context_skas0(unsigned long new_stack, int pid)
574571
err = ptrace(PTRACE_CONT, pid, 0, 0);
575572
if (err) {
576573
err = -errno;
577-
printk(UM_KERN_ERR "Failed to continue new process, pid = %d, "
578-
"errno = %d\n", pid, errno);
574+
printk(UM_KERN_ERR "Failed to continue new process, pid = %d, errno = %d\n",
575+
pid, errno);
579576
return err;
580577
}
581578

582579
wait_stub_done(pid);
583580

584581
pid = data->parent_err;
585582
if (pid < 0) {
586-
printk(UM_KERN_ERR "copy_context_skas0 - stub-parent reports "
587-
"error %d\n", -pid);
583+
printk(UM_KERN_ERR "%s - stub-parent reports error %d\n",
584+
__func__, -pid);
588585
return pid;
589586
}
590587

@@ -594,17 +591,17 @@ int copy_context_skas0(unsigned long new_stack, int pid)
594591
*/
595592
wait_stub_done(pid);
596593
if (child_data->child_err != STUB_DATA) {
597-
printk(UM_KERN_ERR "copy_context_skas0 - stub-child %d reports "
598-
"error %ld\n", pid, data->child_err);
594+
printk(UM_KERN_ERR "%s - stub-child %d reports error %ld\n",
595+
__func__, pid, data->child_err);
599596
err = data->child_err;
600597
goto out_kill;
601598
}
602599

603600
if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL,
604601
(void *)PTRACE_O_TRACESYSGOOD) < 0) {
605602
err = -errno;
606-
printk(UM_KERN_ERR "copy_context_skas0 : PTRACE_OLDSETOPTIONS "
607-
"failed, errno = %d\n", errno);
603+
printk(UM_KERN_ERR "%s : PTRACE_OLDSETOPTIONS failed, errno = %d\n",
604+
__func__, errno);
608605
goto out_kill;
609606
}
610607

@@ -672,8 +669,8 @@ int start_idle_thread(void *stack, jmp_buf *switch_buf)
672669
kmalloc_ok = 0;
673670
return 1;
674671
default:
675-
printk(UM_KERN_ERR "Bad sigsetjmp return in "
676-
"start_idle_thread - %d\n", n);
672+
printk(UM_KERN_ERR "Bad sigsetjmp return in %s - %d\n",
673+
__func__, n);
677674
fatal_sigsegv();
678675
}
679676
longjmp(*switch_buf, 1);

0 commit comments

Comments
 (0)