Ver código fonte

Add XFER_INIT() macro.

tags/v0.9.3
Michael Brown 17 anos atrás
pai
commit
a2b4252d5a
2 arquivos alterados com 14 adições e 7 exclusões
  1. 1
    7
      src/core/xfer.c
  2. 13
    0
      src/include/gpxe/xfer.h

+ 1
- 7
src/core/xfer.c Ver arquivo

@@ -402,10 +402,4 @@ struct xfer_interface_operations null_xfer_ops = {
402 402
  * connected when unplugged.  It will never generate messages, and
403 403
  * will silently absorb all received messages.
404 404
  */
405
-struct xfer_interface null_xfer = {
406
-	.intf = {
407
-		.dest = &null_xfer.intf,
408
-		.refcnt = NULL,
409
-	},
410
-	.op = &null_xfer_ops,
411
-};
405
+struct xfer_interface null_xfer = XFER_INIT ( &null_xfer_ops );

+ 13
- 0
src/include/gpxe/xfer.h Ver arquivo

@@ -183,6 +183,19 @@ static inline void xfer_init ( struct xfer_interface *xfer,
183 183
 	xfer->op = op;
184 184
 }
185 185
 
186
+/**
187
+ * Initialise a static data transfer interface
188
+ *
189
+ * @v operations		Data transfer interface operations
190
+ */
191
+#define XFER_INIT( operations ) {			\
192
+		.intf = {				\
193
+			.dest = &null_xfer.intf,	\
194
+			.refcnt = NULL,			\
195
+		},					\
196
+		.op = operations,			\
197
+	}
198
+
186 199
 /**
187 200
  * Get data transfer interface from generic object communication interface
188 201
  *

Carregando…
Cancelar
Salvar