qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

virtiofsd: convert more fprintf and perror to use fuse log infra

Signed-off-by: Eryu Guan <eguan@linux.alibaba.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

authored by

Eryu Guan and committed by
Dr. David Alan Gilbert
fc1aed0b e468d4af

+11 -5
+5 -2
tools/virtiofsd/fuse_signals.c
··· 12 12 #include "fuse_i.h" 13 13 #include "fuse_lowlevel.h" 14 14 15 + #include <errno.h> 15 16 #include <signal.h> 16 17 #include <stdio.h> 17 18 #include <stdlib.h> ··· 47 48 sa.sa_flags = 0; 48 49 49 50 if (sigaction(sig, NULL, &old_sa) == -1) { 50 - perror("fuse: cannot get old signal handler"); 51 + fuse_log(FUSE_LOG_ERR, "fuse: cannot get old signal handler: %s\n", 52 + strerror(errno)); 51 53 return -1; 52 54 } 53 55 54 56 if (old_sa.sa_handler == (remove ? handler : SIG_DFL) && 55 57 sigaction(sig, &sa, NULL) == -1) { 56 - perror("fuse: cannot set signal handler"); 58 + fuse_log(FUSE_LOG_ERR, "fuse: cannot set signal handler: %s\n", 59 + strerror(errno)); 57 60 return -1; 58 61 } 59 62 return 0;
+6 -3
tools/virtiofsd/helper.c
··· 208 208 char completed; 209 209 210 210 if (pipe(waiter)) { 211 - perror("fuse_daemonize: pipe"); 211 + fuse_log(FUSE_LOG_ERR, "fuse_daemonize: pipe: %s\n", 212 + strerror(errno)); 212 213 return -1; 213 214 } 214 215 ··· 218 219 */ 219 220 switch (fork()) { 220 221 case -1: 221 - perror("fuse_daemonize: fork"); 222 + fuse_log(FUSE_LOG_ERR, "fuse_daemonize: fork: %s\n", 223 + strerror(errno)); 222 224 return -1; 223 225 case 0: 224 226 break; ··· 228 230 } 229 231 230 232 if (setsid() == -1) { 231 - perror("fuse_daemonize: setsid"); 233 + fuse_log(FUSE_LOG_ERR, "fuse_daemonize: setsid: %s\n", 234 + strerror(errno)); 232 235 return -1; 233 236 } 234 237