~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/smb/client/dfs_cache.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * DFS referral cache routines
  4  *
  5  * Copyright (c) 2018-2019 Paulo Alcantara <palcantara@suse.de>
  6  */
  7 
  8 #ifndef _CIFS_DFS_CACHE_H
  9 #define _CIFS_DFS_CACHE_H
 10 
 11 #include <linux/nls.h>
 12 #include <linux/list.h>
 13 #include <linux/uuid.h>
 14 #include "cifsglob.h"
 15 
 16 extern struct workqueue_struct *dfscache_wq;
 17 extern atomic_t dfs_cache_ttl;
 18 
 19 #define DFS_CACHE_TGT_LIST_INIT(var) \
 20         { .tl_numtgts = 0, .tl_list = LIST_HEAD_INIT((var).tl_list), }
 21 
 22 #define DFS_CACHE_TGT_LIST(var) \
 23         struct dfs_cache_tgt_list var = DFS_CACHE_TGT_LIST_INIT(var)
 24 
 25 struct dfs_cache_tgt_list {
 26         int tl_numtgts;
 27         struct list_head tl_list;
 28 };
 29 
 30 struct dfs_cache_tgt_iterator {
 31         char *it_name;
 32         int it_path_consumed;
 33         struct list_head it_list;
 34 };
 35 
 36 int dfs_cache_init(void);
 37 void dfs_cache_destroy(void);
 38 extern const struct proc_ops dfscache_proc_ops;
 39 
 40 int dfs_cache_find(const unsigned int xid, struct cifs_ses *ses, const struct nls_table *cp,
 41                    int remap, const char *path, struct dfs_info3_param *ref,
 42                    struct dfs_cache_tgt_list *tgt_list);
 43 int dfs_cache_noreq_find(const char *path, struct dfs_info3_param *ref,
 44                          struct dfs_cache_tgt_list *tgt_list);
 45 void dfs_cache_noreq_update_tgthint(const char *path, const struct dfs_cache_tgt_iterator *it);
 46 int dfs_cache_get_tgt_referral(const char *path, const struct dfs_cache_tgt_iterator *it,
 47                                struct dfs_info3_param *ref);
 48 int dfs_cache_get_tgt_share(char *path, const struct dfs_cache_tgt_iterator *it, char **share,
 49                             char **prefix);
 50 char *dfs_cache_canonical_path(const char *path, const struct nls_table *cp, int remap);
 51 int dfs_cache_remount_fs(struct cifs_sb_info *cifs_sb);
 52 void dfs_cache_refresh(struct work_struct *work);
 53 
 54 static inline struct dfs_cache_tgt_iterator *
 55 dfs_cache_get_next_tgt(struct dfs_cache_tgt_list *tl,
 56                        struct dfs_cache_tgt_iterator *it)
 57 {
 58         if (!tl || !tl->tl_numtgts || list_empty(&tl->tl_list) ||
 59             !it || list_is_last(&it->it_list, &tl->tl_list))
 60                 return NULL;
 61         return list_next_entry(it, it_list);
 62 }
 63 
 64 static inline struct dfs_cache_tgt_iterator *
 65 dfs_cache_get_tgt_iterator(struct dfs_cache_tgt_list *tl)
 66 {
 67         if (!tl)
 68                 return NULL;
 69         return list_first_entry_or_null(&tl->tl_list,
 70                                         struct dfs_cache_tgt_iterator,
 71                                         it_list);
 72 }
 73 
 74 static inline void dfs_cache_free_tgts(struct dfs_cache_tgt_list *tl)
 75 {
 76         struct dfs_cache_tgt_iterator *it, *nit;
 77 
 78         if (!tl || !tl->tl_numtgts || list_empty(&tl->tl_list))
 79                 return;
 80         list_for_each_entry_safe(it, nit, &tl->tl_list, it_list) {
 81                 list_del(&it->it_list);
 82                 kfree(it->it_name);
 83                 kfree(it);
 84         }
 85         tl->tl_numtgts = 0;
 86 }
 87 
 88 static inline const char *
 89 dfs_cache_get_tgt_name(const struct dfs_cache_tgt_iterator *it)
 90 {
 91         return it ? it->it_name : NULL;
 92 }
 93 
 94 static inline int
 95 dfs_cache_get_nr_tgts(const struct dfs_cache_tgt_list *tl)
 96 {
 97         return tl ? tl->tl_numtgts : 0;
 98 }
 99 
100 static inline int dfs_cache_get_ttl(void)
101 {
102         return atomic_read(&dfs_cache_ttl);
103 }
104 
105 #endif /* _CIFS_DFS_CACHE_H */
106 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php