[lxc-devel] [lxc/lxc] cb3fc9: cgroups/devices: enable devpath semantics for cgro...

2019-12-07 Thread Stéphane Graber
  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: cb3fc90ced191ec2558e02eeb6dc3b03f246d474
  https://github.com/lxc/lxc/commit/cb3fc90ced191ec2558e02eeb6dc3b03f246d474
  Author: Christian Brauner 
  Date:   2019-12-08 (Sun, 08 Dec 2019)

  Changed paths:
M src/lxc/cgroups/cgfsng.c

  Log Message:
  ---
  cgroups/devices: enable devpath semantics for cgroup2 device controller

Signed-off-by: Christian Brauner 


  Commit: 296235945609ca795efc78332333defeac11559e
  https://github.com/lxc/lxc/commit/296235945609ca795efc78332333defeac11559e
  Author: Stéphane Graber 
  Date:   2019-12-07 (Sat, 07 Dec 2019)

  Changed paths:
M src/lxc/cgroups/cgfsng.c

  Log Message:
  ---
  Merge pull request #3218 from brauner/bpf_devices_devpath

cgroups/devices: enable devpath semantics for cgroup2 device controller


Compare: https://github.com/lxc/lxc/compare/7453799ad70e...296235945609
___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel


[lxc-devel] [lxd/master] Storage fixes on the way to removing old drivers

2019-12-07 Thread stgraber on Github
The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6573

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) ===

From 574fcef04e767595bdd647a168c60b9127b2bf84 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= 
Date: Sat, 7 Dec 2019 20:35:27 -0500
Subject: [PATCH 1/8] tests: Remove pointless loop/check
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber 
---
 test/suites/storage_local_volume_handling.sh | 75 ++--
 1 file changed, 36 insertions(+), 39 deletions(-)

