The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/3454
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com>
From 104eeedbbe98d51fa60fe3d951907f09baa0f929 Mon Sep 17 00:00:00 2001 From: Christian Brauner <christian.brau...@ubuntu.com> Date: Fri, 19 Jun 2020 23:54:07 +0200 Subject: [PATCH 1/4] openpty: adapt variable naming Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com> --- src/include/openpty.c | 28 ++++++++++++++-------------- src/include/openpty.h | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/include/openpty.c b/src/include/openpty.c index 01579c517a..7804d4c983 100644 --- a/src/include/openpty.c +++ b/src/include/openpty.c @@ -34,43 +34,43 @@ #define _PATH_DEVPTMX "/dev/ptmx" -int openpty (int *amaster, int *aslave, char *name, struct termios *termp, +int openpty (int *aptmx, int *apts, char *name, struct termios *termp, struct winsize *winp) { char buf[PATH_MAX]; - int master, slave; + int ptmx, pts; - master = open(_PATH_DEVPTMX, O_RDWR); - if (master == -1) + ptmx = open(_PATH_DEVPTMX, O_RDWR); + if (ptmx == -1) return -1; - if (grantpt(master)) + if (grantpt(ptmx)) goto fail; - if (unlockpt(master)) + if (unlockpt(ptmx)) goto fail; - if (ptsname_r(master, buf, sizeof buf)) + if (ptsname_r(ptmx, buf, sizeof buf)) goto fail; - slave = open(buf, O_RDWR | O_NOCTTY); - if (slave == -1) + pts = open(buf, O_RDWR | O_NOCTTY); + if (pts == -1) goto fail; /* XXX Should we ignore errors here? */ if (termp) - tcsetattr(slave, TCSAFLUSH, termp); + tcsetattr(pts, TCSAFLUSH, termp); if (winp) - ioctl(slave, TIOCSWINSZ, winp); + ioctl(pts, TIOCSWINSZ, winp); - *amaster = master; - *aslave = slave; + *aptmx = ptmx; + *apts = pts; if (name != NULL) strcpy(name, buf); return 0; fail: - close(master); + close(ptmx); return -1; } diff --git a/src/include/openpty.h b/src/include/openpty.h index 6e7bf8d2d1..607268e07c 100644 --- a/src/include/openpty.h +++ b/src/include/openpty.h @@ -27,10 +27,10 @@ #include <termios.h> #include <sys/ioctl.h> -/* Create pseudo tty master slave pair with NAME and set terminal +/* Create pseudo tty ptmx pts pair with NAME and set terminal attributes according to TERMP and WINP and return handles for both ends in AMASTER and ASLAVE. */ -extern int openpty (int *__amaster, int *__aslave, char *__name, +extern int openpty (int *__aptmx, int *__apts, char *__name, const struct termios *__termp, const struct winsize *__winp); From cc7d84da9343bc51b042f9d4ba14c1fb729ffc39 Mon Sep 17 00:00:00 2001 From: Christian Brauner <christian.brau...@ubuntu.com> Date: Fri, 19 Jun 2020 23:55:56 +0200 Subject: [PATCH 2/4] CODING_STYLE: adapt code example Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com> --- CODING_STYLE.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/CODING_STYLE.md b/CODING_STYLE.md index 6e2ad8562a..bf8b304a52 100644 --- a/CODING_STYLE.md +++ b/CODING_STYLE.md @@ -733,11 +733,11 @@ __do_closedir __attribute__((__cleanup__(__auto_closedir__))) ``` For example: ```c -void remount_all_slave(void) +void turn_into_dependent_mounts(void) { __do_free char *line = NULL; __do_fclose FILE *f = NULL; - __do_close_prot_errno int memfd = -EBADF, mntinfo_fd = -EBADF; + __do_close int memfd = -EBADF, mntinfo_fd = -EBADF; int ret; ssize_t copied; size_t len = 0; @@ -780,7 +780,7 @@ again: return; } - f = fdopen(memfd, "r"); + f = fdopen(memfd, "re"); if (!f) { SYSERROR("Failed to open copy of \"/proc/self/mountinfo\" to mark all shared. Continuing"); return; @@ -810,12 +810,11 @@ again: null_endofword(target); ret = mount(NULL, target, NULL, MS_SLAVE, NULL); if (ret < 0) { - SYSERROR("Failed to make \"%s\" MS_SLAVE", target); - ERROR("Continuing..."); + SYSERROR("Failed to recursively turn old root mount tree into dependent mount. Continuing..."); continue; } - TRACE("Remounted \"%s\" as MS_SLAVE", target); + TRACE("Recursively turned old root mount tree into dependent mount"); } - TRACE("Remounted all mount table entries as MS_SLAVE"); + TRACE("Turned all mount table entries into dependent mount"); } ``` From 9f79cafd0523ffe608df24f083009ab488a82d27 Mon Sep 17 00:00:00 2001 From: Christian Brauner <christian.brau...@ubuntu.com> Date: Fri, 19 Jun 2020 23:58:15 +0200 Subject: [PATCH 3/4] doc: update terminology Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com> --- doc/ja/lxc.container.conf.sgml.in | 20 ++++++++++---------- doc/lxc.container.conf.sgml.in | 18 +++++++++--------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/doc/ja/lxc.container.conf.sgml.in b/doc/ja/lxc.container.conf.sgml.in index 91111a2223..7a65e3fe4c 100644 --- a/doc/ja/lxc.container.conf.sgml.in +++ b/doc/ja/lxc.container.conf.sgml.in @@ -713,25 +713,25 @@ by KATOH Yasufumi <karma at jazz.email.ne.jp> modes are <option>l3</option>, <option>l3s</option> and <option>l2</option>. It defaults to <option>l3</option> mode. In <option>l3</option> mode TX processing up to L3 happens on the stack instance - attached to the slave device and packets are switched to the stack instance of the - master device for the L2 processing and routing from that instance will be - used before packets are queued on the outbound device. In this mode the slaves + attached to the dependent device and packets are switched to the stack instance of the + parent device for the L2 processing and routing from that instance will be + used before packets are queued on the outbound device. In this mode the dependent devices will not receive nor can send multicast / broadcast traffic. In <option>l3s</option> mode TX processing is very similar to the L3 mode except that iptables (conn-tracking) works in this mode and hence it is L3-symmetric (L3s). This will have slightly less performance but that shouldn't matter since you are choosing this mode over plain-L3 mode to make conn-tracking work. In <option>l2</option> mode TX processing happens on the stack instance attached to - the slave device and packets are switched and queued to the master device to send - out. In this mode the slaves will RX/TX multicast and broadcast (if applicable) as well. + the dependent device and packets are switched and queued to the parent device to send + out. In this mode the dependent devices will RX/TX multicast and broadcast (if applicable) as well. <option>lxc.net.[i].ipvlan.isolation</option> specifies the isolation mode. The accepted isolation values are <option>bridge</option>, <option>private</option> and <option>vepa</option>. It defaults to <option>bridge</option>. - In <option>bridge</option> isolation mode slaves can cross-talk among themselves - apart from talking through the master device. + In <option>bridge</option> isolation mode dependent devices can cross-talk among themselves + apart from talking through the parent device. In <option>private</option> isolation mode the port is set in private mode. - i.e. port won't allow cross communication between slaves. + i.e. port won't allow cross communication between dependent devices. In <option>vepa</option> isolation mode the port is set in VEPA mode. i.e. port will offload switching functionality to the external entity as described in 802.1Qbg. @@ -1548,7 +1548,7 @@ by KATOH Yasufumi <karma at jazz.email.ne.jp> fstab フォーマットの一行と同じフォーマットのマウントポイントの指定をします。 <!-- - Moreover lxc supports mount propagation, such as rslave or + Moreover lxc supports mount propagation, such as rshared or rprivate, and adds three additional mount options. <option>optional</option> don't fail if mount does not work. <option>create=dir</option> or <option>create=file</option> @@ -1556,7 +1556,7 @@ by KATOH Yasufumi <karma at jazz.email.ne.jp> <option>relative</option> source path is taken to be relative to the mounted container root. For instance, --> - 加えて、LXC では rslave や rprivate といったマウント・プロパゲーションオプションと、独自の 3 つのマウントオプションが使えます。 + 加えて、LXC では rshared や rprivate といったマウント・プロパゲーションオプションと、独自の 3 つのマウントオプションが使えます。 <option>optional</option> は、マウントが失敗しても失敗を返さずに無視します。 <option>create=dir</option> と <option>create=file</option> は、マウントポイントをマウントする際にディレクトリもしくはファイルを作成します。 <option>relative</option> を指定すると、マウントされたコンテナルートからの相対パスとして取得されます。 diff --git a/doc/lxc.container.conf.sgml.in b/doc/lxc.container.conf.sgml.in index 7b0099d3af..740a02f339 100644 --- a/doc/lxc.container.conf.sgml.in +++ b/doc/lxc.container.conf.sgml.in @@ -536,25 +536,25 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA modes are <option>l3</option>, <option>l3s</option> and <option>l2</option>. It defaults to <option>l3</option> mode. In <option>l3</option> mode TX processing up to L3 happens on the stack instance - attached to the slave device and packets are switched to the stack instance of the - master device for the L2 processing and routing from that instance will be - used before packets are queued on the outbound device. In this mode the slaves + attached to the dependent device and packets are switched to the stack instance of the + parent device for the L2 processing and routing from that instance will be + used before packets are queued on the outbound device. In this mode the dependent devices will not receive nor can send multicast / broadcast traffic. In <option>l3s</option> mode TX processing is very similar to the L3 mode except that iptables (conn-tracking) works in this mode and hence it is L3-symmetric (L3s). This will have slightly less performance but that shouldn't matter since you are choosing this mode over plain-L3 mode to make conn-tracking work. In <option>l2</option> mode TX processing happens on the stack instance attached to - the slave device and packets are switched and queued to the master device to send - out. In this mode the slaves will RX/TX multicast and broadcast (if applicable) as well. + the dependent device and packets are switched and queued to the parent device to send devices + out. In this mode the dependent devices will RX/TX multicast and broadcast (if applicable) as well. <option>lxc.net.[i].ipvlan.isolation</option> specifies the isolation mode. The accepted isolation values are <option>bridge</option>, <option>private</option> and <option>vepa</option>. It defaults to <option>bridge</option>. - In <option>bridge</option> isolation mode slaves can cross-talk among themselves - apart from talking through the master device. + In <option>bridge</option> isolation mode dependent devices can cross-talk among themselves + apart from talking through the parent device. In <option>private</option> isolation mode the port is set in private mode. - i.e. port won't allow cross communication between slaves. + i.e. port won't allow cross communication between dependent devices. In <option>vepa</option> isolation mode the port is set in VEPA mode. i.e. port will offload switching functionality to the external entity as described in 802.1Qbg. @@ -1170,7 +1170,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Specify a mount point corresponding to a line in the fstab format. - Moreover lxc supports mount propagation, such as rslave or + Moreover lxc supports mount propagation, such as rshared or rprivate, and adds three additional mount options. <option>optional</option> don't fail if mount does not work. <option>create=dir</option> or <option>create=file</option> From c177ccba9db4d3058d73ec58d4854b4d77adf753 Mon Sep 17 00:00:00 2001 From: Christian Brauner <christian.brau...@ubuntu.com> Date: Fri, 19 Jun 2020 23:59:46 +0200 Subject: [PATCH 4/4] test: update terminology Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com> --- src/tests/console.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/tests/console.c b/src/tests/console.c index c0ad160330..c88f4329bf 100644 --- a/src/tests/console.c +++ b/src/tests/console.c @@ -37,14 +37,14 @@ } while (0) static void test_console_close_all(int ttyfd[MAXCONSOLES], - int masterfd[MAXCONSOLES]) + int ptmxfd[MAXCONSOLES]) { int i; for (i = 0; i < MAXCONSOLES; i++) { - if (masterfd[i] != -1) { - close(masterfd[i]); - masterfd[i] = -1; + if (ptmxfd[i] != -1) { + close(ptmxfd[i]); + ptmxfd[i] = -1; } if (ttyfd[i] != -1) { @@ -59,14 +59,14 @@ static int test_console_running_container(struct lxc_container *c) int nrconsoles, i, ret = -1; int ttynum [MAXCONSOLES]; int ttyfd [MAXCONSOLES]; - int masterfd[MAXCONSOLES]; + int ptmxfd[MAXCONSOLES]; for (i = 0; i < MAXCONSOLES; i++) - ttynum[i] = ttyfd[i] = masterfd[i] = -1; + ttynum[i] = ttyfd[i] = ptmxfd[i] = -1; ttynum[0] = 1; - ret = c->console_getfd(c, &ttynum[0], &masterfd[0]); + ret = c->console_getfd(c, &ttynum[0], &ptmxfd[0]); if (ret < 0) { TSTERR("console allocate failed"); goto err1; @@ -79,12 +79,12 @@ static int test_console_running_container(struct lxc_container *c) } /* attempt to alloc same ttynum */ - ret = c->console_getfd(c, &ttynum[0], &masterfd[1]); + ret = c->console_getfd(c, &ttynum[0], &ptmxfd[1]); if (ret != -1) { TSTERR("console allocate should fail for allocated ttynum %d", ttynum[0]); goto err2; } - close(masterfd[0]); masterfd[0] = -1; + close(ptmxfd[0]); ptmxfd[0] = -1; close(ttyfd[0]); ttyfd[0] = -1; /* ensure we can allocate all consoles, we do this a few times to @@ -92,7 +92,7 @@ static int test_console_running_container(struct lxc_container *c) */ for (i = 0; i < 10; i++) { for (nrconsoles = 0; nrconsoles < MAXCONSOLES; nrconsoles++) { - ret = c->console_getfd(c, &ttynum[nrconsoles], &masterfd[nrconsoles]); + ret = c->console_getfd(c, &ttynum[nrconsoles], &ptmxfd[nrconsoles]); if (ret < 0) break; ttyfd[nrconsoles] = ret; @@ -103,13 +103,13 @@ static int test_console_running_container(struct lxc_container *c) goto err2; } - test_console_close_all(ttyfd, masterfd); + test_console_close_all(ttyfd, ptmxfd); } ret = 0; err2: - test_console_close_all(ttyfd, masterfd); + test_console_close_all(ttyfd, ptmxfd); err1: return ret;
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel