diff options
62 files changed, 671 insertions, 674 deletions
diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index f94cdc0fd3..6d3c2330b4 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -126,24 +126,24 @@ int main(int argc, char *argv[]) node = argv[optind]; if (node == NULL) { - err("no node specified"); + err("no node specified\n"); rc = 1; goto exit; } fd = open(node, O_RDONLY|O_NONBLOCK); if (fd < 0) { - err("unable to open '%s'", node); + err("unable to open '%s'\n", node); rc = 1; goto exit; } if (ioctl(fd, HDIO_GET_IDENTITY, &id)) { if (errno == ENOTTY) { - info("HDIO_GET_IDENTITY unsupported for '%s'", node); + info("HDIO_GET_IDENTITY unsupported for '%s'\n", node); rc = 2; } else { - err("HDIO_GET_IDENTITY failed for '%s'", node); + err("HDIO_GET_IDENTITY failed for '%s'\n", node); rc = 3; } goto close; diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 315d27610f..b88f5b4b1e 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -71,7 +71,6 @@ void log_message(int priority, const char *format, ...) if (debug) { fprintf(stderr, "[%d] ", (int) getpid()); vfprintf(stderr, format, args); - fprintf(stderr, "\n"); } else vsyslog(priority, format, args); va_end(args); @@ -137,10 +136,10 @@ static unsigned long long int cd_media_session_last_offset; static void info_scsi_cmd_err(const char *cmd, int err) { if (err == -1) { - info("%s failed", cmd); + info("%s failed\n", cmd); return; } - info("%s failed with SK=%Xh/ASC=%02Xh/ACQ=%02Xh", cmd, SK(err), ASC(err), ASCQ(err)); + info("%s failed with SK=%Xh/ASC=%02Xh/ACQ=%02Xh\n", cmd, SK(err), ASC(err), ASCQ(err)); } struct scsi_cmd { @@ -199,7 +198,7 @@ static int cd_capability_compat(int fd) capabilty = ioctl(fd, CDROM_GET_CAPABILITY, NULL); if (capabilty < 0) { - info("CDROM_GET_CAPABILITY failed"); + info("CDROM_GET_CAPABILITY failed\n"); return -1; } @@ -235,11 +234,11 @@ static int cd_inquiry(int fd) { } if ((inq[0] & 0x1F) != 5) { - info("not an MMC unit"); + info("not an MMC unit\n"); return -1; } - info("INQUIRY: [%.8s][%.16s][%.4s]", inq + 8, inq + 16, inq + 32); + info("INQUIRY: [%.8s][%.16s][%.4s]\n", inq + 8, inq + 16, inq + 32); return 0; } @@ -264,9 +263,9 @@ static int cd_profiles(int fd) } len = 4 + (header[0] << 24 | header[1] << 16 | header[2] << 8 | header[3]); - info("GET CONFIGURATION: number of profiles %i", len); + info("GET CONFIGURATION: number of profiles %i\n", len); if (len > sizeof(profiles)) { - info("invalid number of profiles"); + info("invalid number of profiles\n"); return -1; } @@ -287,7 +286,7 @@ static int cd_profiles(int fd) unsigned int profile = (profiles[i] << 8 | profiles[i + 1]); if (profile == 0) continue; - info("profile 0x%02x", profile); + info("profile 0x%02x\n", profile); switch (profile) { case 0x03: @@ -343,9 +342,9 @@ static int cd_profiles(int fd) /* current media profile */ cur_profile = header[6] << 8 | header[7]; - info("current profile 0x%02x", cur_profile); + info("current profile 0x%02x\n", cur_profile); if (cur_profile == 0) { - info("no current profile, assuming no media"); + info("no current profile, assuming no media\n"); return -1; } @@ -435,7 +434,7 @@ static int cd_media_info(int fd) return -1; }; - info("disk type %02x", header[8]); + info("disk type %02x\n", header[8]); if ((header[2] & 3) < 4) cd_media_state = media_status[header[2] & 3]; @@ -467,12 +466,12 @@ static int cd_media_toc(int fd) } len = (header[0] << 8 | header[1]) + 2; - info("READ TOC: len: %d", len); + info("READ TOC: len: %d\n", len); if (len > sizeof(toc)) return -1; /* check if we have a data track */ - info("ctl %02x (0x04 is data/audio)", header[5]); + info("ctl %02x (0x04 is data/audio)\n", header[5]); cd_media_has_audio = (header[5] & 0x04) == 0; scsi_cmd_set(&sc, 0, 0x43); @@ -490,7 +489,7 @@ static int cd_media_toc(int fd) unsigned int block; block = p[4] << 24 | p[5] << 16 | p[6] << 8 | p[7]; - info("track %u starts at block %u", p[2], block); + info("track %u starts at block %u\n", p[2], block); } scsi_cmd_set(&sc, 0, 0x43); @@ -503,7 +502,7 @@ static int cd_media_toc(int fd) return -1; } len = header[4+4] << 24 | header[4+5] << 16 | header[4+6] << 8 | header[4+7]; - info("last track %u starts at block %u", header[4+2], len); + info("last track %u starts at block %u\n", header[4+2], len); cd_media_session_last_offset = (unsigned long long int)len * 2048; return 0; } @@ -550,7 +549,7 @@ int main(int argc, char *argv[]) node = argv[optind]; if (!node) { - err("no device"); + err("no device\n"); fprintf(stderr, "no device\n"); rc = 1; goto exit; @@ -558,11 +557,11 @@ int main(int argc, char *argv[]) fd = open(node, O_RDONLY | O_NONBLOCK); if (fd < 0) { - info("unable to open '%s'", node); + info("unable to open '%s'\n", node); rc = 1; goto exit; } - info("probing: '%s'", node); + info("probing: '%s'\n", node); /* same data as original cdrom_id */ if (cd_capability_compat(fd) < 0) { diff --git a/extras/edd_id/edd_id.c b/extras/edd_id/edd_id.c index 4ba89ede89..4a177709a8 100644 --- a/extras/edd_id/edd_id.c +++ b/extras/edd_id/edd_id.c @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) node = arg; } if (node == NULL) { - err("no node specified"); + err("no node specified\n"); fprintf(stderr, "no node specified\n"); goto exit; } @@ -83,7 +83,7 @@ int main(int argc, char *argv[]) /* check for kernel support */ dir = opendir("/sys/firmware/edd"); if (dir == NULL) { - info("no kernel EDD support"); + info("no kernel EDD support\n"); fprintf(stderr, "no kernel EDD support\n"); rc = 2; goto exit; @@ -91,7 +91,7 @@ int main(int argc, char *argv[]) disk_fd = open(node, O_RDONLY); if (disk_fd < 0) { - info("unable to open '%s'", node); + info("unable to open '%s'\n", node); fprintf(stderr, "unable to open '%s'\n", node); rc = 3; goto closedir; @@ -99,38 +99,38 @@ int main(int argc, char *argv[]) /* check for valid MBR signature */ if (lseek(disk_fd, 510, SEEK_SET) < 0) { - info("seek to MBR validity failed '%s'", node); + info("seek to MBR validity failed '%s'\n", node); rc = 4; goto close; } if (read(disk_fd, &mbr_valid, sizeof(mbr_valid)) != sizeof(mbr_valid)) { - info("read MBR validity failed '%s'", node); + info("read MBR validity failed '%s'\n", node); rc = 5; goto close; } if (mbr_valid != 0xAA55) { fprintf(stderr, "no valid MBR signature '%s'\n", node); - info("no valid MBR signature '%s'", node); + info("no valid MBR signature '%s'\n", node); rc=6; goto close; } /* read EDD signature */ if (lseek(disk_fd, 440, SEEK_SET) < 0) { - info("seek to signature failed '%s'", node); + info("seek to signature failed '%s'\n", node); rc = 7; goto close; } if (read(disk_fd, &disk_id, sizeof(disk_id)) != sizeof(disk_id)) { - info("read signature failed '%s'", node); + info("read signature failed '%s'\n", node); rc = 8; goto close; } /* all zero is invalid */ - info("read id 0x%08x from '%s'", disk_id, node); + info("read id 0x%08x from '%s'\n", disk_id, node); if (disk_id == 0) { fprintf(stderr, "no EDD signature '%s'\n", node); - info("'%s' signature is zero", node); + info("'%s' signature is zero\n", node); rc = 9; goto close; } @@ -150,18 +150,18 @@ int main(int argc, char *argv[]) sysfs_fd = open(file, O_RDONLY); if (sysfs_fd < 0) { - info("unable to open sysfs '%s'", file); + info("unable to open sysfs '%s'\n", file); continue; } size = read(sysfs_fd, sysfs_id_buf, sizeof(sysfs_id_buf)-1); close(sysfs_fd); if (size <= 0) { - info("read sysfs '%s' failed", file); + info("read sysfs '%s' failed\n", file); continue; } sysfs_id_buf[size] = '\0'; - info("read '%s' from '%s'", sysfs_id_buf, file); + info("read '%s' from '%s'\n", sysfs_id_buf, file); sysfs_id = strtoul(sysfs_id_buf, NULL, 16); /* look for matching value, that appears only once */ @@ -171,7 +171,7 @@ int main(int argc, char *argv[]) strlcpy(match, dent->d_name, sizeof(match)); } else { /* error, same signature for another device */ - info("'%s' does not have a unique signature", node); + info("'%s' does not have a unique signature\n", node); fprintf(stderr, "'%s' does not have a unique signature\n", node); rc = 10; goto exit; diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index d8b269a950..463b3775cf 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -174,25 +174,25 @@ static int create_tmp_dev(const char *devpath, char *tmpdev, int dev_type) unsigned int maj, min; const char *attr; - dbg("%s", devpath); + dbg("%s\n", devpath); attr = sysfs_attr_get_value(devpath, "dev"); if (attr == NULL) { - dbg("%s: could not get dev attribute: %s", devpath, strerror(errno)); + dbg("%s: could not get dev attribute: %s\n", devpath, strerror(errno)); return -1; } - dbg("dev value %s", attr); + dbg("dev value %s\n", attr); if (sscanf(attr, "%u:%u", &maj, &min) != 2) { - err("%s: invalid dev major/minor", devpath); + err("%s: invalid dev major/minor\n", devpath); return -1; } snprintf(tmpdev, MAX_PATH_LEN, "%s/%s-maj%d-min%d-%u", TMP_DIR, TMP_PREFIX, maj, min, getpid()); - dbg("tmpdev '%s'", tmpdev); + dbg("tmpdev '%s'\n", tmpdev); if (mknod(tmpdev, 0600 | dev_type, makedev(maj, min))) { - err("mknod failed: %s", strerror(errno)); + err("mknod failed: %s\n", strerror(errno)); return -1; } return 0; @@ -273,7 +273,7 @@ static int get_file_options(const char *vendor, const char *model, if (errno == ENOENT) { return 1; } else { - err("can't open %s: %s", config_file, strerror(errno)); + err("can't open %s: %s\n", config_file, strerror(errno)); return -1; } } @@ -285,7 +285,7 @@ static int get_file_options(const char *vendor, const char *model, */ buffer = malloc(MAX_BUFFER_LEN); if (!buffer) { - err("Can't allocate memory."); + err("can't allocate memory\n"); return -1; } @@ -299,7 +299,7 @@ static int get_file_options(const char *vendor, const char *model, break; lineno++; if (buf[strlen(buffer) - 1] != '\n') { - info("Config file line %d too long.\n", lineno); + info("Config file line %d too long\n", lineno); break; } @@ -344,14 +344,14 @@ static int get_file_options(const char *vendor, const char *model, } options_in = str1; } - dbg("config file line %d:" + dbg("config file line %d:\n" " vendor '%s'; model '%s'; options '%s'\n", lineno, vendor_in, model_in, options_in); /* * Only allow: [vendor=foo[,model=bar]]options=stuff */ if (!options_in || (!vendor_in && model_in)) { - info("Error parsing config file line %d '%s'", lineno, buffer); + info("Error parsing config file line %d '%s'\n", lineno, buffer); retval = -1; break; } @@ -389,7 +389,7 @@ static int get_file_options(const char *vendor, const char *model, c = argc_count(buffer) + 2; *newargv = calloc(c, sizeof(**newargv)); if (!*newargv) { - err("Can't allocate memory."); + err("can't allocate memory\n"); retval = -1; } else { *argc = c; @@ -492,7 +492,7 @@ static int set_options(int argc, char **argv, const char *short_opts, } else if (strcmp(optarg, "pre-spc3-83") == 0) { default_page_code = PAGE_83_PRE_SPC3; } else { - info("Unknown page code '%s'", optarg); + info("Unknown page code '%s'\n", optarg); return -1; } break; @@ -571,13 +571,13 @@ static int per_dev_options(struct sysfs_device *dev_scsi, int *good_bad, int *pa } else if (strcmp(optarg, "pre-spc3-83") == 0) { *page_code = PAGE_83_PRE_SPC3; } else { - info("Unknown page code '%s'", optarg); + info("Unknown page code '%s'\n", optarg); retval = -1; } break; default: - info("Unknown or bad option '%c' (0x%x)", option, option); + info("Unknown or bad option '%c' (0x%x)\n", option, option); retval = -1; break; } @@ -596,7 +596,7 @@ static int set_sysfs_values(struct sysfs_device *dev_scsi) vendor = sysfs_attr_get_value(dev_scsi->devpath, "vendor"); if (!vendor) { - info("%s: cannot get vendor attribute", dev_scsi->devpath); + info("%s: cannot get vendor attribute\n", dev_scsi->devpath); return -1; } set_str(vendor_str, vendor, sizeof(vendor_str)-1); @@ -610,7 +610,7 @@ static int set_sysfs_values(struct sysfs_device *dev_scsi) type = sysfs_attr_get_value(dev_scsi->devpath, "type"); if (!type) { - info("%s: cannot get type attribute", dev_scsi->devpath); + info("%s: cannot get type attribute\n", dev_scsi->devpath); return -1; } set_type(type_str, type, sizeof(type_str)); @@ -690,7 +690,7 @@ static int scsi_id(const char *devpath, char *maj_min_dev) dev = sysfs_device_get(devpath); if (dev == NULL) { - err("unable to access '%s'", devpath); + err("unable to access '%s'\n", devpath); return 1; } @@ -709,7 +709,7 @@ static int scsi_id(const char *devpath, char *maj_min_dev) /* get scsi parent device */ dev_scsi = sysfs_device_get_parent_with_subsystem(dev, "scsi"); if (dev_scsi == NULL) { - err("unable to access parent device of '%s'", devpath); + err("unable to access parent device of '%s'\n", devpath); return 1; } set_sysfs_values(dev_scsi); @@ -721,7 +721,7 @@ static int scsi_id(const char *devpath, char *maj_min_dev) /* get per device (vendor + model) options from the config file */ retval = per_dev_options(dev_scsi, &good_dev, &page_code); - dbg("per dev options: good %d; page code 0x%x", good_dev, page_code); + dbg("per dev options: good %d; page code 0x%x\n", good_dev, page_code); if (!good_dev) { retval = 1; diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index c84f41e043..28e82db3ca 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -179,7 +179,7 @@ static int scsi_dump_sense(struct sysfs_device *dev_scsi, struct sg_io_hdr *io) sb_len = io->sb_len_wr; if (sb_len < 1) { - info("%s: sense buffer empty", dev_scsi->kernel); + info("%s: sense buffer empty\n", dev_scsi->kernel); return -1; } @@ -193,7 +193,7 @@ static int scsi_dump_sense(struct sysfs_device *dev_scsi, struct sg_io_hdr *io) */ s = sense_buffer[7] + 8; if (sb_len < s) { - info("%s: sense buffer too small %d bytes, %d bytes too short", + info("%s: sense buffer too small %d bytes, %d bytes too short\n", dev_scsi->kernel, sb_len, s - sb_len); return -1; } @@ -204,7 +204,7 @@ static int scsi_dump_sense(struct sysfs_device *dev_scsi, struct sg_io_hdr *io) /* * Possible? */ - info("%s: sense result too" " small %d bytes", + info("%s: sense result too" " small %d bytes\n", dev_scsi->kernel, s); return -1; } @@ -216,25 +216,25 @@ static int scsi_dump_sense(struct sysfs_device *dev_scsi, struct sg_io_hdr *io) asc = sense_buffer[2]; ascq = sense_buffer[3]; } else { - info("%s: invalid sense code 0x%x", + info("%s: invalid sense code 0x%x\n", dev_scsi->kernel, code); return -1; } - info("%s: sense key 0x%x ASC 0x%x ASCQ 0x%x", + info("%s: sense key 0x%x ASC 0x%x ASCQ 0x%x\n", dev_scsi->kernel, sense_key, asc, ascq); } else { if (sb_len < 4) { - info("%s: sense buffer too small %d bytes, %d bytes too short", + info("%s: sense buffer too small %d bytes, %d bytes too short\n", dev_scsi->kernel, sb_len, 4 - sb_len); return -1; } if (sense_buffer[0] < 15) - info("%s: old sense key: 0x%x", dev_scsi->kernel, sense_buffer[0] & 0x0f); + info("%s: old sense key: 0x%x\n", dev_scsi->kernel, sense_buffer[0] & 0x0f); else - info("%s: sense = %2x %2x", + info("%s: sense = %2x %2x\n", dev_scsi->kernel, sense_buffer[0], sense_buffer[2]); - info("%s: non-extended sense class %d code 0x%0x", + info("%s: non-extended sense class %d code 0x%0x\n", dev_scsi->kernel, sense_class, code); } @@ -247,8 +247,8 @@ static int scsi_dump_sense(struct sysfs_device *dev_scsi, struct sg_io_hdr *io) out_buffer[j++] = ' '; } out_buffer[j] = '\0'; - info("%s: sense dump:", dev_scsi->kernel); - info("%s: %s", dev_scsi->kernel, out_buffer); + info("%s: sense dump:\n", dev_scsi->kernel); + info("%s: %s\n", dev_scsi->kernel, out_buffer); #endif return -1; @@ -261,11 +261,11 @@ static int scsi_dump(struct sysfs_device *dev_scsi, struct sg_io_hdr *io) /* * Impossible, should not be called. */ - info("%s: called with no error", __FUNCTION__); + info("%s: called with no error\n", __FUNCTION__); return -1; } - info("%s: sg_io failed status 0x%x 0x%x 0x%x 0x%x", + info("%s: sg_io failed status 0x%x 0x%x 0x%x 0x%x\n", dev_scsi->kernel, io->driver_status, io->host_status, io->msg_status, io->status); if (io->status == SCSI_CHECK_CONDITION) return scsi_dump_sense(dev_scsi, io); @@ -285,7 +285,7 @@ static int scsi_inquiry(struct sysfs_device *dev_scsi, int fd, int retry = 3; /* rather random */ if (buflen > SCSI_INQ_BUFF_LEN) { - info("buflen %d too long", buflen); + info("buflen %d too long\n", buflen); return -1; } @@ -304,7 +304,7 @@ resend: io_hdr.timeout = DEF_TIMEOUT; if (ioctl(fd, SG_IO, &io_hdr) < 0) { - info("%s: ioctl failed: %s", dev_scsi->kernel, strerror(errno)); + info("%s: ioctl failed: %s\n", dev_scsi->kernel, strerror(errno)); retval = -1; goto error; } @@ -336,7 +336,7 @@ resend: error: if (retval < 0) - info("%s: Unable to get INQUIRY vpd %d page 0x%x.", + info("%s: Unable to get INQUIRY vpd %d page 0x%x.\n", dev_scsi->kernel, evpd, page); return retval; @@ -355,11 +355,11 @@ static int do_scsi_page0_inquiry(struct sysfs_device *dev_scsi, int fd, return 1; if (buffer[1] != 0) { - info("%s: page 0 not available.", dev_scsi->kernel); + info("%s: page 0 not available.\n", dev_scsi->kernel); return 1; } if (buffer[3] > len) { - info("%s: page 0 buffer too long %d", dev_scsi->kernel, buffer[3]); + info("%s: page 0 buffer too long %d\n", dev_scsi->kernel, buffer[3]); return 1; } @@ -377,11 +377,11 @@ static int do_scsi_page0_inquiry(struct sysfs_device *dev_scsi, int fd, */ vendor = sysfs_attr_get_value(dev_scsi->devpath, "vendor"); if (!vendor) { - info("%s: cannot get model attribute", dev_scsi->kernel); + info("%s: cannot get model attribute\n", dev_scsi->kernel); return 1; } if (!strncmp((char *)&buffer[VENDOR_LENGTH], vendor, VENDOR_LENGTH)) { - info("%s: invalid page0 data", dev_scsi->kernel); + info("%s: invalid page0 data\n", dev_scsi->kernel); return 1; } } @@ -399,7 +399,7 @@ static int prepend_vendor_model(struct sysfs_device *dev_scsi, char *serial) attr = sysfs_attr_get_value(dev_scsi->devpath, "vendor"); if (!attr) { - info("%s: cannot get vendor attribute", dev_scsi->kernel); + info("%s: cannot get vendor attribute\n", dev_scsi->kernel); return 1; } strncpy(serial, attr, VENDOR_LENGTH); @@ -407,7 +407,7 @@ static int prepend_vendor_model(struct sysfs_device *dev_scsi, char *serial) attr = sysfs_attr_get_value(dev_scsi->devpath, "model"); if (!attr) { - info("%s: cannot get model attribute", dev_scsi->kernel); + info("%s: cannot get model attribute\n", dev_scsi->kernel); return 1; } strncat(serial, attr, MODEL_LENGTH); @@ -419,7 +419,7 @@ static int prepend_vendor_model(struct sysfs_device *dev_scsi, char *serial) * above, ind will never be too large. */ if (ind != (VENDOR_LENGTH + MODEL_LENGTH)) { - info("%s: expected length %d, got length %d", + info("%s: expected length %d, got length %d\n", dev_scsi->kernel, (VENDOR_LENGTH + MODEL_LENGTH), ind); return 1; } @@ -477,7 +477,7 @@ static int check_fill_0x83_id(struct sysfs_device *dev_scsi, len += VENDOR_LENGTH + MODEL_LENGTH; if (max_len < len) { - info("%s: length %d too short - need %d", + info("%s: length %d too short - need %d\n", dev_scsi->kernel, max_len, len); return 1; } @@ -528,7 +528,7 @@ static int check_fill_0x83_prespc3(struct sysfs_device *dev_scsi, { int i, j; - dbg("using pre-spc3-83 for %s.\n", dev_scsi->kernel); + dbg("using pre-spc3-83 for %s\n", dev_scsi->kernel); serial[0] = hex_str[id_search->id_type]; /* serial has been memset to zero before */ j = strlen(serial); /* j = 1; */ @@ -557,7 +557,7 @@ static int do_scsi_page83_inquiry(struct sysfs_device *dev_scsi, int fd, return 1; if (page_83[1] != PAGE_83) { - info("%s: Invalid page 0x83", dev_scsi->kernel); + info("%s: Invalid page 0x83\n", dev_scsi->kernel); return 1; } @@ -613,13 +613,13 @@ static int do_scsi_page83_inquiry(struct sysfs_device *dev_scsi, int fd, id_search_list[id_ind].naa_type, id_search_list[id_ind].code_set); if (!retval) { - dbg(" used\n"); + dbg(" used\n"); return retval; } else if (retval < 0) { - dbg(" failed\n"); + dbg(" failed\n"); return retval; } else { - dbg(" not used\n"); + dbg(" not used\n"); } } } @@ -646,7 +646,7 @@ static int do_scsi_page83_prespc3_inquiry(struct sysfs_device *dev_scsi, int fd, return 1; if (page_83[1] != PAGE_83) { - info("%s: Invalid page 0x83", dev_scsi->kernel); + info("%s: Invalid page 0x83\n", dev_scsi->kernel); return 1; } /* @@ -690,7 +690,7 @@ static int do_scsi_page83_prespc3_inquiry(struct sysfs_device *dev_scsi, int fd, serial[j++] = hex_str[page_83[i] & 0x0f]; i++; } - dbg("using pre-spc3-83 for %s.\n", dev_scsi->kernel); + dbg("using pre-spc3-83 for %s\n", dev_scsi->kernel); return 0; } @@ -710,13 +710,13 @@ static int do_scsi_page80_inquiry(struct sysfs_device *dev_scsi, int fd, return retval; if (buf[1] != PAGE_80) { - info("%s: Invalid page 0x80", dev_scsi->kernel); + info("%s: Invalid page 0x80\n", dev_scsi->kernel); return 1; } len = 1 + VENDOR_LENGTH + MODEL_LENGTH + buf[3]; if (max_len < len) { - info("%s: length %d too short - need %d", + info("%s: length %d too short - need %d\n", dev_scsi->kernel, max_len, len); return 1; } @@ -746,7 +746,7 @@ int scsi_std_inquiry(struct sysfs_device *dev_scsi, const char *devname, dbg("opening %s\n", devname); fd = open(devname, O_RDONLY | O_NONBLOCK); if (fd < 0) { - info("%s: cannot open %s: %s", + info("%s: cannot open %s: %s\n", dev_scsi->kernel, devname, strerror(errno)); return 1; } @@ -762,7 +762,7 @@ int scsi_std_inquiry(struct sysfs_device *dev_scsi, const char *devname, sprintf(type,"%x", buf[0] & 0x1f); if (close(fd) < 0) - info("%s: close failed: %s", dev_scsi->kernel, strerror(errno)); + info("%s: close failed: %s\n", dev_scsi->kernel, strerror(errno)); return 0; } @@ -779,7 +779,7 @@ int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, dbg("opening %s\n", devname); fd = open(devname, O_RDONLY | O_NONBLOCK); if (fd < 0) { - info("%s: cannot open %s: %s", + info("%s: cannot open %s: %s\n", dev_scsi->kernel, devname, strerror(errno)); return 1; } @@ -826,7 +826,7 @@ int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, goto completed; } } else if (page_code != 0x00) { - info("%s: unsupported page code 0x%d", dev_scsi->kernel, page_code); + info("%s: unsupported page code 0x%d\n", dev_scsi->kernel, page_code); return 1; } @@ -870,6 +870,6 @@ int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, retval = 1; completed: if (close(fd) < 0) - info("%s: close failed: %s", dev_scsi->kernel, strerror(errno)); + info("%s: close failed: %s\n", dev_scsi->kernel, strerror(errno)); return retval; } diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 5fb030db56..fed6631b90 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -231,20 +231,20 @@ static int usb_id(const char *devpath) /* get all usb specific information: dev_interface, if_class, dev_usb */ dev = sysfs_device_get(devpath); if (dev == NULL) { - err("unable to access '%s'", devpath); + err("unable to access '%s'\n", devpath); return 1; } /* usb interface directory */ dev_interface = sysfs_device_get_parent_with_subsystem(dev, "usb"); if (dev_interface == NULL) { - info("unable to access usb_interface device of '%s'", devpath); + info("unable to access usb_interface device of '%s'\n", devpath); return 1; } if_class = sysfs_attr_get_value(dev_interface->devpath, "bInterfaceClass"); if (!if_class) { - info("%s: cannot get bInterfaceClass attribute", dev_interface->kernel); + info("%s: cannot get bInterfaceClass attribute\n", dev_interface->kernel); return 1; } if_class_num = strtoul(if_class, NULL, 16); @@ -260,7 +260,7 @@ static int usb_id(const char *devpath) /* usb device directory */ dev_usb = sysfs_device_get_parent_with_subsystem(dev_interface, "usb"); if (!dev_usb) { - info("unable to find parent 'usb' device of '%s'", devpath); + info("unable to find parent 'usb' device of '%s'\n", devpath); return 1; } @@ -273,39 +273,39 @@ static int usb_id(const char *devpath) /* get scsi device */ dev_scsi = sysfs_device_get_parent_with_subsystem(dev, "scsi"); if (dev_scsi == NULL) { - info("unable to find parent 'scsi' device of '%s'", devpath); + info("unable to find parent 'scsi' device of '%s'\n", devpath); goto fallback; } if (sscanf(dev_scsi->kernel, "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4) { - info("invalid scsi device '%s'", dev_scsi->kernel); + info("invalid scsi device '%s'\n", dev_scsi->kernel); goto fallback; } /* Generic SPC-2 device */ scsi_vendor = sysfs_attr_get_value(dev_scsi->devpath, "vendor"); if (!scsi_vendor) { - info("%s: cannot get SCSI vendor attribute", dev_scsi->kernel); + info("%s: cannot get SCSI vendor attribute\n", dev_scsi->kernel); goto fallback; } set_str(vendor_str, scsi_vendor, sizeof(vendor_str)-1); scsi_model = sysfs_attr_get_value(dev_scsi->devpath, "model"); if (!scsi_model) { - info("%s: cannot get SCSI model attribute", dev_scsi->kernel); + info("%s: cannot get SCSI model attribute\n", dev_scsi->kernel); goto fallback; } set_str(model_str, scsi_model, sizeof(model_str)-1); scsi_type = sysfs_attr_get_value(dev_scsi->devpath, "type"); if (!scsi_type) { - info("%s: cannot get SCSI type attribute", dev_scsi->kernel); + info("%s: cannot get SCSI type attribute\n", dev_scsi->kernel); goto fallback; } set_scsi_type(type_str, scsi_type, sizeof(type_str)-1); scsi_rev = sysfs_attr_get_value(dev_scsi->devpath, "rev"); if (!scsi_rev) { - info("%s: cannot get SCSI revision attribute", dev_scsi->kernel); + info("%s: cannot get SCSI revision attribute\n", dev_scsi->kernel); goto fallback; } set_str(revision_str, scsi_rev, sizeof(revision_str)-1); @@ -329,7 +329,7 @@ fallback: usb_vendor = sysfs_attr_get_value(dev_usb->devpath, "idVendor"); if (!usb_vendor) { - info("No USB vendor information available"); + info("No USB vendor information available\n"); return 1; } set_str(vendor_str, usb_vendor, sizeof(vendor_str)-1); @@ -345,7 +345,7 @@ fallback: usb_model = sysfs_attr_get_value(dev_usb->devpath, "idProduct"); if (!usb_model) { - dbg("No USB model information available"); + dbg("No USB model information available\n"); return 1; } set_str(model_str, usb_model, sizeof(model_str)-1); diff --git a/extras/volume_id/lib/adaptec_raid.c b/extras/volume_id/lib/adaptec_raid.c index 858c3ba09e..5ab9451890 100644 --- a/extras/volume_id/lib/adaptec_raid.c +++ b/extras/volume_id/lib/adaptec_raid.c @@ -86,7 +86,7 @@ int volume_id_probe_adaptec_raid(struct volume_id *id, uint64_t off, uint64_t si uint64_t meta_off; struct adaptec_meta *ad; - info("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); if (size < 0x10000) diff --git a/extras/volume_id/lib/cramfs.c b/extras/volume_id/lib/cramfs.c index bf329506e1..9c7eaf6177 100644 --- a/extras/volume_id/lib/cramfs.c +++ b/extras/volume_id/lib/cramfs.c @@ -45,7 +45,7 @@ int volume_id_probe_cramfs(struct volume_id *id, uint64_t off, uint64_t size) { struct cramfs_super *cs; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); cs = (struct cramfs_super *) volume_id_get_buffer(id, off, 0x200); if (cs == NULL) diff --git a/extras/volume_id/lib/ddf_raid.c b/extras/volume_id/lib/ddf_raid.c index 560e6bd603..60837a48b1 100644 --- a/extras/volume_id/lib/ddf_raid.c +++ b/extras/volume_id/lib/ddf_raid.c @@ -45,7 +45,7 @@ int volume_id_probe_ddf_raid(struct volume_id *id, uint64_t off, uint64_t size) uint64_t ddf_off = ((size / 0x200)-1) * 0x200; const uint8_t *buf; - info("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); if (size < 0x10000) return -1; diff --git a/extras/volume_id/lib/ext.c b/extras/volume_id/lib/ext.c index ac21f12501..56edd2531f 100644 --- a/extras/volume_id/lib/ext.c +++ b/extras/volume_id/lib/ext.c @@ -132,7 +132,7 @@ int volume_id_probe_ext(struct volume_id *id, uint64_t off, uint64_t size) uint32_t feature_incompat; uint32_t flags; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); es = (struct ext2_super_block *) volume_id_get_buffer(id, off + EXT_SUPERBLOCK_OFFSET, 0x200); if (es == NULL) @@ -142,9 +142,9 @@ int volume_id_probe_ext(struct volume_id *id, uint64_t off, uint64_t size) return -1; bsize = 0x400 << le32_to_cpu(es->s_log_block_size); - dbg("ext blocksize 0x%zx", bsize); + dbg("ext blocksize 0x%zx\n", bsize); if (bsize < EXT3_MIN_BLOCK_SIZE || bsize > EXT3_MAX_BLOCK_SIZE) { - dbg("invalid ext blocksize"); + dbg("invalid ext blocksize\n"); return -1; } diff --git a/extras/volume_id/lib/fat.c b/extras/volume_id/lib/fat.c index 3ddf0258eb..58f8f825c4 100644 --- a/extras/volume_id/lib/fat.c +++ b/extras/volume_id/lib/fat.c @@ -217,7 +217,7 @@ static size_t get_fat_attr_volume_id(uint8_t *filename, size_t fnsize, for (i = 0; i < count; i++) { /* end marker */ if (dir[i].name[0] == 0x00) { - dbg("end of dir"); + dbg("end of dir\n"); break; } @@ -234,11 +234,11 @@ static size_t get_fat_attr_volume_id(uint8_t *filename, size_t fnsize, if (dir[i].cluster_high != 0 || dir[i].cluster_low != 0) continue; - dbg("found ATTR_VOLUME_ID id in root dir"); + dbg("found ATTR_VOLUME_ID id in root dir\n"); return fat_read_filename(filename, fnsize, dir, &dir[i]); } - dbg("skip dir entry"); + dbg("skip dir entry\n"); } return 0; @@ -270,7 +270,7 @@ int volume_id_probe_vfat(struct volume_id *id, uint64_t off, uint64_t size) int maxloop; size_t fnlen; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); buf = volume_id_get_buffer(id, off, 0x400); if (buf == NULL) @@ -328,22 +328,22 @@ magic: if (sector_size == 0 || ((sector_size & (sector_size-1)) != 0)) return -1; - dbg("sector_size 0x%x", sector_size); - dbg("sectors_per_cluster 0x%x", vs->sectors_per_cluster); + dbg("sector_size 0x%x\n", sector_size); + dbg("sectors_per_cluster 0x%x\n", vs->sectors_per_cluster); dir_entries = le16_to_cpu(vs->dir_entries); reserved = le16_to_cpu(vs->reserved); - dbg("reserved 0x%x", reserved); + dbg("reserved 0x%x\n", reserved); sect_count = le16_to_cpu(vs->sectors); if (sect_count == 0) sect_count = le32_to_cpu(vs->total_sect); - dbg("sect_count 0x%x", sect_count); + dbg("sect_count 0x%x\n", sect_count); fat_length = le16_to_cpu(vs->fat_length); - dbg("fat_length 0x%x", fat_length); + dbg("fat_length 0x%x\n", fat_length); fat32_length = le32_to_cpu(vs->type.fat32.fat32_length); - dbg("fat32_length 0x%x", fat32_length); + dbg("fat32_length 0x%x\n", fat32_length); if (fat_length) fat_size = fat_length * vs->fats; @@ -351,15 +351,15 @@ magic: fat_size = fat32_length * vs->fats; else return -1; - dbg("fat_size 0x%x", fat_size); + dbg("fat_size 0x%x\n", fat_size); dir_size = ((dir_entries * sizeof(struct vfat_dir_entry)) + (sector_size-1)) / sector_size; - dbg("dir_size 0x%x", dir_size); + dbg("dir_size 0x%x\n", dir_size); cluster_count = sect_count - (reserved + fat_size + dir_size); cluster_count /= vs->sectors_per_cluster; - dbg("cluster_count 0x%x", cluster_count); + dbg("cluster_count 0x%x\n", cluster_count); /* must be FAT32 */ if (!fat_length && fat32_length) @@ -375,9 +375,9 @@ magic: /* the label may be an attribute in the root directory */ root_start = (reserved + fat_size) * sector_size; - dbg("root dir start 0x%llx", (unsigned long long) root_start); + dbg("root dir start 0x%llx\n", (unsigned long long) root_start); root_dir_entries = le16_to_cpu(vs->dir_entries); - dbg("expected entries 0x%x", root_dir_entries); + dbg("expected entries 0x%x\n", root_dir_entries); buf_size = root_dir_entries * sizeof(struct vfat_dir_entry); buf = volume_id_get_buffer(id, off + root_start, buf_size); @@ -423,7 +423,7 @@ fat32: /* FAT32 root dir is a cluster chain like any other directory */ buf_size = vs->sectors_per_cluster * sector_size; root_cluster = le32_to_cpu(vs->type.fat32.root_cluster); - dbg("root dir cluster %u", root_cluster); + dbg("root dir cluster %u\n", root_cluster); start_data_sect = reserved + fat_size; next = root_cluster; @@ -434,10 +434,10 @@ fat32: uint64_t fat_entry_off; int count; - dbg("next cluster %u", next); + dbg("next cluster %u\n", next); next_sect_off = (next - 2) * vs->sectors_per_cluster; next_off = (start_data_sect + next_sect_off) * sector_size; - dbg("cluster offset 0x%llx", (unsigned long long) next_off); + dbg("cluster offset 0x%llx\n", (unsigned long long) next_off); /* get cluster */ buf = volume_id_get_buffer(id, off + next_off, buf_size); @@ -446,7 +446,7 @@ fat32: dir = (struct vfat_dir_entry*) buf; count = buf_size / sizeof(struct vfat_dir_entry); - dbg("expected entries 0x%x", count); + dbg("expected entries 0x%x\n", count); fnlen = get_fat_attr_volume_id(filename, sizeof(filename), dir, count); if (fnlen > 0) @@ -464,7 +464,7 @@ fat32: break; } if (maxloop == 0) - dbg("reached maximum follow count of root cluster chain, give up"); + dbg("reached maximum follow count of root cluster chain, give up\n"); vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); if (vs == NULL) diff --git a/extras/volume_id/lib/gfs.c b/extras/volume_id/lib/gfs.c index 1d3a4a0f1e..53382222ac 100644 --- a/extras/volume_id/lib/gfs.c +++ b/extras/volume_id/lib/gfs.c @@ -78,7 +78,7 @@ static int volume_id_probe_gfs_generic(struct volume_id *id, uint64_t off, int v { struct gfs2_sb *sbd; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); sbd = (struct gfs2_sb *) volume_id_get_buffer(id, off + GFS_SUPERBLOCK_OFFSET, sizeof(struct gfs2_sb)); diff --git a/extras/volume_id/lib/hfs.c b/extras/volume_id/lib/hfs.c index 70a6b4ae2c..b6d7e0290b 100644 --- a/extras/volume_id/lib/hfs.c +++ b/extras/volume_id/lib/hfs.c @@ -186,7 +186,7 @@ int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off, uint64_t siz struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; const uint8_t *buf; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); if (buf == NULL) @@ -199,17 +199,17 @@ int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off, uint64_t siz /* it may be just a hfs wrapper for hfs+ */ if (memcmp(hfs->embed_sig, "H+", 2) == 0) { alloc_block_size = be32_to_cpu(hfs->al_blk_size); - dbg("alloc_block_size 0x%x", alloc_block_size); + dbg("alloc_block_size 0x%x\n", alloc_block_size); alloc_first_block = be16_to_cpu(hfs->al_bl_st); - dbg("alloc_first_block 0x%x", alloc_first_block); + dbg("alloc_first_block 0x%x\n", alloc_first_block); embed_first_block = be16_to_cpu(hfs->embed_startblock); - dbg("embed_first_block 0x%x", embed_first_block); + dbg("embed_first_block 0x%x\n", embed_first_block); off += (alloc_first_block * 512) + (embed_first_block * alloc_block_size); - dbg("hfs wrapped hfs+ found at offset 0x%llx", (unsigned long long) off); + dbg("hfs wrapped hfs+ found at offset 0x%llx\n", (unsigned long long) off); buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); if (buf == NULL) @@ -241,11 +241,11 @@ hfsplus: hfsid_set_uuid(id, hfsplus->finder_info.id); blocksize = be32_to_cpu(hfsplus->blocksize); - dbg("blocksize %u", blocksize); + dbg("blocksize %u\n", blocksize); memcpy(extents, hfsplus->cat_file.extents, sizeof(extents)); cat_block = be32_to_cpu(extents[0].start_block); - dbg("catalog start block 0x%x", cat_block); + dbg("catalog start block 0x%x\n", cat_block); buf = volume_id_get_buffer(id, off + (cat_block * blocksize), 0x2000); if (buf == NULL) @@ -255,13 +255,13 @@ hfsplus: &buf[sizeof(struct hfsplus_bnode_descriptor)]; leaf_node_head = be32_to_cpu(bnode->leaf_head); - dbg("catalog leaf node 0x%x", leaf_node_head); + dbg("catalog leaf node 0x%x\n", leaf_node_head); leaf_node_size = be16_to_cpu(bnode->node_size); - dbg("leaf node size 0x%x", leaf_node_size); + dbg("leaf node size 0x%x\n", leaf_node_size); leaf_node_count = be32_to_cpu(bnode->leaf_count); - dbg("leaf node count 0x%x", leaf_node_count); + dbg("leaf node count 0x%x\n", leaf_node_count); if (leaf_node_count == 0) goto found; @@ -271,7 +271,7 @@ hfsplus: for (ext = 0; ext < HFSPLUS_EXTENT_COUNT; ext++) { ext_block_start = be32_to_cpu(extents[ext].start_block); ext_block_count = be32_to_cpu(extents[ext].block_count); - dbg("extent start block 0x%x, count 0x%x", ext_block_start, ext_block_count); + dbg("extent start block 0x%x, count 0x%x\n", ext_block_start, ext_block_count); if (ext_block_count == 0) goto found; @@ -284,7 +284,7 @@ hfsplus: } if (ext == HFSPLUS_EXTENT_COUNT) goto found; - dbg("found block in extent %i", ext); + dbg("found block in extent %i\n", ext); leaf_off = (ext_block_start + leaf_block) * blocksize; @@ -293,10 +293,10 @@ hfsplus: goto found; descr = (struct hfsplus_bnode_descriptor *) buf; - dbg("descriptor type 0x%x", descr->type); + dbg("descriptor type 0x%x\n", descr->type); record_count = be16_to_cpu(descr->num_recs); - dbg("number of records %u", record_count); + dbg("number of records %u\n", record_count); if (record_count == 0) goto found; @@ -306,12 +306,12 @@ hfsplus: key = (struct hfsplus_catalog_key *) &buf[sizeof(struct hfsplus_bnode_descriptor)]; - dbg("parent id 0x%x", be32_to_cpu(key->parent_id)); + dbg("parent id 0x%x\n", be32_to_cpu(key->parent_id)); if (be32_to_cpu(key->parent_id) != HFSPLUS_POR_CNID) goto found; label_len = be16_to_cpu(key->unicode_len) * 2; - dbg("label unicode16 len %i", label_len); + dbg("label unicode16 len %i\n", label_len); volume_id_set_label_raw(id, key->unicode, label_len); volume_id_set_label_unicode16(id, key->unicode, BE, label_len); diff --git a/extras/volume_id/lib/highpoint.c b/extras/volume_id/lib/highpoint.c index f2c4069cc6..0629015117 100644 --- a/extras/volume_id/lib/highpoint.c +++ b/extras/volume_id/lib/highpoint.c @@ -49,7 +49,7 @@ int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off, uint6 struct hpt37x_meta *hpt; uint32_t magic; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); buf = volume_id_get_buffer(id, off + HPT37X_CONFIG_OFF, 0x200); if (buf == NULL) @@ -73,7 +73,7 @@ int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint6 uint64_t meta_off; uint32_t magic; - dbg("probing at offset 0x%llx, size 0x%llx", + dbg("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); if (size < 0x10000) diff --git a/extras/volume_id/lib/hpfs.c b/extras/volume_id/lib/hpfs.c index edcf0666ae..ac5a35437a 100644 --- a/extras/volume_id/lib/hpfs.c +++ b/extras/volume_id/lib/hpfs.c @@ -38,7 +38,7 @@ int volume_id_probe_hpfs(struct volume_id *id, uint64_t off, uint64_t size) { struct hpfs_super *hs; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); hs = (struct hpfs_super *) volume_id_get_buffer(id, off + HPFS_SUPERBLOCK_OFFSET, 0x200); if (hs == NULL) diff --git a/extras/volume_id/lib/iso9660.c b/extras/volume_id/lib/iso9660.c index 1d8bdff878..0e2c686fa2 100644 --- a/extras/volume_id/lib/iso9660.c +++ b/extras/volume_id/lib/iso9660.c @@ -59,7 +59,7 @@ int volume_id_probe_iso9660(struct volume_id *id, uint64_t off, uint64_t size) struct iso_volume_descriptor *is; struct high_sierra_volume_descriptor *hs; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); buf = volume_id_get_buffer(id, off + ISO_SUPERBLOCK_OFFSET, 0x200); if (buf == NULL) @@ -71,11 +71,11 @@ int volume_id_probe_iso9660(struct volume_id *id, uint64_t off, uint64_t size) int vd_offset; int i; - dbg("read label from PVD"); + dbg("read label from PVD\n"); volume_id_set_label_raw(id, is->volume_id, 32); volume_id_set_label_string(id, is->volume_id, 32); - dbg("looking for SVDs"); + dbg("looking for SVDs\n"); vd_offset = ISO_VD_OFFSET; for (i = 0; i < ISO_VD_MAX; i++) { uint8_t svd_label[64]; @@ -86,14 +86,14 @@ int volume_id_probe_iso9660(struct volume_id *id, uint64_t off, uint64_t size) if (is->type != ISO_VD_SUPPLEMENTARY) continue; - dbg("found SVD at offset 0x%llx", (unsigned long long) (off + vd_offset)); + dbg("found SVD at offset 0x%llx\n", (unsigned long long) (off + vd_offset)); if (memcmp(is->escape_sequences, "%/@", 3) == 0|| memcmp(is->escape_sequences, "%/C", 3) == 0|| memcmp(is->escape_sequences, "%/E", 3) == 0) { - dbg("Joliet extension found"); + dbg("Joliet extension found\n"); volume_id_set_unicode16(svd_label, sizeof(svd_label), is->volume_id, BE, 32); if (memcmp(id->label, svd_label, 16) == 0) { - dbg("SVD label is identical, use the possibly longer PVD one"); + dbg("SVD label is identical, use the possibly longer PVD one\n"); break; } diff --git a/extras/volume_id/lib/isw_raid.c b/extras/volume_id/lib/isw_raid.c index f5761e826b..337a9cecbd 100644 --- a/extras/volume_id/lib/isw_raid.c +++ b/extras/volume_id/lib/isw_raid.c @@ -43,7 +43,7 @@ int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint uint64_t meta_off; struct isw_meta *isw; - info("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); if (size < 0x10000) diff --git a/extras/volume_id/lib/jfs.c b/extras/volume_id/lib/jfs.c index 00b66cccc7..950ba43e1c 100644 --- a/extras/volume_id/lib/jfs.c +++ b/extras/volume_id/lib/jfs.c @@ -45,7 +45,7 @@ int volume_id_probe_jfs(struct volume_id *id, uint64_t off, uint64_t size) { struct jfs_super_block *js; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); js = (struct jfs_super_block *) volume_id_get_buffer(id, off + JFS_SUPERBLOCK_OFFSET, 0x200); if (js == NULL) diff --git a/extras/volume_id/lib/jmicron_raid.c b/extras/volume_id/lib/jmicron_raid.c index 5182a3e825..6cb1f6f315 100644 --- a/extras/volume_id/lib/jmicron_raid.c +++ b/extras/volume_id/lib/jmicron_raid.c @@ -39,7 +39,7 @@ int volume_id_probe_jmicron_raid(struct volume_id *id, uint64_t off, uint64_t si uint64_t meta_off; struct jmicron_meta *jm; - info("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); if (size < 0x10000) diff --git a/extras/volume_id/lib/linux_raid.c b/extras/volume_id/lib/linux_raid.c index 5e0c4a494f..96ae7c32e3 100644 --- a/extras/volume_id/lib/linux_raid.c +++ b/extras/volume_id/lib/linux_raid.c @@ -66,7 +66,7 @@ static int volume_id_probe_linux_raid0(struct volume_id *id, uint64_t off, uint6 uint8_t bytes[16]; } uuid; - info("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); if (size < 0x10000) return -1; @@ -120,7 +120,7 @@ static int volume_id_probe_linux_raid1(struct volume_id *id, uint64_t off, uint6 { const uint8_t *buf; - info("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); buf = volume_id_get_buffer(id, off, 0x800); diff --git a/extras/volume_id/lib/linux_swap.c b/extras/volume_id/lib/linux_swap.c index 50d43ccce6..9ff16e2798 100644 --- a/extras/volume_id/lib/linux_swap.c +++ b/extras/volume_id/lib/linux_swap.c @@ -43,7 +43,7 @@ int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off, uint64_t size unsigned int page; struct swap_header_v1_2 *sw; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); /* eek, the swap signature is at the end of the PAGE_SIZE */ for (page = 0x1000; page <= LARGEST_PAGESIZE; page <<= 1) { diff --git a/extras/volume_id/lib/lsi_raid.c b/extras/volume_id/lib/lsi_raid.c index 56fd5671d3..eef87142b8 100644 --- a/extras/volume_id/lib/lsi_raid.c +++ b/extras/volume_id/lib/lsi_raid.c @@ -38,7 +38,7 @@ int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t s uint64_t meta_off; struct lsi_meta *lsi; - info("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); if (size < 0x10000) diff --git a/extras/volume_id/lib/lvm.c b/extras/volume_id/lib/lvm.c index 7c4f81131c..d234113d77 100644 --- a/extras/volume_id/lib/lvm.c +++ b/extras/volume_id/lib/lvm.c @@ -51,7 +51,7 @@ int volume_id_probe_lvm1(struct volume_id *id, uint64_t off, uint64_t size) const uint8_t *buf; struct lvm1_super_block *lvm; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); buf = volume_id_get_buffer(id, off + LVM1_SB_OFF, 0x800); if (buf == NULL) @@ -78,7 +78,7 @@ int volume_id_probe_lvm2(struct volume_id *id, uint64_t off, uint64_t size) struct lvm2_super_block *lvm; struct lvm2_pv_header *pvhdr; - dbg("probing at offset 0x%llx", (unsigned long long) off); + dbg("probing at offset 0x%llx\n", (unsigned long long) off); buf = volume_id_get_buffer(id, off, LVM2LABEL_SCAN_SECTORS * 0x200); if (buf == NULL) @@ -95,7 +95,7 @@ int volume_id_probe_lvm2(struct volume_id *id, uint64_t off, uint64_t size) return -1; found: - dbg("found at offset 0x%x (pv hdr offset 0x%x)", + dbg("found at offset 0x%x (pv hdr offset 0x%x)\n", soff, cpu_to_le32(lvm->offset_xl)); soff += cpu_to_le32(lvm->offset_xl); pvhdr = (struct lvm2_pv_header *) &buf[soff]; diff --git a/extras/volume_id/lib/minix.c b/extras/volume_id/lib/minix.c index 64945067e8..88b4c189c4 100644 --- a/extras/volume_id/lib/minix.c +++ b/extras/volume_id/lib/minix.c @@ -70,7 +70,7 @@ int volume_id_probe_minix(struct volume_id *id, uint64_t off, uint64_t size) struct minix_super_block *ms; struct minix3_super_block *m3s; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); buf = volume_id_get_buffer(id, off + MINIX_SUPERBLOCK_OFFSET, 0x200); if (buf == NULL) diff --git a/extras/volume_id/lib/netware.c b/extras/volume_id/lib/netware.c index 4d157aaf5d..c03455791c 100644 --- a/extras/volume_id/lib/netware.c +++ b/extras/volume_id/lib/netware.c @@ -82,7 +82,7 @@ int volume_id_probe_netware(struct volume_id *id, uint64_t off, uint64_t size) { struct netware_super_block *nw; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); nw = (struct netware_super_block *) volume_id_get_buffer(id, off + NW_SUPERBLOCK_OFFSET, 0x200); if (nw == NULL) diff --git a/extras/volume_id/lib/ntfs.c b/extras/volume_id/lib/ntfs.c index f63804d711..1e73bc8f15 100644 --- a/extras/volume_id/lib/ntfs.c +++ b/extras/volume_id/lib/ntfs.c @@ -105,7 +105,7 @@ int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size) const uint8_t *buf; const uint8_t *val; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); ns = (struct ntfs_super_block *) volume_id_get_buffer(id, off, 0x200); if (ns == NULL) @@ -130,12 +130,12 @@ int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size) else mft_record_size = ns->cluster_per_mft_record * cluster_size; - dbg("sectorsize 0x%x", sector_size); - dbg("clustersize 0x%x", cluster_size); - dbg("mftcluster %llu", (unsigned long long) mft_cluster); - dbg("mftoffset 0x%llx", (unsigned long long) mft_off); - dbg("cluster per mft_record %i", ns->cluster_per_mft_record); - dbg("mft record size %i", mft_record_size); + dbg("sectorsize 0x%x\n", sector_size); + dbg("clustersize 0x%x\n", cluster_size); + dbg("mftcluster %llu\n", (unsigned long long) mft_cluster); + dbg("mftoffset 0x%llx\n", (unsigned long long) mft_off); + dbg("cluster per mft_record %i\n", ns->cluster_per_mft_record); + dbg("mft record size %i\n", mft_record_size); buf = volume_id_get_buffer(id, off + mft_off + (MFT_RECORD_VOLUME * mft_record_size), mft_record_size); @@ -143,12 +143,12 @@ int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size) return -1; mftr = (struct master_file_table_record*) buf; - dbg("mftr->magic '%c%c%c%c'", mftr->magic[0], mftr->magic[1], mftr->magic[2], mftr->magic[3]); + dbg("mftr->magic '%c%c%c%c'\n", mftr->magic[0], mftr->magic[1], mftr->magic[2], mftr->magic[3]); if (memcmp(mftr->magic, "FILE", 4) != 0) return -1; attr_off = le16_to_cpu(mftr->attrs_offset); - dbg("file $Volume's attributes are at offset %i", attr_off); + dbg("file $Volume's attributes are at offset %i\n", attr_off); while (1) { attr = (struct file_attribute*) &buf[attr_off]; @@ -167,18 +167,18 @@ int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size) if (attr_type == MFT_RECORD_ATTR_END) break; - dbg("found attribute type 0x%x, len %i, at offset %i", + dbg("found attribute type 0x%x, len %i, at offset %i\n", attr_type, attr_len, attr_off); if (attr_type == MFT_RECORD_ATTR_VOLUME_INFO) { - dbg("found info, len %i", val_len); + dbg("found info, len %i\n", val_len); info = (struct volume_info*) (((uint8_t *) attr) + val_off); snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u", info->major_ver, info->minor_ver); } if (attr_type == MFT_RECORD_ATTR_VOLUME_NAME) { - dbg("found label, len %i", val_len); + dbg("found label, len %i\n", val_len); if (val_len > VOLUME_ID_LABEL_SIZE) val_len = VOLUME_ID_LABEL_SIZE; diff --git a/extras/volume_id/lib/nvidia_raid.c b/extras/volume_id/lib/nvidia_raid.c index ca42459307..c6b5185399 100644 --- a/extras/volume_id/lib/nvidia_raid.c +++ b/extras/volume_id/lib/nvidia_raid.c @@ -41,7 +41,7 @@ int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t siz uint64_t meta_off; struct nvidia_meta *nv; - info("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); if (size < 0x10000) diff --git a/extras/volume_id/lib/ocfs.c b/extras/volume_id/lib/ocfs.c index 9f251f1794..ec81f5e8e3 100644 --- a/extras/volume_id/lib/ocfs.c +++ b/extras/volume_id/lib/ocfs.c @@ -132,7 +132,7 @@ int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off, uint64_t size) struct ocfs1_super_block_header *osh; struct ocfs1_super_block_label *osl; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); buf = volume_id_get_buffer(id, off, 0x200); if (buf == NULL) @@ -144,7 +144,7 @@ int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off, uint64_t size) snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u", osh->major_version, osh->minor_version); - dbg("found OracleCFS signature, now reading label"); + dbg("found OracleCFS signature, now reading label\n"); buf = volume_id_get_buffer(id, off + 0x200, 0x200); if (buf == NULL) return -1; @@ -170,7 +170,7 @@ int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off, uint64_t size) struct ocfs2_super_block *os; size_t blksize; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); for (blksize = 0x200; blksize <= OCFS2_MAX_BLOCKSIZE; blksize <<= 1) { buf = volume_id_get_buffer(id, off + OCFS2_SUPER_BLOCK_BLKNO * blksize, 0x200); diff --git a/extras/volume_id/lib/promise_raid.c b/extras/volume_id/lib/promise_raid.c index 1c4d3658ce..ecaed00986 100644 --- a/extras/volume_id/lib/promise_raid.c +++ b/extras/volume_id/lib/promise_raid.c @@ -42,7 +42,7 @@ int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, u 63, 255, 256, 16, 399, 0 }; - info("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); if (size < 0x40000) diff --git a/extras/volume_id/lib/reiserfs.c b/extras/volume_id/lib/reiserfs.c index 18db63817a..0f30233eaf 100644 --- a/extras/volume_id/lib/reiserfs.c +++ b/extras/volume_id/lib/reiserfs.c @@ -60,7 +60,7 @@ int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off, uint64_t size) struct reiser4_super_block *rs4; uint8_t *buf; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); buf = volume_id_get_buffer(id, off + REISERFS_SUPERBLOCK_OFFSET, 0x200); if (buf == NULL) diff --git a/extras/volume_id/lib/romfs.c b/extras/volume_id/lib/romfs.c index 2db36d61a5..303a1fb40e 100644 --- a/extras/volume_id/lib/romfs.c +++ b/extras/volume_id/lib/romfs.c @@ -37,7 +37,7 @@ int volume_id_probe_romfs(struct volume_id *id, uint64_t off, uint64_t size) { struct romfs_super *rfs; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); rfs = (struct romfs_super *) volume_id_get_buffer(id, off, 0x200); if (rfs == NULL) diff --git a/extras/volume_id/lib/silicon_raid.c b/extras/volume_id/lib/silicon_raid.c index 634e4abd0b..cfdcbcb868 100644 --- a/extras/volume_id/lib/silicon_raid.c +++ b/extras/volume_id/lib/silicon_raid.c @@ -53,7 +53,7 @@ int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint uint64_t meta_off; struct silicon_meta *sil; - info("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); if (size < 0x10000) diff --git a/extras/volume_id/lib/squashfs.c b/extras/volume_id/lib/squashfs.c index 035d6fb22a..18e44abcb4 100644 --- a/extras/volume_id/lib/squashfs.c +++ b/extras/volume_id/lib/squashfs.c @@ -45,7 +45,7 @@ int volume_id_probe_squashfs(struct volume_id *id, uint64_t off, uint64_t size) { struct squashfs_super *sqs; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); sqs = (struct squashfs_super *) volume_id_get_buffer(id, off, 0x200); if (sqs == NULL) diff --git a/extras/volume_id/lib/sysv.c b/extras/volume_id/lib/sysv.c index e48013c2bd..ba37c4d0a6 100644 --- a/extras/volume_id/lib/sysv.c +++ b/extras/volume_id/lib/sysv.c @@ -95,7 +95,7 @@ int volume_id_probe_sysv(struct volume_id *id, uint64_t off, uint64_t size) struct xenix_super *xs; unsigned int boff; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); for (boff = 0x200; boff <= SYSV_MAX_BLOCKSIZE; boff <<= 1) { vs = (struct sysv_super *) diff --git a/extras/volume_id/lib/udf.c b/extras/volume_id/lib/udf.c index ac2f40a9e8..2a589c5f2a 100644 --- a/extras/volume_id/lib/udf.c +++ b/extras/volume_id/lib/udf.c @@ -72,7 +72,7 @@ int volume_id_probe_udf(struct volume_id *id, uint64_t off, uint64_t size) unsigned int loc; unsigned int clen; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET, 0x200); if (vsd == NULL) @@ -100,7 +100,7 @@ blocksize: vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET + bs, 0x800); if (vsd == NULL) return -1; - dbg("test for blocksize: 0x%x", bs); + dbg("test for blocksize: 0x%x\n", bs); if (vsd->id[0] != '\0') goto nsr; } @@ -113,7 +113,7 @@ nsr: if (vsd == NULL) return -1; - dbg("vsd: %c%c%c%c%c", + dbg("vsd: %c%c%c%c%c\n", vsd->id[0], vsd->id[1], vsd->id[2], vsd->id[3], vsd->id[4]); if (vsd->id[0] == '\0') @@ -138,7 +138,7 @@ anchor: /* get desriptor list address and block count */ count = le32_to_cpu(vd->type.anchor.length) / bs; loc = le32_to_cpu(vd->type.anchor.location); - dbg("0x%x descriptors starting at logical secor 0x%x", count, loc); + dbg("0x%x descriptors starting at logical secor 0x%x\n", count, loc); /* pick the primary descriptor from the list */ for (b = 0; b < count; b++) { @@ -147,7 +147,7 @@ anchor: return -1; type = le16_to_cpu(vd->tag.id); - dbg("descriptor type %i", type); + dbg("descriptor type %i\n", type); /* check validity */ if (type == 0) @@ -164,7 +164,7 @@ pvd: volume_id_set_label_raw(id, &(vd->type.primary.ident.clen), 32); clen = vd->type.primary.ident.clen; - dbg("label string charsize=%i bit", clen); + dbg("label string charsize=%i bit\n", clen); if (clen == 8) volume_id_set_label_string(id, vd->type.primary.ident.c, 31); else if (clen == 16) diff --git a/extras/volume_id/lib/ufs.c b/extras/volume_id/lib/ufs.c index 4ace8c99fd..bedcfa47da 100644 --- a/extras/volume_id/lib/ufs.c +++ b/extras/volume_id/lib/ufs.c @@ -175,20 +175,20 @@ int volume_id_probe_ufs(struct volume_id *id, uint64_t off, uint64_t size) struct ufs_super_block *ufs; int offsets[] = {0, 8, 64, 256, -1}; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); for (i = 0; offsets[i] >= 0; i++) { ufs = (struct ufs_super_block *) volume_id_get_buffer(id, off + (offsets[i] * 0x400), 0x800); if (ufs == NULL) return -1; - dbg("offset 0x%x", offsets[i] * 0x400); + dbg("offset 0x%x\n", offsets[i] * 0x400); magic = be32_to_cpu(ufs->fs_magic); if ((magic == UFS_MAGIC) || (magic == UFS2_MAGIC) || (magic == UFS_MAGIC_FEA) || (magic == UFS_MAGIC_LFN)) { - dbg("magic 0x%08x(be)", magic); + dbg("magic 0x%08x(be)\n", magic); goto found; } magic = le32_to_cpu(ufs->fs_magic); @@ -196,7 +196,7 @@ int volume_id_probe_ufs(struct volume_id *id, uint64_t off, uint64_t size) (magic == UFS2_MAGIC) || (magic == UFS_MAGIC_FEA) || (magic == UFS_MAGIC_LFN)) { - dbg("magic 0x%08x(le)", magic); + dbg("magic 0x%08x(le)\n", magic); goto found; } } diff --git a/extras/volume_id/lib/util.c b/extras/volume_id/lib/util.c index 0a3bd39992..2a63efe8f7 100644 --- a/extras/volume_id/lib/util.c +++ b/extras/volume_id/lib/util.c @@ -353,33 +353,33 @@ uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) { ssize_t buf_len; - info("get buffer off 0x%llx(%llu), len 0x%zx", (unsigned long long) off, (unsigned long long) off, len); + info("get buffer off 0x%llx(%llu), len 0x%zx\n", (unsigned long long) off, (unsigned long long) off, len); /* check if requested area fits in superblock buffer */ if (off + len <= SB_BUFFER_SIZE) { if (id->sbbuf == NULL) { id->sbbuf = malloc(SB_BUFFER_SIZE); if (id->sbbuf == NULL) { - dbg("error malloc"); + dbg("error malloc\n"); return NULL; } } /* check if we need to read */ if ((off + len) > id->sbbuf_len) { - info("read sbbuf len:0x%llx", (unsigned long long) (off + len)); + info("read sbbuf len:0x%llx\n", (unsigned long long) (off + len)); if (lseek(id->fd, 0, SEEK_SET) < 0) { - dbg("lseek failed (%s)", strerror(errno)); + dbg("lseek failed (%s)\n", strerror(errno)); return NULL; } buf_len = read(id->fd, id->sbbuf, off + len); if (buf_len < 0) { - dbg("read failed (%s)", strerror(errno)); + dbg("read failed (%s)\n", strerror(errno)); return NULL; } - dbg("got 0x%zx (%zi) bytes", buf_len, buf_len); + dbg("got 0x%zx (%zi) bytes\n", buf_len, buf_len); id->sbbuf_len = buf_len; if ((size_t)buf_len < off + len) { - dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len); + dbg("requested 0x%zx bytes, got only 0x%zx bytes\n", len, buf_len); return NULL; } } @@ -387,7 +387,7 @@ uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) return &(id->sbbuf[off]); } else { if (len > SEEK_BUFFER_SIZE) { - dbg("seek buffer too small %d", SEEK_BUFFER_SIZE); + dbg("seek buffer too small %d\n", SEEK_BUFFER_SIZE); return NULL; } @@ -395,28 +395,28 @@ uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) if (id->seekbuf == NULL) { id->seekbuf = malloc(SEEK_BUFFER_SIZE); if (id->seekbuf == NULL) { - dbg("error malloc"); + dbg("error malloc\n"); return NULL; } } /* check if we need to read */ if ((off < id->seekbuf_off) || ((off + len) > (id->seekbuf_off + id->seekbuf_len))) { - info("read seekbuf off:0x%llx len:0x%zx", (unsigned long long) off, len); + info("read seekbuf off:0x%llx len:0x%zx\n", (unsigned long long) off, len); if (lseek(id->fd, off, SEEK_SET) < 0) { - dbg("lseek failed (%s)", strerror(errno)); + dbg("lseek failed (%s)\n", strerror(errno)); return NULL; } buf_len = read(id->fd, id->seekbuf, len); if (buf_len < 0) { - dbg("read failed (%s)", strerror(errno)); + dbg("read failed (%s)\n", strerror(errno)); return NULL; } - dbg("got 0x%zx (%zi) bytes", buf_len, buf_len); + dbg("got 0x%zx (%zi) bytes\n", buf_len, buf_len); id->seekbuf_off = off; id->seekbuf_len = buf_len; if ((size_t)buf_len < len) { - dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len); + dbg("requested 0x%zx bytes, got only 0x%zx bytes\n", len, buf_len); return NULL; } } diff --git a/extras/volume_id/lib/via_raid.c b/extras/volume_id/lib/via_raid.c index 62c165e034..9965e13bc2 100644 --- a/extras/volume_id/lib/via_raid.c +++ b/extras/volume_id/lib/via_raid.c @@ -63,7 +63,7 @@ int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size) uint64_t meta_off; struct via_meta *via; - dbg("probing at offset 0x%llx, size 0x%llx", + dbg("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); if (size < 0x10000) diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index 7c68fb1ef9..bb909c9956 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -358,7 +358,7 @@ int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size) if (!device_is_readable(id, off)) return -1; - info("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); for (i = 0; i < ARRAY_SIZE(prober_raid); i++) @@ -392,7 +392,7 @@ int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size if (!device_is_readable(id, off)) return -1; - info("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); for (i = 0; i < ARRAY_SIZE(prober_filesystem); i++) @@ -493,7 +493,7 @@ struct volume_id *volume_id_open_node(const char *path) fd = open(path, O_RDONLY); if (fd < 0) { - dbg("unable to open '%s'", path); + dbg("unable to open '%s'\n", path); return NULL; } diff --git a/extras/volume_id/lib/vxfs.c b/extras/volume_id/lib/vxfs.c index c9b76285e8..33d357b7d8 100644 --- a/extras/volume_id/lib/vxfs.c +++ b/extras/volume_id/lib/vxfs.c @@ -37,7 +37,7 @@ int volume_id_probe_vxfs(struct volume_id *id, uint64_t off, uint64_t size) { struct vxfs_super *vxs; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); vxs = (struct vxfs_super *) volume_id_get_buffer(id, off + 0x200, 0x200); if (vxs == NULL) diff --git a/extras/volume_id/lib/xfs.c b/extras/volume_id/lib/xfs.c index 9eac8273c8..3e10560af9 100644 --- a/extras/volume_id/lib/xfs.c +++ b/extras/volume_id/lib/xfs.c @@ -45,7 +45,7 @@ int volume_id_probe_xfs(struct volume_id *id, uint64_t off, uint64_t size) { struct xfs_super_block *xs; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); xs = (struct xfs_super_block *) volume_id_get_buffer(id, off, 0x200); if (xs == NULL) diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 04e85abb7f..5c4e05d794 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -218,7 +218,7 @@ int main(int argc, char *argv[]) node = argv[optind]; if (!node) { - err("no device"); + err("no device\n"); fprintf(stderr, "no device\n"); rc = 1; goto exit; @@ -239,7 +239,7 @@ int main(int argc, char *argv[]) if (ioctl(fd, BLKGETSIZE64, &size) != 0) size = 0; - dbg("BLKGETSIZE64=%llu", (unsigned long long)size); + dbg("BLKGETSIZE64=%llu\n", (unsigned long long)size); /* try to drop all privileges before reading disk content */ if (getuid() == 0) { @@ -250,7 +250,7 @@ int main(int argc, char *argv[]) if (setgroups(0, NULL) != 0 || setgid(pw->pw_gid) != 0 || setuid(pw->pw_uid) != 0) - info("unable to drop privileges: %s\n", strerror(errno)); + info("unable to drop privileges: %s\n\n", strerror(errno)); } } diff --git a/test-udev.c b/test-udev.c index 0c25778aa6..e341b74f2f 100644 --- a/test-udev.c +++ b/test-udev.c @@ -90,10 +90,10 @@ int main(int argc, char *argv[], char *envp[]) logging_init("udev"); if (devnull < 0) - err("open /dev/null failed: %s", strerror(errno)); + err("open /dev/null failed: %s\n", strerror(errno)); udev_config_init(); selinux_init(); - dbg("version %s", UDEV_VERSION); + dbg("version %s\n", UDEV_VERSION); /* set signal handlers */ memset(&act, 0x00, sizeof(act)); @@ -115,7 +115,7 @@ int main(int argc, char *argv[], char *envp[]) subsystem = argv[1]; if (action == NULL || subsystem == NULL || devpath == NULL) { - err("action, subsystem or devpath missing"); + err("action, subsystem or devpath missing\n"); goto exit; } @@ -132,7 +132,7 @@ int main(int argc, char *argv[], char *envp[]) dev = sysfs_device_get(devpath); if (dev == NULL) { - info("unable to open '%s'", devpath); + info("unable to open '%s'\n", devpath); goto fail; } diff --git a/udev_config.c b/udev_config.c index 2f2a69eb48..42190945fc 100644 --- a/udev_config.c +++ b/udev_config.c @@ -98,7 +98,7 @@ static int parse_config_file(void) int retval = 0; if (file_map(udev_config_filename, &buf, &bufsize) != 0) { - err("can't open '%s' as config file: %s", udev_config_filename, strerror(errno)); + err("can't open '%s' as config file: %s\n", udev_config_filename, strerror(errno)); return -ENODEV; } @@ -124,7 +124,7 @@ static int parse_config_file(void) continue; if (count >= sizeof(line)) { - err("line too long, conf line skipped %s, line %d", udev_config_filename, lineno); + err("line too long, conf line skipped %s, line %d\n", udev_config_filename, lineno); continue; } @@ -134,7 +134,7 @@ static int parse_config_file(void) linepos = line; retval = get_key(&linepos, &variable, &value); if (retval != 0) { - err("error parsing %s, line %d:%d", udev_config_filename, lineno, (int)(linepos-line)); + err("error parsing %s, line %d:%d\n", udev_config_filename, lineno, (int)(linepos-line)); continue; } @@ -193,8 +193,8 @@ void udev_config_init(void) if (env) udev_log_priority = log_priority(env); - dbg("UDEV_CONFIG_FILE='%s'", udev_config_filename); - dbg("udev_root='%s'", udev_root); - dbg("udev_rules='%s'", udev_rules_dir); - dbg("udev_log=%d", udev_log_priority); + dbg("UDEV_CONFIG_FILE='%s'\n", udev_config_filename); + dbg("udev_root='%s'\n", udev_root); + dbg("udev_rules='%s'\n", udev_rules_dir); + dbg("udev_log=%d\n", udev_log_priority); } @@ -65,13 +65,13 @@ static int name_index(const char *devpath, const char *name, int add) strlcat(filename, device, sizeof(filename)); if (add) { - info("creating index: '%s'", filename); + info("creating index: '%s'\n", filename); create_path(filename); fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); if (fd > 0) close(fd); } else { - info("removing index: '%s'", filename); + info("removing index: '%s'\n", filename); unlink(filename); delete_path(filename); } @@ -92,12 +92,12 @@ int udev_db_get_devices_by_name(const char *name, struct list_head *name_list) dir = opendir(dirname); if (dir == NULL) { - info("no index directory '%s': %s", dirname, strerror(errno)); + info("no index directory '%s': %s\n", dirname, strerror(errno)); rc = -1; goto out; } - info("found index directory '%s'", dirname); + info("found index directory '%s'\n", dirname); while (1) { struct dirent *ent; char device[PATH_SIZE]; @@ -146,12 +146,12 @@ int udev_db_add_device(struct udevice *udev) if (list_empty(&udev->symlink_list) && list_empty(&udev->env_list) && !udev->partitions && !udev->ignore_remove) { int ret; - dbg("nothing interesting to store, create symlink"); + dbg("nothing interesting to store, create symlink\n"); selinux_setfscreatecon(filename, NULL, S_IFLNK); ret = symlink(udev->name, filename); selinux_resetfscreatecon(); if (ret != 0) { - err("unable to create db link '%s': %s", filename, strerror(errno)); + err("unable to create db link '%s': %s\n", filename, strerror(errno)); return -1; } } else { @@ -160,10 +160,10 @@ int udev_db_add_device(struct udevice *udev) f = fopen(filename, "w"); if (f == NULL) { - err("unable to create db file '%s': %s", filename, strerror(errno)); + err("unable to create db file '%s': %s\n", filename, strerror(errno)); return -1; } - dbg("storing data for device '%s' in '%s'", udev->dev->devpath, filename); + dbg("storing data for device '%s' in '%s'\n", udev->dev->devpath, filename); fprintf(f, "N:%s\n", udev->name); list_for_each_entry(name_loop, &udev->symlink_list, node) { @@ -205,28 +205,28 @@ int udev_db_get_device(struct udevice *udev, const char *devpath) devpath_to_db_path(devpath, filename, sizeof(filename)); if (lstat(filename, &stats) != 0) { - info("no db file to read %s: %s", filename, strerror(errno)); + info("no db file to read %s: %s\n", filename, strerror(errno)); return -1; } if ((stats.st_mode & S_IFMT) == S_IFLNK) { char target[NAME_SIZE]; int target_len; - info("found a symlink as db file"); + info("found a symlink as db file\n"); target_len = readlink(filename, target, sizeof(target)); if (target_len > 0) target[target_len] = '\0'; else { - info("error reading db link %s: %s", filename, strerror(errno)); + info("error reading db link %s: %s\n", filename, strerror(errno)); return -1; } - dbg("db link points to '%s'", target); + dbg("db link points to '%s'\n", target); strlcpy(udev->name, target, sizeof(udev->name)); return 0; } if (file_map(filename, &buf, &bufsize) != 0) { - info("error reading db file %s: %s", filename, strerror(errno)); + info("error reading db file %s: %s\n", filename, strerror(errno)); return -1; } @@ -323,7 +323,7 @@ int udev_db_get_all_entries(struct list_head *name_list) strlcat(dbpath, "/"DB_DIR, sizeof(dbpath)); dir = opendir(dbpath); if (dir == NULL) { - info("no udev_db available '%s': %s", dbpath, strerror(errno)); + info("no udev_db available '%s': %s\n", dbpath, strerror(errno)); return -1; } @@ -340,7 +340,7 @@ int udev_db_get_all_entries(struct list_head *name_list) strlcpy(device, ent->d_name, sizeof(device)); path_decode(device); name_list_add(name_list, device, 1); - dbg("added '%s'", device); + dbg("added '%s'\n", device); } closedir(dir); diff --git a/udev_device.c b/udev_device.c index 62217ff585..6546db482c 100644 --- a/udev_device.c +++ b/udev_device.c @@ -104,13 +104,13 @@ static int rename_netif(struct udevice *udev) struct ifreq ifr; int retval; - info("changing net interface name from '%s' to '%s'", udev->dev->kernel, udev->name); + info("changing net interface name from '%s' to '%s'\n", udev->dev->kernel, udev->name); if (udev->test_run) return 0; sk = socket(PF_INET, SOCK_DGRAM, 0); if (sk < 0) { - err("error opening socket: %s", strerror(errno)); + err("error opening socket: %s\n", strerror(errno)); return -1; } @@ -125,7 +125,7 @@ static int rename_netif(struct udevice *udev) /* see if the destination interface name already exists */ if (errno != EEXIST) { - err("error changing netif name %s to %s: %s", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); + err("error changing netif name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); goto exit; } @@ -134,7 +134,7 @@ static int rename_netif(struct udevice *udev) strlcat(ifr.ifr_newname, "_rename", IFNAMSIZ); retval = ioctl(sk, SIOCSIFNAME, &ifr); if (retval != 0) { - err("error changing netif name %s to %s: %s", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); + err("error changing netif name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); goto exit; } @@ -150,11 +150,11 @@ static int rename_netif(struct udevice *udev) } if (errno != EEXIST) { - err("error changing net interface name %s to %s: %s", + err("error changing net interface name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); break; } - dbg("wait for netif '%s' to become free, loop=%i", udev->name, (30 * 20) - loop); + dbg("wait for netif '%s' to become free, loop=%i\n", udev->name, (30 * 20) - loop); usleep(1000 * 1000 / 20); } } @@ -170,22 +170,22 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) if (udev->devpath_old != NULL) if (udev_db_rename(udev->devpath_old, udev->dev->devpath) == 0) - info("moved database from '%s' to '%s'", udev->devpath_old, udev->dev->devpath); + info("moved database from '%s' to '%s'\n", udev->devpath_old, udev->dev->devpath); /* add device node */ if (major(udev->devt) != 0 && (strcmp(udev->action, "add") == 0 || strcmp(udev->action, "change") == 0)) { struct udevice *udev_old; - dbg("device node add '%s'", udev->dev->devpath); + dbg("device node add '%s'\n", udev->dev->devpath); udev_rules_get_name(rules, udev); if (udev->ignore_device) { - info("device event will be ignored"); + info("device event will be ignored\n"); goto exit; } if (udev->name[0] == '\0') { - info("device node creation supressed"); + info("device node creation supressed\n"); goto exit; } @@ -194,7 +194,7 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) if (udev_old != NULL) { udev_old->test_run = udev->test_run; if (udev_db_get_device(udev_old, udev->dev->devpath) == 0) { - info("device '%s' already in database, cleanup", udev->dev->devpath); + info("device '%s' already in database, cleanup\n", udev->dev->devpath); udev_db_delete_device(udev_old); } else { udev_device_cleanup(udev_old); @@ -220,14 +220,14 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) /* add netif */ if (strcmp(udev->dev->subsystem, "net") == 0 && strcmp(udev->action, "add") == 0) { - dbg("netif add '%s'", udev->dev->devpath); + dbg("netif add '%s'\n", udev->dev->devpath); udev_rules_get_name(rules, udev); if (udev->ignore_device) { - info("device event will be ignored"); + info("device event will be ignored\n"); goto exit; } if (udev->name[0] == '\0') { - info("device renaming supressed"); + info("device renaming supressed\n"); goto exit; } @@ -239,7 +239,7 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) retval = rename_netif(udev); if (retval != 0) goto exit; - info("renamed netif to '%s'", udev->name); + info("renamed netif to '%s'\n", udev->name); /* export old name */ setenv("INTERFACE_OLD", udev->dev->kernel, 1); @@ -253,7 +253,7 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) sysfs_device_set_values(udev->dev, devpath, NULL, NULL); setenv("DEVPATH", udev->dev->devpath, 1); setenv("INTERFACE", udev->name, 1); - info("changed devpath to '%s'", udev->dev->devpath); + info("changed devpath to '%s'\n", udev->dev->devpath); } } goto exit; @@ -270,19 +270,19 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) list_for_each_entry(name_loop, &udev->env_list, node) putenv(name_loop->name); } else { - dbg("'%s' not found in database, using kernel name '%s'", + dbg("'%s' not found in database, using kernel name '%s'\n", udev->dev->devpath, udev->dev->kernel); strlcpy(udev->name, udev->dev->kernel, sizeof(udev->name)); } udev_rules_get_run(rules, udev); if (udev->ignore_device) { - info("device event will be ignored"); + info("device event will be ignored\n"); goto exit; } if (udev->ignore_remove) { - info("ignore_remove for '%s'", udev->name); + info("ignore_remove for '%s'\n", udev->name); goto exit; } /* remove the node */ @@ -296,7 +296,7 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) /* default devices */ udev_rules_get_run(rules, udev); if (udev->ignore_device) - info("device event will be ignored"); + info("device event will be ignored\n"); exit: return retval; diff --git a/udev_node.c b/udev_node.c index 6ca0601ea4..0e59e2dbc9 100644 --- a/udev_node.c +++ b/udev_node.c @@ -48,7 +48,7 @@ int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t m if (lstat(file, &stats) == 0) { if ((stats.st_mode & S_IFMT) == (mode & S_IFMT) && (stats.st_rdev == devt)) { - info("preserve file '%s', because it has correct dev_t", file); + info("preserve file '%s', because it has correct dev_t\n", file); selinux_setfilecon(file, udev->dev->kernel, stats.st_mode); goto perms; } @@ -60,7 +60,7 @@ int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t m goto perms; } - info("atomically replace '%s'", file); + info("atomically replace '%s'\n", file); strlcpy(file_tmp, file, sizeof(file_tmp)); strlcat(file_tmp, TMP_FILE_EXT, sizeof(file_tmp)); unlink(file_tmp); @@ -68,29 +68,29 @@ int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t m retval = mknod(file_tmp, mode, devt); selinux_resetfscreatecon(); if (retval != 0) { - err("mknod(%s, %#o, %u, %u) failed: %s", + err("mknod(%s, %#o, %u, %u) failed: %s\n", file_tmp, mode, major(devt), minor(devt), strerror(errno)); goto exit; } retval = rename(file_tmp, file); if (retval != 0) { - err("rename(%s, %s) failed: %s", + err("rename(%s, %s) failed: %s\n", file_tmp, file, strerror(errno)); unlink(file_tmp); goto exit; } perms: - dbg("chmod(%s, %#o)", file, mode); + dbg("chmod(%s, %#o)\n", file, mode); if (chmod(file, mode) != 0) { - err("chmod(%s, %#o) failed: %s", file, mode, strerror(errno)); + err("chmod(%s, %#o) failed: %s\n", file, mode, strerror(errno)); goto exit; } if (uid != 0 || gid != 0) { - dbg("chown(%s, %u, %u)", file, uid, gid); + dbg("chown(%s, %u, %u)\n", file, uid, gid); if (chown(file, uid, gid) != 0) { - err("chown(%s, %u, %u) failed: %s", + err("chown(%s, %u, %u) failed: %s\n", file, uid, gid, strerror(errno)); goto exit; } @@ -127,32 +127,32 @@ static int node_symlink(const char *node, const char *slink) if (S_ISBLK(stats.st_mode) || S_ISCHR(stats.st_mode)) { struct stat stats2; - info("found existing node instead of symlink '%s'", slink); + info("found existing node instead of symlink '%s'\n", slink); if (lstat(node, &stats2) == 0) { if ((stats.st_mode & S_IFMT) == (stats2.st_mode & S_IFMT) && stats.st_rdev == stats2.st_rdev) { - info("replace device node '%s' with symlink to our node '%s'", slink, node); + info("replace device node '%s' with symlink to our node '%s'\n", slink, node); } else { - err("device node '%s' already exists, link to '%s' will not overwrite it", slink, node); + err("device node '%s' already exists, link to '%s' will not overwrite it\n", slink, node); goto exit; } } } else if (S_ISLNK(stats.st_mode)) { char buf[PATH_SIZE]; - info("found existing symlink '%s'", slink); + info("found existing symlink '%s'\n", slink); len = readlink(slink, buf, sizeof(buf)); if (len > 0) { buf[len] = '\0'; if (strcmp(target, buf) == 0) { - info("preserve already existing symlink '%s' to '%s'", slink, target); + info("preserve already existing symlink '%s' to '%s'\n", slink, target); selinux_setfilecon(slink, NULL, S_IFLNK); goto exit; } } } } else { - info("creating symlink '%s' to '%s'", slink, target); + info("creating symlink '%s' to '%s'\n", slink, target); selinux_setfscreatecon(slink, NULL, S_IFLNK); retval = symlink(target, slink); selinux_resetfscreatecon(); @@ -160,7 +160,7 @@ static int node_symlink(const char *node, const char *slink) goto exit; } - info("atomically replace '%s'", slink); + info("atomically replace '%s'\n", slink); strlcpy(slink_tmp, slink, sizeof(slink_tmp)); strlcat(slink_tmp, TMP_FILE_EXT, sizeof(slink_tmp)); unlink(slink_tmp); @@ -168,12 +168,12 @@ static int node_symlink(const char *node, const char *slink) retval = symlink(target, slink_tmp); selinux_resetfscreatecon(); if (retval != 0) { - err("symlink(%s, %s) failed: %s", target, slink_tmp, strerror(errno)); + err("symlink(%s, %s) failed: %s\n", target, slink_tmp, strerror(errno)); goto exit; } retval = rename(slink_tmp, slink); if (retval != 0) { - err("rename(%s, %s) failed: %s", slink_tmp, slink, strerror(errno)); + err("rename(%s, %s) failed: %s\n", slink_tmp, slink, strerror(errno)); unlink(slink_tmp); goto exit; } @@ -198,11 +198,11 @@ static int update_link(struct udevice *udev, const char *name) strlcat(slink, name, sizeof(slink)); count = udev_db_get_devices_by_name(name, &name_list); - info("found %i devices with name '%s'", count, name); + info("found %i devices with name '%s'\n", count, name); /* if we don't have a reference, delete it */ if (count <= 0) { - info("no reference left, remove '%s'", name); + info("no reference left, remove '%s'\n", name); if (!udev->test_run) { unlink(slink); delete_path(slink); @@ -212,14 +212,14 @@ static int update_link(struct udevice *udev, const char *name) /* find the device with the highest priority */ list_for_each_entry(device, &name_list, node) { - info("found '%s' for '%s'", device->name, name); + info("found '%s' for '%s'\n", device->name, name); /* did we find ourself? we win, if we have the same priority */ if (strcmp(udev->dev->devpath, device->name) == 0) { - info("compare (our own) priority of '%s' %i >= %i", + info("compare (our own) priority of '%s' %i >= %i\n", udev->dev->devpath, udev->link_priority, priority); if (strcmp(udev->name, name) == 0) { - info("'%s' is our device node, database inconsistent, skip link update", udev->name); + info("'%s' is our device node, database inconsistent, skip link update\n", udev->name); } else if (target[0] == '\0' || udev->link_priority >= priority) { priority = udev->link_priority; strlcpy(target, udev->name, sizeof(target)); @@ -233,9 +233,9 @@ static int update_link(struct udevice *udev, const char *name) continue; if (udev_db_get_device(udev_db, device->name) == 0) { if (strcmp(udev_db->name, name) == 0) { - info("'%s' is a device node of '%s', skip link update", udev_db->name, device->name); + info("'%s' is a device node of '%s', skip link update\n", udev_db->name, device->name); } else { - info("compare priority of '%s' %i > %i", + info("compare priority of '%s' %i > %i\n", udev_db->dev->devpath, udev_db->link_priority, priority); if (target[0] == '\0' || udev_db->link_priority > priority) { priority = udev_db->link_priority; @@ -248,7 +248,7 @@ static int update_link(struct udevice *udev, const char *name) name_list_cleanup(&name_list); if (target[0] == '\0') { - info("no current target for '%s' found", name); + info("no current target for '%s' found\n", name); rc = 1; goto out; } @@ -257,7 +257,7 @@ static int update_link(struct udevice *udev, const char *name) strlcpy(node, udev_root, sizeof(node)); strlcat(node, "/", sizeof(node)); strlcat(node, target, sizeof(node)); - info("'%s' with target '%s' has the highest priority %i, create it", name, target, priority); + info("'%s' with target '%s' has the highest priority %i, create it\n", name, target, priority); if (!udev->test_run) { create_path(slink); node_symlink(node, slink); @@ -272,7 +272,7 @@ void udev_node_update_symlinks(struct udevice *udev, struct udevice *udev_old) char symlinks[PATH_SIZE] = ""; list_for_each_entry(name_loop, &udev->symlink_list, node) { - info("update symlink '%s' of '%s'", name_loop->name, udev->dev->devpath); + info("update symlink '%s' of '%s'\n", name_loop->name, udev->dev->devpath); update_link(udev, name_loop->name); strlcat(symlinks, udev_root, sizeof(symlinks)); strlcat(symlinks, "/", sizeof(symlinks)); @@ -302,7 +302,7 @@ void udev_node_update_symlinks(struct udevice *udev, struct udevice *udev_old) } if (!found) { /* link does no longer belong to this device */ - info("update old symlink '%s' no longer belonging to '%s'", + info("update old symlink '%s' no longer belonging to '%s'\n", link_old_loop->name, udev->dev->devpath); update_link(udev, link_old_loop->name); } @@ -356,7 +356,7 @@ int udev_node_add(struct udevice *udev) gid = lookup_group(udev->group); } - info("creating device node '%s', major=%d, minor=%d, mode=%#o, uid=%d, gid=%d", + info("creating device node '%s', major=%d, minor=%d, mode=%#o, uid=%d, gid=%d\n", filename, major(udev->devt), minor(udev->devt), udev->mode, uid, gid); if (!udev->test_run) @@ -380,7 +380,7 @@ int udev_node_add(struct udevice *udev) if (range > 1) udev->partitions = range-1; } - info("creating device partition nodes '%s[1-%i]'", filename, udev->partitions); + info("creating device partition nodes '%s[1-%i]'\n", filename, udev->partitions); if (!udev->test_run) { for (i = 1; i <= udev->partitions; i++) { dev_t part_devt; @@ -408,15 +408,15 @@ int udev_node_remove(struct udevice *udev) strlcat(filename, "/", sizeof(filename)); strlcat(filename, udev->name, sizeof(filename)); if (stat(filename, &stats) != 0) { - info("device node '%s' not found", filename); + info("device node '%s' not found\n", filename); return 0; } if (udev->devt && stats.st_rdev != udev->devt) { - info("device node '%s' points to a different device, skip removal", filename); + info("device node '%s' points to a different device, skip removal\n", filename); return -1; } - info("removing device node '%s'", filename); + info("removing device node '%s'\n", filename); if (!udev->test_run) retval = unlink_secure(filename); if (retval) @@ -427,7 +427,7 @@ int udev_node_remove(struct udevice *udev) if (num > 0) { int i; - info("removing all_partitions '%s[1-%i]'", filename, num); + info("removing all_partitions '%s[1-%i]'\n", filename, num); if (num > 255) return -1; for (i = 1; i <= num; i++) { diff --git a/udev_rules.c b/udev_rules.c index 8a793ffded..884cb7098c 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -48,13 +48,13 @@ static char *get_format_attribute(char **str) if (*str[0] == '{') { pos = strchr(*str, '}'); if (pos == NULL) { - err("missing closing brace for format"); + err("missing closing brace for format\n"); return NULL; } pos[0] = '\0'; attr = *str+1; *str = pos+1; - dbg("attribute='%s', str='%s'", attr, *str); + dbg("attribute='%s', str='%s'\n", attr, *str); } return attr; } @@ -69,10 +69,10 @@ static int get_format_len(char **str) num = (int) strtoul(*str, &tail, 10); if (num > 0) { *str = tail; - dbg("format length=%i", num); + dbg("format length=%i\n", num); return num; } else { - err("format parsing error '%s'", *str); + err("format parsing error '%s'\n", *str); } } return -1; @@ -148,7 +148,7 @@ static int run_program(const char *command, const char *subsystem, } else { argv[i] = strsep(&pos, " "); } - dbg("arg[%i] '%s'", i, argv[i]); + dbg("arg[%i] '%s'\n", i, argv[i]); i++; } argv[i] = NULL; @@ -156,18 +156,18 @@ static int run_program(const char *command, const char *subsystem, argv[0] = arg; argv[1] = NULL; } - info("'%s'", command); + info("'%s'\n", command); /* prepare pipes from child to parent */ if (result != NULL || udev_log_priority >= LOG_INFO) { if (pipe(outpipe) != 0) { - err("pipe failed: %s", strerror(errno)); + err("pipe failed: %s\n", strerror(errno)); return -1; } } if (udev_log_priority >= LOG_INFO) { if (pipe(errpipe) != 0) { - err("pipe failed: %s", strerror(errno)); + err("pipe failed: %s\n", strerror(errno)); return -1; } } @@ -198,7 +198,7 @@ static int run_program(const char *command, const char *subsystem, dup2(devnull, STDERR_FILENO); close(devnull); } else - err("open /dev/null failed: %s", strerror(errno)); + err("open /dev/null failed: %s\n", strerror(errno)); if (outpipe[WRITE_END] > 0) { dup2(outpipe[WRITE_END], STDOUT_FILENO); close(outpipe[WRITE_END]); @@ -210,14 +210,14 @@ static int run_program(const char *command, const char *subsystem, execv(argv[0], argv); if (errno == ENOENT || errno == ENOTDIR) { /* may be on a filesytem which is not mounted right now */ - info("program '%s' not found", argv[0]); + info("program '%s' not found\n", argv[0]); } else { /* other problems */ - err("exec of program '%s' failed", argv[0]); + err("exec of program '%s' failed\n", argv[0]); } _exit(1); case -1: - err("fork of '%s' failed: %s", argv[0], strerror(errno)); + err("fork of '%s' failed: %s\n", argv[0], strerror(errno)); return -1; default: /* read from child if requested */ @@ -260,7 +260,7 @@ static int run_program(const char *command, const char *subsystem, close(outpipe[READ_END]); outpipe[READ_END] = -1; if (count < 0) { - err("stdin read failed: %s", strerror(errno)); + err("stdin read failed: %s\n", strerror(errno)); retval = -1; } continue; @@ -273,14 +273,14 @@ static int run_program(const char *command, const char *subsystem, memcpy(&result[respos], inbuf, count); respos += count; } else { - err("ressize %ld too short", (long)ressize); + err("ressize %ld too short\n", (long)ressize); retval = -1; } } pos = inbuf; while ((line = strsep(&pos, "\n"))) if (pos || line[0] != '\0') - info("'%s' (stdout) '%s'", argv[0], line); + info("'%s' (stdout) '%s'\n", argv[0], line); } /* get stderr */ @@ -294,14 +294,14 @@ static int run_program(const char *command, const char *subsystem, close(errpipe[READ_END]); errpipe[READ_END] = -1; if (count < 0) - err("stderr read failed: %s", strerror(errno)); + err("stderr read failed: %s\n", strerror(errno)); continue; } errbuf[count] = '\0'; pos = errbuf; while ((line = strsep(&pos, "\n"))) if (pos || line[0] != '\0') - info("'%s' (stderr) '%s'", argv[0], line); + info("'%s' (stderr) '%s'\n", argv[0], line); } } if (outpipe[READ_END] > 0) @@ -312,18 +312,18 @@ static int run_program(const char *command, const char *subsystem, /* return the childs stdout string */ if (result) { result[respos] = '\0'; - dbg("result='%s'", result); + dbg("result='%s'\n", result); if (reslen) *reslen = respos; } } waitpid(pid, &status, 0); if (WIFEXITED(status)) { - info("'%s' returned with status %i", argv[0], WEXITSTATUS(status)); + info("'%s' returned with status %i\n", argv[0], WEXITSTATUS(status)); if (WEXITSTATUS(status) != 0) retval = -1; } else { - err("'%s' abnormal exit", argv[0]); + err("'%s' abnormal exit\n", argv[0]); retval = -1; } } @@ -364,7 +364,7 @@ static int import_keys_into_env(struct udevice *udev, const char *buf, size_t bu continue; if (count >= sizeof(line)) { - err("line too long, conf line skipped %s, line %d", udev_config_filename, lineno); + err("line too long, conf line skipped %s, line %d\n", udev_config_filename, lineno); continue; } @@ -373,11 +373,11 @@ static int import_keys_into_env(struct udevice *udev, const char *buf, size_t bu linepos = line; if (get_key(&linepos, &variable, &value) == 0) { - dbg("import '%s=%s'", variable, value); + dbg("import '%s=%s'\n", variable, value); /* handle device, renamed by external tool, returning new path */ if (strcmp(variable, "DEVPATH") == 0) { - info("updating devpath from '%s' to '%s'", udev->dev->devpath, value); + info("updating devpath from '%s' to '%s'\n", udev->dev->devpath, value); sysfs_device_set_values(udev->dev, value, NULL, NULL); } else name_list_key_add(&udev->env_list, variable, value); @@ -394,7 +394,7 @@ static int import_file_into_env(struct udevice *udev, const char *filename) size_t bufsize; if (file_map(filename, &buf, &bufsize) != 0) { - err("can't open '%s': %s", filename, strerror(errno)); + err("can't open '%s': %s\n", filename, strerror(errno)); return -1; } import_keys_into_env(udev, buf, bufsize); @@ -423,13 +423,13 @@ static int import_parent_into_env(struct udevice *udev, const char *filter) struct udevice *udev_parent; struct name_entry *name_loop; - dbg("found parent '%s', get the node name", dev_parent->devpath); + dbg("found parent '%s', get the node name\n", dev_parent->devpath); udev_parent = udev_device_init(NULL); if (udev_parent == NULL) return -1; /* import the udev_db of the parent */ if (udev_db_get_device(udev_parent, dev_parent->devpath) == 0) { - dbg("import stored parent env '%s'", udev_parent->name); + dbg("import stored parent env '%s'\n", udev_parent->name); list_for_each_entry(name_loop, &udev_parent->env_list, node) { char name[NAME_SIZE]; char *pos; @@ -440,16 +440,16 @@ static int import_parent_into_env(struct udevice *udev, const char *filter) pos[0] = '\0'; pos++; if (fnmatch(filter, name, 0) == 0) { - dbg("import key '%s'", name_loop->name); + dbg("import key '%s'\n", name_loop->name); name_list_add(&udev->env_list, name_loop->name, 0); setenv(name, pos, 1); } else - dbg("skip key '%s'", name_loop->name); + dbg("skip key '%s'\n", name_loop->name); } } rc = 0; } else - dbg("parent not found in database"); + dbg("parent not found in database\n"); udev_device_cleanup(udev_parent); } @@ -468,7 +468,7 @@ static int pass_env_to_socket(const char *sockpath, const char *devpath, const c ssize_t count; int retval = 0; - dbg("pass environment to socket '%s'", sockpath); + dbg("pass environment to socket '%s'\n", sockpath); sock = socket(AF_LOCAL, SOCK_DGRAM, 0); memset(&saddr, 0x00, sizeof(struct sockaddr_un)); saddr.sun_family = AF_LOCAL; @@ -498,7 +498,7 @@ static int pass_env_to_socket(const char *sockpath, const char *devpath, const c count = sendto(sock, &buf, bufpos, 0, (struct sockaddr *)&saddr, saddrlen); if (count < 0) retval = -1; - info("passed %zi bytes to socket '%s', ", count, sockpath); + info("passed %zi bytes to socket '%s', \n", count, sockpath); close(sock); return retval; @@ -509,7 +509,7 @@ int udev_rules_run(struct udevice *udev) struct name_entry *name_loop; int retval = 0; - dbg("executing run list"); + dbg("executing run list\n"); list_for_each_entry(name_loop, &udev->run_list, node) { if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) { pass_env_to_socket(&name_loop->name[strlen("socket:")], udev->dev->devpath, udev->action); @@ -541,22 +541,22 @@ static int wait_for_sysfs(struct udevice *udev, const char *file, int timeout) strlcat(filepath, "/", sizeof(filepath)); strlcat(filepath, file, sizeof(filepath)); - dbg("will wait %i sec for '%s'", timeout, filepath); + dbg("will wait %i sec for '%s'\n", timeout, filepath); while (--loop) { /* lookup file */ if (stat(filepath, &stats) == 0) { - info("file '%s' appeared after %i loops", filepath, (timeout * WAIT_LOOP_PER_SECOND) - loop-1); + info("file '%s' appeared after %i loops\n", filepath, (timeout * WAIT_LOOP_PER_SECOND) - loop-1); return 0; } /* make sure, the device did not disappear in the meantime */ if (stat(devicepath, &stats) != 0) { - info("device disappeared while waiting for '%s'", filepath); + info("device disappeared while waiting for '%s'\n", filepath); return -2; } - info("wait for '%s' for %i mseconds", filepath, 1000 / WAIT_LOOP_PER_SECOND); + info("wait for '%s' for %i mseconds\n", filepath, 1000 / WAIT_LOOP_PER_SECOND); usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); } - info("waiting for '%s' failed", filepath); + info("waiting for '%s' failed\n", filepath); return -1; } @@ -707,12 +707,12 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) if (strncasecmp(&head[1], subst->name, strlen(subst->name)) == 0) { type = subst->type; tail = head + strlen(subst->name)+1; - dbg("will substitute format name '%s'", subst->name); + dbg("will substitute format name '%s'\n", subst->name); goto found; } } head[0] = '$'; - err("unknown format variable '%s'", head); + err("unknown format variable '%s'\n", head); } else if (head[0] == '%') { /* substitute format char */ if (head[1] == '\0') @@ -730,12 +730,12 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) if (tail[0] == subst->fmt) { type = subst->type; tail++; - dbg("will substitute format char '%c'", subst->fmt); + dbg("will substitute format char '%c'\n", subst->fmt); goto found; } } head[0] = '%'; - err("unknown format char '%c'", tail[0]); + err("unknown format char '%c'\n", tail[0]); } head++; } @@ -743,42 +743,42 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) found: attr = get_format_attribute(&tail); strlcpy(temp, tail, sizeof(temp)); - dbg("format=%i, string='%s', tail='%s'", type ,string, tail); + dbg("format=%i, string='%s', tail='%s'\n", type ,string, tail); switch (type) { case SUBST_DEVPATH: strlcat(string, udev->dev->devpath, maxsize); - dbg("substitute devpath '%s'", udev->dev->devpath); + dbg("substitute devpath '%s'\n", udev->dev->devpath); break; case SUBST_KERNEL: strlcat(string, udev->dev->kernel, maxsize); - dbg("substitute kernel name '%s'", udev->dev->kernel); + dbg("substitute kernel name '%s'\n", udev->dev->kernel); break; case SUBST_KERNEL_NUMBER: strlcat(string, udev->dev->kernel_number, maxsize); - dbg("substitute kernel number '%s'", udev->dev->kernel_number); + dbg("substitute kernel number '%s'\n", udev->dev->kernel_number); break; case SUBST_ID: if (udev->dev_parent != NULL) { strlcat(string, udev->dev_parent->kernel, maxsize); - dbg("substitute id '%s'", udev->dev_parent->kernel); + dbg("substitute id '%s'\n", udev->dev_parent->kernel); } break; case SUBST_DRIVER: if (udev->dev_parent != NULL) { strlcat(string, udev->dev_parent->driver, maxsize); - dbg("substitute driver '%s'", udev->dev_parent->driver); + dbg("substitute driver '%s'\n", udev->dev_parent->driver); } break; case SUBST_MAJOR: sprintf(temp2, "%d", major(udev->devt)); strlcat(string, temp2, maxsize); - dbg("substitute major number '%s'", temp2); + dbg("substitute major number '%s'\n", temp2); break; case SUBST_MINOR: sprintf(temp2, "%d", minor(udev->devt)); strlcat(string, temp2, maxsize); - dbg("substitute minor number '%s'", temp2); + dbg("substitute minor number '%s'\n", temp2); break; case SUBST_RESULT: if (udev->program_result[0] == '\0') @@ -788,7 +788,7 @@ found: if (attr != NULL) i = strtoul(attr, &rest, 10); if (i > 0) { - dbg("request part #%d of result string", i); + dbg("request part #%d of result string\n", i); cpos = udev->program_result; while (--i) { while (cpos[0] != '\0' && !isspace(cpos[0])) @@ -797,7 +797,7 @@ found: cpos++; } if (i > 0) { - err("requested part of result string not found"); + err("requested part of result string not found\n"); break; } strlcpy(temp2, cpos, sizeof(temp2)); @@ -808,15 +808,15 @@ found: cpos[0] = '\0'; } strlcat(string, temp2, maxsize); - dbg("substitute part of result string '%s'", temp2); + dbg("substitute part of result string '%s'\n", temp2); } else { strlcat(string, udev->program_result, maxsize); - dbg("substitute result string '%s'", udev->program_result); + dbg("substitute result string '%s'\n", udev->program_result); } break; case SUBST_ATTR: if (attr == NULL) - err("missing file parameter for attr"); + err("missing file parameter for attr\n"); else { char devpath[PATH_SIZE]; char *attrib; @@ -839,7 +839,7 @@ found: struct sysfs_device *dev_parent = udev->dev; do { - dbg("looking at '%s'", dev_parent->devpath); + dbg("looking at '%s'\n", dev_parent->devpath); value = sysfs_attr_get_value(dev_parent->devpath, attr); if (value != NULL) { strlcpy(temp2, value, sizeof(temp2)); @@ -860,9 +860,9 @@ found: temp2[--size] = '\0'; count = replace_chars(temp2, ALLOWED_CHARS_INPUT); if (count > 0) - info("%i character(s) replaced" , count); + info("%i character(s) replaced\n" , count); strlcat(string, temp2, maxsize); - dbg("substitute sysfs value '%s'", temp2); + dbg("substitute sysfs value '%s'\n", temp2); } break; case SUBST_PARENT: @@ -873,15 +873,15 @@ found: if (dev_parent != NULL) { struct udevice *udev_parent; - dbg("found parent '%s', get the node name", dev_parent->devpath); + dbg("found parent '%s', get the node name\n", dev_parent->devpath); udev_parent = udev_device_init(NULL); if (udev_parent != NULL) { /* lookup the name in the udev_db with the DEVPATH of the parent */ if (udev_db_get_device(udev_parent, dev_parent->devpath) == 0) { strlcat(string, udev_parent->name, maxsize); - dbg("substitute parent node name'%s'", udev_parent->name); + dbg("substitute parent node name'%s'\n", udev_parent->name); } else - dbg("parent not found in database"); + dbg("parent not found in database\n"); udev_device_cleanup(udev_parent); } } @@ -889,48 +889,48 @@ found: break; case SUBST_TEMP_NODE: if (udev->tmp_node[0] == '\0' && major(udev->devt) > 0) { - dbg("create temporary device node for callout"); + dbg("create temporary device node for callout\n"); snprintf(udev->tmp_node, sizeof(udev->tmp_node), "%s/.tmp-%u-%u", udev_root, major(udev->devt), minor(udev->devt)); udev->tmp_node[sizeof(udev->tmp_node)-1] = '\0'; udev_node_mknod(udev, udev->tmp_node, udev->devt, 0600, 0, 0); } strlcat(string, udev->tmp_node, maxsize); - dbg("substitute temporary device node name '%s'", udev->tmp_node); + dbg("substitute temporary device node name '%s'\n", udev->tmp_node); break; case SUBST_NAME: strlcat(string, udev->name, maxsize); - dbg("substitute udev->name '%s'", udev->name); + dbg("substitute udev->name '%s'\n", udev->name); break; case SUBST_ROOT: strlcat(string, udev_root, maxsize); - dbg("substitute udev_root '%s'", udev_root); + dbg("substitute udev_root '%s'\n", udev_root); break; case SUBST_SYS: strlcat(string, sysfs_path, maxsize); - dbg("substitute sysfs_path '%s'", sysfs_path); + dbg("substitute sysfs_path '%s'\n", sysfs_path); break; case SUBST_ENV: if (attr == NULL) { - dbg("missing attribute"); + dbg("missing attribute\n"); break; } pos = getenv(attr); if (pos == NULL) { - dbg("env '%s' not available", attr); + dbg("env '%s' not available\n", attr); break; } - dbg("substitute env '%s=%s'", attr, pos); + dbg("substitute env '%s=%s'\n", attr, pos); strlcat(string, pos, maxsize); break; default: - err("unknown substitution type=%i", type); + err("unknown substitution type=%i\n", type); break; } /* possibly truncate to format-char specified length */ if (len >= 0 && len < (int)strlen(head)) { head[len] = '\0'; - dbg("truncate to %i chars, subtitution string becomes '%s'", len, head); + dbg("truncate to %i chars, subtitution string becomes '%s'\n", len, head); } strlcat(string, temp, maxsize); } @@ -960,7 +960,7 @@ static int match_key(const char *key_name, struct udev_rule *rule, struct key *k /* look for a matching string, parts are separated by '|' */ strlcpy(value, rule->buf + key->val_off, sizeof(value)); key_value = value; - dbg("key %s value='%s'", key_name, key_value); + dbg("key %s value='%s'\n", key_name, key_value); while (key_value) { pos = strchr(key_value, '|'); if (pos) { @@ -968,7 +968,7 @@ static int match_key(const char *key_name, struct udev_rule *rule, struct key *k pos++; } - dbg("match %s '%s' <-> '%s'", key_name, key_value, val); + dbg("match %s '%s' <-> '%s'\n", key_name, key_value, val); match = (fnmatch(key_value, val, 0) == 0); if (match) break; @@ -977,11 +977,11 @@ static int match_key(const char *key_name, struct udev_rule *rule, struct key *k } if (match && (key->operation == KEY_OP_MATCH)) { - dbg("%s is true (matching value)", key_name); + dbg("%s is true (matching value)\n", key_name); return 0; } if (!match && (key->operation == KEY_OP_NOMATCH)) { - dbg("%s is true (non-matching value)", key_name); + dbg("%s is true (non-matching value)\n", key_name); return 0; } return -1; @@ -1037,7 +1037,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) const char *value = getenv(key_name); if (!value) { - dbg("ENV{'%s'} is not set, treat as empty", key_name); + dbg("ENV{'%s'} is not set, treat as empty\n", key_name); value = ""; } if (match_key("ENV", rule, &pair->key, value)) @@ -1076,10 +1076,10 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) attr_subst_subdir(filename, sizeof(filename)); match = (stat(filename, &statbuf) == 0); - info("'%s' %s", filename, match ? "exists" : "does not exist"); + info("'%s' %s", filename, match ? "exists" : "does not exist\n"); if (match && rule->test_mode_mask > 0) { match = ((statbuf.st_mode & rule->test_mode_mask) > 0); - info("'%s' has mode=%#o and %s %#o", filename, statbuf.st_mode, + info("'%s' has mode=%#o and %s %#o\n", filename, statbuf.st_mode, match ? "matches" : "does not match", rule->test_mode_mask); } @@ -1087,7 +1087,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) goto nomatch; if (!match && rule->test.operation == KEY_OP_MATCH) goto nomatch; - dbg("TEST key is true"); + dbg("TEST key is true\n"); } if (rule->wait_for_sysfs.operation != KEY_OP_UNSET) { @@ -1130,7 +1130,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) len = strlen(val); while (len > 0 && isspace(val[len-1])) val[--len] = '\0'; - dbg("removed %zi trailing whitespace chars from '%s'", strlen(val)-len, val); + dbg("removed %zi trailing whitespace chars from '%s'\n", strlen(val)-len, val); } if (match_key("ATTR", rule, &pair->key, val)) @@ -1178,7 +1178,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) len = strlen(val); while (len > 0 && isspace(val[len-1])) val[--len] = '\0'; - dbg("removed %zi trailing whitespace chars from '%s'", strlen(val)-len, val); + dbg("removed %zi trailing whitespace chars from '%s'\n", strlen(val)-len, val); } if (match_key("ATTRS", rule, &pair->key, val)) @@ -1190,12 +1190,12 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) break; try_parent: /* move to parent device */ - dbg("try parent sysfs device"); + dbg("try parent sysfs device\n"); udev->dev_parent = sysfs_device_get_parent(udev->dev_parent); if (udev->dev_parent == NULL) goto nomatch; - dbg("looking at dev_parent->devpath='%s'", udev->dev_parent->devpath); - dbg("looking at dev_parent->kernel='%s'", udev->dev_parent->kernel); + dbg("looking at dev_parent->devpath='%s'\n", udev->dev_parent->devpath); + dbg("looking at dev_parent->kernel='%s'\n", udev->dev_parent->kernel); } /* execute external program */ @@ -1206,28 +1206,28 @@ try_parent: strlcpy(program, key_val(rule, &rule->program), sizeof(program)); udev_rules_apply_format(udev, program, sizeof(program)); if (run_program(program, udev->dev->subsystem, result, sizeof(result), NULL) != 0) { - dbg("PROGRAM is false"); + dbg("PROGRAM is false\n"); udev->program_result[0] = '\0'; if (rule->program.operation != KEY_OP_NOMATCH) goto nomatch; } else { int count; - dbg("PROGRAM matches"); + dbg("PROGRAM matches\n"); remove_trailing_chars(result, '\n'); if (rule->string_escape == ESCAPE_UNSET || rule->string_escape == ESCAPE_REPLACE) { count = replace_chars(result, ALLOWED_CHARS_INPUT); if (count > 0) - info("%i character(s) replaced" , count); + info("%i character(s) replaced\n" , count); } - dbg("result is '%s'", result); + dbg("result is '%s'\n", result); strlcpy(udev->program_result, result, sizeof(udev->program_result)); - dbg("PROGRAM returned successful"); + dbg("PROGRAM returned successful\n"); if (rule->program.operation == KEY_OP_NOMATCH) goto nomatch; } - dbg("PROGRAM key is true"); + dbg("PROGRAM key is true\n"); } /* check for matching result of external program */ @@ -1241,23 +1241,23 @@ try_parent: strlcpy(import, key_val(rule, &rule->import), sizeof(import)); udev_rules_apply_format(udev, import, sizeof(import)); - dbg("check for IMPORT import='%s'", import); + dbg("check for IMPORT import='%s'\n", import); if (rule->import_type == IMPORT_PROGRAM) { rc = import_program_into_env(udev, import); } else if (rule->import_type == IMPORT_FILE) { - dbg("import file import='%s'", import); + dbg("import file import='%s'\n", import); rc = import_file_into_env(udev, import); } else if (rule->import_type == IMPORT_PARENT) { - dbg("import parent import='%s'", import); + dbg("import parent import='%s'\n", import); rc = import_parent_into_env(udev, import); } if (rc != 0) { - dbg("IMPORT failed"); + dbg("IMPORT failed\n"); if (rule->import.operation != KEY_OP_NOMATCH) goto nomatch; } else - dbg("IMPORT '%s' imported", key_val(rule, &rule->import)); - dbg("IMPORT key is true"); + dbg("IMPORT '%s' imported\n", key_val(rule, &rule->import)); + dbg("IMPORT key is true\n"); } /* rule matches, if we have ENV assignments export it */ @@ -1276,7 +1276,7 @@ try_parent: if (temp_value[0] == '\0') { name_list_key_remove(&udev->env_list, key_name); unsetenv(key_name); - info("unset ENV '%s'", key_name); + info("unset ENV '%s'\n", key_name); } else { struct name_entry *entry; @@ -1284,7 +1284,7 @@ try_parent: if (entry == NULL) break; putenv(entry->name); - info("set ENV '%s'", entry->name); + info("set ENV '%s'\n", entry->name); } } } @@ -1321,15 +1321,15 @@ try_parent: strlcpy(value, key_val(rule, &pair->key), sizeof(value)); udev_rules_apply_format(udev, value, sizeof(value)); - info("writing '%s' to sysfs file '%s'", value, attr); + info("writing '%s' to sysfs file '%s'\n", value, attr); f = fopen(attr, "w"); if (f != NULL) { if (!udev->test_run) if (fprintf(f, "%s", value) <= 0) - err("error writing ATTR{%s}: %s", attr, strerror(errno)); + err("error writing ATTR{%s}: %s\n", attr, strerror(errno)); fclose(f); } else - err("error opening ATTR{%s} for writing: %s", attr, strerror(errno)); + err("error opening ATTR{%s} for writing: %s\n", attr, strerror(errno)); } } return 0; @@ -1343,8 +1343,8 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) struct udev_rule *rule; int name_set = 0; - dbg("udev->dev->devpath='%s'", udev->dev->devpath); - dbg("udev->dev->kernel='%s'", udev->dev->kernel); + dbg("udev->dev->devpath='%s'\n", udev->dev->devpath); + dbg("udev->dev->kernel='%s'\n", udev->dev->kernel); /* look for a matching rule to apply */ udev_rules_iter_init(rules); @@ -1357,31 +1357,31 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) (rule->name.operation == KEY_OP_ASSIGN || rule->name.operation == KEY_OP_ASSIGN_FINAL || rule->name.operation == KEY_OP_ADD)) { - dbg("node name already set, rule ignored"); + dbg("node name already set, rule ignored\n"); continue; } - dbg("process rule"); + dbg("process rule\n"); if (match_rule(udev, rule) == 0) { /* apply options */ if (rule->ignore_device) { - info("rule applied, '%s' is ignored", udev->dev->kernel); + info("rule applied, '%s' is ignored\n", udev->dev->kernel); udev->ignore_device = 1; return 0; } if (rule->ignore_remove) { udev->ignore_remove = 1; - dbg("remove event should be ignored"); + dbg("remove event should be ignored\n"); } if (rule->link_priority != 0) { udev->link_priority = rule->link_priority; - info("link_priority=%i", udev->link_priority); + info("link_priority=%i\n", udev->link_priority); } /* apply all_partitions option only at a main block device */ if (rule->partitions && strcmp(udev->dev->subsystem, "block") == 0 && udev->dev->kernel_number[0] == '\0') { udev->partitions = rule->partitions; - dbg("creation of partition nodes requested"); + dbg("creation of partition nodes requested\n"); } /* apply permissions */ @@ -1389,21 +1389,21 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) if (rule->mode.operation == KEY_OP_ASSIGN_FINAL) udev->mode_final = 1; udev->mode = strtol(key_val(rule, &rule->mode), NULL, 8); - dbg("applied mode=%#o to '%s'", udev->mode, udev->dev->kernel); + dbg("applied mode=%#o to '%s'\n", udev->mode, udev->dev->kernel); } if (!udev->owner_final && rule->owner.operation != KEY_OP_UNSET) { if (rule->owner.operation == KEY_OP_ASSIGN_FINAL) udev->owner_final = 1; strlcpy(udev->owner, key_val(rule, &rule->owner), sizeof(udev->owner)); udev_rules_apply_format(udev, udev->owner, sizeof(udev->owner)); - dbg("applied owner='%s' to '%s'", udev->owner, udev->dev->kernel); + dbg("applied owner='%s' to '%s'\n", udev->owner, udev->dev->kernel); } if (!udev->group_final && rule->group.operation != KEY_OP_UNSET) { if (rule->group.operation == KEY_OP_ASSIGN_FINAL) udev->group_final = 1; strlcpy(udev->group, key_val(rule, &rule->group), sizeof(udev->group)); udev_rules_apply_format(udev, udev->group, sizeof(udev->group)); - dbg("applied group='%s' to '%s'", udev->group, udev->dev->kernel); + dbg("applied group='%s' to '%s'\n", udev->group, udev->dev->kernel); } /* collect symlinks */ @@ -1419,7 +1419,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) udev->symlink_final = 1; if (rule->symlink.operation == KEY_OP_ASSIGN || rule->symlink.operation == KEY_OP_ASSIGN_FINAL) { - info("reset symlink list"); + info("reset symlink list\n"); name_list_cleanup(&udev->symlink_list); } /* allow multiple symlinks separated by spaces */ @@ -1429,16 +1429,16 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) rule->string_escape == ESCAPE_REPLACE) { count = replace_chars(temp, ALLOWED_CHARS_FILE " "); if (count > 0) - info("%i character(s) replaced" , count); + info("%i character(s) replaced\n" , count); } - dbg("rule applied, added symlink(s) '%s'", temp); + dbg("rule applied, added symlink(s) '%s'\n", temp); pos = temp; while (isspace(pos[0])) pos++; next = strchr(pos, ' '); while (next) { next[0] = '\0'; - info("add symlink '%s'", pos); + info("add symlink '%s'\n", pos); name_list_add(&udev->symlink_list, pos, 0); while (isspace(next[1])) next++; @@ -1446,7 +1446,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) next = strchr(pos, ' '); } if (pos[0] != '\0') { - info("add symlink '%s'", pos); + info("add symlink '%s'\n", pos); name_list_add(&udev->symlink_list, pos, 0); } } @@ -1464,12 +1464,12 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) rule->string_escape == ESCAPE_REPLACE) { count = replace_chars(udev->name, ALLOWED_CHARS_FILE); if (count > 0) - info("%i character(s) replaced", count); + info("%i character(s) replaced\n", count); } - info("rule applied, '%s' becomes '%s'", udev->dev->kernel, udev->name); + info("rule applied, '%s' becomes '%s'\n", udev->dev->kernel, udev->name); if (strcmp(udev->dev->subsystem, "net") != 0) - dbg("name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i", + dbg("name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i\n", udev->name, udev->owner, udev->group, udev->mode, udev->partitions); } @@ -1479,34 +1479,34 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) if (rule->run.operation == KEY_OP_ASSIGN_FINAL) udev->run_final = 1; if (rule->run.operation == KEY_OP_ASSIGN || rule->run.operation == KEY_OP_ASSIGN_FINAL) { - info("reset run list"); + info("reset run list\n"); name_list_cleanup(&udev->run_list); } - dbg("add run '%s'", key_val(rule, &rule->run)); + dbg("add run '%s'\n", key_val(rule, &rule->run)); entry = name_list_add(&udev->run_list, key_val(rule, &rule->run), 0); if (rule->run_ignore_error) entry->ignore_error = 1; } if (rule->last_rule) { - dbg("last rule to be applied"); + dbg("last rule to be applied\n"); break; } if (rule->goto_label.operation != KEY_OP_UNSET) { - dbg("moving forward to label '%s'", key_val(rule, &rule->goto_label)); + dbg("moving forward to label '%s'\n", key_val(rule, &rule->goto_label)); udev_rules_iter_label(rules, key_val(rule, &rule->goto_label)); } } } if (!name_set) { - info("no node name set, will use kernel name '%s'", udev->dev->kernel); + info("no node name set, will use kernel name '%s'\n", udev->dev->kernel); strlcpy(udev->name, udev->dev->kernel, sizeof(udev->name)); } if (udev->tmp_node[0] != '\0') { - dbg("removing temporary device node"); + dbg("removing temporary device node\n"); unlink_secure(udev->tmp_node); udev->tmp_node[0] = '\0'; } @@ -1518,7 +1518,7 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) { struct udev_rule *rule; - dbg("udev->kernel='%s'", udev->dev->kernel); + dbg("udev->kernel='%s'\n", udev->dev->kernel); /* look for a matching rule to apply */ udev_rules_iter_init(rules); @@ -1527,7 +1527,7 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) if (rule == NULL) break; - dbg("process rule"); + dbg("process rule\n"); if (rule->name.operation == KEY_OP_ASSIGN || rule->name.operation == KEY_OP_ASSIGN_FINAL || rule->name.operation == KEY_OP_ADD || @@ -1536,19 +1536,19 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) rule->symlink.operation == KEY_OP_ADD || rule->mode.operation != KEY_OP_UNSET || rule->owner.operation != KEY_OP_UNSET || rule->group.operation != KEY_OP_UNSET) { - dbg("skip rule that names a device"); + dbg("skip rule that names a device\n"); continue; } if (match_rule(udev, rule) == 0) { if (rule->ignore_device) { - info("rule applied, '%s' is ignored", udev->dev->kernel); + info("rule applied, '%s' is ignored\n", udev->dev->kernel); udev->ignore_device = 1; return 0; } if (rule->ignore_remove) { udev->ignore_remove = 1; - dbg("remove event should be ignored"); + dbg("remove event should be ignored\n"); } if (!udev->run_final && rule->run.operation != KEY_OP_UNSET) { @@ -1556,10 +1556,10 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) if (rule->run.operation == KEY_OP_ASSIGN || rule->run.operation == KEY_OP_ASSIGN_FINAL) { - info("reset run list"); + info("reset run list\n"); name_list_cleanup(&udev->run_list); } - dbg("add run '%s'", key_val(rule, &rule->run)); + dbg("add run '%s'\n", key_val(rule, &rule->run)); entry = name_list_add(&udev->run_list, key_val(rule, &rule->run), 0); if (rule->run_ignore_error) entry->ignore_error = 1; @@ -1568,12 +1568,12 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) } if (rule->last_rule) { - dbg("last rule to be applied"); + dbg("last rule to be applied\n"); break; } if (rule->goto_label.operation != KEY_OP_UNSET) { - dbg("moving forward to label '%s'", key_val(rule, &rule->goto_label)); + dbg("moving forward to label '%s'\n", key_val(rule, &rule->goto_label)); udev_rules_iter_label(rules, key_val(rule, &rule->goto_label)); } } diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 6d88354dbd..b586df1324 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -33,7 +33,7 @@ void udev_rules_iter_init(struct udev_rules *rules) { - dbg("bufsize=%zi", rules->bufsize); + dbg("bufsize=%zi\n", rules->bufsize); rules->current = 0; } @@ -44,9 +44,9 @@ struct udev_rule *udev_rules_iter_next(struct udev_rules *rules) if (!rules) return NULL; - dbg("current=%zi", rules->current); + dbg("current=%zi\n", rules->current); if (rules->current >= rules->bufsize) { - dbg("no more rules"); + dbg("no more rules\n"); return NULL; } @@ -62,20 +62,20 @@ struct udev_rule *udev_rules_iter_label(struct udev_rules *rules, const char *la static struct udev_rule *rule; next: - dbg("current=%zi", rules->current); + dbg("current=%zi\n", rules->current); if (rules->current >= rules->bufsize) { - dbg("no more rules"); + dbg("no more rules\n"); return NULL; } rule = (struct udev_rule *) (rules->buf + rules->current); if (strcmp(&rule->buf[rule->label.val_off], label) != 0) { - dbg("moving forward, looking for label '%s'", label); + dbg("moving forward, looking for label '%s'\n", label); rules->current += sizeof(struct udev_rule) + rule->bufsize; goto next; } - dbg("found label '%s'", label); + dbg("found label '%s'\n", label); return rule; } @@ -123,29 +123,29 @@ static int get_key(char **line, char **key, enum key_operation *operation, char if (linepos[0] == '=' && linepos[1] == '=') { *operation = KEY_OP_MATCH; linepos += 2; - dbg("operator=match"); + dbg("operator=match\n"); } else if (linepos[0] == '!' && linepos[1] == '=') { *operation = KEY_OP_NOMATCH; linepos += 2; - dbg("operator=nomatch"); + dbg("operator=nomatch\n"); } else if (linepos[0] == '+' && linepos[1] == '=') { *operation = KEY_OP_ADD; linepos += 2; - dbg("operator=add"); + dbg("operator=add\n"); } else if (linepos[0] == '=') { *operation = KEY_OP_ASSIGN; linepos++; - dbg("operator=assign"); + dbg("operator=assign\n"); } else if (linepos[0] == ':' && linepos[1] == '=') { *operation = KEY_OP_ASSIGN_FINAL; linepos += 2; - dbg("operator=assign_final"); + dbg("operator=assign_final\n"); } else return -1; /* terminate key */ temp[0] = '\0'; - dbg("key='%s'", *key); + dbg("key='%s'\n", *key); /* skip whitespace after operator */ while (isspace(linepos[0])) @@ -165,7 +165,7 @@ static int get_key(char **line, char **key, enum key_operation *operation, char return -1; temp[0] = '\0'; temp++; - dbg("value='%s'", *value); + dbg("value='%s'\n", *value); /* move line to next key */ *line = temp; @@ -184,11 +184,11 @@ static char *get_key_attribute(char *str) attr++; pos = strchr(attr, '}'); if (pos == NULL) { - err("missing closing brace for format"); + err("missing closing brace for format\n"); return NULL; } pos[0] = '\0'; - dbg("attribute='%s'", attr); + dbg("attribute='%s'\n", attr); return attr; } @@ -215,7 +215,7 @@ static int add_rule_key_pair(struct udev_rule *rule, struct key_pairs *pairs, size_t key_len = strnlen(key, PATH_SIZE); if (pairs->count >= PAIRS_MAX) { - err("skip, too many keys of the same type in a single rule"); + err("skip, too many keys of the same type in a single rule\n"); return -1; } @@ -261,7 +261,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strcasecmp(key, "ACTION") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid ACTION operation"); + err("invalid ACTION operation\n"); goto invalid; } add_rule_key(rule, &rule->action, operation, value); @@ -272,7 +272,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strcasecmp(key, "DEVPATH") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid DEVPATH operation"); + err("invalid DEVPATH operation\n"); goto invalid; } add_rule_key(rule, &rule->devpath, operation, value); @@ -283,7 +283,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strcasecmp(key, "KERNEL") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid KERNEL operation"); + err("invalid KERNEL operation\n"); goto invalid; } add_rule_key(rule, &rule->kernel, operation, value); @@ -294,7 +294,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strcasecmp(key, "SUBSYSTEM") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid SUBSYSTEM operation"); + err("invalid SUBSYSTEM operation\n"); goto invalid; } /* bus, class, subsystem events should all be the same */ @@ -302,7 +302,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena strcmp(value, "bus") == 0 || strcmp(value, "class") == 0) { if (strcmp(value, "bus") == 0 || strcmp(value, "class") == 0) - err("'%s' must be specified as 'subsystem' " + err("'%s' must be specified as 'subsystem' \n" "please fix it in %s:%u", value, filename, lineno); add_rule_key(rule, &rule->subsystem, operation, "subsystem|class|bus"); } else @@ -314,7 +314,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strcasecmp(key, "DRIVER") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid DRIVER operation"); + err("invalid DRIVER operation\n"); goto invalid; } add_rule_key(rule, &rule->driver, operation, value); @@ -325,7 +325,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strncasecmp(key, "ATTR{", sizeof("ATTR{")-1) == 0) { attr = get_key_attribute(key + sizeof("ATTR")-1); if (attr == NULL) { - err("error parsing ATTR attribute"); + err("error parsing ATTR attribute\n"); goto invalid; } if (add_rule_key_pair(rule, &rule->attr, operation, attr, value) != 0) @@ -338,7 +338,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena strcasecmp(key, "ID") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid KERNELS operation"); + err("invalid KERNELS operation\n"); goto invalid; } add_rule_key(rule, &rule->kernels, operation, value); @@ -350,7 +350,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena strcasecmp(key, "BUS") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid SUBSYSTEMS operation"); + err("invalid SUBSYSTEMS operation\n"); goto invalid; } add_rule_key(rule, &rule->subsystems, operation, value); @@ -361,7 +361,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strcasecmp(key, "DRIVERS") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid DRIVERS operation"); + err("invalid DRIVERS operation\n"); goto invalid; } add_rule_key(rule, &rule->drivers, operation, value); @@ -373,19 +373,19 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena strncasecmp(key, "SYSFS{", sizeof("SYSFS{")-1) == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid ATTRS operation"); + err("invalid ATTRS operation\n"); goto invalid; } attr = get_key_attribute(key + sizeof("ATTRS")-1); if (attr == NULL) { - err("error parsing ATTRS attribute"); + err("error parsing ATTRS attribute\n"); goto invalid; } if (strncmp(attr, "device/", 7) == 0) - err("the 'device' link is deprecated and will be removed from a future kernel, " + err("the 'device' link is deprecated and will be removed from a future kernel, \n" "please fix it in %s:%u", filename, lineno); else if (strstr(attr, "../") != NULL) - err("do not reference parent sysfs directories directly, that may break with a future kernel, " + err("do not reference parent sysfs directories directly, that may break with a future kernel, \n" "please fix it in %s:%u", filename, lineno); if (add_rule_key_pair(rule, &rule->attrs, operation, attr, value) != 0) goto invalid; @@ -396,7 +396,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strncasecmp(key, "ENV{", sizeof("ENV{")-1) == 0) { attr = get_key_attribute(key + sizeof("ENV")-1); if (attr == NULL) { - err("error parsing ENV attribute"); + err("error parsing ENV attribute\n"); goto invalid; } if (strncmp(attr, "PHYSDEV", 7) == 0) @@ -416,7 +416,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strcasecmp(key, "RESULT") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid RESULT operation"); + err("invalid RESULT operation\n"); goto invalid; } add_rule_key(rule, &rule->result, operation, value); @@ -427,13 +427,13 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strncasecmp(key, "IMPORT", sizeof("IMPORT")-1) == 0) { attr = get_key_attribute(key + sizeof("IMPORT")-1); if (attr != NULL && strstr(attr, "program")) { - dbg("IMPORT will be executed"); + dbg("IMPORT will be executed\n"); rule->import_type = IMPORT_PROGRAM; } else if (attr != NULL && strstr(attr, "file")) { - dbg("IMPORT will be included as file"); + dbg("IMPORT will be included as file\n"); rule->import_type = IMPORT_FILE; } else if (attr != NULL && strstr(attr, "parent")) { - dbg("IMPORT will include the parent values"); + dbg("IMPORT will include the parent values\n"); rule->import_type = IMPORT_PARENT; } else { /* figure it out if it is executable */ @@ -455,12 +455,12 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena pos[0] = '\0'; } - dbg("IMPORT auto mode for '%s'", file); + dbg("IMPORT auto mode for '%s'\n", file); if (!lstat(file, &statbuf) && (statbuf.st_mode & S_IXUSR)) { - dbg("IMPORT is executable, will be executed (autotype)"); + dbg("IMPORT is executable, will be executed (autotype)\n"); rule->import_type = IMPORT_PROGRAM; } else { - dbg("IMPORT is not executable, will be included as file (autotype)"); + dbg("IMPORT is not executable, will be included as file (autotype)\n"); rule->import_type = IMPORT_FILE; } } @@ -472,7 +472,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strncasecmp(key, "TEST", sizeof("TEST")-1) == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid TEST operation"); + err("invalid TEST operation\n"); goto invalid; } attr = get_key_attribute(key + sizeof("TEST")-1); @@ -516,16 +516,16 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena attr = get_key_attribute(key + sizeof("NAME")-1); if (attr != NULL) { if (strstr(attr, "all_partitions") != NULL) { - dbg("creation of partition nodes requested"); + dbg("creation of partition nodes requested\n"); rule->partitions = DEFAULT_PARTITIONS_COUNT; } if (strstr(attr, "ignore_remove") != NULL) { - dbg("remove event should be ignored"); + dbg("remove event should be ignored\n"); rule->ignore_remove = 1; } } if (value[0] == '\0') - dbg("name empty, node creation supressed"); + dbg("name empty, node creation supressed\n"); add_rule_key(rule, &rule->name, operation, value); continue; } @@ -548,7 +548,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (endptr[0] != '\0') { char owner[32]; uid_t uid = lookup_user(value); - dbg("replacing username='%s' by id=%i", value, uid); + dbg("replacing username='%s' by id=%i\n", value, uid); sprintf(owner, "%u", (unsigned int) uid); add_rule_key(rule, &rule->owner, operation, owner); continue; @@ -567,7 +567,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (endptr[0] != '\0') { char group[32]; gid_t gid = lookup_group(value); - dbg("replacing groupname='%s' by id=%i", value, gid); + dbg("replacing groupname='%s' by id=%i\n", value, gid); sprintf(group, "%u", (unsigned int) gid); add_rule_key(rule, &rule->group, operation, group); continue; @@ -588,21 +588,21 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena const char *pos; if (strstr(value, "last_rule") != NULL) { - dbg("last rule to be applied"); + dbg("last rule to be applied\n"); rule->last_rule = 1; } if (strstr(value, "ignore_device") != NULL) { - dbg("device should be ignored"); + dbg("device should be ignored\n"); rule->ignore_device = 1; } if (strstr(value, "ignore_remove") != NULL) { - dbg("remove event should be ignored"); + dbg("remove event should be ignored\n"); rule->ignore_remove = 1; } pos = strstr(value, "link_priority="); if (pos != NULL) { rule->link_priority = atoi(&pos[strlen("link_priority=")]); - dbg("link priority=%i", rule->link_priority); + dbg("link priority=%i\n", rule->link_priority); } pos = strstr(value, "string_escape="); if (pos != NULL) { @@ -613,18 +613,18 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena rule->string_escape = ESCAPE_REPLACE; } if (strstr(value, "all_partitions") != NULL) { - dbg("creation of partition nodes requested"); + dbg("creation of partition nodes requested\n"); rule->partitions = DEFAULT_PARTITIONS_COUNT; } valid = 1; continue; } - err("unknown key '%s' in %s:%u", key, filename, lineno); + err("unknown key '%s' in %s:%u\n", key, filename, lineno); } if (physdev && rule->wait_for_sysfs.operation == KEY_OP_UNSET) - err("PHYSDEV* values are deprecated and will be removed from a future kernel, " + err("PHYSDEV* values are deprecated and will be removed from a future kernel, \n" "please fix it in %s:%u", filename, lineno); /* skip line if not any valid key was found */ @@ -634,23 +634,23 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena /* grow buffer and add rule */ rule_size = sizeof(struct udev_rule) + rule->bufsize; padding = (sizeof(size_t) - rule_size % sizeof(size_t)) % sizeof(size_t); - dbg("add %zi padding bytes", padding); + dbg("add %zi padding bytes\n", padding); rule_size += padding; rule->bufsize += padding; rules->buf = realloc(rules->buf, rules->bufsize + rule_size); if (!rules->buf) { - err("realloc failed"); + err("realloc failed\n"); goto exit; } - dbg("adding rule to offset %zi", rules->bufsize); + dbg("adding rule to offset %zi\n", rules->bufsize); memcpy(rules->buf + rules->bufsize, rule, rule_size); rules->bufsize += rule_size; exit: return 0; invalid: - err("invalid rule '%s:%u'", filename, lineno); + err("invalid rule '%s:%u'\n", filename, lineno); return -1; } @@ -666,10 +666,10 @@ static int parse_file(struct udev_rules *rules, const char *filename) int retval = 0; if (file_map(filename, &buf, &bufsize) != 0) { - err("can't open '%s' as rules file: %s", filename, strerror(errno)); + err("can't open '%s' as rules file: %s\n", filename, strerror(errno)); return -1; } - info("reading '%s' as rules file", filename); + info("reading '%s' as rules file\n", filename); /* loop through the whole file */ cur = 0; @@ -695,7 +695,7 @@ static int parse_file(struct udev_rules *rules, const char *filename) continue; if (count >= sizeof(line)) { - err("line too long, rule skipped '%s:%u'", filename, lineno); + err("line too long, rule skipped '%s:%u'\n", filename, lineno); continue; } @@ -708,7 +708,7 @@ static int parse_file(struct udev_rules *rules, const char *filename) } line[j] = '\0'; - dbg("read '%s'", line); + dbg("read '%s'\n", line); add_to_rules(rules, line, filename, lineno); } @@ -733,10 +733,10 @@ int udev_rules_init(struct udev_rules *rules, int resolve_names) if (stat(udev_rules_dir, &statbuf) != 0) return -1; if ((statbuf.st_mode & S_IFMT) != S_IFDIR) { - dbg("parse single rules file '%s'", udev_rules_dir); + dbg("parse single rules file '%s'\n", udev_rules_dir); name_list_add(&name_list, udev_rules_dir, 1); } else { - dbg("parse rules directory '%s'", udev_rules_dir); + dbg("parse rules directory '%s'\n", udev_rules_dir); retval = add_matching_files(&name_list, udev_rules_dir, RULESFILE_SUFFIX); } @@ -776,9 +776,9 @@ int udev_rules_init(struct udev_rules *rules, int resolve_names) if (statbuf.st_size) parse_file(rules, name_loop->name); else - dbg("empty rules file '%s'", name_loop->name); + dbg("empty rules file '%s'\n", name_loop->name); } else - err("could not read '%s': %s", name_loop->name, strerror(errno)); + err("could not read '%s': %s\n", name_loop->name, strerror(errno)); list_del(&name_loop->node); free(name_loop); } diff --git a/udev_selinux.c b/udev_selinux.c index 3fa84a0d43..eec950194c 100644 --- a/udev_selinux.c +++ b/udev_selinux.c @@ -40,7 +40,7 @@ static int is_selinux_running(void) if (selinux_enabled == -1) selinux_enabled = (is_selinux_enabled() > 0); - dbg("selinux=%i", selinux_enabled); + dbg("selinux=%i\n", selinux_enabled); return selinux_enabled; } @@ -75,7 +75,7 @@ static char *get_media(const char *devname, int mode) } media = strdup(mediabuf); - info("selinux_get_media(%s)='%s'", devname, media); + info("selinux_get_media(%s)='%s'\n", devname, media); close_out: fclose(fp); @@ -100,12 +100,12 @@ void selinux_setfilecon(const char *file, const char *devname, unsigned int mode if (ret < 0) if (matchpathcon(file, mode, &scontext) < 0) { - err("matchpathcon(%s) failed", file); + err("matchpathcon(%s) failed\n", file); return; } if (lsetfilecon(file, scontext) < 0) - err("setfilecon %s failed: %s", file, strerror(errno)); + err("setfilecon %s failed: %s\n", file, strerror(errno)); freecon(scontext); } @@ -128,12 +128,12 @@ void selinux_setfscreatecon(const char *file, const char *devname, unsigned int if (ret < 0) if (matchpathcon(file, mode, &scontext) < 0) { - err("matchpathcon(%s) failed", file); + err("matchpathcon(%s) failed\n", file); return; } if (setfscreatecon(scontext) < 0) - err("setfscreatecon %s failed: %s", file, strerror(errno)); + err("setfscreatecon %s failed: %s\n", file, strerror(errno)); freecon(scontext); } @@ -143,7 +143,7 @@ void selinux_resetfscreatecon(void) { if (is_selinux_running()) { if (setfscreatecon(prev_scontext) < 0) - err("setfscreatecon failed: %s", strerror(errno)); + err("setfscreatecon failed: %s\n", strerror(errno)); } } @@ -155,10 +155,10 @@ void selinux_init(void) */ if (is_selinux_running()) { if (!udev_root[0]) - err("selinux_init: udev_root not set"); + err("selinux_init: udev_root not set\n"); matchpathcon_init_prefix(NULL, udev_root); if (getfscreatecon(&prev_scontext) < 0) { - err("getfscreatecon failed"); + err("getfscreatecon failed\n"); prev_scontext = NULL; } } diff --git a/udev_sysfs.c b/udev_sysfs.c index 9293305b81..c4cd4ab75d 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -52,7 +52,7 @@ int sysfs_init(void) remove_trailing_chars(sysfs_path, '/'); } else strlcpy(sysfs_path, "/sys", sizeof(sysfs_path)); - dbg("sysfs_path='%s'", sysfs_path); + dbg("sysfs_path='%s'\n", sysfs_path); INIT_LIST_HEAD(&dev_list); INIT_LIST_HEAD(&attr_list); @@ -93,7 +93,7 @@ void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath, if (pos == NULL) return; strlcpy(dev->kernel, &pos[1], sizeof(dev->kernel)); - dbg("kernel='%s'", dev->kernel); + dbg("kernel='%s'\n", dev->kernel); /* some devices have '!' in their name, change that to '/' */ pos = dev->kernel; @@ -108,7 +108,7 @@ void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath, while (isdigit(pos[-1])) pos--; strlcpy(dev->kernel_number, pos, sizeof(dev->kernel_number)); - dbg("kernel_number='%s'", dev->kernel_number); + dbg("kernel_number='%s'\n", dev->kernel_number); } int sysfs_resolve_link(char *devpath, size_t size) @@ -125,11 +125,11 @@ int sysfs_resolve_link(char *devpath, size_t size) if (len <= 0) return -1; link_target[len] = '\0'; - dbg("path link '%s' points to '%s'", devpath, link_target); + dbg("path link '%s' points to '%s'\n", devpath, link_target); for (back = 0; strncmp(&link_target[back * 3], "../", 3) == 0; back++) ; - dbg("base '%s', tail '%s', back %i", devpath, &link_target[back * 3], back); + dbg("base '%s', tail '%s', back %i\n", devpath, &link_target[back * 3], back); for (i = 0; i <= back; i++) { char *pos = strrchr(devpath, '/'); @@ -137,7 +137,7 @@ int sysfs_resolve_link(char *devpath, size_t size) return -1; pos[0] = '\0'; } - dbg("after moving back '%s'", devpath); + dbg("after moving back '%s'\n", devpath); strlcat(devpath, "/", size); strlcat(devpath, &link_target[back * 3], size); return 0; @@ -165,7 +165,7 @@ struct sysfs_device *sysfs_device_get(const char *devpath) strncmp(devpath, "/block/", 7) != 0) return NULL; - dbg("open '%s'", devpath); + dbg("open '%s'\n", devpath); strlcpy(devpath_real, devpath, sizeof(devpath_real)); remove_trailing_chars(devpath_real, '/'); if (devpath[0] == '\0' ) @@ -174,7 +174,7 @@ struct sysfs_device *sysfs_device_get(const char *devpath) /* look for device already in cache (we never put an untranslated path in the cache) */ list_for_each_entry(dev_loop, &dev_list, node) { if (strcmp(dev_loop->devpath, devpath_real) == 0) { - dbg("found in cache '%s'", dev_loop->devpath); + dbg("found in cache '%s'\n", dev_loop->devpath); return dev_loop; } } @@ -183,7 +183,7 @@ struct sysfs_device *sysfs_device_get(const char *devpath) strlcpy(path, sysfs_path, sizeof(path)); strlcat(path, devpath_real, sizeof(path)); if (lstat(path, &statbuf) != 0) { - dbg("stat '%s' failed: %s", path, strerror(errno)); + dbg("stat '%s' failed: %s\n", path, strerror(errno)); return NULL; } if (S_ISLNK(statbuf.st_mode)) { @@ -193,14 +193,14 @@ struct sysfs_device *sysfs_device_get(const char *devpath) /* now look for device in cache after path translation */ list_for_each_entry(dev_loop, &dev_list, node) { if (strcmp(dev_loop->devpath, devpath_real) == 0) { - dbg("found in cache '%s'", dev_loop->devpath); + dbg("found in cache '%s'\n", dev_loop->devpath); return dev_loop; } } } /* it is a new device */ - dbg("new uncached device '%s'", devpath_real); + dbg("new uncached device '%s'\n", devpath_real); dev = malloc(sizeof(struct sysfs_device)); if (dev == NULL) return NULL; @@ -216,7 +216,7 @@ struct sysfs_device *sysfs_device_get(const char *devpath) if (len > 0) { /* get subsystem from "subsystem" link */ link_target[len] = '\0'; - dbg("subsystem link '%s' points to '%s'", link_path, link_target); + dbg("subsystem link '%s' points to '%s'\n", link_path, link_target); pos = strrchr(link_target, '/'); if (pos != NULL) strlcpy(dev->subsystem, &pos[1], sizeof(dev->subsystem)); @@ -245,13 +245,13 @@ struct sysfs_device *sysfs_device_get(const char *devpath) len = readlink(link_path, link_target, sizeof(link_target)); if (len > 0) { link_target[len] = '\0'; - dbg("driver link '%s' points to '%s'", link_path, link_target); + dbg("driver link '%s' points to '%s'\n", link_path, link_target); pos = strrchr(link_target, '/'); if (pos != NULL) strlcpy(dev->driver, &pos[1], sizeof(dev->driver)); } - dbg("add to cache 'devpath=%s', subsystem='%s', driver='%s'", dev->devpath, dev->subsystem, dev->driver); + dbg("add to cache 'devpath=%s', subsystem='%s', driver='%s'\n", dev->devpath, dev->subsystem, dev->driver); list_add(&dev->node, &dev_list); return dev; @@ -262,14 +262,14 @@ struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) char parent_devpath[PATH_SIZE]; char *pos; - dbg("open '%s'", dev->devpath); + dbg("open '%s'\n", dev->devpath); /* look if we already know the parent */ if (dev->parent != NULL) return dev->parent; strlcpy(parent_devpath, dev->devpath, sizeof(parent_devpath)); - dbg("'%s'", parent_devpath); + dbg("'%s'\n", parent_devpath); /* strip last element */ pos = strrchr(parent_devpath, '/'); @@ -280,12 +280,12 @@ struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) if (strncmp(parent_devpath, "/class", 6) == 0) { pos = strrchr(parent_devpath, '/'); if (pos == &parent_devpath[6] || pos == parent_devpath) { - dbg("/class top level, look for device link"); + dbg("/class top level, look for device link\n"); goto device_link; } } if (strcmp(parent_devpath, "/block") == 0) { - dbg("/block top level, look for device link"); + dbg("/block top level, look for device link\n"); goto device_link; } @@ -334,7 +334,7 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) ssize_t size; size_t sysfs_len; - dbg("open '%s'/'%s'", devpath, attr_name); + dbg("open '%s'/'%s'\n", devpath, attr_name); sysfs_len = strlcpy(path_full, sysfs_path, sizeof(path_full)); if(sysfs_len >= sizeof(path_full)) sysfs_len = sizeof(path_full) - 1; @@ -346,23 +346,23 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) /* look for attribute in cache */ list_for_each_entry(attr_loop, &attr_list, node) { if (strcmp(attr_loop->path, path) == 0) { - dbg("found in cache '%s'", attr_loop->path); + dbg("found in cache '%s'\n", attr_loop->path); return attr_loop->value; } } /* store attribute in cache (also negatives are kept in cache) */ - dbg("new uncached attribute '%s'", path_full); + dbg("new uncached attribute '%s'\n", path_full); attr = malloc(sizeof(struct sysfs_attr)); if (attr == NULL) return NULL; memset(attr, 0x00, sizeof(struct sysfs_attr)); strlcpy(attr->path, path, sizeof(attr->path)); - dbg("add to cache '%s'", path_full); + dbg("add to cache '%s'\n", path_full); list_add(&attr->node, &attr_list); if (lstat(path_full, &statbuf) != 0) { - dbg("stat '%s' failed: %s", path_full, strerror(errno)); + dbg("stat '%s' failed: %s\n", path_full, strerror(errno)); goto out; } @@ -377,7 +377,7 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) link_target[len] = '\0'; pos = strrchr(link_target, '/'); if (pos != NULL) { - dbg("cache '%s' with link value '%s'", path_full, value); + dbg("cache '%s' with link value '%s'\n", path_full, value); strlcpy(attr->value_local, &pos[1], sizeof(attr->value_local)); attr->value = attr->value_local; } @@ -396,7 +396,7 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) /* read attribute value */ fd = open(path_full, O_RDONLY); if (fd < 0) { - dbg("attribute '%s' can not be opened", path_full); + dbg("attribute '%s' can not be opened\n", path_full); goto out; } size = read(fd, value, sizeof(value)); @@ -409,7 +409,7 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) /* got a valid value, store and return it */ value[size] = '\0'; remove_trailing_chars(value, '\n'); - dbg("cache '%s' with attribute value '%s'", path_full, value); + dbg("cache '%s' with attribute value '%s'\n", path_full, value); strlcpy(attr->value_local, value, sizeof(attr->value_local)); attr->value = attr->value_local; diff --git a/udev_utils.c b/udev_utils.c index e1630b67b5..00b67dadc6 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -62,7 +62,7 @@ struct name_entry *name_list_add(struct list_head *name_list, const char *name, /* avoid duplicate entries */ list_for_each_entry(name_loop, name_list, node) { if (strcmp(name_loop->name, name) == 0) { - dbg("'%s' is already in the list", name); + dbg("'%s' is already in the list\n", name); return name_loop; } } @@ -78,7 +78,7 @@ struct name_entry *name_list_add(struct list_head *name_list, const char *name, return NULL; strlcpy(name_new->name, name, sizeof(name_new->name)); - dbg("adding '%s'", name_new->name); + dbg("adding '%s'\n", name_new->name); list_add_tail(&name_new->node, &name_loop->node); return name_new; @@ -91,7 +91,7 @@ struct name_entry *name_list_key_add(struct list_head *name_list, const char *ke list_for_each_entry(name_loop, name_list, node) { if (strncmp(name_loop->name, key, strlen(key)) == 0) { - dbg("key already present '%s', replace it", name_loop->name); + dbg("key already present '%s', replace it\n", name_loop->name); snprintf(name_loop->name, sizeof(name_loop->name), "%s=%s", key, value); name_loop->name[sizeof(name_loop->name)-1] = '\0'; return name_loop; @@ -104,7 +104,7 @@ struct name_entry *name_list_key_add(struct list_head *name_list, const char *ke snprintf(name_new->name, sizeof(name_new->name), "%s=%s", key, value); name_new->name[sizeof(name_new->name)-1] = '\0'; - dbg("adding '%s'", name_new->name); + dbg("adding '%s'\n", name_new->name); list_add_tail(&name_new->node, &name_loop->node); return name_new; @@ -148,10 +148,10 @@ int add_matching_files(struct list_head *name_list, const char *dirname, const c DIR *dir; char filename[PATH_SIZE]; - dbg("open directory '%s'", dirname); + dbg("open directory '%s'\n", dirname); dir = opendir(dirname); if (dir == NULL) { - err("unable to open '%s': %s", dirname, strerror(errno)); + err("unable to open '%s': %s\n", dirname, strerror(errno)); return -1; } @@ -173,7 +173,7 @@ int add_matching_files(struct list_head *name_list, const char *dirname, const c if (strcmp(ext, suffix) != 0) continue; } - dbg("put file '%s/%s' into list", dirname, ent->d_name); + dbg("put file '%s/%s' into list\n", dirname, ent->d_name); snprintf(filename, sizeof(filename), "%s/%s", dirname, ent->d_name); filename[sizeof(filename)-1] = '\0'; @@ -193,9 +193,9 @@ uid_t lookup_user(const char *user) pw = getpwnam(user); if (pw == NULL) { if (errno == 0 || errno == ENOENT || errno == ESRCH) - err("specified user '%s' unknown", user); + err("specified user '%s' unknown\n", user); else - err("error resolving user '%s': %s", user, strerror(errno)); + err("error resolving user '%s': %s\n", user, strerror(errno)); } else uid = pw->pw_uid; @@ -211,9 +211,9 @@ extern gid_t lookup_group(const char *group) gr = getgrnam(group); if (gr == NULL) { if (errno == 0 || errno == ENOENT || errno == ESRCH) - err("specified group '%s' unknown", group); + err("specified group '%s' unknown\n", group); else - err("error resolving group '%s': %s", group, strerror(errno)); + err("error resolving group '%s': %s\n", group, strerror(errno)); } else gid = gr->gr_gid; diff --git a/udev_utils_file.c b/udev_utils_file.c index 19668b936f..a492785af9 100644 --- a/udev_utils_file.c +++ b/udev_utils_file.c @@ -47,14 +47,14 @@ int create_path(const char *path) pos--; pos[0] = '\0'; - dbg("stat '%s'", p); + dbg("stat '%s'\n", p); if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) return 0; if (create_path(p) != 0) return -1; - dbg("mkdir '%s'", p); + dbg("mkdir '%s'\n", p); selinux_setfscreatecon(p, NULL, S_IFDIR|0755); ret = mkdir(p, 0755); selinux_resetfscreatecon(); @@ -93,10 +93,10 @@ int delete_path(const char *path) if (retval) { if (errno == ENOTEMPTY) return 0; - err("rmdir(%s) failed: %s", p, strerror(errno)); + err("rmdir(%s) failed: %s\n", p, strerror(errno)); break; } - dbg("removed '%s'", p); + dbg("removed '%s'\n", p); } return 0; } @@ -110,18 +110,18 @@ int unlink_secure(const char *filename) retval = chown(filename, 0, 0); if (retval) - err("chown(%s, 0, 0) failed: %s", filename, strerror(errno)); + err("chown(%s, 0, 0) failed: %s\n", filename, strerror(errno)); retval = chmod(filename, 0000); if (retval) - err("chmod(%s, 0000) failed: %s", filename, strerror(errno)); + err("chmod(%s, 0000) failed: %s\n", filename, strerror(errno)); retval = unlink(filename); if (errno == ENOENT) retval = 0; if (retval) - err("unlink(%s) failed: %s", filename, strerror(errno)); + err("unlink(%s) failed: %s\n", filename, strerror(errno)); return retval; } @@ -26,7 +26,7 @@ #include "udev.h" -static int verbose; +static int debug; #ifdef USE_LOG void log_message(int priority, const char *format, ...) @@ -37,9 +37,8 @@ void log_message(int priority, const char *format, ...) return; va_start(args, format); - if (verbose) { + if (debug) { vprintf(format, args); - printf("\n"); } else vsyslog(priority, format, args); va_end(args); @@ -50,7 +49,7 @@ struct command { const char *name; int (*cmd)(int argc, char *argv[], char *envp[]); const char *help; - int verbose; + int debug; }; static const struct command cmds[]; @@ -102,7 +101,7 @@ static const struct command cmds[] = { .name = "test", .cmd = udevtest, .help = "simulation run", - .verbose = 1, + .debug = 1, }, { .name = "version", @@ -155,7 +154,7 @@ int main(int argc, char *argv[], char *envp[]) /* find and execute command */ for (cmd = cmds; cmd->name != NULL; cmd++) { if (strcmp(cmd->name, command) == 0) { - verbose = cmd->verbose; + debug = cmd->debug; rc = cmd->cmd(argc, argv, envp); goto out; } diff --git a/udevcontrol.c b/udevcontrol.c index f6b5dd9053..287e8aaf99 100644 --- a/udevcontrol.c +++ b/udevcontrol.c @@ -50,7 +50,7 @@ int udevcontrol(int argc, char *argv[], char *envp[]) udev_log = log_priority(env); logging_init("udevcontrol"); - dbg("version %s", UDEV_VERSION); + dbg("version %s\n", UDEV_VERSION); if (argc < 2) { fprintf(stderr, "missing command\n\n"); @@ -75,7 +75,7 @@ int udevcontrol(int argc, char *argv[], char *envp[]) val = &arg[strlen("log_priority=")]; ctrl_msg.type = UDEVD_CTRL_SET_LOG_LEVEL; *intval = log_priority(val); - info("send log_priority=%i", *intval); + info("send log_priority=%i\n", *intval); } else if (!strncmp(arg, "max_childs=", strlen("max_childs="))) { char *endp; int count; @@ -89,7 +89,7 @@ int udevcontrol(int argc, char *argv[], char *envp[]) goto exit; } *intval = count; - info("send max_childs=%i", *intval); + info("send max_childs=%i\n", *intval); } else if (!strncmp(arg, "max_childs_running=", strlen("max_childs_running="))) { char *endp; int count; @@ -103,7 +103,7 @@ int udevcontrol(int argc, char *argv[], char *envp[]) goto exit; } *intval = count; - info("send max_childs_running=%i", *intval); + info("send max_childs_running=%i\n", *intval); } else if (!strncmp(arg, "env", strlen("env"))) { val = argv[2]; if (val == NULL) { @@ -112,7 +112,7 @@ int udevcontrol(int argc, char *argv[], char *envp[]) } ctrl_msg.type = UDEVD_CTRL_ENV; strlcpy(ctrl_msg.buf, val, sizeof(ctrl_msg.buf)); - info("send env '%s'", val); + info("send env '%s'\n", val); } else if (strcmp(arg, "help") == 0 || strcmp(arg, "-h") == 0) { printf("Usage: udevadm control COMMAND\n" " --log_priority=<level> set the udev log level for the daemon\n" @@ -136,7 +136,7 @@ int udevcontrol(int argc, char *argv[], char *envp[]) sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (sock == -1) { - err("error getting socket: %s", strerror(errno)); + err("error getting socket: %s\n", strerror(errno)); goto exit; } @@ -148,10 +148,10 @@ int udevcontrol(int argc, char *argv[], char *envp[]) retval = sendto(sock, &ctrl_msg, sizeof(ctrl_msg), 0, (struct sockaddr *)&saddr, addrlen); if (retval == -1) { - err("error sending message: %s", strerror(errno)); + err("error sending message: %s\n", strerror(errno)); retval = 1; } else { - dbg("sent message type=0x%02x, %u bytes sent", ctrl_msg.type, retval); + dbg("sent message type=0x%02x, %u bytes sent\n", ctrl_msg.type, retval); retval = 0; } @@ -14,7 +14,7 @@ udevd - event managing daemon .SH "SYNOPSIS" .HP 6 -\fBudevd\fR [\fB\-\-daemon\fR] [\fB\-\-debug\-trace\fR] [\fB\-\-verbose\fR] [\fB\-\-version\fR] [\fB\-\-help\fR] +\fBudevd\fR [\fB\-\-daemon\fR] [\fB\-\-debug\-trace\fR] [\fB\-\-debug\fR] [\fB\-\-version\fR] [\fB\-\-help\fR] .SH "DESCRIPTION" .PP udevd listens to kernel uevents and passes the incoming events to udev\. It ensures the correct event order and takes care, that events for child devices are delayed until the parent event has finished the device handling\. The behavior of the running daemon can be changed with @@ -31,7 +31,7 @@ Detach and run in the background\. Run all events completely serialized\. This may be useful if udev triggers actions or loads kernel modules which cause problems and a slow but continuous operation is needed, where no events are processed in parallel\. .RE .PP -\fB\-\-verbose\fR +\fB\-\-debug\fR .RS 4 Print log messages to stdout\. .RE @@ -46,7 +46,7 @@ #include "udev_selinux.h" static int debug_trace; -static int verbose; +static int debug; static struct udev_rules rules; static int udevd_sock = -1; @@ -77,10 +77,9 @@ void log_message(int priority, const char *format, ...) return; va_start(args, format); - if (verbose) { + if (debug) { printf("[%d] ", (int) getpid()); vprintf(format, args); - printf("\n"); } else vsyslog(priority, format, args); va_end(args); @@ -184,7 +183,7 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st path_encode(&filename_failed_old[start], sizeof(filename) - start); if (rename(filename_failed_old, filename_failed) == 0) - info("renamed devpath, moved failed state of '%s' to %s'", + info("renamed devpath, moved failed state of '%s' to %s'\n", msg->devpath_old, msg->devpath); } else { unlink(filename_failed); @@ -241,19 +240,19 @@ static void udev_event_run(struct udevd_uevent_msg *msg) setpriority(PRIO_PROCESS, 0, UDEV_PRIORITY); retval = udev_event_process(msg); - info("seq %llu finished with %i", msg->seqnum, retval); + info("seq %llu finished with %i\n", msg->seqnum, retval); logging_close(); if (retval) exit(1); exit(0); case -1: - err("fork of child failed: %s", strerror(errno)); + err("fork of child failed: %s\n", strerror(errno)); msg_queue_delete(msg); break; default: /* get SIGCHLD in main loop */ - info("seq %llu forked, pid [%d], '%s' '%s', %ld seconds old", + info("seq %llu forked, pid [%d], '%s' '%s', %ld seconds old\n", msg->seqnum, pid, msg->action, msg->subsystem, time(NULL) - msg->queue_time); msg->pid = pid; } @@ -279,7 +278,7 @@ static void msg_queue_insert(struct udevd_uevent_msg *msg) } export_event_state(msg, EVENT_QUEUED); - info("seq %llu queued, '%s' '%s'", msg->seqnum, msg->action, msg->subsystem); + info("seq %llu queued, '%s' '%s'\n", msg->seqnum, msg->action, msg->subsystem); /* run one event after the other in debug mode */ if (debug_trace) { @@ -476,7 +475,7 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) /* check identical, parent, or child device event */ if (compare_devpath(loop_msg->devpath, msg->devpath) != 0) { - dbg("%llu, device event still pending %llu (%s)", + dbg("%llu, device event still pending %llu (%s)\n", msg->seqnum, loop_msg->seqnum, loop_msg->devpath); return 3; } @@ -484,7 +483,7 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) /* check for our major:minor number */ if (msg->devt && loop_msg->devt == msg->devt && strcmp(msg->subsystem, loop_msg->subsystem) == 0) { - dbg("%llu, device event still pending %llu (%d:%d)", msg->seqnum, + dbg("%llu, device event still pending %llu (%d:%d)\n", msg->seqnum, loop_msg->seqnum, major(loop_msg->devt), minor(loop_msg->devt)); return 4; } @@ -492,7 +491,7 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) /* check physical device event (special case of parent) */ if (msg->physdevpath && msg->action && strcmp(msg->action, "add") == 0) if (compare_devpath(loop_msg->devpath, msg->physdevpath) != 0) { - dbg("%llu, physical device event still pending %llu (%s)", + dbg("%llu, physical device event still pending %llu (%s)\n", msg->seqnum, loop_msg->seqnum, loop_msg->devpath); return 5; } @@ -501,7 +500,7 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) /* check run queue for still running events */ list_for_each_entry(loop_msg, &running_list, node) { if (limit && childs_count++ > limit) { - dbg("%llu, maximum number (%i) of childs reached", msg->seqnum, childs_count); + dbg("%llu, maximum number (%i) of childs reached\n", msg->seqnum, childs_count); return 1; } @@ -512,7 +511,7 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) /* check identical, parent, or child device event */ if (compare_devpath(loop_msg->devpath, msg->devpath) != 0) { - dbg("%llu, device event still running %llu (%s)", + dbg("%llu, device event still running %llu (%s)\n", msg->seqnum, loop_msg->seqnum, loop_msg->devpath); return 3; } @@ -520,7 +519,7 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) /* check for our major:minor number */ if (msg->devt && loop_msg->devt == msg->devt && strcmp(msg->subsystem, loop_msg->subsystem) == 0) { - dbg("%llu, device event still running %llu (%d:%d)", msg->seqnum, + dbg("%llu, device event still running %llu (%d:%d)\n", msg->seqnum, loop_msg->seqnum, major(loop_msg->devt), minor(loop_msg->devt)); return 4; } @@ -528,7 +527,7 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) /* check physical device event (special case of parent) */ if (msg->physdevpath && msg->action && strcmp(msg->action, "add") == 0) if (compare_devpath(loop_msg->devpath, msg->physdevpath) != 0) { - dbg("%llu, physical device event still running %llu (%s)", + dbg("%llu, physical device event still running %llu (%s)\n", msg->seqnum, loop_msg->seqnum, loop_msg->devpath); return 5; } @@ -547,7 +546,7 @@ static void msg_queue_manager(void) return; running = running_processes(); - dbg("%d processes runnning on system", running); + dbg("%d processes runnning on system\n", running); if (running < 0) running = max_childs_running; @@ -555,16 +554,16 @@ static void msg_queue_manager(void) /* check running processes in our session and possibly throttle */ if (running >= max_childs_running) { running = running_processes_in_session(sid, max_childs_running+10); - dbg("at least %d processes running in session", running); + dbg("at least %d processes running in session\n", running); if (running >= max_childs_running) { - dbg("delay seq %llu, too many processes already running", loop_msg->seqnum); + dbg("delay seq %llu, too many processes already running\n", loop_msg->seqnum); return; } } /* serialize and wait for parent or child events */ if (devpath_busy(loop_msg, max_childs) != 0) { - dbg("delay seq %llu (%s)", loop_msg->seqnum, loop_msg->devpath); + dbg("delay seq %llu (%s)\n", loop_msg->seqnum, loop_msg->devpath); continue; } @@ -572,7 +571,7 @@ static void msg_queue_manager(void) list_move_tail(&loop_msg->node, &running_list); udev_event_run(loop_msg); running++; - dbg("moved seq %llu to running list", loop_msg->seqnum); + dbg("moved seq %llu to running list\n", loop_msg->seqnum); } } @@ -601,7 +600,7 @@ static struct udevd_uevent_msg *get_msg_from_envbuf(const char *buf, int buf_siz keylen = strlen(key); msg->envp[i] = key; bufpos += keylen + 1; - dbg("add '%s' to msg.envp[%i]", msg->envp[i], i); + dbg("add '%s' to msg.envp[%i]\n", msg->envp[i], i); /* remember some keys for further processing */ if (strncmp(key, "ACTION=", 7) == 0) @@ -639,7 +638,7 @@ static struct udevd_uevent_msg *get_msg_from_envbuf(const char *buf, int buf_siz msg->envp[i] = NULL; if (msg->devpath == NULL || msg->action == NULL) { - info("DEVPATH or ACTION missing, ignore message"); + info("DEVPATH or ACTION missing, ignore message\n"); free(msg); return NULL; } @@ -672,24 +671,24 @@ static void get_ctrl_msg(void) size = recvmsg(udevd_sock, &smsg, 0); if (size < 0) { if (errno != EINTR) - err("unable to receive user udevd message: %s", strerror(errno)); + err("unable to receive user udevd message: %s\n", strerror(errno)); return; } cmsg = CMSG_FIRSTHDR(&smsg); cred = (struct ucred *) CMSG_DATA(cmsg); if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { - err("no sender credentials received, message ignored"); + err("no sender credentials received, message ignored\n"); return; } if (cred->uid != 0) { - err("sender uid=%i, message ignored", cred->uid); + err("sender uid=%i, message ignored\n", cred->uid); return; } if (strncmp(ctrl_msg.magic, UDEVD_CTRL_MAGIC, sizeof(UDEVD_CTRL_MAGIC)) != 0 ) { - err("message magic '%s' doesn't match, ignore it", ctrl_msg.magic); + err("message magic '%s' doesn't match, ignore it\n", ctrl_msg.magic); return; } @@ -697,50 +696,50 @@ static void get_ctrl_msg(void) case UDEVD_CTRL_ENV: pos = strchr(ctrl_msg.buf, '='); if (pos == NULL) { - err("wrong key format '%s'", ctrl_msg.buf); + err("wrong key format '%s'\n", ctrl_msg.buf); break; } pos[0] = '\0'; if (pos[1] == '\0') { - info("udevd message (ENV) received, unset '%s'", ctrl_msg.buf); + info("udevd message (ENV) received, unset '%s'\n", ctrl_msg.buf); unsetenv(ctrl_msg.buf); } else { - info("udevd message (ENV) received, set '%s=%s'", ctrl_msg.buf, &pos[1]); + info("udevd message (ENV) received, set '%s=%s'\n", ctrl_msg.buf, &pos[1]); setenv(ctrl_msg.buf, &pos[1], 1); } break; case UDEVD_CTRL_STOP_EXEC_QUEUE: - info("udevd message (STOP_EXEC_QUEUE) received"); + info("udevd message (STOP_EXEC_QUEUE) received\n"); stop_exec_q = 1; break; case UDEVD_CTRL_START_EXEC_QUEUE: - info("udevd message (START_EXEC_QUEUE) received"); + info("udevd message (START_EXEC_QUEUE) received\n"); stop_exec_q = 0; msg_queue_manager(); break; case UDEVD_CTRL_SET_LOG_LEVEL: intval = (int *) ctrl_msg.buf; - info("udevd message (SET_LOG_PRIORITY) received, udev_log_priority=%i", *intval); + info("udevd message (SET_LOG_PRIORITY) received, udev_log_priority=%i\n", *intval); udev_log_priority = *intval; sprintf(udev_log, "UDEV_LOG=%i", udev_log_priority); putenv(udev_log); break; case UDEVD_CTRL_SET_MAX_CHILDS: intval = (int *) ctrl_msg.buf; - info("udevd message (UDEVD_SET_MAX_CHILDS) received, max_childs=%i", *intval); + info("udevd message (UDEVD_SET_MAX_CHILDS) received, max_childs=%i\n", *intval); max_childs = *intval; break; case UDEVD_CTRL_SET_MAX_CHILDS_RUNNING: intval = (int *) ctrl_msg.buf; - info("udevd message (UDEVD_SET_MAX_CHILDS_RUNNING) received, max_childs=%i", *intval); + info("udevd message (UDEVD_SET_MAX_CHILDS_RUNNING) received, max_childs=%i\n", *intval); max_childs_running = *intval; break; case UDEVD_CTRL_RELOAD_RULES: - info("udevd message (RELOAD_RULES) received"); + info("udevd message (RELOAD_RULES) received\n"); reload_config = 1; break; default: - err("unknown control message type"); + err("unknown control message type\n"); } } @@ -756,14 +755,14 @@ static struct udevd_uevent_msg *get_netlink_msg(void) size = recv(uevent_netlink_sock, &buffer, sizeof(buffer), 0); if (size < 0) { if (errno != EINTR) - err("unable to receive kernel netlink message: %s", strerror(errno)); + err("unable to receive kernel netlink message: %s\n", strerror(errno)); return NULL; } if ((size_t)size > sizeof(buffer)-1) size = sizeof(buffer)-1; buffer[size] = '\0'; - dbg("uevent_size=%zi", size); + dbg("uevent_size=%zi\n", size); /* start of event payload */ bufpos = strlen(buffer)+1; @@ -774,20 +773,20 @@ static struct udevd_uevent_msg *get_netlink_msg(void) /* validate message */ pos = strchr(buffer, '@'); if (pos == NULL) { - err("invalid uevent '%s'", buffer); + err("invalid uevent '%s'\n", buffer); free(msg); return NULL; } pos[0] = '\0'; if (msg->action == NULL) { - info("no ACTION in payload found, skip event '%s'", buffer); + info("no ACTION in payload found, skip event '%s'\n", buffer); free(msg); return NULL; } if (strcmp(msg->action, buffer) != 0) { - err("ACTION in payload does not match uevent, skip event '%s'", buffer); + err("ACTION in payload does not match uevent, skip event '%s'\n", buffer); free(msg); return NULL; } @@ -822,7 +821,7 @@ static void udev_done(int pid, int exitstatus) list_for_each_entry(msg, &running_list, node) { if (msg->pid == pid) { - info("seq %llu, pid [%d] exit with %i, %ld seconds old", msg->seqnum, msg->pid, + info("seq %llu, pid [%d] exit with %i, %ld seconds old\n", msg->seqnum, msg->pid, exitstatus, time(NULL) - msg->queue_time); msg->exitstatus = exitstatus; msg_queue_delete(msg); @@ -868,14 +867,14 @@ static int init_udevd_socket(void) udevd_sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (udevd_sock == -1) { - err("error getting socket: %s", strerror(errno)); + err("error getting socket: %s\n", strerror(errno)); return -1; } /* the bind takes care of ensuring only one copy running */ retval = bind(udevd_sock, (struct sockaddr *) &saddr, addrlen); if (retval < 0) { - err("bind failed: %s", strerror(errno)); + err("bind failed: %s\n", strerror(errno)); close(udevd_sock); udevd_sock = -1; return -1; @@ -900,7 +899,7 @@ static int init_uevent_netlink_sock(void) uevent_netlink_sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); if (uevent_netlink_sock == -1) { - err("error getting socket: %s", strerror(errno)); + err("error getting socket: %s\n", strerror(errno)); return -1; } @@ -909,7 +908,7 @@ static int init_uevent_netlink_sock(void) retval = bind(uevent_netlink_sock, (struct sockaddr *) &snl, sizeof(struct sockaddr_nl)); if (retval < 0) { - err("bind failed: %s", strerror(errno)); + err("bind failed: %s\n", strerror(errno)); close(uevent_netlink_sock); uevent_netlink_sock = -1; return -1; @@ -957,7 +956,7 @@ int main(int argc, char *argv[], char *envp[]) static const struct option options[] = { { "daemon", 0, NULL, 'd' }, { "debug-trace", 0, NULL, 't' }, - { "verbose", 0, NULL, 'v' }, + { "debug", 0, NULL, 'D' }, { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, {} @@ -968,10 +967,10 @@ int main(int argc, char *argv[], char *envp[]) logging_init("udevd"); udev_config_init(); selinux_init(); - dbg("version %s", UDEV_VERSION); + dbg("version %s\n", UDEV_VERSION); while (1) { - option = getopt_long(argc, argv, "dtvhV", options, NULL); + option = getopt_long(argc, argv, "dDthV", options, NULL); if (option == -1) break; @@ -982,13 +981,13 @@ int main(int argc, char *argv[], char *envp[]) case 't': debug_trace = 1; break; - case 'v': - verbose = 1; + case 'D': + debug = 1; if (udev_log_priority < LOG_INFO) udev_log_priority = LOG_INFO; break; case 'h': - printf("Usage: udevd [--help] [--daemon] [--debug-trace] [--verbose] [--version]\n"); + printf("Usage: udevd [--help] [--daemon] [--debug-trace] [--debug] [--version]\n"); goto exit; case 'V': printf("%s\n", UDEV_VERSION); @@ -1000,7 +999,7 @@ int main(int argc, char *argv[], char *envp[]) if (getuid() != 0) { fprintf(stderr, "root privileges required\n"); - err("root privileges required"); + err("root privileges required\n"); goto exit; } @@ -1008,7 +1007,7 @@ int main(int argc, char *argv[], char *envp[]) fd = open("/dev/null", O_RDWR); if (fd < 0) { fprintf(stderr, "cannot open /dev/null\n"); - err("cannot open /dev/null"); + err("cannot open /dev/null\n"); } if (fd > STDIN_FILENO) dup2(fd, STDIN_FILENO); @@ -1021,11 +1020,11 @@ int main(int argc, char *argv[], char *envp[]) if (init_udevd_socket() < 0) { if (errno == EADDRINUSE) { fprintf(stderr, "another udev daemon already running\n"); - err("another udev daemon already running"); + err("another udev daemon already running\n"); rc = 1; } else { fprintf(stderr, "error initializing udevd socket\n"); - err("error initializing udevd socket"); + err("error initializing udevd socket\n"); rc = 2; } goto exit; @@ -1033,7 +1032,7 @@ int main(int argc, char *argv[], char *envp[]) if (init_uevent_netlink_sock() < 0) { fprintf(stderr, "error initializing netlink socket\n"); - err("error initializing netlink socket"); + err("error initializing netlink socket\n"); rc = 3; goto exit; } @@ -1041,29 +1040,29 @@ int main(int argc, char *argv[], char *envp[]) /* setup signal handler pipe */ retval = pipe(signal_pipe); if (retval < 0) { - err("error getting pipes: %s", strerror(errno)); + err("error getting pipes: %s\n", strerror(errno)); goto exit; } retval = fcntl(signal_pipe[READ_END], F_GETFL, 0); if (retval < 0) { - err("error fcntl on read pipe: %s", strerror(errno)); + err("error fcntl on read pipe: %s\n", strerror(errno)); goto exit; } retval = fcntl(signal_pipe[READ_END], F_SETFL, retval | O_NONBLOCK); if (retval < 0) { - err("error fcntl on read pipe: %s", strerror(errno)); + err("error fcntl on read pipe: %s\n", strerror(errno)); goto exit; } retval = fcntl(signal_pipe[WRITE_END], F_GETFL, 0); if (retval < 0) { - err("error fcntl on write pipe: %s", strerror(errno)); + err("error fcntl on write pipe: %s\n", strerror(errno)); goto exit; } retval = fcntl(signal_pipe[WRITE_END], F_SETFL, retval | O_NONBLOCK); if (retval < 0) { - err("error fcntl on write pipe: %s", strerror(errno)); + err("error fcntl on write pipe: %s\n", strerror(errno)); goto exit; } @@ -1079,21 +1078,21 @@ int main(int argc, char *argv[], char *envp[]) pid = fork(); switch (pid) { case 0: - dbg("daemonized fork running"); + dbg("daemonized fork running\n"); break; case -1: - err("fork of daemon failed: %s", strerror(errno)); + err("fork of daemon failed: %s\n", strerror(errno)); rc = 4; goto exit; default: - dbg("child [%u] running, parent exits", pid); + dbg("child [%u] running, parent exits\n", pid); rc = 0; goto exit; } } /* redirect std{out,err} fd's */ - if (!verbose) + if (!debug) dup2(fd, STDOUT_FILENO); dup2(fd, STDERR_FILENO); if (fd > STDERR_FILENO) @@ -1107,12 +1106,12 @@ int main(int argc, char *argv[], char *envp[]) /* become session leader */ sid = setsid(); - dbg("our session is %d", sid); + dbg("our session is %d\n", sid); /* OOM_DISABLE == -17 */ fd = open("/proc/self/oom_adj", O_RDWR); if (fd < 0) - err("error disabling OOM: %s", strerror(errno)); + err("error disabling OOM: %s\n", strerror(errno)); else { write(fd, "-17", 3); close(fd); @@ -1148,9 +1147,9 @@ int main(int argc, char *argv[], char *envp[]) strlcat(filename, "/"RULES_DYN_DIR, sizeof(filename)); inotify_add_watch(inotify_fd, filename, IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); } else if (errno == ENOSYS) - err("the kernel does not support inotify, udevd can't monitor rules file changes"); + err("the kernel does not support inotify, udevd can't monitor rules file changes\n"); else - err("inotify_init failed: %s", strerror(errno)); + err("inotify_init failed: %s\n", strerror(errno)); /* maximum limit of forked childs */ value = getenv("UDEVD_MAX_CHILDS"); @@ -1163,7 +1162,7 @@ int main(int argc, char *argv[], char *envp[]) else max_childs = UDEVD_MAX_CHILDS; } - info("initialize max_childs to %u", max_childs); + info("initialize max_childs to %u\n", max_childs); /* start to throttle forking if maximum number of _running_ childs is reached */ value = getenv("UDEVD_MAX_CHILDS_RUNNING"); @@ -1176,7 +1175,7 @@ int main(int argc, char *argv[], char *envp[]) else max_childs_running = UDEVD_MAX_CHILDS_RUNNING; } - info("initialize max_childs_running to %u", max_childs_running); + info("initialize max_childs_running to %u\n", max_childs_running); /* clear environment for forked event processes */ clearenv(); @@ -1206,7 +1205,7 @@ int main(int argc, char *argv[], char *envp[]) fdcount = select(maxfd+1, &readfds, NULL, NULL, NULL); if (fdcount < 0) { if (errno != EINTR) - err("error in select: %s", strerror(errno)); + err("error in select: %s\n", strerror(errno)); continue; } @@ -1239,7 +1238,7 @@ int main(int argc, char *argv[], char *envp[]) reload_config = 1; buf = malloc(nbytes); if (buf == NULL) { - err("error getting buffer for inotify, disable watching"); + err("error getting buffer for inotify, disable watching\n"); close(inotify_fd); inotify_fd = -1; } @@ -27,7 +27,7 @@ <command>udevd</command> <arg><option>--daemon</option></arg> <arg><option>--debug-trace</option></arg> - <arg><option>--verbose</option></arg> + <arg><option>--debug</option></arg> <arg><option>--version</option></arg> <arg><option>--help</option></arg> </cmdsynopsis> @@ -59,7 +59,7 @@ </listitem> </varlistentry> <varlistentry> - <term><option>--verbose</option></term> + <term><option>--debug</option></term> <listitem> <para>Print log messages to stdout.</para> </listitem> diff --git a/udevinfo.c b/udevinfo.c index 52d409df88..a0d6cac401 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -69,7 +69,7 @@ static void print_all_attributes(const char *devpath, const char *key) len = strlcpy(value, attr_value, sizeof(value)); if(len >= sizeof(value)) len = sizeof(value) - 1; - dbg("attr '%s'='%s'(%zi)", dent->d_name, value, len); + dbg("attr '%s'='%s'(%zi)\n", dent->d_name, value, len); /* remove trailing newlines */ while (len && value[len-1] == '\n') @@ -79,7 +79,7 @@ static void print_all_attributes(const char *devpath, const char *key) while (len && isprint(value[len-1])) len--; if (len) { - dbg("attribute value of '%s' non-printable, skip", dent->d_name); + dbg("attribute value of '%s' non-printable, skip\n", dent->d_name); continue; } @@ -175,7 +175,7 @@ static int lookup_device_by_name(struct udevice *udev, const char *name) if (count <= 0) goto out; - info("found %i devices for '%s'", count, name); + info("found %i devices for '%s'\n", count, name); /* select the device that seems to match */ list_for_each_entry(device, &name_list, node) { @@ -185,7 +185,7 @@ static int lookup_device_by_name(struct udevice *udev, const char *name) udev_device_init(udev); if (udev_db_get_device(udev, device->name) != 0) continue; - info("found db entry '%s'", device->name); + info("found db entry '%s'\n", device->name); /* make sure, we don't get a link of a differnt device */ strlcpy(filename, udev_root, sizeof(filename)); @@ -194,7 +194,7 @@ static int lookup_device_by_name(struct udevice *udev, const char *name) if (stat(filename, &statbuf) != 0) continue; if (major(udev->devt) > 0 && udev->devt != statbuf.st_rdev) { - info("skip '%s', dev_t doesn't match", udev->name); + info("skip '%s', dev_t doesn't match\n", udev->name); continue; } rc = 0; @@ -272,7 +272,7 @@ int udevinfo(int argc, char *argv[], char *envp[]) if (option == -1) break; - dbg("option '%c'", option); + dbg("option '%c'\n", option); switch (option) { case 'n': /* remove /dev if given */ @@ -281,7 +281,7 @@ int udevinfo(int argc, char *argv[], char *envp[]) else strlcpy(name, optarg, sizeof(name)); remove_trailing_chars(name, '/'); - dbg("name: %s", name); + dbg("name: %s\n", name); break; case 'p': /* remove /sys if given */ @@ -310,7 +310,7 @@ int udevinfo(int argc, char *argv[], char *envp[]) } } } - dbg("path: %s", path); + dbg("path: %s\n", path); break; case 'q': action = ACTION_QUERY; diff --git a/udevsettle.c b/udevsettle.c index e3982a42b0..4b66f89cd6 100644 --- a/udevsettle.c +++ b/udevsettle.c @@ -57,7 +57,7 @@ int udevsettle(int argc, char *argv[], char *envp[]) logging_init("udevsettle"); udev_config_init(); - dbg("version %s", UDEV_VERSION); + dbg("version %s\n", UDEV_VERSION); sysfs_init(); while (1) { @@ -72,7 +72,7 @@ int udevsettle(int argc, char *argv[], char *envp[]) timeout = seconds; else fprintf(stderr, "invalid timeout value\n"); - dbg("timeout=%i", timeout); + dbg("timeout=%i\n", timeout); break; case 'h': printf("Usage: udevadm settle [--help] [--timeout=<seconds>]\n\n"); @@ -90,13 +90,13 @@ int udevsettle(int argc, char *argv[], char *envp[]) struct stat statbuf; if (stat(queuename, &statbuf) < 0) { - info("queue is empty"); + info("queue is empty\n"); break; } usleep(1000 * 1000 / LOOP_PER_SECOND); } if (loop <= 0) { - info("timeout waiting for queue"); + info("timeout waiting for queue\n"); goto exit; } @@ -112,7 +112,7 @@ int udevsettle(int argc, char *argv[], char *envp[]) goto exit; seqnum[len] = '\0'; seq_udev = strtoull(seqnum, NULL, 10); - info("udev seqnum = %llu", seq_udev); + info("udev seqnum = %llu\n", seq_udev); /* read current kernel seqnum */ strlcpy(filename, sysfs_path, sizeof(filename)); @@ -126,16 +126,16 @@ int udevsettle(int argc, char *argv[], char *envp[]) goto exit; seqnum[len] = '\0'; seq_kernel = strtoull(seqnum, NULL, 10); - info("kernel seqnum = %llu", seq_kernel); + info("kernel seqnum = %llu\n", seq_kernel); /* make sure all kernel events have arrived in the queue */ if (seq_udev >= seq_kernel) { - info("queue is empty and no pending events left"); + info("queue is empty and no pending events left\n"); rc = 0; goto exit; } usleep(1000 * 1000 / LOOP_PER_SECOND); - info("queue is empty, but events still pending"); + info("queue is empty, but events still pending\n"); } exit: diff --git a/udevtest.c b/udevtest.c index a36e503fd4..8beba217ea 100644 --- a/udevtest.c +++ b/udevtest.c @@ -62,7 +62,7 @@ static int import_uevent_var(const char *devpath) if (next == NULL) goto out; next[0] = '\0'; - info("import into environment: '%s'", key); + info("import into environment: '%s'\n", key); putenv(key); key = &next[1]; } @@ -91,7 +91,7 @@ int udevtest(int argc, char *argv[], char *envp[]) {} }; - info("version %s", UDEV_VERSION); + info("version %s\n", UDEV_VERSION); udev_config_init(); if (udev_log_priority < LOG_INFO) { char priority[32]; @@ -108,7 +108,7 @@ int udevtest(int argc, char *argv[], char *envp[]) if (option == -1) break; - dbg("option '%c'", option); + dbg("option '%c'\n", option); switch (option) { case 'a': action = optarg; @@ -181,7 +181,7 @@ int udevtest(int argc, char *argv[], char *envp[]) setenv("ACTION", udev->action, 1); import_uevent_var(udev->dev->devpath); - info("looking at device '%s' from subsystem '%s'", udev->dev->devpath, udev->dev->subsystem); + info("looking at device '%s' from subsystem '%s'\n", udev->dev->devpath, udev->dev->subsystem); retval = udev_device_event(&rules, udev); if (retval == 0 && !udev->ignore_device && udev_run) { struct name_entry *name_loop; @@ -191,7 +191,7 @@ int udevtest(int argc, char *argv[], char *envp[]) strlcpy(program, name_loop->name, sizeof(program)); udev_rules_apply_format(udev, program, sizeof(program)); - info("run: '%s'", program); + info("run: '%s'\n", program); } } udev_device_cleanup(udev); diff --git a/udevtrigger.c b/udevtrigger.c index e50fd4ee04..72464c8381 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -70,7 +70,7 @@ static int device_list_insert(const char *path) char devpath[PATH_SIZE]; struct stat statbuf; - dbg("add '%s'" , path); + dbg("add '%s'\n" , path); /* we only have a device, if we have an uevent file */ strlcpy(filename, path, sizeof(filename)); @@ -110,12 +110,12 @@ static void trigger_uevent(const char *devpath, const char *action) fd = open(filename, O_WRONLY); if (fd < 0) { - dbg("error on opening %s: %s", filename, strerror(errno)); + dbg("error on opening %s: %s\n", filename, strerror(errno)); return; } if (write(fd, action, strlen(action)) < 0) - info("error writing '%s' to '%s': %s", action, filename, strerror(errno)); + info("error writing '%s' to '%s': %s\n", action, filename, strerror(errno)); close(fd); } @@ -574,7 +574,7 @@ int udevtrigger(int argc, char *argv[], char *envp[]) logging_init("udevtrigger"); udev_config_init(); - dbg("version %s", UDEV_VERSION); + dbg("version %s\n", UDEV_VERSION); sysfs_init(); while (1) { |