Browse Source

Prefix all the open()-family routines with xfer_, to disambiguate them

from the normal POSIX-style open()
tags/v0.9.3
Michael Brown 17 years ago
parent
commit
59e738d756
4 changed files with 21 additions and 19 deletions
  1. 3
    3
      src/core/downloader.c
  2. 4
    3
      src/core/hw.c
  3. 8
    8
      src/core/open.c
  4. 6
    5
      src/include/gpxe/open.h

+ 3
- 3
src/core/downloader.c View File

239
 /** Downloader data transfer interface operations */
239
 /** Downloader data transfer interface operations */
240
 static struct xfer_interface_operations downloader_xfer_operations = {
240
 static struct xfer_interface_operations downloader_xfer_operations = {
241
 	.close		= downloader_xfer_close,
241
 	.close		= downloader_xfer_close,
242
-	.vredirect	= vopen,
242
+	.vredirect	= xfer_vopen,
243
 	.request	= ignore_xfer_request,
243
 	.request	= ignore_xfer_request,
244
 	.seek		= downloader_xfer_seek,
244
 	.seek		= downloader_xfer_seek,
245
 	.deliver_iob	= xfer_deliver_as_raw,
245
 	.deliver_iob	= xfer_deliver_as_raw,
285
 	downloader->register_image = register_image;
285
 	downloader->register_image = register_image;
286
 
286
 
287
 	/* Instantiate child objects and attach to our interfaces */
287
 	/* Instantiate child objects and attach to our interfaces */
288
-	if ( ( rc = open ( &downloader->xfer, LOCATION_URI,
289
-			   uri_string ) ) != 0 )
288
+	if ( ( rc = xfer_open ( &downloader->xfer, LOCATION_URI,
289
+				uri_string ) ) != 0 )
290
 		goto err;
290
 		goto err;
291
 
291
 
292
 	/* Attach parent interface, mortalise self, and return */
292
 	/* Attach parent interface, mortalise self, and return */

+ 4
- 3
src/core/hw.c View File

30
 	hw_finished ( hw, rc );
30
 	hw_finished ( hw, rc );
31
 }
31
 }
32
 
32
 
33
-static void hw_xfer_request ( struct xfer_interface *xfer,
34
-			      off_t start __unused, int whence __unused,
35
-			      size_t len __unused ) {
33
+static int hw_xfer_request ( struct xfer_interface *xfer,
34
+			     off_t start __unused, int whence __unused,
35
+			     size_t len __unused ) {
36
 	struct hw *hw = container_of ( xfer, struct hw, xfer );
36
 	struct hw *hw = container_of ( xfer, struct hw, xfer );
37
 	int rc;
37
 	int rc;
38
 
38
 
39
 	rc = xfer_deliver_raw ( xfer, hw_msg, sizeof ( hw_msg ) );
39
 	rc = xfer_deliver_raw ( xfer, hw_msg, sizeof ( hw_msg ) );
40
 	hw_finished ( hw, rc );
40
 	hw_finished ( hw, rc );
41
+	return 0;
41
 }
42
 }
42
 
43
 
