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) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * DFS referral cache routines
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (c) 2018-2019 Paulo Alcantara <palcantara@suse.de>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #ifndef _CIFS_DFS_CACHE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #define _CIFS_DFS_CACHE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/nls.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/list.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include "cifsglob.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) struct dfs_cache_tgt_list {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 	int tl_numtgts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 	struct list_head tl_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) struct dfs_cache_tgt_iterator {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	char *it_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	int it_path_consumed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	struct list_head it_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) extern int dfs_cache_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) extern void dfs_cache_destroy(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) extern const struct proc_ops dfscache_proc_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) extern int dfs_cache_find(const unsigned int xid, struct cifs_ses *ses,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 			  const struct nls_table *nls_codepage, int remap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 			  const char *path, struct dfs_info3_param *ref,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 			  struct dfs_cache_tgt_list *tgt_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) extern int dfs_cache_noreq_find(const char *path, struct dfs_info3_param *ref,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 				struct dfs_cache_tgt_list *tgt_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) extern int dfs_cache_update_tgthint(const unsigned int xid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 				    struct cifs_ses *ses,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 				    const struct nls_table *nls_codepage,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 				    int remap, const char *path,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 				    const struct dfs_cache_tgt_iterator *it);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) extern int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) dfs_cache_noreq_update_tgthint(const char *path,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 			       const struct dfs_cache_tgt_iterator *it);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) extern int dfs_cache_get_tgt_referral(const char *path,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 				      const struct dfs_cache_tgt_iterator *it,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 				      struct dfs_info3_param *ref);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) extern int dfs_cache_add_vol(char *mntdata, struct smb_vol *vol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 			const char *fullpath);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) extern int dfs_cache_update_vol(const char *fullpath,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 				struct TCP_Server_Info *server);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) extern void dfs_cache_del_vol(const char *fullpath);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) extern int dfs_cache_get_tgt_share(char *path, const struct dfs_cache_tgt_iterator *it,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 				   char **share, char **prefix);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) static inline struct dfs_cache_tgt_iterator *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) dfs_cache_get_next_tgt(struct dfs_cache_tgt_list *tl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 		       struct dfs_cache_tgt_iterator *it)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	if (!tl || list_empty(&tl->tl_list) || !it ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	    list_is_last(&it->it_list, &tl->tl_list))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	return list_next_entry(it, it_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) static inline struct dfs_cache_tgt_iterator *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) dfs_cache_get_tgt_iterator(struct dfs_cache_tgt_list *tl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	if (!tl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	return list_first_entry_or_null(&tl->tl_list,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 					struct dfs_cache_tgt_iterator,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 					it_list);
^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 void dfs_cache_free_tgts(struct dfs_cache_tgt_list *tl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	struct dfs_cache_tgt_iterator *it, *nit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	if (!tl || list_empty(&tl->tl_list))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	list_for_each_entry_safe(it, nit, &tl->tl_list, it_list) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 		list_del(&it->it_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 		kfree(it->it_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 		kfree(it);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	tl->tl_numtgts = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) static inline const char *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) dfs_cache_get_tgt_name(const struct dfs_cache_tgt_iterator *it)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	return it ? it->it_name : NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) dfs_cache_get_nr_tgts(const struct dfs_cache_tgt_list *tl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	return tl ? tl->tl_numtgts : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) #endif /* _CIFS_DFS_CACHE_H */