Page MenuHomeFreeBSD

D45422.id139265.diff
No OneTemporary

D45422.id139265.diff

diff --git a/sys/sys/_iovec.h b/sys/sys/_iovec.h
--- a/sys/sys/_iovec.h
+++ b/sys/sys/_iovec.h
@@ -44,4 +44,37 @@
size_t iov_len; /* Length. */
};
+#if __BSD_VISIBLE
+#define IOVEC_INIT(_iovp, base, len) __extension__ ({ \
+ struct iovec *iovp = (_iovp); \
+ iovp->iov_len = (len); \
+ iovp->iov_base = (base); \
+})
+
+/* String with length including NUL terminator */
+#define IOVEC_INIT_STR(iovp, _str) __extension__ ({ \
+ void *str = (_str); \
+ IOVEC_INIT(iovp, str, strlen(str) + 1); \
+})
+
+/*
+ * Object with size from sizeof()
+ *
+ * NB: obj argument is unavoidably evaluted twice. This should be
+ * harmless in reasionable use.
+ */
+#define IOVEC_INIT_OBJ(iovp, obj) __extension__ ({ \
+ IOVEC_INIT(iovp, &(obj), sizeof(obj)); \
+})
+
+#define IOVEC_ADVANCE(_iovp, amt) __extension__ ({ \
+ struct iovec *iovp = (_iovp); \
+ size_t amount = (amt); \
+ KASSERT(amount <= iovp->iov_len, ("%s: amount %zu > iov_len \
+ %zu", __func__, amount, iovp->iov_len)); \
+ iovp->iov_len -= amount; \
+ iovp->iov_base = (char *)iovp->iov_base + amount; \
+})
+#endif /* __BSD_VISIBLE */
+
#endif /* !_SYS__IOVEC_H_ */

File Metadata

Mime Type
text/plain
Expires
Fri, Jul 3, 8:37 PM (3 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34636430
Default Alt Text
D45422.id139265.diff (1 KB)

Event Timeline