Want abstraction over USDT/SDT split in probes

Abierto
#389 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Refactorización
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
rust
Área
networking

Línea de trabajo

Start by surveying the Port::*_probe methods and their repeated cfg_if! branches for SDT, USDT, and no-op behavior. Compare the argument-conversion paths and determine the intended macro or abstraction boundary. Done means current and future DTrace probes can use the shared abstraction without duplicating the conditional probe setup.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

cleanup

Many of the DTrace probes we have in OPTE are structured such that they automatically switch between USDT and SDT probes depending on whether the crate is compiled for userland (cargo test) or as part of the kernel module (xde):

impl Port {
    fn xyz_probe(&self, dir: Direction, pkt: &Packet<Parsed>, msg: String) {
        cfg_if::cfg_if! {
            if #[cfg(all(not(feature = "std"), not(test)))] {
                /* SDT-specific arg conversion: String->CString, ... */
                unsafe {
                    __dtrace_probe_xyz(
                        /* ... pointers to args ... */
                    );
                }
            } else if #[cfg(feature = "usdt")] {
                /* USDT-specific arg conversion */
                crate::opte_provider::xyz!(
                    || (/* ... Rust-friendly args (references, owned types) ... */)
                );
            } else {
                /* feature-flag-driven no-op */
                let (..) = (dir, pkt, msg);
            }
        }
    }
}

Many of the Port::*_probe methods have a structure more or less in line with this, which leads to a lot of duplication and noise. We should define a macro or similar abstraction to simplify the implementation of {current, future} DTrace probes we choose to insert.

Lenguaje dominante
Rust
Estrellas
82
Forks
16
Merge medio
3 d 6 h
PR fusionados (30 d)
11

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de oxidecomputer/opte

Todos los issues de oxidecomputer/opte

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.