__u32 result;
void *buf = NULL;
int fd, ffd = STDIN_FILENO;
- char *endptr = NULL;
- uint64_t number = 0;
struct config {
char *file;
}
if (buf) {
- /* if feature ID is 0x0E, get timestamp value by -v option */
+ /*
+ * Use the '-v' value for the timestamp feature if provided as
+ * a convenience since it can often fit in 4-bytes. The user
+ * should use the buffer method if the value exceeds this
+ * length.
+ */
if (NVME_FEAT_FID_TIMESTAMP == cfg.feature_id && cfg.value) {
memcpy(buf, &cfg.value, NVME_FEAT_TIMESTAMP_DATA_SIZE);
} else {
goto free;
}
}
+
err = read(ffd, (void *)buf, cfg.data_len);
if (err < 0) {
err = -errno;
" file: %s\n", strerror(errno));
goto close_ffd;
}
- /* if feature ID is 0x0E, then change string from file to integer */
- if (NVME_FEAT_FID_TIMESTAMP == cfg.feature_id) {
- number = strtoul(buf, &endptr, STRTOUL_AUTO_BASE);
- memset(buf, 0, cfg.data_len);
- memcpy(buf, &number, NVME_FEAT_TIMESTAMP_DATA_SIZE);
- }
}
}