On 10/13/2011 03:25 PM, AndyChen wrote: > 2011/10/13 Liu Yuan<namei.unix at gmail.com>: >> On 10/13/2011 12:12 PM, AndyChen wrote: >>>>> - vprintf(SDOG_INFO "we create a new vdi, %d %s (%zd) %" PRIu64 ", >>>>> vid: %" >>>>> + vprintf(SDOG_INFO, "we create a new vdi, %d %s (%zd) %" PRIu64 >>>>> ", vid: %" >>>>> PRIx32 ", base %" PRIx32 ", cur %" PRIx32 " \n", >>>>> is_snapshot, name, strlen(name), size, *new_vid, >>>>> base_vid, cur_vid); >>>>> >>>>> if (!copies) { >>>>> - vprintf(SDOG_WARNING "qemu doesn't specify the copies... >>>>> %d\n", >>>>> + vprintf(SDOG_WARNING, "qemu doesn't specify the >>>>> copies... %d\n", >>>>> sys->nr_sobjs); >>>>> copies = sys->nr_sobjs; >>>>> } >>>> Why we need extra ',' in vprintf? >>> it is not extra, now vprintf() use log_write() which defined in >>> sheepdog/include/logger.h, >>> log_write() has log level parameter 'prio', but vrpintf() does not >>> parse the log level, use LOG_INFO default. >>> you mean use vprintf() such as use printk()? >>> >> I didn't get you meant. but the definition vprintf(fmt, args...) shows that >> 'fmt' is the constant char *, so I don't think we need to place ',' between >> two format strings. I look at the printk implementation in linux kernel, >> there is no such ',' between format strings either. > here the vprintf defined by the sheep logger, not the standard library > function: vprintf(fmt, args...) #define vprintf(fmt, args...) \ do { \ log_write(LOG_INFO, __func__, __LINE__, fmt, ##args); \ } while (0) extern void log_write(int prio, const char *func, int line, const char *fmt, ...) __attribute__ ((format (printf, 4, 5))); So I think, it is safe to say that the type of 'fmt' in vprintf() is, const char *. Thanks, Yuan |