summaryrefslogtreecommitdiffstats
path: root/src/net/tcp
diff options
context:
space:
mode:
authorMichael Brown2011-06-24 15:14:41 +0200
committerMichael Brown2011-06-28 15:45:08 +0200
commite01ec74601b58f54a5e2ae7b9fd1196972034114 (patch)
tree54f2d2202274523e2365584502dee7db8deca43b /src/net/tcp
parent[xfer] Send xfer_window_changed() after xfer_vredirect() (diff)
downloadipxe-e01ec74601b58f54a5e2ae7b9fd1196972034114.tar.gz
ipxe-e01ec74601b58f54a5e2ae7b9fd1196972034114.tar.xz
ipxe-e01ec74601b58f54a5e2ae7b9fd1196972034114.zip
[process] Pass containing object pointer to process step() methods
Give the step() method a pointer to the containing object, rather than a pointer to the process. This is consistent with the operation of interface methods, and allows a single function to serve as both an interface method and a process step() method. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/tcp')
-rw-r--r--src/net/tcp/http.c12
-rw-r--r--src/net/tcp/iscsi.c10
2 files changed, 13 insertions, 9 deletions
diff --git a/src/net/tcp/http.c b/src/net/tcp/http.c
index 598f28931..15f88b319 100644
--- a/src/net/tcp/http.c
+++ b/src/net/tcp/http.c
@@ -483,11 +483,9 @@ static int http_socket_deliver ( struct http_request *http,
/**
* HTTP process
*
- * @v process Process
+ * @v http HTTP request
*/
-static void http_step ( struct process *process ) {
- struct http_request *http =
- container_of ( process, struct http_request, process );
+static void http_step ( struct http_request *http ) {
const char *host = http->uri->host;
const char *user = http->uri->user;
const char *password =
@@ -561,6 +559,10 @@ static struct interface_descriptor http_xfer_desc =
INTF_DESC_PASSTHRU ( struct http_request, xfer,
http_xfer_operations, socket );
+/** HTTP process descriptor */
+static struct process_descriptor http_process_desc =
+ PROC_DESC ( struct http_request, process, http_step );
+
/**
* Initiate an HTTP connection, with optional filter
*
@@ -591,7 +593,7 @@ int http_open_filter ( struct interface *xfer, struct uri *uri,
intf_init ( &http->xfer, &http_xfer_desc, &http->refcnt );
http->uri = uri_get ( uri );
intf_init ( &http->socket, &http_socket_desc, &http->refcnt );
- process_init ( &http->process, http_step, &http->refcnt );
+ process_init ( &http->process, &http_process_desc, &http->refcnt );
/* Open socket */
memset ( &server, 0, sizeof ( server ) );
diff --git a/src/net/tcp/iscsi.c b/src/net/tcp/iscsi.c
index cde3ed6db..34d06ce3a 100644
--- a/src/net/tcp/iscsi.c
+++ b/src/net/tcp/iscsi.c
@@ -1427,9 +1427,7 @@ static void iscsi_tx_done ( struct iscsi_session *iscsi ) {
*
* Constructs data to be sent for the current TX state
*/
-static void iscsi_tx_step ( struct process *process ) {
- struct iscsi_session *iscsi =
- container_of ( process, struct iscsi_session, process );
+static void iscsi_tx_step ( struct iscsi_session *iscsi ) {
struct iscsi_bhs_common *common = &iscsi->tx_bhs.common;
int ( * tx ) ( struct iscsi_session *iscsi );
enum iscsi_tx_state next_state;
@@ -1488,6 +1486,10 @@ static void iscsi_tx_step ( struct process *process ) {
}
}
+/** iSCSI TX process descriptor */
+static struct process_descriptor iscsi_process_desc =
+ PROC_DESC ( struct iscsi_session, process, iscsi_tx_step );
+
/**
* Receive basic header segment of an iSCSI PDU
*
@@ -2034,7 +2036,7 @@ static int iscsi_open ( struct interface *parent, struct uri *uri ) {
intf_init ( &iscsi->control, &iscsi_control_desc, &iscsi->refcnt );
intf_init ( &iscsi->data, &iscsi_data_desc, &iscsi->refcnt );
intf_init ( &iscsi->socket, &iscsi_socket_desc, &iscsi->refcnt );
- process_init_stopped ( &iscsi->process, iscsi_tx_step,
+ process_init_stopped ( &iscsi->process, &iscsi_process_desc,
&iscsi->refcnt );
/* Parse root path */