diff --git a/test/suites/storage_local_volume_handling.sh 
b/test/suites/storage_local_volume_handling.sh
index 12cf50a186..fa5805f9c6 100644
--- a/test/suites/storage_local_volume_handling.sh
+++ b/test/suites/storage_local_volume_handling.sh
@@ -49,50 +49,47 @@ test_storage_local_volume_handling() {
 #  zfs   |   x   |   x   |   x   |   x   |   x   |
 # ---|---|---|---|---|---|
 
-for driver in "btrfs" "ceph" "dir" "lvm" "zfs"; do
-  if [ "$lxd_backend" = "$driver" ]; then
-pool_opts=
+driver="${lxd_backend}"
+pool_opts=
 
-if [ "$driver" = "btrfs" ] || [ "$driver" = "zfs" ]; then
-  pool_opts="size=100GB"
-fi
+if [ "$driver" = "btrfs" ] || [ "$driver" = "zfs" ]; then
+  pool_opts="size=100GB"
+fi
 
-if [ "$driver" = "ceph" ]; then
-  pool_opts="volume.size=25MB ceph.osd.pg_num=1"
-fi
+if [ "$driver" = "ceph" ]; then
+  pool_opts="volume.size=25MB ceph.osd.pg_num=1"
+fi
 
-if [ "$driver" = "lvm" ]; then
-  pool_opts="volume.size=25MB"
-fi
+if [ "$driver" = "lvm" ]; then
+  pool_opts="volume.size=25MB"
+fi
 
-if [ -n "${pool_opts}" ]; then
-  # shellcheck disable=SC2086
-  lxc storage create "lxdtest-$(basename "${LXD_DIR}")-${driver}1" 
"${driver}" $pool_opts
-else
-  lxc storage create "lxdtest-$(basename "${LXD_DIR}")-${driver}1" 
"${driver}"
-fi
+if [ -n "${pool_opts}" ]; then
+  # shellcheck disable=SC2086
+  lxc storage create "lxdtest-$(basename "${LXD_DIR}")-${driver}1" 
"${driver}" $pool_opts
+else
+  lxc storage create "lxdtest-$(basename "${LXD_DIR}")-${driver}1" 
"${driver}"
+fi
 
-lxc storage volume create "lxdtest-$(basename "${LXD_DIR}")-${driver}" 
vol1
-# This will create the snapshot vol1/snap0
-lxc storage volume snapshot "lxdtest-$(basename 
"${LXD_DIR}")-${driver}" vol1
-# Copy volume with snapshots
-lxc storage volume copy "lxdtest-$(basename 
"${LXD_DIR}")-${driver}/vol1" "lxdtest-$(basename "${LXD_DIR}")-${driver}1/vol1"
-# Ensure the target snapshot is there
-lxc storage volume show "lxdtest-$(basename "${LXD_DIR}")-${driver}1" 
vol1/snap0
-# Copy volume only
-lxc storage volume copy --volume-only "lxdtest-$(basename 
"${LXD_DIR}")-${driver}/vol1" "lxdtest-$(basename "${LXD_DIR}")-${driver}1/vol2"
-# Copy snapshot to volume
-lxc storage volume copy "lxdtest-$(basename 
"${LXD_DIR}")-${driver}/vol1/snap0" "lxdtest-$(basename 
"${LXD_DIR}")-${driver}1/vol3"
-lxc storage volume delete "lxdtest-$(basename 
"${LXD_DIR}")-${driver}1" vol1
-lxc storage volume delete "lxdtest-$(basename 
"${LXD_DIR}")-${driver}1" vol2
-lxc storage volume delete "lxdtest-$(basename 
"${LXD_DIR}")-${driver}1" vol3
-lxc storage volume move "lxdtest-$(basename 
"${LXD_DIR}")-${driver}/vol1" "lxdtest-$(basename "${LXD_DIR}")-${driver}1/vol1"
-! lxc storage volume show "lxdtest-$(basename "${LXD_DIR}")-${driver}" 
vol1 || false
-lxc storage volume show "lxdtest-$(basename "${LXD_DIR}")-${driver}1" 
vol1
-lxc storage volume delete "lxdtest-$(basename 
"${LXD_DIR}")-${driver}1" vol1
-lxc storage delete "lxdtest-$(basename "${LXD_DIR}")-${driver}1"
-  fi
-done
+lxc storage volume create "lxdtest-$(basename "${LXD_DIR}")-${driver}" vol1
+# This will create the snapshot vol1/snap0
+lxc storage volume snapshot "lxdtest-$(basename "${LXD_DIR}")-${driver}" 
vol1
+# Copy volume with snapshots
+lxc storage volume copy "lxdtest-$(basename "${LXD_DIR}")-${driver}/vol1" 
"lxdtest-$(basename "${LXD_DIR}")-${driver}1/vol1"
+# Ensure the target snapshot is there
+lxc storage volume show "lxdtest-$(basename "${LXD_DIR}")-${driver}1" 
vol1/snap0
+# Copy volume only
+lxc storage volume copy --volume-only "lxdtest-$(basename 
"${LXD_DIR}")-${driver}/vol1" "lxdtest-$(basename "${LXD_DIR}")-${driver}1/vol2"
+# Copy snapshot to volume
+lxc storage volume copy "lxdtest-$(basename 
"${LXD_DIR}")-${driver}/vol1/snap0" "lxdtest-$(basename 
"${LXD_DIR}")-${driver}

[lxc-devel] [lxc/lxc] 7cac34: log: rearrange

2019-12-07 Thread Christian Brauner
  Branch: refs/heads/stable-3.0
  Home:   https://github.com/lxc/lxc
  Commit: 7cac3403a885bcccebc50f9bad895d1b028110c7
  https://github.com/lxc/lxc/commit/7cac3403a885bcccebc50f9bad895d1b028110c7
  Author: Christian Brauner 
  Date:   2019-12-08 (Sun, 08 Dec 2019)

  Changed paths:
M src/lxc/log.h

  Log Message:
  ---
  log: rearrange

Signed-off-by: Christian Brauner 


  Commit: 3ed47250b322182cce212c191a069b131aa11e27
  https://github.com/lxc/lxc/commit/3ed47250b322182cce212c191a069b131aa11e27
  Author: Christian Brauner 
  Date:   2019-12-08 (Sun, 08 Dec 2019)

  Changed paths:
M src/lxc/macro.h

  Log Message:
  ---
  macro: add ret_errno()

