fs/smb/client/dfs.h
Source file repositories/reference/linux-study-clean/fs/smb/client/dfs.h
File Facts
- System
- Linux kernel
- Corpus path
fs/smb/client/dfs.h- Extension
.h- Size
- 4895 bytes
- Lines
- 200
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
cifsglob.hcifsproto.hfs_context.hdfs_cache.hcifs_unicode.hlinux/namei.hlinux/errno.h
Detected Declarations
struct dfs_refstruct dfs_ref_walkfunction ref_walk_initfunction __ref_walk_freefunction ref_walk_freefunction ref_walk_advancefunction ref_walk_next_tgtfunction ref_walk_get_tgtfunction ref_walk_set_tgt_hintfunction ref_walk_set_tconfunction ref_walk_mark_endfunction dfs_get_referralfunction cifs_get_smb_sesfunction list_for_each_entry_safe
Annotated Snippet
struct dfs_ref {
char *path;
char *full_path;
struct cifs_ses *ses;
struct dfs_cache_tgt_list tl;
struct dfs_cache_tgt_iterator *tit;
};
struct dfs_ref_walk {
struct cifs_mount_ctx *mnt_ctx;
struct dfs_ref *ref;
struct dfs_ref refs[MAX_NESTED_LINKS];
};
#define ref_walk_start(w) ((w)->refs)
#define ref_walk_end(w) (&(w)->refs[ARRAY_SIZE((w)->refs) - 1])
#define ref_walk_cur(w) ((w)->ref)
#define ref_walk_descend(w) (--ref_walk_cur(w) >= ref_walk_start(w))
#define ref_walk_tit(w) (ref_walk_cur(w)->tit)
#define ref_walk_path(w) (ref_walk_cur(w)->path)
#define ref_walk_fpath(w) (ref_walk_cur(w)->full_path)
#define ref_walk_tl(w) (&ref_walk_cur(w)->tl)
#define ref_walk_ses(w) (ref_walk_cur(w)->ses)
static inline struct dfs_ref_walk *ref_walk_alloc(void)
{
struct dfs_ref_walk *rw;
rw = kmalloc_obj(*rw);
if (!rw)
return ERR_PTR(-ENOMEM);
return rw;
}
static inline void ref_walk_init(struct dfs_ref_walk *rw,
struct cifs_mount_ctx *mnt_ctx)
{
memset(rw, 0, sizeof(*rw));
rw->mnt_ctx = mnt_ctx;
ref_walk_cur(rw) = ref_walk_start(rw);
}
static inline void __ref_walk_free(struct dfs_ref *ref)
{
kfree(ref->path);
kfree(ref->full_path);
dfs_cache_free_tgts(&ref->tl);
if (ref->ses)
cifs_put_smb_ses(ref->ses);
memset(ref, 0, sizeof(*ref));
}
static inline void ref_walk_free(struct dfs_ref_walk *rw)
{
struct dfs_ref *ref;
if (!rw)
return;
for (ref = ref_walk_start(rw); ref <= ref_walk_end(rw); ref++)
__ref_walk_free(ref);
kfree(rw);
}
static inline int ref_walk_advance(struct dfs_ref_walk *rw)
{
struct dfs_ref *ref = ref_walk_cur(rw) + 1;
if (ref > ref_walk_end(rw))
return -ELOOP;
__ref_walk_free(ref);
ref_walk_cur(rw) = ref;
return 0;
}
static inline struct dfs_cache_tgt_iterator *
ref_walk_next_tgt(struct dfs_ref_walk *rw)
{
struct dfs_ref *ref = ref_walk_cur(rw);
struct dfs_cache_tgt_iterator *tit;
if (IS_ERR(ref->tit))
return NULL;
if (!ref->tit)
tit = dfs_cache_get_tgt_iterator(&ref->tl);
else
tit = dfs_cache_get_next_tgt(&ref->tl, ref->tit);
Annotation
- Immediate include surface: `cifsglob.h`, `cifsproto.h`, `fs_context.h`, `dfs_cache.h`, `cifs_unicode.h`, `linux/namei.h`, `linux/errno.h`.
- Detected declarations: `struct dfs_ref`, `struct dfs_ref_walk`, `function ref_walk_init`, `function __ref_walk_free`, `function ref_walk_free`, `function ref_walk_advance`, `function ref_walk_next_tgt`, `function ref_walk_get_tgt`, `function ref_walk_set_tgt_hint`, `function ref_walk_set_tcon`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.