On 27/04/2022 08:26, Jan Kiszka wrote:
On 26.04.22 19:22, Ralf Ramsauer wrote:
Since Linux commit cdb4f26a63c3 ("kobject: kobj_type: remove
default_attrs"), the deprecated kobj member default_attrs is gone. It is
replaced by default_groups.

default_groups is available since 2013, so simply switch to
default_groups, without (hopefully) breaking any older kernel.

Signed-off-by: Ralf Ramsauer <[email protected]>
---
  driver/sysfs.c | 9 ++++++---
  1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/driver/sysfs.c b/driver/sysfs.c
index a604afa4..f91d5ac5 100644
--- a/driver/sysfs.c
+++ b/driver/sysfs.c
@@ -180,10 +180,11 @@ static struct attribute *cell_stats_attrs[] = {
  #endif
        NULL
  };
+ATTRIBUTE_GROUPS(cell_stats);
static struct kobj_type cell_stats_type = {
        .sysfs_ops = &kobj_sysfs_ops,
-       .default_attrs = cell_stats_attrs,
+       .default_groups = cell_stats_groups,
  };
static struct attribute *cpu_stats_attrs[] = {
@@ -212,10 +213,11 @@ static struct attribute *cpu_stats_attrs[] = {
  #endif
        NULL
  };
+ATTRIBUTE_GROUPS(cpu_stats);
static struct kobj_type cell_cpu_type = {
        .sysfs_ops = &kobj_sysfs_ops,
-       .default_attrs = cpu_stats_attrs,
+       .default_groups = cpu_stats_groups,
  };
static int print_cpumask(char *buf, size_t size, cpumask_t *mask, bool as_list)
@@ -342,11 +344,12 @@ static struct attribute *cell_attrs[] = {
        &cell_cpus_failed_list_attr.attr,
        NULL,
  };
+ATTRIBUTE_GROUPS(cell);
static struct kobj_type cell_type = {
        .release = jailhouse_cell_kobj_release,
        .sysfs_ops = &kobj_sysfs_ops,
-       .default_attrs = cell_attrs,
+       .default_groups = cell_groups,
  };
static struct cell_cpu *find_cell_cpu(struct cell *cell, unsigned int cpu)

Which kernel versions are compatible with the new API?

With the latest v5.18 release, it becomes mandatory.

I just successfully compile-tested v5.17, v5.16, v5.14, v5.10, v5.4 and v5.2 (the latest one that works). Latest LTS 4.19.y and downwards won't compile.

The question is, if we want to demand at least v5.2, or introduce yet another workaround.

  Ralf

--
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/2e24bb64-4111-a75c-1ed2-c79a717b5500%40oth-regensburg.de.

Reply via email to