43
 static struct xfer_interface_operations hw_xfer_operations = {
44
 static struct xfer_interface_operations hw_xfer_operations = {

+ 8
- 8
src/core/open.c View File

49
  * @v uri_string	URI string (e.g. "http://etherboot.org/kernel")
49
  * @v uri_string	URI string (e.g. "http://etherboot.org/kernel")
50
  * @ret rc		Return status code
50
  * @ret rc		Return status code
51
  */
51
  */
52
-int open_uri ( struct xfer_interface *xfer, const char *uri_string ) {
52
+int xfer_open_uri ( struct xfer_interface *xfer, const char *uri_string ) {
53
 	struct uri *uri;
53
 	struct uri *uri;
54
 	struct uri_opener *opener;
54
 	struct uri_opener *opener;
55
 
55
 
78
  * @v domain		Communication domain (e.g. PF_INET)
78
  * @v domain		Communication domain (e.g. PF_INET)
79
  * @v type		Communication semantics (e.g. SOCK_STREAM)
79
  * @v type		Communication semantics (e.g. SOCK_STREAM)
80
  */
80
  */
81
-int open_socket ( struct xfer_interface *xfer,
82
-		  int domain, int type, struct sockaddr *sa ) {
81
+int xfer_open_socket ( struct xfer_interface *xfer,
82
+		       int domain, int type, struct sockaddr *sa ) {
83
 	struct socket_opener *opener;
83
 	struct socket_opener *opener;
84
 
84
 
85
 	DBGC ( xfer, "XFER %p opening (%s,%s) socket\n", xfer,
85
 	DBGC ( xfer, "XFER %p opening (%s,%s) socket\n", xfer,
106
  * @v args		Remaining arguments depend upon location type
106
  * @v args		Remaining arguments depend upon location type
107
  * @ret rc		Return status code
107
  * @ret rc		Return status code
108
  */
108
  */
109
-int vopen ( struct xfer_interface *xfer, int type, va_list args ) {
109
+int xfer_vopen ( struct xfer_interface *xfer, int type, va_list args ) {
110
 	switch ( type ) {
110
 	switch ( type ) {
111
 	case LOCATION_URI: {
111
 	case LOCATION_URI: {
112
 		const char *uri_string = va_arg ( args, const char * );
112
 		const char *uri_string = va_arg ( args, const char * );
113
 
113
 
114
-		return open_uri ( xfer, uri_string ); }
114
+		return xfer_open_uri ( xfer, uri_string ); }
115
 	case LOCATION_SOCKET: {
115
 	case LOCATION_SOCKET: {
116
 		int domain = va_arg ( args, int );
116
 		int domain = va_arg ( args, int );
117
 		int type = va_arg ( args, int );
117
 		int type = va_arg ( args, int );
118
 		struct sockaddr *sa = va_arg ( args, struct sockaddr * );
118
 		struct sockaddr *sa = va_arg ( args, struct sockaddr * );
119
 
119
 
120
-		return open_socket ( xfer, domain, type, sa ); }
120
+		return xfer_open_socket ( xfer, domain, type, sa ); }
121
 	default:
121
 	default:
122
 		DBGC ( xfer, "XFER %p attempted to open unsupported location "
122
 		DBGC ( xfer, "XFER %p attempted to open unsupported location "
123
 		       "type %d\n", xfer, type );
123
 		       "type %d\n", xfer, type );
133
  * @v ...		Remaining arguments depend upon location type
133
  * @v ...		Remaining arguments depend upon location type
134
  * @ret rc		Return status code
134
  * @ret rc		Return status code
135
  */
135
  */
136
-int open ( struct xfer_interface *xfer, int type, ... ) {
136
+int xfer_open ( struct xfer_interface *xfer, int type, ... ) {
137
 	va_list args;
137
 	va_list args;
138
 	int rc;
138
 	int rc;
139
 
139
 
140
 	va_start ( args, type );
140
 	va_start ( args, type );
141
-	rc = vopen ( xfer, type, args );
141
+	rc = xfer_vopen ( xfer, type, args );
142
 	va_end ( args );
142
 	va_end ( args );
143
 	return rc;
143
 	return rc;
144
 }
144
 }

+ 6
- 5
src/include/gpxe/open.h View File

72
 /** Register a socket opener */
72
 /** Register a socket opener */
73
 #define __socket_opener __table ( struct socket_opener, socket_openers, 01 )
73
 #define __socket_opener __table ( struct socket_opener, socket_openers, 01 )
74
 
74
 
75
-extern int open_uri ( struct xfer_interface *xfer, const char *uri_string );
76
-extern int open_socket ( struct xfer_interface *xfer,
77
-			 int domain, int type, struct sockaddr *sa );
78
-extern int vopen ( struct xfer_interface *xfer, int type, va_list args );
79
-extern int open ( struct xfer_interface *xfer, int type, ... );
75
+extern int xfer_open_uri ( struct xfer_interface *xfer,
76
+			   const char *uri_string );
77
+extern int xfer_open_socket ( struct xfer_interface *xfer,
78
+			      int domain, int type, struct sockaddr *sa );
79
+extern int xfer_vopen ( struct xfer_interface *xfer, int type, va_list args );
80
+extern int xfer_open ( struct xfer_interface *xfer, int type, ... );
80
 
81
 
81
 #endif /* _GPXE_OPEN_H */
82
 #endif /* _GPXE_OPEN_H */

Loading…
Cancel
Save