return ((struct fifo_ipc *)ipc)->ino == file->stat.st_ino;
}
-static struct ipc_class *fifo_get_ipc_class(struct file *file __attribute__((__unused__)))
+static const struct ipc_class *fifo_get_ipc_class(struct file *file __attribute__((__unused__)))
{
- static struct ipc_class fifo_ipc_class = {
+ static const struct ipc_class fifo_ipc_class = {
.get_hash = fifo_get_hash,
.is_suitable_ipc = fifo_is_suitable_ipc,
.free = NULL,
return false;
}
-static struct sock_xinfo_class unix_xinfo_class = {
+static const struct sock_xinfo_class unix_xinfo_class = {
.class = "unix",
.get_name = unix_get_name,
.get_type = unix_get_type,
}
define_fill_column_func(tcp, TCP)
-static struct sock_xinfo_class tcp_xinfo_class = {
+static const struct sock_xinfo_class tcp_xinfo_class = {
.class = "tcp",
.get_name = tcp_get_name,
.get_type = tcp_get_type,
#define TCP_LINE_LEN 256
static void load_xinfo_from_proc_inet_L3(ino_t netns_inode, const char *proc_file,
- struct sock_xinfo_class *class)
+ const struct sock_xinfo_class *class)
{
char line[TCP_LINE_LEN];
FILE *tcp_fp;
}
define_fill_column_func(udp, UDP)
-static struct sock_xinfo_class udp_xinfo_class = {
+static const struct sock_xinfo_class udp_xinfo_class = {
.class = "udp",
.get_name = udp_get_name,
.get_type = udp_get_type,
struct unkn {
struct file file;
- struct anon_ops *anon_ops;
+ const struct anon_ops *anon_ops;
void *anon_data;
};
int (*handle_fdinfo)(struct unkn *, const char *, const char *);
};
-static struct anon_ops anon_generic_ops;
-static struct anon_ops anon_pidfd_ops;
+static const struct anon_ops anon_generic_ops;
+static const struct anon_ops anon_pidfd_ops;
static char * anon_get_class(struct unkn *unkn)
{
return false;
}
-static struct anon_ops anon_pidfd_ops = {
+static const struct anon_ops anon_pidfd_ops = {
.class = "pidfd",
.get_name = anon_pidfd_get_name,
.fill_column = anon_pidfd_fill_column,
/*
* generic (fallback implementation)
*/
-static struct anon_ops anon_generic_ops = {
+static const struct anon_ops anon_generic_ops = {
.class = NULL,
.get_name = NULL,
.fill_column = NULL,
};
/* columns descriptions */
-static struct colinfo infos[] = {
+static const struct colinfo infos[] = {
[COL_AINODECLASS]
= { "AINODECLASS",0,SCOLS_FL_RIGHT,SCOLS_JSON_STRING,
N_("class of anonymous inode") },
const char *expr;
};
-static struct counter_spec default_counter_specs[] = {
+static const struct counter_spec default_counter_specs[] = {
{
.name = N_("processes"),
.expr = "ASSOC == 'cwd'",
{
int slot;
struct list_head *e;
- struct ipc_class *ipc_class;
+ const struct ipc_class *ipc_class;
if (!file->class->get_ipc_class)
return NULL;
free(counter_spec);
}
-static struct lsfd_counter *new_counter(struct counter_spec *spec, struct lsfd_control *ctl)
+static struct lsfd_counter *new_counter(const struct counter_spec *spec, struct lsfd_control *ctl)
{
struct lsfd_filter *filter;
counters = xcalloc(len + 1, sizeof(struct lsfd_counter *));
for (i = 0; i < len; i++) {
- struct counter_spec *spec = default_counter_specs + i;
+ const struct counter_spec *spec = default_counter_specs + i;
counters[i] = new_counter(spec, ctl);
}
assert(counters[len] == NULL);
puts("default counter specs:");
for (i = 0; i < len; i++) {
- struct counter_spec *spec = default_counter_specs + i;
+ const struct counter_spec *spec = default_counter_specs + i;
printf("\t%s:%s\n", spec->name, spec->expr);
}
}
void (*attach_xinfo)(struct file *file);
void (*initialize_content)(struct file *file);
void (*free_content)(struct file *file);
- struct ipc_class *(*get_ipc_class)(struct file *file);
+ const struct ipc_class *(*get_ipc_class)(struct file *file);
};
extern const struct file_class file_class, cdev_class, bdev_class, sock_class, unkn_class, fifo_class,