agileRTOS (zrtos)  Version 0.8.0 (ghostbuster)
vfs_dentry.h File Reference
#include <zrtos/str.h>
#include <zrtos/types.h>
#include <zrtos/clist.h>
#include <zrtos/vfs_inode.h>
#include <zrtos/vfs/module/null/null.h>
Include dependency graph for vfs_dentry.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _zrtos_vfs_dentry_t
 
struct  _zrtos_vfs_dentry__each_child_cb_inode_t
 

Typedefs

typedef struct _zrtos_vfs_dentry_t zrtos_vfs_dentry_t
 
typedef struct _zrtos_vfs_dentry__each_child_cb_inode_t zrtos_vfs_dentry__each_child_cb_inode_t
 

Functions

bool zrtos_vfs_dentry__init (zrtos_vfs_dentry_t *thiz, char *name, struct _zrtos_vfs_dentry_t *parent)
 
bool zrtos_vfs_dentry__is_filesystem (zrtos_vfs_dentry_t *node)
 
static bool zrtos_vfs_dentry__each_child_cb (zrtos_clist_node_t *node, void *arg)
 
void zrtos_vfs_dentry__each_child (zrtos_vfs_dentry_t *thiz, bool(*callback)(zrtos_vfs_dentry_t *node, void *arg), void *callback_arg, bool(*filter)(zrtos_vfs_dentry_t *node, void *arg), void *filter_arg)
 
bool zrtos_vfs_dentry__each_child_filter_name_cb (zrtos_vfs_dentry_t *thiz, void *arg)
 
static bool zrtos_vfs_dentry__lookup_callback_cb (zrtos_vfs_dentry_t *node, void *arg)
 
zrtos_vfs_dentry_tzrtos_vfs_dentry__lookup (zrtos_vfs_dentry_t *thiz, char *path)
 
zrtos_error_t zrtos_vfs_dentry__mount (zrtos_vfs_dentry_t *thiz, zrtos_vfs_plugin_t *plugin, void *inode_ctx)
 
zrtos_error_t zrtos_vfs_dentry__umount (zrtos_vfs_dentry_t *thiz)
 
void zrtos_vfs_dentry__set_inode_data (zrtos_vfs_dentry_t *thiz, void *ctx)
 
void * zrtos_vfs_dentry__get_inode_data (zrtos_vfs_dentry_t *thiz)
 

Variables

zrtos_clist_t zrtos_vfs_dentry__index = {}
 

Typedef Documentation

◆ zrtos_vfs_dentry__each_child_cb_inode_t

◆ zrtos_vfs_dentry_t

Function Documentation

◆ zrtos_vfs_dentry__each_child()

void zrtos_vfs_dentry__each_child ( zrtos_vfs_dentry_t thiz,
bool(*)(zrtos_vfs_dentry_t *node, void *arg)  callback,
void *  callback_arg,
bool(*)(zrtos_vfs_dentry_t *node, void *arg)  filter,
void *  filter_arg 
)

Definition at line 92 of file vfs_dentry.h.

98  {
100  .parent = thiz
101  ,.callback = callback
102  ,.callback_arg = callback_arg
103  ,.filter = filter
104  ,.filter_arg = filter_arg
105  };
109  ,&args
110  );
111 }
zrtos_clist_t zrtos_vfs_dentry__index
Definition: vfs_dentry.h:29
static bool zrtos_vfs_dentry__each_child_cb(zrtos_clist_node_t *node, void *arg)
Definition: vfs_dentry.h:74
void zrtos_clist__each(zrtos_clist_t *thiz, bool(*callback)(zrtos_clist_node_t *node, void *arg), void *arg)
Definition: clist.h:143
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zrtos_vfs_dentry__each_child_cb()

static bool zrtos_vfs_dentry__each_child_cb ( zrtos_clist_node_t node,
void *  arg 
)
static

Definition at line 74 of file vfs_dentry.h.

