#include <libcfs/util/list.h>
#include <libcfs/util/ioctl.h>
+#include <libcfs/util/string.h>
#include <linux/lustre/lustre_ioctl.h>
#include <linux/lustre/lustre_barrier_user.h>
if (end)
*end = '\0';
- rc = snprintf(cmd + len, size - len - 1,
- "-o %s=\"%s\" ", buf, ptr);
+ rc = scnprintf(cmd + len, size - len - 1,
+ "-o %s=\"%s\" ", buf, ptr);
if (rc <= 0)
return -EOVERFLOW;
int len;
memset(cmd, 0, sizeof(cmd));
- len = snprintf(cmd, sizeof(cmd) - 1,
- DRSH" '"DZFS" snapshot "
- "-o lustre:fsname=%s "
- "-o lustre:magic=%s "
- "-o lustre:ctime=%llu "
- "-o lustre:mtime=%llu ",
- PRSH(si, st), PZFS(st), fsname,
- SNAPSHOT_MAGIC, xtime, xtime);
+ len = scnprintf(cmd, sizeof(cmd) - 1,
+ DRSH" '"DZFS" snapshot "
+ "-o lustre:fsname=%s "
+ "-o lustre:magic=%s "
+ "-o lustre:ctime=%llu "
+ "-o lustre:mtime=%llu ",
+ PRSH(si, st), PZFS(st), fsname,
+ SNAPSHOT_MAGIC,
+ (unsigned long long)xtime,
+ (unsigned long long)xtime);
if (len <= 0)
exit(-EOVERFLOW);
if (si->si_comment) {
- rc = snprintf(cmd + len, sizeof(cmd) - len - 1,
- "-o lustre:comment=\"%s\" ",
- si->si_comment);
+ rc = scnprintf(cmd + len, sizeof(cmd) - len - 1,
+ "-o lustre:comment=\"%s\" ",
+ si->si_comment);
if (rc <= 0)
exit(-EOVERFLOW);
PRSH(si, st), PIMPORT(st), PZFS(st),
PSSNAME(si, st), PSS_NEW(si, st),
PZFS(st), si->si_comment,
- PSS_NEW(si, st), PZFS(st), xtime,
+ PSS_NEW(si, st), PZFS(st),
+ (unsigned long long)xtime,
PSS_NEW(si, st));
else if (si->si_new_ssname)
snprintf(cmd, sizeof(cmd) - 1,
" set lustre:mtime=%llu "DSSNAME"'",
PRSH(si, st), PIMPORT(st), PZFS(st),
PSSNAME(si, st), PSS_NEW(si, st),
- PZFS(st), xtime, PSS_NEW(si, st));
+ PZFS(st), (unsigned long long)xtime,
+ PSS_NEW(si, st));
else if (si->si_comment)
snprintf(cmd, sizeof(cmd) - 1,
DRSH" '"DIMPORT"; "DZFS
" set lustre:mtime=%llu "DSSNAME"'",
PRSH(si, st), PIMPORT(st), PZFS(st),
si->si_comment, PSSNAME(si, st),
- PZFS(st), xtime, PSSNAME(si, st));
+ PZFS(st), (unsigned long long)xtime,
+ PSSNAME(si, st));
else
exit(-EINVAL);
strlen("lustre:ctime")) == 0) {
ptr = snapshot_first_skip_blank(buf);
if (ptr) {
- sscanf(ptr, "%llu", &xtime);
+ xtime = (__u64)strtoull(ptr, NULL, 10);
printf("create_time: %s",
ctime((time_t *)&xtime));
}
strlen("lustre:mtime")) == 0) {
ptr = snapshot_first_skip_blank(buf);
if (ptr) {
- sscanf(ptr, "%llu", &xtime);
+ xtime = (__u64)strtoull(ptr, NULL, 10);
printf("modify_time: %s",
ctime((time_t *)&xtime));
}