diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2008-04-20 21:07:06 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2008-04-20 21:07:06 +0200 |
commit | c70560feef0eb61a150cd2f956f0beead4313ffe (patch) | |
tree | 48db1f001e87e46b0ccd2b30704b87a8662ba9b9 /extras/scsi_id | |
parent | 1d918b50cddc975abbfd06af134a6d843d9bc7f0 (diff) |
logging: add trailing newline to all strings
Diffstat (limited to 'extras/scsi_id')
-rw-r--r-- | extras/scsi_id/scsi_id.c | 40 | ||||
-rw-r--r-- | extras/scsi_id/scsi_serial.c | 76 |
2 files changed, 58 insertions, 58 deletions
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; } |