74  {
75  bool ret = true;
77  node
79  ,node
80  );
83  ,arg
84  );
85  if(args->parent == dentry->parent
86  && args->filter(dentry,args->filter_arg)){
87  ret = args->callback(dentry,args->callback_arg);
88  }
89  return ret;
90 }
#define ZRTOS_CAST(type, value)
Definition: cast.h:18
bool(* filter)(zrtos_vfs_dentry_t *node, void *arg)
Definition: vfs_dentry.h:70
bool(* callback)(zrtos_vfs_dentry_t *node, void *arg)
Definition: vfs_dentry.h:68
#define zrtos_types__get_container_of_ex(ptr, type, member)
Definition: types.h:75
struct _zrtos_vfs_dentry_t * parent
Definition: vfs_dentry.h:24
Here is the caller graph for this function:

◆ zrtos_vfs_dentry__each_child_filter_name_cb()

bool zrtos_vfs_dentry__each_child_filter_name_cb ( zrtos_vfs_dentry_t thiz,
void *  arg 
)

Definition at line 113 of file vfs_dentry.h.

116  {
117  return 0 == zrtos_str__cmp(thiz->name,(char*)arg);
118 }
int zrtos_str__cmp(char *a, char *b)
Definition: str.h:33
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zrtos_vfs_dentry__get_inode_data()

void* zrtos_vfs_dentry__get_inode_data ( zrtos_vfs_dentry_t thiz)

Definition at line 196 of file vfs_dentry.h.

196  {
197  return thiz->inode.ctx;
198 }
zrtos_vfs_inode_t inode
Definition: vfs_dentry.h:25
Here is the caller graph for this function:

◆ zrtos_vfs_dentry__init()

bool zrtos_vfs_dentry__init ( zrtos_vfs_dentry_t thiz,
char *  name,
struct _zrtos_vfs_dentry_t parent 
)

Definition at line 31 of file vfs_dentry.h.

35  {
37  thiz->name = name;
38  thiz->parent = parent;
40  &thiz->inode
41  ,ZRTOS_VFS_PLUGIN(null)
42  ,0
43  );
44  thiz->count = 0;
45 
47 
48  return true;
49 }
zrtos_clist_node_t node
Definition: vfs_dentry.h:22
zrtos_vfs_inode_t inode
Definition: vfs_dentry.h:25
#define ZRTOS_VFS_PLUGIN(name)
Definition: vfs_plugin.h:136
zrtos_clist_t zrtos_vfs_dentry__index
Definition: vfs_dentry.h:29
struct _zrtos_vfs_dentry_t * parent
Definition: vfs_dentry.h:24
bool zrtos_clist__push(zrtos_clist_t *thiz, zrtos_clist_node_t *node)
Definition: clist.h:85
bool zrtos_clist_node__init(zrtos_clist_node_t *thiz)
Definition: clist.h:33
bool zrtos_vfs_inode__init(zrtos_vfs_inode_t *thiz, zrtos_vfs_plugin_t *plugin, void *ctx)
Definition: vfs_inode.h:22
Here is the call graph for this function:

◆ zrtos_vfs_dentry__is_filesystem()

bool zrtos_vfs_dentry__is_filesystem ( zrtos_vfs_dentry_t node)

Definition at line 51 of file vfs_dentry.h.

51  {
52  //return ZRTOS_VFS_PLUGIN_TYPE__FILESYSTEM == node->inode.plugin->type;
53  return false;
54 }
Here is the caller graph for this function:

◆ zrtos_vfs_dentry__lookup()

zrtos_vfs_dentry_t* zrtos_vfs_dentry__lookup ( zrtos_vfs_dentry_t thiz,
char *  path 
)

Definition at line 126 of file vfs_dentry.h.

