Commit e56d4a66 authored by Philippe Gerum's avatar Philippe Gerum Committed by Jan Kiszka

cobalt/thread: pipeline: abstract threadinfo accessor

The I-pipe and Dovetail access the per-thread information block
differently. Abstract this kernel interface.

No functional change is introduced.
Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
[Jan: add linux/sched.h include for older kernels]
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent 34a73fcb
/*
* SPDX-License-Identifier: GPL-2.0
*
* Copyright (C) 2019 Philippe Gerum <rpm@xenomai.org>
*/
#ifndef _COBALT_KERNEL_IPIPE_THREAD_H
#define _COBALT_KERNEL_IPIPE_THREAD_H
#include <linux/ipipe.h>
#include <linux/sched.h>
struct xnthread;
#define cobalt_threadinfo ipipe_threadinfo
static inline struct cobalt_threadinfo *pipeline_current(void)
{
return ipipe_current_threadinfo();
}
static inline struct xnthread *pipeline_thread_from_task(struct task_struct *p)
{
return ipipe_task_threadinfo(p)->thread;
}
#endif /* !_COBALT_KERNEL_IPIPE_THREAD_H */
......@@ -22,6 +22,7 @@
#include <linux/wait.h>
#include <linux/sched.h>
#include <linux/sched/rt.h>
#include <pipeline/thread.h>
#include <cobalt/kernel/list.h>
#include <cobalt/kernel/stat.h>
#include <cobalt/kernel/timer.h>
......@@ -372,7 +373,7 @@ void __xnthread_discard(struct xnthread *thread);
*/
static inline struct xnthread *xnthread_current(void)
{
return ipipe_current_threadinfo()->thread;
return pipeline_current()->thread;
}
/**
......@@ -388,7 +389,7 @@ static inline struct xnthread *xnthread_current(void)
*/
static inline struct xnthread *xnthread_from_task(struct task_struct *p)
{
return ipipe_task_threadinfo(p)->thread;
return pipeline_thread_from_task(p);
}
/**
......
......@@ -832,16 +832,16 @@ static inline int get_mayday_prot(void)
void pipeline_attach_current(struct xnthread *thread)
{
struct ipipe_threadinfo *p;
struct cobalt_threadinfo *p;
p = ipipe_current_threadinfo();
p = pipeline_current();
p->thread = thread;
p->process = cobalt_search_process(current->mm);
}
static void detach_current(void)
{
struct ipipe_threadinfo *p = ipipe_current_threadinfo();
struct cobalt_threadinfo *p = pipeline_current();
p->thread = NULL;
p->process = NULL;
}
......
......@@ -462,7 +462,7 @@ EXPORT_SYMBOL_GPL(cobalt_unregister_personality);
struct xnthread_personality *
cobalt_push_personality(int xid)
{
struct ipipe_threadinfo *p = ipipe_current_threadinfo();
struct cobalt_threadinfo *p = pipeline_current();
struct xnthread_personality *prev, *next;
struct xnthread *thread = p->thread;
......@@ -503,7 +503,7 @@ EXPORT_SYMBOL_GPL(cobalt_push_personality);
*/
void cobalt_pop_personality(struct xnthread_personality *prev)
{
struct ipipe_threadinfo *p = ipipe_current_threadinfo();
struct cobalt_threadinfo *p = pipeline_current();
struct xnthread *thread = p->thread;
secondary_mode_only();
......
......@@ -20,6 +20,7 @@
#include <linux/list.h>
#include <linux/bitmap.h>
#include <pipeline/thread.h>
#include <cobalt/kernel/ppd.h>
#define KEVENT_PROPAGATE 0
......@@ -94,13 +95,13 @@ extern struct cobalt_resources cobalt_global_resources;
static inline struct cobalt_process *cobalt_current_process(void)
{
return ipipe_current_threadinfo()->process;
return pipeline_current()->process;
}
static inline struct cobalt_process *
cobalt_set_process(struct cobalt_process *process)
{
struct ipipe_threadinfo *p = ipipe_current_threadinfo();
struct cobalt_threadinfo *p = pipeline_current();
struct cobalt_process *old;
old = p->process;
......
......@@ -2452,9 +2452,9 @@ static inline void wakeup_parent(struct completion *done)
static inline void init_kthread_info(struct xnthread *thread)
{
struct ipipe_threadinfo *p;
struct cobalt_threadinfo *p;
p = ipipe_current_threadinfo();
p = pipeline_current();
p->thread = thread;
p->process = NULL;
}
......
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