Signed-off-by: Christian Brauner 


  Commit: fa85bdaa23990bac7d69b7599f2e336578703522
  https://github.com/lxc/lxc/commit/fa85bdaa23990bac7d69b7599f2e336578703522
  Author: Christian Brauner 
  Date:   2019-12-08 (Sun, 08 Dec 2019)

  Changed paths:
M src/lxc/af_unix.c

  Log Message:
  ---
  af_unix: s/minus_one_set_errno(/ret_set_errno(-1, /g

Signed-off-by: Christian Brauner 


  Commit: ad9fbcc46e8e8878786bad65102d5d7fcdb51549
  https://github.com/lxc/lxc/commit/ad9fbcc46e8e8878786bad65102d5d7fcdb51549
  Author: Christian Brauner 
  Date:   2019-12-08 (Sun, 08 Dec 2019)

  Changed paths:
M src/lxc/attach.c

  Log Message:
  ---
  attach: s/minus_one_set_errno(/ret_set_errno(-1, /g

Signed-off-by: Christian Brauner 


  Commit: 17809bcf82af9bf1672159e7d914d1b3431a308c
  https://github.com/lxc/lxc/commit/17809bcf82af9bf1672159e7d914d1b3431a308c
  Author: Christian Brauner 
  Date:   2019-12-08 (Sun, 08 Dec 2019)

  Changed paths:
M src/lxc/commands.c

  Log Message:
  ---
  commands: replace logging helpers

s/error_log_errno(/log_error_errno(-1, /g
s/minus_one_set_errno(/ret_set_errno(-1, /g

Signed-off-by: Christian Brauner 


  Commit: 71fac4fb5427817fe8020655b361c7ec680de76c
  https://github.com/lxc/lxc/commit/71fac4fb5427817fe8020655b361c7ec680de76c
  Author: Christian Brauner 
  Date:   2019-12-08 (Sun, 08 Dec 2019)

  Changed paths:
M src/lxc/network.c

  Log Message:
  ---
  network: replace logging helpers

s/error_log_errno(/log_error_errno(-1, /g
s/minus_one_set_errno(/ret_set_errno(-1, /g

Signed-off-by: Christian Brauner 


  Commit: 6d9a9f085c4f2acd8bd787396f5295a8b2d6b7e3
  https://github.com/lxc/lxc/commit/6d9a9f085c4f2acd8bd787396f5295a8b2d6b7e3
  Author: Christian Brauner 
  Date:   2019-12-08 (Sun, 08 Dec 2019)

  Changed paths:
M src/lxc/confile.c

  Log Message:
  ---
  confile: replace logging helpers

Signed-off-by: Christian Brauner 


  Commit: c00683a49d00ae3131fa34682415dd0c0c0c9929
  https://github.com/lxc/lxc/commit/c00683a49d00ae3131fa34682415dd0c0c0c9929
  Author: Christian Brauner 
  Date:   2019-12-08 (Sun, 08 Dec 2019)

  Changed paths:
M src/lxc/cgroups/cgfsng.c

  Log Message:
  ---
  cgroups/cgfsng: replace logging functions

Signed-off-by: Christian Brauner 


  Commit: 56e96489da2f0557911aae833b935e2594d9e713
  https://github.com/lxc/lxc/commit/56e96489da2f0557911aae833b935e2594d9e713
  Author: Christian Brauner 
  Date:   2019-12-08 (Sun, 08 Dec 2019)

  Changed paths:
M src/lxc/cgroups/cgroup.c

  Log Message:
  ---
  cgroups/cgroup: replace logging functions

Signed-off-by: Christian Brauner 


  Commit: 093469d725a4522e2150551a492522913f4e9dbb
  https://github.com/lxc/lxc/commit/093469d725a4522e2150551a492522913f4e9dbb
  Author: Christian Brauner 
  Date:   2019-12-08 (Sun, 08 Dec 2019)

  Changed paths:
M src/lxc/cgroups/cgroup2_devices.c

  Log Message:
  ---
  cgroups/cgroup2_devices: replace logging functions

Signed-off-by: Christian Brauner 


  Commit: b53314a68a91a8ed5e2fdbc263ecbafbfe76b7ed
  https://github.com/lxc/lxc/commit/b53314a68a91a8ed5e2fdbc263ecbafbfe76b7ed
  Author: Christian Brauner 
  Date:   2019-12-08 (Sun, 08 Dec 2019)

  Changed paths:
M src/lxc/cgroups/cgfsng.c
M src/lxc/cgroups/cgroup.h

  Log Message:
  ---
  cgroups: rework return values of some functions

Signed-off-by: Christian Brauner 


  Commit: e35dec01637f957e9cfaa7fac940804926a41ee4
  https://github.com/lxc/lxc/commit/e35dec01637f957e9cfaa7fac940804926a41ee4
  Author: Christian Brauner 
  Date:   2019-12-08 (Sun, 08 Dec 2019)

  Changed paths:
M src/lxc/log.h
M src/lxc/macro.h

  Log Message:
  ---
  {log, macro}: remove unused logging functions

Signed-off-by: Christian Brauner 


  Commit: b7e685d6d806a741db5b0a64f34f3d0a077f3908
  https://github.com/lxc/lxc/commit/b7e685d6d806a741db5b0a64f34f3d0a077f3908
  Author: Christian Brauner 
  Date:   2019-12-08 (Sun, 08 Dec 2019)

  Changed paths:
M src/lxc/compiler.h

  Log Message:
  ---
  compiler: add __unused attribute

Signed-off-by: Christian Brauner 


  Commit: 40354e5a8e317ebc8c2270dc7de074dde40f55ea
  https://github.com/lxc/lxc/commit/40354e5a8e317ebc8c2270d

[lxc-devel] [lxc/master] cgroups/devices: enable devpath semantics for cgroup2 device controller

2019-12-07 Thread brauner on Github
The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/3218

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 
From 22175a0eaba67b34c3d6534b16b32a8e21ffe026 Mon Sep 17 00:00:00 2001
From: Christian Brauner 
Date: Sun, 8 Dec 2019 01:58:24 +0100
Subject: [PATCH] cgroups/devices: enable devpath semantics for cgroup2 device
 controller

Signed-off-by: Christian Brauner 
---
 src/lxc/cgroups/cgfsng.c | 122 ---
 1 file changed, 74 insertions(+), 48 deletions(-)

diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c
index 01b6f57131..113cf98369 100644
--- a/src/lxc/cgroups/cgfsng.c
+++ b/src/lxc/cgroups/cgfsng.c
@@ -2394,6 +2394,31 @@ __cgfsng_ops static int cgfsng_get(struct cgroup_ops 
*ops, const char *filename,
return ret;
 }
 
+static int device_cgroup_parse_access(struct device_item *device, const char 
*val)
+{
+   for (int count = 0; count < 3; count++, val++) {
+   switch (*val) {
+   case 'r':
+   device->access[count] = *val;
+   break;
+   case 'w':
+   device->access[count] = *val;
+   break;
+   case 'm':
+   device->access[count] = *val;
+   break;
+   case '\n':
+   case '\0':
+   count = 3;
+   break;
+   default:
+   return ret_errno(EINVAL);
+   }
+   }
+
+   return 0;
+}
+
 static int device_cgroup_rule_parse(struct device_item *device, const char 
*key,
const char *val)
 {
@@ -2476,27 +2501,8 @@ static int device_cgroup_rule_parse(struct device_item 
*device, const char *key,
}
if (!isspace(*val))
return -1;
-   for (val++, count = 0; count < 3; count++, val++) {
-   switch (*val) {
-   case 'r':
-   device->access[count] = *val;
-   break;
-   case 'w':
-   device->access[count] = *val;
-   break;
-   case 'm':
-   device->access[count] = *val;
-   break;
-   case '\n':
-   case '\0':
-   count = 3;
-   break;
-   default:
-   return -1;
-   }
-   }
 
-   return 0;
+   return device_cgroup_parse_access(device, ++val);
 }
 
 /* Called externally (i.e. from 'lxc-cgroup') to set new cgroup limits.  Here 
we
@@ -2559,19 +2565,20 @@ __cgfsng_ops static int cgfsng_set(struct cgroup_ops 
*ops,
  * line. Return <0 on error. Dest is a preallocated buffer long enough to hold
  * the output.
  */
-static int convert_devpath(const char *invalue, char *dest)
+static int device_cgroup_rule_parse_devpath(struct device_item *device,
+   const char *devpath)
 {
__do_free char *path = NULL;
-   int n_parts;
-   char *p, type;
+   char *mode = NULL;
+   int n_parts, ret;
unsigned long minor, major;
+   char *p, type;
struct stat sb;
-   int ret = -EINVAL;
-   char *mode = NULL;
 
-   path = must_copy_string(invalue);
+   path = must_copy_string(devpath);
 
-   /* Read path followed by mode. Ignore any trailing text.
+   /*
+* Read path followed by mode. Ignore any trailing text.
 * A '# comment' would be legal. Technically other text is not
 * legal, we could check for that if we cared to.
 */
@@ -2591,43 +2598,59 @@ static int convert_devpath(const char *invalue, char 
*dest)
mode = p;
 
if (*p == '\0')
-   goto out;
+   return ret_set_errno(-1, EINVAL);
}
 
+   if (device_cgroup_parse_access(device, mode) < 0)
+   return -1;
+
if (n_parts == 1)
-   goto out;
+   return ret_set_errno(-1, EINVAL);
 
ret = stat(path, &sb);
if (ret < 0)
-   goto out;
+   return ret_set_errno(-1, errno);
 
mode_t m = sb.st_mode & S_IFMT;
switch (m) {
case S_IFBLK:
-   type = 'b';
+   device->type = 'b';
break;
case S_IFCHR:
-   type = 'c';
+   device->type = 'c';
break;
default:
-   ERROR("Unsupported device type %i for \"%s\"", m, path);
-   ret = -EINVAL;
-   goto out;
+   return log_error_errno(-1, EINVAL,
+  "Un

[lxc-devel] [lxc/lxc] 2b0c58: log: rearrange

2019-12-07 Thread Stéphane Graber
  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: 2b0c584613bcc75c25f0491c4622fa9169196959
  https://github.com/lxc/lxc/commit/2b0c584613bcc75c25f0491c4622fa9169196959
  Author: Christian Brauner 
  Date:   2019-12-07 (Sat, 07 Dec 2019)

  Changed paths:
M src/lxc/log.h

  Log Message:
  ---
  log: rearrange

Signed-off-by: Christian Brauner 


  Commit: 9958e6fe7f69871a8452cebf48e9e8da019fa6a0
  https://github.com/lxc/lxc/commit/9958e6fe7f69871a8452cebf48e9e8da019fa6a0
  Author: Christian Brauner 
  Date:   2019-12-07 (Sat, 07 Dec 2019)

  Changed paths:
M src/lxc/macro.h

  Log Message:
  ---
  macro: add ret_errno()

Signed-off-by: Christian Brauner 


  Commit: db1b8b0f5ef3d24760587a1a56b7ea0fa5c0c712
  https://github.com/lxc/lxc/commit/db1b8b0f5ef3d24760587a1a56b7ea0fa5c0c712
  Author: Christian Brauner 
  Date:   2019-12-07 (Sat, 07 Dec 2019)

  Changed paths:
M src/lxc/af_unix.c

  Log Message:
  ---
  af_unix: s/minus_one_set_errno(/ret_set_errno(-1, /g

Signed-off-by: Christian Brauner 


  Commit: 540a2f7092605c586ad1f1c8e4231c3a53655099
  https://github.com/lxc/lxc/commit/540a2f7092605c586ad1f1c8e4231c3a53655099
  Author: Christian Brauner 
  Date:   2019-12-07 (Sat, 07 Dec 2019)

  Changed paths:
M src/lxc/attach.c

  Log Message:
  ---
  attach: s/minus_one_set_errno(/ret_set_errno(-1, /g

Signed-off-by: Christian Brauner 


  Commit: 3d0327ed245ff14e8a33659ec82ef13b6b54fc55
  https://github.com/lxc/lxc/commit/3d0327ed245ff14e8a33659ec82ef13b6b54fc55
  Author: Christian Brauner 
  Date:   2019-12-07 (Sat, 07 Dec 2019)

  Changed paths:
M src/lxc/commands.c

  Log Message:
  ---
  commands: replace logging helpers

s/error_log_errno(/log_error_errno(-1, /g
s/minus_one_set_errno(/ret_set_errno(-1, /g

Signed-off-by: Christian Brauner 


  Commit: 596a002c6846cc977c45e0fff595ed58278169b0
  https://github.com/lxc/lxc/commit/596a002c6846cc977c45e0fff595ed58278169b0
  Author: Christian Brauner 
  Date:   2019-12-07 (Sat, 07 Dec 2019)

  Changed paths:
M src/lxc/network.c

  Log Message:
  ---
  network: replace logging helpers

s/error_log_errno(/log_error_errno(-1, /g
s/minus_one_set_errno(/ret_set_errno(-1, /g

Signed-off-by: Christian Brauner 


  Commit: 21fce08cb69ab6c912c68fb8aefcdfa1a6fbe166
  https://github.com/lxc/lxc/commit/21fce08cb69ab6c912c68fb8aefcdfa1a6fbe166
  Author: Christian Brauner 
  Date:   2019-12-07 (Sat, 07 Dec 2019)

  Changed paths:
M src/lxc/confile.c

  Log Message:
  ---
  confile: replace logging helpers

Signed-off-by: Christian Brauner 


  Commit: d220323012d3bc176461018cc1743ac05e789cb7
  https://github.com/lxc/lxc/commit/d220323012d3bc176461018cc1743ac05e789cb7
  Author: Christian Brauner 
  Date:   2019-12-07 (Sat, 07 Dec 2019)

  Changed paths:
M src/lxc/cgroups/cgfsng.c

  Log Message:
  ---
  cgroups/cgfsng: replace logging functions

Signed-off-by: Christian Brauner 


  Commit: 102dca262246efa419058f14f56717b44b85dec2
  https://github.com/lxc/lxc/commit/102dca262246efa419058f14f56717b44b85dec2
  Author: Christian Brauner 
  Date:   2019-12-07 (Sat, 07 Dec 2019)

  Changed paths:
M src/lxc/cgroups/cgroup.c

  Log Message:
  ---
  cgroups/cgroup: replace logging functions

Signed-off-by: Christian Brauner 


  Commit: 55cc1116857df23d76eec0b6a2241c7aa3e0f5f3
  https://github.com/lxc/lxc/commit/55cc1116857df23d76eec0b6a2241c7aa3e0f5f3
  Author: Christian Brauner 
  Date:   2019-12-07 (Sat, 07 Dec 2019)

  Changed paths:
M src/lxc/cgroups/cgroup2_devices.c

  Log Message:
  ---
  cgroups/cgroup2_devices: replace logging functions

Signed-off-by: Christian Brauner 


  Commit: 341e6516f255753cf4e1d35f75647e4896bf919c
  https://github.com/lxc/lxc/commit/341e6516f255753cf4e1d35f75647e4896bf919c
  Author: Christian Brauner 
  Date:   2019-12-07 (Sat, 07 Dec 2019)

  Changed paths:
M src/lxc/cgroups/cgfsng.c
M src/lxc/cgroups/cgroup.h

  Log Message:
  ---
  cgroups: rework return values of some functions

Signed-off-by: Christian Brauner 


  Commit: bf39128d818fcdf8248a029e711ae00e2e803329
  https://github.com/lxc/lxc/commit/bf39128d818fcdf8248a029e711ae00e2e803329
  Author: Christian Brauner 
  Date:   2019-12-07 (Sat, 07 Dec 2019)

  Changed paths:
M src/lxc/confile_utils.c

  Log Message:
  ---
  confile_utils: replace logging functions

Signed-off-by: Christian Brauner 


  Commit: b18f6aac91dab359e43821b22ae46eb259ca5050
  https://github.com/lxc/lxc/commit/b18f6aac91dab359e43821b22ae46eb259ca5050
  Author: Christian Brauner 
  Date:   2019-12-07 (Sat, 07 Dec 2019)

  Changed paths:
M src/lxc/lxccontainer.c

  Log Message:
  ---
  lxccontainer: replace logging functions

Signed-off-by: Christian Brauner 


  Commit: 08e8091de8218dfa0ba67be25a639587913259d7
  https://github.com/lxc/lxc/commit/08e8091de8218dfa0ba67be25a6395879

[lxc-devel] [lxc/master] logging and returning: rework

2019-12-07 Thread brauner on Github
The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/3216

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 
From 2b0c584613bcc75c25f0491c4622fa9169196959 Mon Sep 17 00:00:00 2001
From: Christian Brauner 
Date: Sat, 7 Dec 2019 17:21:18 +0100
Subject: [PATCH 01/19] log: rearrange

Signed-off-by: Christian Brauner 
---
 src/lxc/log.h | 32 
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/src/lxc/log.h b/src/lxc/log.h
index 951eaba318..553bc2a120 100644
--- a/src/lxc/log.h
+++ b/src/lxc/log.h
@@ -491,12 +491,6 @@ ATTR_UNUSED static inline void LXC_##LEVEL(struct 
lxc_log_locinfo* locinfo,\
-1;  \
})
 
-#define log_trace(__ret__, format, ...)  \
-   ({\
-   TRACE(format, ##__VA_ARGS__); \
-   __ret__;  \
-   })
-
 #define log_error_errno(__ret__, __errno__, format, ...) \
({   \
errno = __errno__;   \
@@ -510,6 +504,19 @@ ATTR_UNUSED static inline void LXC_##LEVEL(struct 
lxc_log_locinfo* locinfo,\
__ret__;  \
})
 
+#define log_trace_errno(__ret__, __errno__, format, ...) \
+   ({   \
+   errno = __errno__;   \
+   SYSTRACE(format, ##__VA_ARGS__); \
+   __ret__; \
+   })
+
+#define log_trace(__ret__, format, ...)  \
+   ({\
+   TRACE(format, ##__VA_ARGS__); \
+   __ret__;  \
+   })
+
 #define log_warn_errno(__ret__, __errno__, format, ...) \
({  \
errno = __errno__;  \
@@ -517,18 +524,19 @@ ATTR_UNUSED static inline void LXC_##LEVEL(struct 
lxc_log_locinfo* locinfo,   \
__ret__;\
})
 
-#define log_debug(__ret__, format, ...)  \
-   ({\
-   DEBUG(format, ##__VA_ARGS__); \
-   __ret__;  \
-   })
-
 #define log_debug_errno(__ret__, __errno__, format, ...) \
({   \
+   errno = __errno__;  \
SYSDEBUG(format, ##__VA_ARGS__); \
__ret__; \
})
 
+#define log_debug(__ret__, format, ...)  \
+   ({\
+   DEBUG(format, ##__VA_ARGS__); \
+   __ret__;  \
+   })
+
 extern int lxc_log_fd;
 
 extern int lxc_log_syslog(int facility);

From 9958e6fe7f69871a8452cebf48e9e8da019fa6a0 Mon Sep 17 00:00:00 2001
From: Christian Brauner 
Date: Sat, 7 Dec 2019 17:21:53 +0100
Subject: [PATCH 02/19] macro: add ret_errno()

Signed-off-by: Christian Brauner 
---
 src/lxc/macro.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/lxc/macro.h b/src/lxc/macro.h
index e011596d21..b4c9f4e7c6 100644
--- a/src/lxc/macro.h
+++ b/src/lxc/macro.h
@@ -454,6 +454,12 @@ enum {
__ret__;  \
})
 
+#define ret_errno(__errno__)   \
+   ({ \
+   errno = __errno__; \
+   -__errno__;\
+   })
+
 #define free_replace_move_ptr(a, b) \
({  \
free(a);\

From db1b8b0f5ef3d24760587a1a56b7ea0fa5c0c712 Mon Sep 17 00:00:00 2001
From: Christian Brauner 
Date: Sat, 7 Dec 2019 17:22:14 +0100
Subject: [PATCH 03/19] af_unix: s/minus_one_set_errno(/ret_set_errno(-1, /g

Signed-off-by: Christian Brauner 
---
 src/lxc/af_unix.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/lxc/af_unix.c b/src/lxc/af_unix.c
index 061d1c3176..7f8c88b1a2 100644
--- a/src/lxc/af_unix.c
+++ b/src/lxc/af_unix.c
@@ -335,14 +335,14 @@ int lxc_unix_sockaddr(struct sockaddr_un *ret, const char 
*path)
 
len = strlen(path);
if (len == 0)
-   return minus_one_set_errno(EINVAL);
+   return ret_set_errno(-1, EINVAL);
if (path[0] != '/' && path[0] != '@')
-   return minus_one_set_errno(EINVAL);
+   return ret_set_errno(-1, EINVAL);
if (path[1] == '\0')
-   return minus_one_set_errno(EINVAL);
+   return ret_set_errno(-1, EINVAL);
 
if (len + 1 > sizeof(ret->sun_path))
-   retu

[lxc-devel] [lxc/lxc] 8348e4: config: Fix parsing of mount options

2019-12-07 Thread Christian Brauner
  Branch: refs/heads/stable-3.0
  Home:   https://github.com/lxc/lxc
  Commit: 8348e4246d0ee19f66e45eda8e3accd50d139d60
  https://github.com/lxc/lxc/commit/8348e4246d0ee19f66e45eda8e3accd50d139d60
  Author: Maximilian Blenk 
  Date:   2019-12-07 (Sat, 07 Dec 2019)

  Changed paths:
M src/lxc/conf.c

  Log Message:
  ---
  config: Fix parsing of mount options

When parsing mount options e.g. from lxc.mount.entry the specified
options are mapped to the flags constants. To do so, the strings
are compared to the options contained in mount_opt. However,
when comparing the strings, the length of the string is not
checked. That entails that the option "rootcontext=selinux-context"
is mapped to the mount option read-only (ro). This commit fixes
this issue by checking if a '=' is contained in the specified option
and additionally comparing the length of the strings.

Signed-off-by: Maximilian Blenk 


  Commit: a0a707e2aa90cd2dd3eef35d676a5b5dfa0ef42c
  https://github.com/lxc/lxc/commit/a0a707e2aa90cd2dd3eef35d676a5b5dfa0ef42c
  Author: Rachid Koucha <47061324+rachid-kou...@users.noreply.github.com>
  Date:   2019-12-07 (Sat, 07 Dec 2019)

  Changed paths:
M src/lxc/start.c

  Log Message:
  ---
  Init "busy" field to -1 as 0 is valid fd

"busy" field is assigned with the command socket descriptor when the terminal 
is in use. So, use "-1" to disable it.
Signed-off-by: Rachid Koucha 


  Commit: 1bcae9fb23f2c7b5511fef47a8986036b1871931
  https://github.com/lxc/lxc/commit/1bcae9fb23f2c7b5511fef47a8986036b1871931
  Author: Rachid Koucha <47061324+rachid-kou...@users.noreply.github.com>
  Date:   2019-12-07 (Sat, 07 Dec 2019)

  Changed paths:
M src/lxc/conf.c

  Log Message:
  ---
  "busy" field set to 1 instead of 0

"busy" field is assigned with the command socket descriptor when the terminal 
is in use. So, use "-1" to disable it.

Signed-off-by: Rachid Koucha 


  Commit: 64b23e10cfe27c4cb3d86f783050144dcbc8b1c7
  https://github.com/lxc/lxc/commit/64b23e10cfe27c4cb3d86f783050144dcbc8b1c7
  Author: Rachid Koucha <47061324+rachid-kou...@users.noreply.github.com>
  Date:   2019-12-07 (Sat, 07 Dec 2019)

  Changed paths:
M src/lxc/terminal.c

  Log Message:
  ---
  "busy" field set to -1 instead of 0

"busy" field is assigned with the command socket descriptor when the terminal 
is in use. So, use "-1" to disable it.

Signed-off-by: Rachid Koucha 


  Commit: 4c3a47db9eb48e3b2ccfe153a6a998d83c3bfc3d
  https://github.com/lxc/lxc/commit/4c3a47db9eb48e3b2ccfe153a6a998d83c3bfc3d
  Author: Christian Brauner 
  Date:   2019-12-07 (Sat, 07 Dec 2019)

  Changed paths:
M src/lxc/cgroups/cgfsng.c
M src/lxc/cgroups/cgroup.c
M src/lxc/cgroups/cgroup.h
M src/lxc/lxccontainer.c
M src/lxc/macro.h
M src/lxc/start.c
M src/lxc/start.h

  Log Message:
  ---
  cgroup2: rework controller delegation

Signed-off-by: Christian Brauner 


Compare: https://github.com/lxc/lxc/compare/df5f3618851b...4c3a47db9eb4
___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel