Project

General

Profile

Bug #4309 » freebsd_libzfs_printf_changes.txt

sean bruno, 2013-11-09 01:20 AM

 
1
Index: cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
2
===================================================================
3
--- cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c	(revision 257859)
4
+++ cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c	(working copy)
5
@@ -2134,7 +2134,7 @@
6
 			    localtime_r(&time, &t) == NULL ||
7
 			    strftime(propbuf, proplen, "%a %b %e %k:%M %Y",
8
 			    &t) == 0)
9
-				(void) snprintf(propbuf, proplen, "%llu", val);
10
+				(void) snprintf(propbuf, proplen, "%ju", (intmax_t)val);
11
 		}
12
 		break;
13
 
14
@@ -2648,7 +2648,7 @@
15
 		return (err);
16
 
17
 	if (literal) {
18
-		(void) snprintf(propbuf, proplen, "%llu", propvalue);
19
+		(void) snprintf(propbuf, proplen, "%ju", (intmax_t)propvalue);
20
 	} else if (propvalue == 0 &&
21
 	    (type == ZFS_PROP_USERQUOTA || type == ZFS_PROP_GROUPQUOTA)) {
22
 		(void) strlcpy(propbuf, "none", proplen);
23
@@ -2705,7 +2705,7 @@
24
 		return (err);
25
 
26
 	if (literal) {
27
-		(void) snprintf(propbuf, proplen, "%llu", propvalue);
28
+		(void) snprintf(propbuf, proplen, "%ju", (intmax_t)propvalue);
29
 	} else {
30
 		zfs_nicenum(propvalue, propbuf, proplen);
31
 	}
32
Index: cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c
33
===================================================================
34
--- cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c	(revision 257859)
35
+++ cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c	(working copy)
36
@@ -116,7 +116,7 @@
37
 		(void) snprintf(di->errbuf, sizeof (di->errbuf),
38
 		    dgettext(TEXT_DOMAIN,
39
 		    "Unable to determine path or stats for "
40
-		    "object %lld in %s"), obj, dsname);
41
+		    "object %jd in %s"), (intmax_t)obj, dsname);
42
 		return (-1);
43
 	}
44
 }
45
@@ -409,8 +409,8 @@
46
 		} else {
47
 			(void) snprintf(di->errbuf, sizeof (di->errbuf),
48
 			    dgettext(TEXT_DOMAIN,
49
-			    "next allocated object (> %lld) find failure"),
50
-			    zc.zc_obj);
51
+			    "next allocated object (> %jd) find failure"),
52
+			    (intmax_t)(zc.zc_obj));
53
 			di->zerr = errno;
54
 			break;
55
 		}
56
Index: cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
57
===================================================================
58
--- cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c	(revision 257859)
59
+++ cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c	(working copy)
60
@@ -261,7 +261,7 @@
61
 
62
 		case ZPOOL_PROP_GUID:
63
 			intval = zpool_get_prop_int(zhp, prop, &src);
64
-			(void) snprintf(buf, len, "%llu", intval);
65
+			(void) snprintf(buf, len, "%ju", (uintmax_t)intval);
66
 			break;
67
 
68
 		case ZPOOL_PROP_ALTROOT:
69
@@ -337,7 +337,7 @@
70
 			}
71
 			/* FALLTHROUGH */
72
 		default:
73
-			(void) snprintf(buf, len, "%llu", intval);
74
+			(void) snprintf(buf, len, "%ju", (uintmax_t)intval);
75
 		}
76
 		break;
77
 
78
@@ -1472,15 +1472,15 @@
79
 		}
80
 		if (loss > 120) {
81
 			(void) printf(dgettext(TEXT_DOMAIN,
82
-			    "%s approximately %lld "),
83
+			    "%s approximately %jd "),
84
 			    dryrun ? "Would discard" : "Discarded",
85
-			    (loss + 30) / 60);
86
+			    (intmax_t)(loss + 30) / 60);
87
 			(void) printf(dgettext(TEXT_DOMAIN,
88
 			    "minutes of transactions.\n"));
89
 		} else if (loss > 0) {
90
 			(void) printf(dgettext(TEXT_DOMAIN,
91
-			    "%s approximately %lld "),
92
-			    dryrun ? "Would discard" : "Discarded", loss);
93
+			    "%s approximately %jd "),
94
+			    dryrun ? "Would discard" : "Discarded", (intmax_t)loss);
95
 			(void) printf(dgettext(TEXT_DOMAIN,
96
 			    "seconds of transactions.\n"));
97
 		}
98
@@ -1533,12 +1533,13 @@
99
 
100
 	if (loss > 120) {
101
 		(void) printf(dgettext(TEXT_DOMAIN,
102
-		    "Approximately %lld minutes of data\n"
103
-		    "\tmust be discarded, irreversibly.  "), (loss + 30) / 60);
104
+		    "Approximately %jd minutes of data\n"
105
+		    "\tmust be discarded, irreversibly.  "),
106
+		    (intmax_t)(loss + 30) / 60);
107
 	} else if (loss > 0) {
108
 		(void) printf(dgettext(TEXT_DOMAIN,
109
-		    "Approximately %lld seconds of data\n"
110
-		    "\tmust be discarded, irreversibly.  "), loss);
111
+		    "Approximately %jd seconds of data\n"
112
+		    "\tmust be discarded, irreversibly.  "), (intmax_t)loss);
113
 	}