129  {
130  char *token;
131  zrtos_vfs_dentry_t *ret = 0;
132 
133  while((token = zrtos_str__tok_r(path,"/", &path))){
135  thiz
137  ,&thiz
139  ,token
140  );
141  if(thiz){
142  ret = thiz;
143  }else{
145  ret = 0;
146  }
147  break;
148  }
149  }
150 
151  return ret;
152 }
void zrtos_vfs_dentry__each_child(zrtos_vfs_dentry_t *thiz, bool(*callback)(zrtos_vfs_dentry_t *node, void *arg), void *callback_arg, bool(*filter)(zrtos_vfs_dentry_t *node, void *arg), void *filter_arg)
Definition: vfs_dentry.h:92
static bool zrtos_vfs_dentry__lookup_callback_cb(zrtos_vfs_dentry_t *node, void *arg)
Definition: vfs_dentry.h:120
bool zrtos_vfs_dentry__each_child_filter_name_cb(zrtos_vfs_dentry_t *thiz, void *arg)
Definition: vfs_dentry.h:113
char * zrtos_str__tok_r(char *s, const char *delim, char **save_ptr)
Definition: str.h:254
bool zrtos_vfs_dentry__is_filesystem(zrtos_vfs_dentry_t *node)
Definition: vfs_dentry.h:51
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zrtos_vfs_dentry__lookup_callback_cb()

static bool zrtos_vfs_dentry__lookup_callback_cb ( zrtos_vfs_dentry_t node,
void *  arg 
)
static

Definition at line 120 of file vfs_dentry.h.

120  {
121  zrtos_vfs_dentry_t **args = (zrtos_vfs_dentry_t **)arg;
122  *args = node;
123  return false;
124 }
Here is the caller graph for this function:

◆ zrtos_vfs_dentry__mount()

zrtos_error_t zrtos_vfs_dentry__mount ( zrtos_vfs_dentry_t thiz,
zrtos_vfs_plugin_t plugin,
void *  inode_ctx 
)

Definition at line 154 of file vfs_dentry.h.

158  {
160  if(0 == thiz->count){
162  &thiz->inode
163  ,plugin
164  ,inode_ctx
165  );
167  plugin
169  ,thiz
170  );
171  }
172  return ret;
173 }
zrtos_vfs_inode_t inode
Definition: vfs_dentry.h:25
#define ZRTOS_VFS_PLUGIN__INVOKE(thiz, operation,...)
Definition: vfs_plugin.h:139
#define ZRTOS_VFS_PLUGIN_OPERATION__MOUNT
Definition: vfs_plugin.h:77
Device or resource busy.
Definition: error.h:40
bool zrtos_vfs_inode__init(zrtos_vfs_inode_t *thiz, zrtos_vfs_plugin_t *plugin, void *ctx)
Definition: vfs_inode.h:22
zrtos_error_t
Definition: error.h:20
Here is the call graph for this function:

◆ zrtos_vfs_dentry__set_inode_data()

void zrtos_vfs_dentry__set_inode_data ( zrtos_vfs_dentry_t thiz,
void *  ctx 
)

Definition at line 192 of file vfs_dentry.h.

192  {
193  thiz->inode.ctx = ctx;
194 }
zrtos_vfs_inode_t inode
Definition: vfs_dentry.h:25
Here is the caller graph for this function:

◆ zrtos_vfs_dentry__umount()

zrtos_error_t zrtos_vfs_dentry__umount ( zrtos_vfs_dentry_t thiz)

Definition at line 175 of file vfs_dentry.h.

177  {
179  if(0 == thiz->count){
181  thiz->inode.plugin
183  ,thiz
184  );
185  if(zrtos_error__is_success(ret)){
187  }
188  }
189  return ret;
190 }
zrtos_vfs_inode_t inode
Definition: vfs_dentry.h:25
#define ZRTOS_VFS_PLUGIN__INVOKE(thiz, operation,...)
Definition: vfs_plugin.h:139
void zrtos_vfs_inode__deinit(zrtos_vfs_inode_t *thiz)
Definition: vfs_inode.h:32
zrtos_vfs_plugin_t * plugin
Definition: vfs_inode.h:18
bool zrtos_error__is_success(zrtos_error_t thiz)
Definition: error.h:152
Device or resource busy.
Definition: error.h:40
zrtos_error_t
Definition: error.h:20
#define ZRTOS_VFS_PLUGIN_OPERATION__UMOUNT
Definition: vfs_plugin.h:78
Here is the call graph for this function:

Variable Documentation

◆ zrtos_vfs_dentry__index

zrtos_clist_t zrtos_vfs_dentry__index = {}

Definition at line 29 of file vfs_dentry.h.