Changeset 4860 in vbox
- Timestamp:
- Sep 17, 2007 3:45:24 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/log.h
r4351 r4860 529 529 do { LogTrace(); LogFlow(m); } while (0) 530 530 531 /** @def LogFunc 532 * Level 1 logging inside C/C++ functions. 533 * Prepends the given log message with the function name followed by a semicolon 534 * and space. 535 * @param m log message in format <tt>("string\n" [, args])</tt> 536 * @todo use a Log macro with a variable argument list (requires MSVC8) to 537 * join two separate Log* calls and make this op atomic 538 */ 539 #define LogFunc(m) \ 540 do { Log(("%s: ", __PRETTY_FUNCTION__)); Log(m); } while (0) 541 542 /** @def LogThisFunc 543 * The same as LogFunc but for class functions (methods): the resulting log 544 * line is additionally perpended with a hex value of |this| pointer. 545 * @param m log message in format <tt>("string\n" [, args])</tt> 546 * @todo use a Log macro with a variable argument list (requires MSVC8) to 547 * join two separate Log* calls and make this op atomic 548 */ 549 #define LogThisFunc(m) \ 550 do { Log(("{%p} %s: ", this, __PRETTY_FUNCTION__)); Log(m); } while (0) 551 531 552 /** @def LogFlowFunc 532 553 * Macro to log the execution flow inside C/C++ functions. -
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestLog.h
r4731 r4860 22 22 #if defined(RT_OS_LINUX) 23 23 24 /* Since I don't know the background for the stuff below, I prefer not to change25 it. I don't need it or want it for backdoor logging inside the Linux26 Guest Additions kernel modules though. */24 /* Since I don't know the background for the stuff below, I prefer not to 25 change it. I don't need it or want it for backdoor logging inside the 26 Linux Guest Additions kernel modules though. */ 27 27 # include <VBox/log.h> 28 # define LogRelPrint(a) \29 do { \30 RTLogWriteUser (a, strlen(a)); \31 } while (0)32 33 # define LogRelPrintQuote(a) \34 do { \35 LogRelPrint (#a); \36 } while (0)37 38 # define LogRelPrintFunc(a) \39 do { \40 LogRelPrint (__PRETTY_FUNCTION__); \41 LogRelPrint (": "); \42 LogRelPrint (a); \43 } while (0)44 45 # define LogFunc(a) \46 do { \47 Log(("%s: ", __PRETTY_FUNCTION__)); \48 Log(a); \49 } while (0)50 28 51 29 #else /* RT_OS_LINUX not defined */ -
trunk/src/VBox/Additions/linux/module/Makefile.module
r4780 r4860 33 33 udivdi3.o \ 34 34 umoddi3.o \ 35 qdivrem.o 36 ifeq ($(BUILD_TYPE),debug) 37 OBJS += \ 35 qdivrem.o \ 38 36 logbackdoor.o \ 39 37 logformat.o \ … … 41 39 strformatrt.o \ 42 40 strformat-vbox.o 43 endif44 41 45 42 ifneq ($(MAKECMDGOALS),clean) -
trunk/src/VBox/Additions/linux/module/vboxmod.c
r4745 r4860 25 25 #include <VBox/log.h> 26 26 27 #define VERSION "0.5"28 29 27 MODULE_DESCRIPTION("VirtualBox Guest Additions for Linux Module"); 30 28 MODULE_AUTHOR("innotek GmbH"); … … 38 36 const char *pszFile, const char *pszFunction) 39 37 { 40 elog("!!Assertion Failed!!\n"41 "Expression: %s\n"42 "Location : %s(%d) %s\n",43 pszExpr, pszFile, uLine, pszFunction);44 38 Log(("!!Assertion Failed!!\n" 45 39 "Expression: %s\n" … … 58 52 vsnprintf(msg, sizeof(msg) - 1, pszFormat, ap); 59 53 msg[sizeof(msg) - 1] = '\0'; 60 elog("%s", msg);61 54 Log(("%s", msg)); 62 55 va_end(ap); … … 69 62 } 70 63 EXPORT_SYMBOL(RTAssertDoBreakpoint); 71 #if !defined(DEBUG) && defined(IN_MODULE)72 /** Write a string to the backdoor logger. */73 RTDECL(void) RTLogWriteUser(const char *pch, size_t cb)74 {75 const uint8_t *pu8;76 for (pu8 = (const uint8_t *)pch; cb-- > 0; pu8++)77 ASMOutU8(RTLOG_DEBUG_PORT, *pu8);78 /** @todo a rep outs could be more efficient, I don't know...79 * @code80 * __asm {81 * mov ecx, [cb]82 * mov esi, [pch]83 * mov dx, RTLOG_DEFAULT_PORT84 * rep outsb85 * }86 * @endcode87 */88 }89 EXPORT_SYMBOL(RTLogWriteUser);90 #endif /* DEBUG not defined and IN_MODULE defined */91 64 92 65 /** device extension structure (we only support one device instance) */ … … 670 643 VMMDevReportGuestInfo *infoReq = NULL; 671 644 672 printk(KERN_INFO "vboxadd: initializing version %s\n", VERSION); 645 printk(KERN_INFO "vboxadd: initializing version %s\n", VBOX_VERSION_STRING); 646 LogRel(("Starting VirtualBox Guest Additions version %s\n", 647 VBOX_VERSION_STRING)); 673 648 674 649 if (vboxadd_cmc_init ()) -
trunk/src/VBox/Additions/linux/sharedfolders/dirops.c
r4822 r4860 42 42 43 43 if (!sf_d) { 44 LogRelPrintFunc("could not allocate directory info for"); 45 LogRelPrint(sf_i->path->String.utf8); 46 LogRelPrint("\n"); 44 LogRelFunc(("could not allocate directory info for %s\n", 45 sf_i->path->String.utf8)); 47 46 return -ENOMEM; 48 47 } … … 211 210 fake_ino = sanity; 212 211 if (sanity - fake_ino) { 213 LogRel PrintFunc("can not compute ino\n");212 LogRelFunc(("can not compute ino\n")); 214 213 return -EINVAL; 215 214 } … … 286 285 sf_new_i = kmalloc (sizeof (*sf_new_i), GFP_KERNEL); 287 286 if (!sf_new_i) { 288 LogRel PrintFunc("could not allocate memory for new inode info\n");287 LogRelFunc(("could not allocate memory for new inode info\n")); 289 288 err = -ENOMEM; 290 289 goto fail1; … … 337 336 sf_new_i = kmalloc (sizeof (*sf_new_i), GFP_KERNEL); 338 337 if (!sf_new_i) { 339 LogRelPrintFunc("could not allocate inode info. caller="); 340 LogRelPrint(caller); 341 LogRelPrint("\n"); 338 LogRelFunc(("could not allocate inode info. caller=%s\n", caller)); 342 339 err = -ENOMEM; 343 340 goto fail0; -
trunk/src/VBox/Additions/linux/sharedfolders/regops.c
r4743 r4860 65 65 tmp = kmalloc (CHUNK_SIZE, GFP_KERNEL); 66 66 if (!tmp) { 67 LogRelPrintFunc("could not allocate bounce buffer memory "); 68 LogRelPrintQuote(CHUNK_SIZE); 69 LogRelPrint(" bytes\n"); 67 LogRelFunc(("could not allocate bounce buffer memory %d bytes\n", CHUNK_SIZE)); 70 68 return -ENOMEM; 71 69 } … … 137 135 tmp = kmalloc (CHUNK_SIZE, GFP_KERNEL); 138 136 if (!tmp) { 139 LogRelPrintFunc("could not allocate bounce buffer memory "); 140 LogRelPrintQuote(CHUNK_SIZE); 141 LogRelPrint("bytes\n"); 137 LogRelFunc(("could not allocate bounce buffer memory %d\n", CHUNK_SIZE)); 142 138 return -ENOMEM; 143 139 } … … 205 201 sf_r = kmalloc (sizeof (*sf_r), GFP_KERNEL); 206 202 if (!sf_r) { 207 LogRel PrintFunc("could not allocate reg info\n");203 LogRelFunc(("could not allocate reg info\n")); 208 204 return -ENOMEM; 209 205 } … … 223 219 /* We ignore O_EXCL, as the Linux kernel seems to call create 224 220 beforehand itself, so O_EXCL should always fail. */ 225 // if (file->f_flags & O_EXCL) { 226 // LogFunc(("O_EXCL set\n")); 227 // params.CreateFlags |= SHFL_CF_ACT_FAIL_IF_EXISTS; 228 // } 229 // else { 230 /* O_TRUNC combined with O_EXCL is undefined. */ 231 if (file->f_flags & O_TRUNC) { 232 LogFunc(("O_TRUNC set\n")); 233 params.CreateFlags |= SHFL_CF_ACT_OVERWRITE_IF_EXISTS; 234 } 235 else { 236 params.CreateFlags |= SHFL_CF_ACT_OPEN_IF_EXISTS; 237 } 238 // } 221 if (file->f_flags & O_TRUNC) { 222 LogFunc(("O_TRUNC set\n")); 223 params.CreateFlags |= SHFL_CF_ACT_OVERWRITE_IF_EXISTS; 224 } 225 else { 226 params.CreateFlags |= SHFL_CF_ACT_OPEN_IF_EXISTS; 227 } 239 228 } 240 229 else { … … 248 237 if (!(params.CreateFlags & SHFL_CF_ACCESS_READWRITE)) { 249 238 switch (file->f_flags & O_ACCMODE) { 250 251 252 253 254 255 256 257 258 259 260 261 262 263 239 case O_RDONLY: 240 params.CreateFlags |= SHFL_CF_ACCESS_READ; 241 break; 242 243 case O_WRONLY: 244 params.CreateFlags |= SHFL_CF_ACCESS_WRITE; 245 break; 246 247 case O_RDWR: 248 params.CreateFlags |= SHFL_CF_ACCESS_READWRITE; 249 break; 250 251 default: 252 BUG (); 264 253 } 265 254 } … … 273 262 file->f_flags, params.CreateFlags, rc)); 274 263 kfree (sf_r); 275 return - EPROTO;264 return -RTErrConvertToErrno(rc); 276 265 } 277 266 … … 347 336 page = alloc_page (GFP_HIGHUSER); 348 337 if (!page) { 349 LogRel PrintFunc("failed to allocate page\n");338 LogRelFunc(("failed to allocate page\n")); 350 339 SET_TYPE (VM_FAULT_OOM); 351 340 return NOPAGE_OOM; -
trunk/src/VBox/Additions/linux/sharedfolders/utils.c
r4822 r4860 251 251 tmp = kmalloc (shflstring_len, GFP_KERNEL); 252 252 if (!tmp) { 253 LogRelPrintFunc("kmalloc failed, caller="); 254 LogRelPrint(caller); 253 LogRelFunc(("kmalloc failed, caller=%s\n", caller)); 255 254 return -ENOMEM; 256 255 } … … 419 418 b = kmalloc (sizeof (*b), GFP_KERNEL); 420 419 if (!b) { 421 LogRel PrintFunc("could not alloc directory buffer\n");420 LogRelFunc(("could not alloc directory buffer\n")); 422 421 return NULL; 423 422 } … … 430 429 if (!b->buf) { 431 430 kfree (b); 432 LogRel PrintFunc("could not alloc directory buffer storage\n");431 LogRelFunc(("could not alloc directory buffer storage\n")); 433 432 return NULL; 434 433 } … … 480 479 p = kmalloc (sizeof (*p), GFP_KERNEL); 481 480 if (!p) { 482 LogRel PrintFunc("could not alloc directory info\n");481 LogRelFunc(("could not alloc directory info\n")); 483 482 return NULL; 484 483 } … … 536 535 if (!b) { 537 536 err = -ENOMEM; 538 LogRel PrintFunc("could not alloc directory buffer\n");537 LogRelFunc(("could not alloc directory buffer\n")); 539 538 goto fail1; 540 539 } -
trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.c
r4743 r4860 73 73 if (!sf_g) { 74 74 err = -ENOMEM; 75 LogRel PrintFunc("could not allocate memory for global info\n");75 LogRelFunc(("could not allocate memory for global info\n")); 76 76 goto fail0; 77 77 } … … 91 91 if (!str_name) { 92 92 err = -ENOMEM; 93 LogRel PrintFunc("could not allocate memory for host name\n");93 LogRelFunc(("could not allocate memory for host name\n")); 94 94 goto fail1; 95 95 } … … 196 196 if (!sf_i) { 197 197 err = -ENOMEM; 198 LogRel PrintFunc ("could not allocate memory for root inode info\n");198 LogRelFunc (("could not allocate memory for root inode info\n")); 199 199 goto fail1; 200 200 } … … 203 203 if (!sf_i->path) { 204 204 err = -ENOMEM; 205 LogRel PrintFunc ("could not allocate memory for root inode path\n");205 LogRelFunc (("could not allocate memory for root inode path\n")); 206 206 goto fail2; 207 207 } … … 418 418 rc = vboxInit (); 419 419 if (VBOX_FAILURE (rc)) { 420 LogRelPrintFunc ("vboxInit failed\n"); 421 Log (("rc=%d\n", rc)); 420 LogRelFunc (("vboxInit failed, rc=%d\n", rc)); 422 421 goto fail0; 423 422 } … … 425 424 rc = vboxConnect (&client_handle); 426 425 if (VBOX_FAILURE (rc)) { 427 LogRelPrintFunc ("vboxConnect failed\n"); 428 Log (("rc=%d\n", rc)); 426 LogRelFunc (("vboxConnect failed, rc=%d\n", rc)); 429 427 goto fail1; 430 428 } … … 432 430 rc = vboxCallSetUtf8 (&client_handle); 433 431 if (VBOX_FAILURE (rc)) { 434 LogRelPrintFunc ("vboxCallSetUtf8 failed\n"); 435 Log (("rc=%d\n", rc)); 432 LogRelFunc (("vboxCallSetUtf8 failed, rc=%d\n", rc)); 436 433 goto fail2; 437 434 } -
trunk/src/VBox/Runtime/VBox/logbackdoor.cpp
r4802 r4860 84 84 */ 85 85 # include <linux/module.h> 86 # ifdef DEBUG87 /* We only export the full logging infrastructure to the guest kernel88 modules in debug builds. */89 86 EXPORT_SYMBOL(RTLogBackdoorPrintf); 90 # endif91 87 EXPORT_SYMBOL(RTLogWriteUser); 92 88 #endif /* RT_OS_LINUX && IN_MODULE */ 93
Note:
See TracChangeset
for help on using the changeset viewer.