114
 	if (edata != 0 && edata != UINT64_MAX) {
115
 		if (edata == 1) {
116
@@ -2524,7 +2525,7 @@
117
 	libzfs_handle_t *hdl = zhp->zpool_hdl;
118
 
119
 	(void) snprintf(msg, sizeof (msg),
120
-	    dgettext(TEXT_DOMAIN, "cannot fault %llu"), guid);
121
+	    dgettext(TEXT_DOMAIN, "cannot fault %ju"), (uintmax_t)guid);
122
 
123
 	(void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
124
 	zc.zc_guid = guid;
125
@@ -2559,7 +2560,7 @@
126
 	libzfs_handle_t *hdl = zhp->zpool_hdl;
127
 
128
 	(void) snprintf(msg, sizeof (msg),
129
-	    dgettext(TEXT_DOMAIN, "cannot degrade %llu"), guid);
130
+	    dgettext(TEXT_DOMAIN, "cannot degrade %ju"), (uintmax_t)guid);
131
 
132
 	(void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
133
 	zc.zc_guid = guid;
134
@@ -3227,8 +3228,8 @@
135
 	libzfs_handle_t *hdl = zhp->zpool_hdl;
136
 
137
 	(void) snprintf(msg, sizeof (msg),
138
-	    dgettext(TEXT_DOMAIN, "cannot clear errors for %llx"),
139
-	    guid);
140
+	    dgettext(TEXT_DOMAIN, "cannot clear errors for %jx"),
141
+	    (intmax_t)guid);
142
 
143
 	(void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
144
 	zc.zc_guid = guid;
145
@@ -3793,7 +3794,8 @@
146
 
147
 	if (dsobj == 0) {
148
 		/* special case for the MOS */
149
-		(void) snprintf(pathname, len, "<metadata>:<0x%llx>", obj);
150
+		(void) snprintf(pathname, len, "<metadata>:<0x%jx>",
151
+				(intmax_t)obj);
152
 		return;
153
 	}
154
 
155
@@ -3803,8 +3805,8 @@
156
 	if (ioctl(zhp->zpool_hdl->libzfs_fd,
157
 	    ZFS_IOC_DSOBJ_TO_DSNAME, &zc) != 0) {
158
 		/* just write out a path of two object numbers */
159
-		(void) snprintf(pathname, len, "<0x%llx>:<0x%llx>",
160
-		    dsobj, obj);
161
+		(void) snprintf(pathname, len, "<0x%jx>:<0x%jx>",
162
+		    (intmax_t)dsobj, (intmax_t)obj);
163
 		return;
164
 	}
165
 	(void) strlcpy(dsname, zc.zc_value, sizeof (dsname));
166
@@ -3825,7 +3827,7 @@
167
 			    dsname, zc.zc_value);
168
 		}
169
 	} else {
170
-		(void) snprintf(pathname, len, "%s:<0x%llx>", dsname, obj);
171
+		(void) snprintf(pathname, len, "%s:<0x%jx>", dsname, (intmax_t)obj);
172
 	}
173
 	free(mntpnt);
174
 }
175
Index: cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
176
===================================================================
177
--- cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c	(revision 257859)
178
+++ cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c	(working copy)
179
@@ -2083,7 +2083,7 @@
180
 					needagain = B_TRUE;
181
 				else
182
 					progress = B_TRUE;
183
-				sprintf(guidname, "%lu", thisguid);
184
+				sprintf(guidname, "%ju", (uintmax_t)thisguid);
185
 				nvlist_add_boolean(deleted, guidname);
186
 				continue;
187
 			}
188
@@ -2140,7 +2140,7 @@
189
 				needagain = B_TRUE;
190
 			else
191
 				progress = B_TRUE;
192
-			sprintf(guidname, "%lu", parent_fromsnap_guid);
193
+			sprintf(guidname, "%ju", (uintmax_t)parent_fromsnap_guid);
194
 			nvlist_add_boolean(deleted, guidname);
195
 			continue;
196
 		}
197
@@ -2173,7 +2173,7 @@
198
 		if (stream_parent_fromsnap_guid != 0 &&
199
                     parent_fromsnap_guid != 0 &&
200
                     stream_parent_fromsnap_guid != parent_fromsnap_guid) {
201
-			sprintf(guidname, "%lu", parent_fromsnap_guid);
202
+			sprintf(guidname, "%ju", (uintmax_t)parent_fromsnap_guid);
203
 			if (nvlist_exists(deleted, guidname)) {
204
 				progress = B_TRUE;
205
 				needagain = B_TRUE;
206
@@ -3081,8 +3081,8 @@
207
 		zfs_nicenum(bytes, buf1, sizeof (buf1));
208
 		zfs_nicenum(bytes/delta, buf2, sizeof (buf1));
209
 
210
-		(void) printf("received %sB stream in %lu seconds (%sB/sec)\n",
211
-		    buf1, delta, buf2);
212
+		(void) printf("received %sB stream in %ld seconds (%sB/sec)\n",
213
+		    buf1, (unsigned long)delta, buf2);
214
 	}
215
 
216
 	return (0);
217
Index: cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c
218
===================================================================
219
--- cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c	(revision 257859)
220
+++ cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c	(working copy)
221
@@ -586,13 +586,13 @@
222
 	u = " KMGTPE"[index];
223
 
224
 	if (index == 0) {
225
-		(void) snprintf(buf, buflen, "%llu", n);
226
+		(void) snprintf(buf, buflen, "%ju", (uintmax_t)n);
227
 	} else if ((num & ((1ULL << 10 * index) - 1)) == 0) {
228
 		/*
229
 		 * If this is an even multiple of the base, always display
230
 		 * without any decimal precision.
231
 		 */
232
-		(void) snprintf(buf, buflen, "%llu%c", n, u);
233
+		(void) snprintf(buf, buflen, "%ju%c", (uintmax_t)n, u);
234
 	} else {
235
 		/*
236
 		 * We want to choose a precision that reflects the best choice
(1-1/2)