mirror of https://github.com/ipxe/ipxe.git
Prefix all the open()-family routines with xfer_, to disambiguate them
from the normal POSIX-style open()pull/1/head
parent
b1755462ab
commit
59e738d756
|
@ -239,7 +239,7 @@ static void downloader_xfer_close ( struct xfer_interface *xfer, int rc ) {
|
||||||
/** Downloader data transfer interface operations */
|
/** Downloader data transfer interface operations */
|
||||||
static struct xfer_interface_operations downloader_xfer_operations = {
|
static struct xfer_interface_operations downloader_xfer_operations = {
|
||||||
.close = downloader_xfer_close,
|
.close = downloader_xfer_close,
|
||||||
.vredirect = vopen,
|
.vredirect = xfer_vopen,
|
||||||
.request = ignore_xfer_request,
|
.request = ignore_xfer_request,
|
||||||
.seek = downloader_xfer_seek,
|
.seek = downloader_xfer_seek,
|
||||||
.deliver_iob = xfer_deliver_as_raw,
|
.deliver_iob = xfer_deliver_as_raw,
|
||||||
|
@ -285,7 +285,7 @@ int create_downloader ( struct job_interface *job, const char *uri_string,
|
||||||
downloader->register_image = register_image;
|
downloader->register_image = register_image;
|
||||||
|
|
||||||
/* Instantiate child objects and attach to our interfaces */
|
/* Instantiate child objects and attach to our interfaces */
|
||||||
if ( ( rc = open ( &downloader->xfer, LOCATION_URI,
|
if ( ( rc = xfer_open ( &downloader->xfer, LOCATION_URI,
|
||||||
uri_string ) ) != 0 )
|
uri_string ) ) != 0 )
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ static void hw_xfer_close ( struct xfer_interface *xfer, int rc ) {
|
||||||
hw_finished ( hw, rc );
|
hw_finished ( hw, rc );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hw_xfer_request ( struct xfer_interface *xfer,
|
static int hw_xfer_request ( struct xfer_interface *xfer,
|
||||||
off_t start __unused, int whence __unused,
|
off_t start __unused, int whence __unused,
|
||||||
size_t len __unused ) {
|
size_t len __unused ) {
|
||||||
struct hw *hw = container_of ( xfer, struct hw, xfer );
|
struct hw *hw = container_of ( xfer, struct hw, xfer );
|
||||||
|
@ -38,6 +38,7 @@ static void hw_xfer_request ( struct xfer_interface *xfer,
|
||||||
|
|
||||||
rc = xfer_deliver_raw ( xfer, hw_msg, sizeof ( hw_msg ) );
|
rc = xfer_deliver_raw ( xfer, hw_msg, sizeof ( hw_msg ) );
|
||||||
hw_finished ( hw, rc );
|
hw_finished ( hw, rc );
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct xfer_interface_operations hw_xfer_operations = {
|
static struct xfer_interface_operations hw_xfer_operations = {
|
||||||
|
|
|
@ -49,7 +49,7 @@ static struct socket_opener socket_openers_end[0]
|
||||||
* @v uri_string URI string (e.g. "http://etherboot.org/kernel")
|
* @v uri_string URI string (e.g. "http://etherboot.org/kernel")
|
||||||
* @ret rc Return status code
|
* @ret rc Return status code
|
||||||
*/
|
*/
|
||||||
int open_uri ( struct xfer_interface *xfer, const char *uri_string ) {
|
int xfer_open_uri ( struct xfer_interface *xfer, const char *uri_string ) {
|
||||||
struct uri *uri;
|
struct uri *uri;
|
||||||
struct uri_opener *opener;
|
struct uri_opener *opener;
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ int open_uri ( struct xfer_interface *xfer, const char *uri_string ) {
|
||||||
* @v domain Communication domain (e.g. PF_INET)
|
* @v domain Communication domain (e.g. PF_INET)
|
||||||
* @v type Communication semantics (e.g. SOCK_STREAM)
|
* @v type Communication semantics (e.g. SOCK_STREAM)
|
||||||
*/
|
*/
|
||||||
int open_socket ( struct xfer_interface *xfer,
|
int xfer_open_socket ( struct xfer_interface *xfer,
|
||||||
int domain, int type, struct sockaddr *sa ) {
|
int domain, int type, struct sockaddr *sa ) {
|
||||||
struct socket_opener *opener;
|
struct socket_opener *opener;
|
||||||
|
|
||||||
|
@ -106,18 +106,18 @@ int open_socket ( struct xfer_interface *xfer,
|
||||||
* @v args Remaining arguments depend upon location type
|
* @v args Remaining arguments depend upon location type
|
||||||
* @ret rc Return status code
|
* @ret rc Return status code
|
||||||
*/
|
*/
|
||||||
int vopen ( struct xfer_interface *xfer, int type, va_list args ) {
|
int xfer_vopen ( struct xfer_interface *xfer, int type, va_list args ) {
|
||||||
switch ( type ) {
|
switch ( type ) {
|
||||||
case LOCATION_URI: {
|
case LOCATION_URI: {
|
||||||
const char *uri_string = va_arg ( args, const char * );
|
const char *uri_string = va_arg ( args, const char * );
|
||||||
|
|
||||||
return open_uri ( xfer, uri_string ); }
|
return xfer_open_uri ( xfer, uri_string ); }
|
||||||
case LOCATION_SOCKET: {
|
case LOCATION_SOCKET: {
|
||||||
int domain = va_arg ( args, int );
|
int domain = va_arg ( args, int );
|
||||||
int type = va_arg ( args, int );
|
int type = va_arg ( args, int );
|
||||||
struct sockaddr *sa = va_arg ( args, struct sockaddr * );
|
struct sockaddr *sa = va_arg ( args, struct sockaddr * );
|
||||||
|
|
||||||
return open_socket ( xfer, domain, type, sa ); }
|
return xfer_open_socket ( xfer, domain, type, sa ); }
|
||||||
default:
|
default:
|
||||||
DBGC ( xfer, "XFER %p attempted to open unsupported location "
|
DBGC ( xfer, "XFER %p attempted to open unsupported location "
|
||||||
"type %d\n", xfer, type );
|
"type %d\n", xfer, type );
|
||||||
|
@ -133,12 +133,12 @@ int vopen ( struct xfer_interface *xfer, int type, va_list args ) {
|
||||||
* @v ... Remaining arguments depend upon location type
|
* @v ... Remaining arguments depend upon location type
|
||||||
* @ret rc Return status code
|
* @ret rc Return status code
|
||||||
*/
|
*/
|
||||||
int open ( struct xfer_interface *xfer, int type, ... ) {
|
int xfer_open ( struct xfer_interface *xfer, int type, ... ) {
|
||||||
va_list args;
|
va_list args;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
va_start ( args, type );
|
va_start ( args, type );
|
||||||
rc = vopen ( xfer, type, args );
|
rc = xfer_vopen ( xfer, type, args );
|
||||||
va_end ( args );
|
va_end ( args );
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,10 +72,11 @@ struct socket_opener {
|
||||||
/** Register a socket opener */
|
/** Register a socket opener */
|
||||||
#define __socket_opener __table ( struct socket_opener, socket_openers, 01 )
|
#define __socket_opener __table ( struct socket_opener, socket_openers, 01 )
|
||||||
|
|
||||||
extern int open_uri ( struct xfer_interface *xfer, const char *uri_string );
|
extern int xfer_open_uri ( struct xfer_interface *xfer,
|
||||||
extern int open_socket ( struct xfer_interface *xfer,
|
const char *uri_string );
|
||||||
|
extern int xfer_open_socket ( struct xfer_interface *xfer,
|
||||||
int domain, int type, struct sockaddr *sa );
|
int domain, int type, struct sockaddr *sa );
|
||||||
extern int vopen ( struct xfer_interface *xfer, int type, va_list args );
|
extern int xfer_vopen ( struct xfer_interface *xfer, int type, va_list args );
|
||||||
extern int open ( struct xfer_interface *xfer, int type, ... );
|
extern int xfer_open ( struct xfer_interface *xfer, int type, ... );
|
||||||
|
|
||||||
#endif /* _GPXE_OPEN_H */
|
#endif /* _GPXE_OPEN_H */
|
||||||
|
|
Loading…
Reference in New Issue