xref: /openbmc/linux/net/rds/info.h (revision 498495dba268b20e8eadd7fe93c140c68b6cc9d2)
1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2a8c879a7SAndy Grover #ifndef _RDS_INFO_H
3a8c879a7SAndy Grover #define _RDS_INFO_H
4a8c879a7SAndy Grover 
5a8c879a7SAndy Grover struct rds_info_lengths {
6a8c879a7SAndy Grover 	unsigned int	nr;
7a8c879a7SAndy Grover 	unsigned int	each;
8a8c879a7SAndy Grover };
9a8c879a7SAndy Grover 
10a8c879a7SAndy Grover struct rds_info_iterator;
11a8c879a7SAndy Grover 
12a8c879a7SAndy Grover /*
13a8c879a7SAndy Grover  * These functions must fill in the fields of @lens to reflect the size
14a8c879a7SAndy Grover  * of the available info source.  If the snapshot fits in @len then it
15a8c879a7SAndy Grover  * should be copied using @iter.  The caller will deduce if it was copied
16a8c879a7SAndy Grover  * or not by comparing the lengths.
17a8c879a7SAndy Grover  */
18a8c879a7SAndy Grover typedef void (*rds_info_func)(struct socket *sock, unsigned int len,
19a8c879a7SAndy Grover 			      struct rds_info_iterator *iter,
20a8c879a7SAndy Grover 			      struct rds_info_lengths *lens);
21a8c879a7SAndy Grover 
22a8c879a7SAndy Grover void rds_info_register_func(int optname, rds_info_func func);
23a8c879a7SAndy Grover void rds_info_deregister_func(int optname, rds_info_func func);
24a8c879a7SAndy Grover int rds_info_getsockopt(struct socket *sock, int optname, char __user *optval,
25a8c879a7SAndy Grover 			int __user *optlen);
26a8c879a7SAndy Grover void rds_info_copy(struct rds_info_iterator *iter, void *data,
27a8c879a7SAndy Grover 		   unsigned long bytes);
28a8c879a7SAndy Grover void rds_info_iter_unmap(struct rds_info_iterator *iter);
29a8c879a7SAndy Grover 
30a8c879a7SAndy Grover 
31a8c879a7SAndy Grover #endif
32