Files
s390-tools/zpcimon/zpcimon.h
Niklas Schnelle a9dbb8a1a2 zpcimon: Factor out JSON printing of common PCI adapter attributes
Some of the attributes printed as JSON by opticsmon are common to all
PCI adapters factor these out into reusable helper functions
zpci_adapter_json_print_start() and zpci_adapter_json_print_end().

Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2026-07-24 18:21:50 +02:00

55 lines
1.3 KiB
C

/*
* Copyright IBM Corp. 2024
*
* s390-tools is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
*/
#ifndef ZPCIMON_ZPCIMON_H
#define ZPCIMON_ZPCIMON_H
#include <stdbool.h>
#include <stdint.h>
#include "lib/util_fmt.h"
#include "opticsmon.h"
#define API_LEVEL 1
struct options {
uint32_t interval_seconds;
bool monitor;
bool report;
bool quiet;
enum util_fmt_t format;
bool explicit_format;
/* Optics Monitoring Specific */
bool module_info;
};
struct zpcimon_ctx {
struct options opts;
struct util_list *zpci_list;
struct opticsmon_ctx opticsmon_ctx;
};
struct zpcimon_ops {
int (*collect_adapter_data)(struct zpcimon_ctx *ctx, struct zpci_dev *zdev);
int (*open_monitor)(struct zpcimon_ctx *ctx);
int (*get_monitor_fd)(struct zpcimon_ctx *ctx);
void (*monitor_fd_handle)(struct zpcimon_ctx *ctx);
void (*close_monitor)(struct zpcimon_ctx *ctx);
int (*init)(struct zpcimon_ctx *ctx);
void (*destroy)(struct zpcimon_ctx *ctx);
};
void zpci_list_reload(struct util_list **zpci_list);
void zpci_adapter_json_print_start(struct zpci_dev *zdev);
void zpci_adapter_json_print_end(void);
void zpcimon_json_base64_pair(char *name, uint8_t *buf, int len);
#endif /* ZPCIMON_ZPCIMON_H */