Commit c718cd98 authored by Niels Möller's avatar Niels Möller
Browse files

* src/io_commands.c (io_write_file_command): Use DEFINE_COMMAND.

(connect_local_command): Likewise.
(io_log_peer_command): Likewise.

Rev: src/io_commands.c:1.43
Rev: src/io_commands.h:1.19
parent 1e7d9e07
......@@ -80,7 +80,11 @@ do_io_write_file(struct command *s,
EXCEPTION_RAISE(e, make_io_exception(EXC_IO_OPEN_WRITE, NULL, errno, NULL));
}
DEFINE_COMMAND_SIMPLE(io_write_file_command, a)
DEFINE_COMMAND(io_write_file_command)
(struct command *s UNUSED,
struct lsh_object *a,
struct command_continuation *c,
struct exception_handler *e UNUSED)
{
CAST(io_backend, backend, a);
......@@ -447,24 +451,32 @@ make_connect_local(struct io_backend *backend)
return &self->super;
}
DEFINE_COMMAND_SIMPLE(connect_local_command, a)
DEFINE_COMMAND(connect_local_command)
(struct command *s UNUSED,
struct lsh_object *a,
struct command_continuation *c,
struct exception_handler *e UNUSED)
{
CAST(io_backend, backend, a);
return &make_connect_local(backend)->super;
COMMAND_RETURN(c, make_connect_local(backend));
}
/* Takes a listen_value as argument, logs the peer address, and
* returns the fd object. */
DEFINE_COMMAND_SIMPLE(io_log_peer_command, a)
DEFINE_COMMAND(io_log_peer_command)
(struct command *s UNUSED,
struct lsh_object *a,
struct command_continuation *c,
struct exception_handler *e UNUSED)
{
CAST(listen_value, lv, a);
verbose("Accepting connection from %S, port %i\n",
lv->peer->ip, lv->peer->port);
return &lv->super;
COMMAND_RETURN(c, lv);
}
......
......@@ -46,9 +46,9 @@
struct io_write_file_info *
make_io_write_file_info(const char *name, int flags, int mode, UINT32 block_size);
extern struct command_simple io_write_file_command;
extern struct command io_write_file_command;
#define IO_WRITE_FILE (&io_write_file_command.super.super)
#define IO_WRITE_FILE (&io_write_file_command.super)
/* Read a certain fd */
......@@ -97,10 +97,10 @@ make_listen_local(struct io_backend *backend,
struct command *
make_connect_local(struct io_backend *backend);
extern struct command_simple connect_local_command;
#define CONNECT_LOCAL (&connect_local_command.super.super)
extern struct command connect_local_command;
#define CONNECT_LOCAL (&connect_local_command.super)
extern struct command_simple io_log_peer_command;
#define LOG_PEER (&io_log_peer_command.super.super)
extern struct command io_log_peer_command;
#define LOG_PEER (&io_log_peer_command.super)
#endif /* LSH_IO_COMMANDS_H_INCLUDED */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment