Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) #ifndef __LINUX_NET_AFUNIX_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #define __LINUX_NET_AFUNIX_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) #include <linux/socket.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #include <linux/un.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #include <linux/mutex.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #include <linux/refcount.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #include <net/sock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) void unix_inflight(struct user_struct *user, struct file *fp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) void unix_notinflight(struct user_struct *user, struct file *fp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) void unix_destruct_scm(struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) void unix_gc(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) void wait_for_unix_gc(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct sock *unix_get_socket(struct file *filp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) struct sock *unix_peer_get(struct sock *sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define UNIX_HASH_SIZE	256
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define UNIX_HASH_BITS	8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) extern unsigned int unix_tot_inflight;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) extern spinlock_t unix_table_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) extern struct hlist_head unix_socket_table[2 * UNIX_HASH_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) struct unix_address {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	refcount_t	refcnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	int		len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	unsigned int	hash;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	struct sockaddr_un name[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) struct unix_skb_parms {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	struct pid		*pid;		/* Skb credentials	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	kuid_t			uid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	kgid_t			gid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	struct scm_fp_list	*fp;		/* Passed files		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #ifdef CONFIG_SECURITY_NETWORK
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	u32			secid;		/* Security ID		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	u32			consumed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) } __randomize_layout;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) struct scm_stat {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	atomic_t nr_fds;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #define UNIXCB(skb)	(*(struct unix_skb_parms *)&((skb)->cb))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #define unix_state_lock(s)	spin_lock(&unix_sk(s)->lock)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) #define unix_state_unlock(s)	spin_unlock(&unix_sk(s)->lock)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #define unix_state_lock_nested(s) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 				spin_lock_nested(&unix_sk(s)->lock, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 				SINGLE_DEPTH_NESTING)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) /* The AF_UNIX socket */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) struct unix_sock {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	/* WARNING: sk has to be the first member */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 	struct sock		sk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 	struct unix_address	*addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 	struct path		path;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 	struct mutex		iolock, bindlock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 	struct sock		*peer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 	struct list_head	link;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 	atomic_long_t		inflight;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 	spinlock_t		lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 	unsigned long		gc_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) #define UNIX_GC_CANDIDATE	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) #define UNIX_GC_MAYBE_CYCLE	1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 	struct socket_wq	peer_wq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 	wait_queue_entry_t	peer_wake;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 	struct scm_stat		scm_stat;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) static inline struct unix_sock *unix_sk(const struct sock *sk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) 	return (struct unix_sock *)sk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) #define peer_wait peer_wq.wait
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) long unix_inq_len(struct sock *sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) long unix_outq_len(struct sock *sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) #ifdef CONFIG_SYSCTL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) int unix_sysctl_register(struct net *net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) void unix_sysctl_unregister(struct net *net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) static inline int unix_sysctl_register(struct net *net) { return 0; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) static inline void unix_sysctl_unregister(struct net *net) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) #endif