Sfoglia il codice sorgente

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

from the normal POSIX-style open()
tags/v0.9.3
Michael Brown 17 anni fa
parent
commit
59e738d756
4 ha cambiato i file con 21 aggiunte e 19 eliminazioni
  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 Vedi File

@@ -239,7 +239,7 @@ static void downloader_xfer_close ( struct xfer_interface *xfer, int rc ) {
239 239
 /** Downloader data transfer interface operations */
240 240
 static struct xfer_interface_operations downloader_xfer_operations = {
241 241
 	.close		= downloader_xfer_close,
242
-	.vredirect	= vopen,
242
+	.vredirect	= xfer_vopen,
243 243
 	.request	= ignore_xfer_request,
244 244
 	.seek		= downloader_xfer_seek,
245 245
 	.deliver_iob	= xfer_deliver_as_raw,
@@ -285,8 +285,8 @@ int create_downloader ( struct job_interface *job, const char *uri_string,
285 285
 	downloader->register_image = register_image;
286 286
 
287 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 290
 		goto err;
291 291
 
292 292
 	/* Attach parent interface, mortalise self, and return */

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

@@ -30,14 +30,15 @@ static void hw_xfer_close ( struct xfer_interface *xfer, int rc ) {
30 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 36
 	struct hw *hw = container_of ( xfer, struct hw, xfer );
37 37
 	int rc;
38 38
 
39 39
 	rc = xfer_deliver_raw ( xfer, hw_msg, sizeof ( hw_msg ) );
40 40
 	hw_finished ( hw, rc );
41
+	return 0;
41 42
 }
42 43
 
43 44
 static struct xfer_interface_operations hw_xfer_operations = {

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

@@ -49,7 +49,7 @@ static struct socket_opener socket_openers_end[0]
49 49
  * @v uri_string	URI string (e.g. "http://etherboot.org/kernel")
50 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 53
 	struct uri *uri;
54 54
 	struct uri_opener *opener;
55 55
 
@@ -78,8 +78,8 @@ int open_uri ( struct xfer_interface *xfer, const char *uri_string ) {
78 78
  * @v domain		Communication domain (e.g. PF_INET)
79 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 83
 	struct socket_opener *opener;
84 84
 
85 85
 	DBGC ( xfer, "XFER %p opening (%s,%s) socket\n", xfer,
@@ -106,18 +106,18 @@ int open_socket ( struct xfer_interface *xfer,
106 106
  * @v args		Remaining arguments depend upon location type
107 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 110
 	switch ( type ) {
111 111
 	case LOCATION_URI: {
112 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 115
 	case LOCATION_SOCKET: {
116 116
 		int domain = va_arg ( args, int );
117 117
 		int type = va_arg ( args, int );
118 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 121
 	default:
122 122
 		DBGC ( xfer, "XFER %p attempted to open unsupported location "
123 123
 		       "type %d\n", xfer, type );
@@ -133,12 +133,12 @@ int vopen ( struct xfer_interface *xfer, int type, va_list args ) {
133 133
  * @v ...		Remaining arguments depend upon location type
134 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 137
 	va_list args;
138 138
 	int rc;
139 139
 
140 140
 	va_start ( args, type );
141
-	rc = vopen ( xfer, type, args );
141
+	rc = xfer_vopen ( xfer, type, args );
142 142
 	va_end ( args );
143 143
 	return rc;
144 144
 }

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

@@ -72,10 +72,11 @@ struct socket_opener {
72 72
 /** Register a socket opener */
73 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 82
 #endif /* _GPXE_OPEN_H */

Loading…
Annulla
Salva