tree-wide: s/struct lxc_pty/lxc_terminal/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner 2018-02-27 17:52:55 +01:00
parent 2f835b4b72
commit dcad02f87b
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D
6 changed files with 38 additions and 38 deletions

View File

@ -974,7 +974,7 @@ on_error:
rexit(EXIT_FAILURE); rexit(EXIT_FAILURE);
} }
static int lxc_attach_pty(struct lxc_conf *conf, struct lxc_pty *pty) static int lxc_attach_pty(struct lxc_conf *conf, struct lxc_terminal *pty)
{ {
int ret; int ret;
@ -1001,7 +1001,7 @@ on_error:
return -1; return -1;
} }
static int lxc_attach_pty_mainloop_init(struct lxc_pty *pty, static int lxc_attach_pty_mainloop_init(struct lxc_terminal *pty,
struct lxc_epoll_descr *descr) struct lxc_epoll_descr *descr)
{ {
int ret; int ret;
@ -1022,7 +1022,7 @@ static int lxc_attach_pty_mainloop_init(struct lxc_pty *pty,
return 0; return 0;
} }
static inline void lxc_attach_pty_close_master(struct lxc_pty *pty) static inline void lxc_attach_pty_close_master(struct lxc_terminal *pty)
{ {
if (pty->master < 0) if (pty->master < 0)
return; return;
@ -1031,7 +1031,7 @@ static inline void lxc_attach_pty_close_master(struct lxc_pty *pty)
pty->master = -EBADF; pty->master = -EBADF;
} }
static inline void lxc_attach_pty_close_slave(struct lxc_pty *pty) static inline void lxc_attach_pty_close_slave(struct lxc_terminal *pty)
{ {
if (pty->slave < 0) if (pty->slave < 0)
return; return;
@ -1040,7 +1040,7 @@ static inline void lxc_attach_pty_close_slave(struct lxc_pty *pty)
pty->slave = -EBADF; pty->slave = -EBADF;
} }
static inline void lxc_attach_pty_close_peer(struct lxc_pty *pty) static inline void lxc_attach_pty_close_peer(struct lxc_terminal *pty)
{ {
if (pty->peer < 0) if (pty->peer < 0)
return; return;
@ -1049,7 +1049,7 @@ static inline void lxc_attach_pty_close_peer(struct lxc_pty *pty)
pty->peer = -EBADF; pty->peer = -EBADF;
} }
static inline void lxc_attach_pty_close_log(struct lxc_pty *pty) static inline void lxc_attach_pty_close_log(struct lxc_terminal *pty)
{ {
if (pty->log_fd < 0) if (pty->log_fd < 0)
return; return;
@ -1068,7 +1068,7 @@ int lxc_attach(const char *name, const char *lxcpath,
signed long personality; signed long personality;
pid_t attached_pid, init_pid, pid; pid_t attached_pid, init_pid, pid;
struct lxc_proc_context_info *init_ctx; struct lxc_proc_context_info *init_ctx;
struct lxc_pty pty; struct lxc_terminal pty;
struct lxc_conf *conf; struct lxc_conf *conf;
struct attach_clone_payload payload = {0}; struct attach_clone_payload payload = {0};

View File

@ -1578,7 +1578,7 @@ static int setup_personality(int persona)
} }
static int lxc_setup_dev_console(const struct lxc_rootfs *rootfs, static int lxc_setup_dev_console(const struct lxc_rootfs *rootfs,
const struct lxc_pty *console) const struct lxc_terminal *console)
{ {
char path[MAXPATHLEN]; char path[MAXPATHLEN];
int ret, fd; int ret, fd;
@ -1634,7 +1634,7 @@ static int lxc_setup_dev_console(const struct lxc_rootfs *rootfs,
} }
static int lxc_setup_ttydir_console(const struct lxc_rootfs *rootfs, static int lxc_setup_ttydir_console(const struct lxc_rootfs *rootfs,
const struct lxc_pty *console, const struct lxc_terminal *console,
char *ttydir) char *ttydir)
{ {
int ret, fd; int ret, fd;
@ -1720,7 +1720,7 @@ static int lxc_setup_ttydir_console(const struct lxc_rootfs *rootfs,
} }
static int lxc_setup_console(const struct lxc_rootfs *rootfs, static int lxc_setup_console(const struct lxc_rootfs *rootfs,
const struct lxc_pty *console, char *ttydir) const struct lxc_terminal *console, char *ttydir)
{ {
if (!ttydir) if (!ttydir)

View File

@ -164,7 +164,7 @@ struct lxc_tty_state;
* @peer : the file descriptor put/get console traffic * @peer : the file descriptor put/get console traffic
* @name : the file name of the slave pty * @name : the file name of the slave pty
*/ */
struct lxc_pty { struct lxc_terminal {
int slave; int slave;
int master; int master;
int peer; int peer;
@ -314,7 +314,7 @@ struct lxc_conf {
struct lxc_tty_info tty_info; struct lxc_tty_info tty_info;
/* Comma-separated list of lxc.tty.max pty names. */ /* Comma-separated list of lxc.tty.max pty names. */
char *pty_names; char *pty_names;
struct lxc_pty console; struct lxc_terminal console;
struct lxc_rootfs rootfs; struct lxc_rootfs rootfs;
char *ttydir; char *ttydir;
int close_all_fds; int close_all_fds;

View File

@ -351,7 +351,7 @@ static int lxc_console_write_log_file(struct lxc_pty *console, char *buf,
int lxc_terminal_io_cb(int fd, uint32_t events, void *data, int lxc_terminal_io_cb(int fd, uint32_t events, void *data,
struct lxc_epoll_descr *descr) struct lxc_epoll_descr *descr)
{ {
struct lxc_pty *terminal = data; struct lxc_terminal *terminal = data;
char buf[LXC_TERMINAL_BUFFER_SIZE]; char buf[LXC_TERMINAL_BUFFER_SIZE];
int r, w, w_log, w_rbuf; int r, w, w_log, w_rbuf;
@ -407,7 +407,7 @@ int lxc_terminal_io_cb(int fd, uint32_t events, void *data,
return 0; return 0;
} }
static int lxc_terminal_mainloop_add_peer(struct lxc_pty *terminal) static int lxc_terminal_mainloop_add_peer(struct lxc_terminal *terminal)
{ {
int ret; int ret;
@ -434,7 +434,7 @@ static int lxc_terminal_mainloop_add_peer(struct lxc_pty *terminal)
} }
int lxc_terminal_mainloop_add(struct lxc_epoll_descr *descr, int lxc_terminal_mainloop_add(struct lxc_epoll_descr *descr,
struct lxc_pty *terminal) struct lxc_terminal *terminal)
{ {
int ret; int ret;
@ -509,7 +509,7 @@ int lxc_setup_tios(int fd, struct termios *oldtios)
return 0; return 0;
} }
static void lxc_terminal_peer_proxy_free(struct lxc_pty *terminal) static void lxc_terminal_peer_proxy_free(struct lxc_terminal *terminal)
{ {
if (terminal->tty_state) { if (terminal->tty_state) {
lxc_terminal_signal_fini(terminal->tty_state); lxc_terminal_signal_fini(terminal->tty_state);
@ -524,7 +524,7 @@ static void lxc_terminal_peer_proxy_free(struct lxc_pty *terminal)
terminal->peer = -1; terminal->peer = -1;
} }
static int lxc_terminal_peer_proxy_alloc(struct lxc_pty *terminal, int sockfd) static int lxc_terminal_peer_proxy_alloc(struct lxc_terminal *terminal, int sockfd)
{ {
struct termios oldtermio; struct termios oldtermio;
struct lxc_tty_state *ts; struct lxc_tty_state *ts;
@ -579,7 +579,7 @@ int lxc_terminal_allocate(struct lxc_conf *conf, int sockfd, int *ttyreq)
{ {
int masterfd = -1, ttynum; int masterfd = -1, ttynum;
struct lxc_tty_info *tty_info = &conf->tty_info; struct lxc_tty_info *tty_info = &conf->tty_info;
struct lxc_pty *terminal = &conf->console; struct lxc_terminal *terminal = &conf->console;
if (*ttyreq == 0) { if (*ttyreq == 0) {
if (lxc_terminal_peer_proxy_alloc(terminal, sockfd) < 0) if (lxc_terminal_peer_proxy_alloc(terminal, sockfd) < 0)
@ -621,7 +621,7 @@ void lxc_terminal_free(struct lxc_conf *conf, int fd)
{ {
int i; int i;
struct lxc_tty_info *tty_info = &conf->tty_info; struct lxc_tty_info *tty_info = &conf->tty_info;
struct lxc_pty *terminal = &conf->console; struct lxc_terminal *terminal = &conf->console;
for (i = 0; i < tty_info->nbtty; i++) { for (i = 0; i < tty_info->nbtty; i++) {
if (tty_info->pty_info[i].busy == fd) if (tty_info->pty_info[i].busy == fd)
@ -634,7 +634,7 @@ void lxc_terminal_free(struct lxc_conf *conf, int fd)
} }
} }
static int lxc_terminal_peer_default(struct lxc_pty *terminal) static int lxc_terminal_peer_default(struct lxc_terminal *terminal)
{ {
struct lxc_tty_state *ts; struct lxc_tty_state *ts;
const char *path = terminal->path; const char *path = terminal->path;
@ -703,7 +703,7 @@ out:
return ret; return ret;
} }
int lxc_terminal_write_ringbuffer(struct lxc_pty *terminal) int lxc_terminal_write_ringbuffer(struct lxc_terminal *terminal)
{ {
char *r_addr; char *r_addr;
ssize_t ret; ssize_t ret;
@ -734,7 +734,7 @@ int lxc_terminal_write_ringbuffer(struct lxc_pty *terminal)
return 0; return 0;
} }
void lxc_terminal_delete(struct lxc_pty *terminal) void lxc_terminal_delete(struct lxc_terminal *terminal)
{ {
int ret; int ret;
@ -772,7 +772,7 @@ void lxc_terminal_delete(struct lxc_pty *terminal)
* register a handler for the terminal's masterfd when we create the mainloop * register a handler for the terminal's masterfd when we create the mainloop
* the terminal handler needs to see an allocated ringbuffer. * the terminal handler needs to see an allocated ringbuffer.
*/ */
static int lxc_terminal_create_ringbuf(struct lxc_pty *terminal) static int lxc_terminal_create_ringbuf(struct lxc_terminal *terminal)
{ {
int ret; int ret;
struct lxc_ringbuf *buf = &terminal->ringbuf; struct lxc_ringbuf *buf = &terminal->ringbuf;
@ -818,7 +818,7 @@ static int lxc_terminal_create_ringbuf(struct lxc_pty *terminal)
* This is the terminal log file. Please note that the terminal log file is * This is the terminal log file. Please note that the terminal log file is
* (implementation wise not content wise) independent of the terminal ringbuffer. * (implementation wise not content wise) independent of the terminal ringbuffer.
*/ */
int lxc_terminal_create_log_file(struct lxc_pty *terminal) int lxc_terminal_create_log_file(struct lxc_terminal *terminal)
{ {
if (!terminal->log_path) if (!terminal->log_path)
return 0; return 0;
@ -833,7 +833,7 @@ int lxc_terminal_create_log_file(struct lxc_pty *terminal)
return 0; return 0;
} }
int lxc_terminal_create(struct lxc_pty *terminal) int lxc_terminal_create(struct lxc_terminal *terminal)
{ {
int ret, saved_errno; int ret, saved_errno;
@ -873,7 +873,7 @@ err:
int lxc_terminal_setup(struct lxc_conf *conf) int lxc_terminal_setup(struct lxc_conf *conf)
{ {
int ret; int ret;
struct lxc_pty *terminal = &conf->console; struct lxc_terminal *terminal = &conf->console;
if (terminal->path && !strcmp(terminal->path, "none")) { if (terminal->path && !strcmp(terminal->path, "none")) {
INFO("No terminal was requested"); INFO("No terminal was requested");
@ -1136,7 +1136,7 @@ void lxc_terminal_info_init(struct lxc_pty_info *pty)
pty->busy = -1; pty->busy = -1;
} }
void lxc_terminal_init(struct lxc_pty *pty) void lxc_terminal_init(struct lxc_terminal *pty)
{ {
memset(pty, 0, sizeof(*pty)); memset(pty, 0, sizeof(*pty));
pty->slave = -EBADF; pty->slave = -EBADF;
@ -1146,7 +1146,7 @@ void lxc_terminal_init(struct lxc_pty *pty)
lxc_terminal_info_init(&pty->peerpty); lxc_terminal_info_init(&pty->peerpty);
} }
void lxc_terminal_conf_free(struct lxc_pty *terminal) void lxc_terminal_conf_free(struct lxc_terminal *terminal)
{ {
free(terminal->log_path); free(terminal->log_path);
free(terminal->path); free(terminal->path);
@ -1154,7 +1154,7 @@ void lxc_terminal_conf_free(struct lxc_pty *terminal)
lxc_ringbuf_release(&terminal->ringbuf); lxc_ringbuf_release(&terminal->ringbuf);
} }
int lxc_terminal_map_ids(struct lxc_conf *c, struct lxc_pty *pty) int lxc_terminal_map_ids(struct lxc_conf *c, struct lxc_terminal *pty)
{ {
int ret; int ret;

View File

@ -82,7 +82,7 @@ extern int lxc_terminal_allocate(struct lxc_conf *conf, int sockfd, int *ttynum
* automatically chowned to the uid/gid of the unprivileged user. For this * automatically chowned to the uid/gid of the unprivileged user. For this
* ttys_shift_ids() can be called.) * ttys_shift_ids() can be called.)
*/ */
extern int lxc_terminal_create(struct lxc_pty *console); extern int lxc_terminal_create(struct lxc_terminal *console);
/** /**
* lxc_terminal_setup: Create a new pty. * lxc_terminal_setup: Create a new pty.
@ -98,7 +98,7 @@ extern int lxc_terminal_setup(struct lxc_conf *);
* /dev/tty) * /dev/tty)
* Registered handlers in a mainloop are not automatically deleted. * Registered handlers in a mainloop are not automatically deleted.
*/ */
extern void lxc_terminal_delete(struct lxc_pty *); extern void lxc_terminal_delete(struct lxc_terminal *);
/* /*
* lxc_terminal_free: mark the console or a tty as unallocated, free any * lxc_terminal_free: mark the console or a tty as unallocated, free any
@ -114,7 +114,7 @@ extern void lxc_terminal_free(struct lxc_conf *conf, int fd);
/* /*
* Register pty event handlers in an open mainloop * Register pty event handlers in an open mainloop
*/ */
extern int lxc_terminal_mainloop_add(struct lxc_epoll_descr *, struct lxc_pty *); extern int lxc_terminal_mainloop_add(struct lxc_epoll_descr *, struct lxc_terminal *);
/* /*
* Handle SIGWINCH events on the allocated ptys. * Handle SIGWINCH events on the allocated ptys.
@ -227,16 +227,16 @@ extern int lxc_terminal_signalfd_cb(int fd, uint32_t events, void *cbdata,
*/ */
extern void lxc_terminal_signal_fini(struct lxc_tty_state *ts); extern void lxc_terminal_signal_fini(struct lxc_tty_state *ts);
extern int lxc_terminal_write_ringbuffer(struct lxc_pty *console); extern int lxc_terminal_write_ringbuffer(struct lxc_terminal *console);
extern int lxc_terminal_create_log_file(struct lxc_pty *console); extern int lxc_terminal_create_log_file(struct lxc_terminal *console);
extern int lxc_terminal_io_cb(int fd, uint32_t events, void *data, extern int lxc_terminal_io_cb(int fd, uint32_t events, void *data,
struct lxc_epoll_descr *descr); struct lxc_epoll_descr *descr);
extern int lxc_make_controlling_pty(int fd); extern int lxc_make_controlling_pty(int fd);
extern int lxc_login_pty(int fd); extern int lxc_login_pty(int fd);
extern void lxc_terminal_conf_free(struct lxc_pty *console); extern void lxc_terminal_conf_free(struct lxc_terminal *console);
extern void lxc_terminal_info_init(struct lxc_pty_info *pty); extern void lxc_terminal_info_init(struct lxc_pty_info *pty);
extern void lxc_terminal_init(struct lxc_pty *pty); extern void lxc_terminal_init(struct lxc_terminal *pty);
extern int lxc_terminal_map_ids(struct lxc_conf *c, struct lxc_pty *pty); extern int lxc_terminal_map_ids(struct lxc_conf *c, struct lxc_terminal *pty);
#endif #endif

View File

@ -529,7 +529,7 @@ int lxc_poll(const char *name, struct lxc_handler *handler)
} }
if (has_console) { if (has_console) {
struct lxc_pty *console = &handler->conf->console; struct lxc_terminal *console = &handler->conf->console;
ret = lxc_terminal_mainloop_add(&descr, console); ret = lxc_terminal_mainloop_add(&descr, console);
if (ret < 0) { if (ret < 0) {