Lines Matching refs:sd

56 	struct configfs_dirent *sd = dentry->d_fsdata;  in configfs_d_iput()  local
58 if (sd) { in configfs_d_iput()
69 if (atomic_read(&sd->s_count) <= 2) in configfs_d_iput()
70 sd->s_dentry = NULL; in configfs_d_iput()
73 configfs_put(sd); in configfs_d_iput()
104 static void configfs_init_dirent_depth(struct configfs_dirent *sd) in configfs_init_dirent_depth() argument
106 sd->s_depth = -1; in configfs_init_dirent_depth()
110 struct configfs_dirent *sd) in configfs_set_dir_dirent_depth() argument
115 sd->s_depth = parent_depth + 1; in configfs_set_dir_dirent_depth()
119 configfs_adjust_dir_dirent_depth_before_populate(struct configfs_dirent *sd) in configfs_adjust_dir_dirent_depth_before_populate() argument
131 if (sd->s_depth == -1) in configfs_adjust_dir_dirent_depth_before_populate()
136 sd->s_depth = 0; in configfs_adjust_dir_dirent_depth_before_populate()
140 configfs_adjust_dir_dirent_depth_after_populate(struct configfs_dirent *sd) in configfs_adjust_dir_dirent_depth_after_populate() argument
143 sd->s_depth = -1; in configfs_adjust_dir_dirent_depth_after_populate()
148 static void configfs_init_dirent_depth(struct configfs_dirent *sd) in configfs_init_dirent_depth() argument
153 struct configfs_dirent *sd) in configfs_set_dir_dirent_depth() argument
158 configfs_adjust_dir_dirent_depth_before_populate(struct configfs_dirent *sd) in configfs_adjust_dir_dirent_depth_before_populate() argument
163 configfs_adjust_dir_dirent_depth_after_populate(struct configfs_dirent *sd) in configfs_adjust_dir_dirent_depth_after_populate() argument
175 struct configfs_dirent * sd; in configfs_new_dirent() local
177 sd = kmem_cache_zalloc(configfs_dir_cachep, GFP_KERNEL); in configfs_new_dirent()
178 if (!sd) in configfs_new_dirent()
181 atomic_set(&sd->s_count, 1); in configfs_new_dirent()
182 INIT_LIST_HEAD(&sd->s_links); in configfs_new_dirent()
183 INIT_LIST_HEAD(&sd->s_children); in configfs_new_dirent()
184 sd->s_element = element; in configfs_new_dirent()
185 sd->s_type = type; in configfs_new_dirent()
186 configfs_init_dirent_depth(sd); in configfs_new_dirent()
190 kmem_cache_free(configfs_dir_cachep, sd); in configfs_new_dirent()
193 list_add(&sd->s_sibling, &parent_sd->s_children); in configfs_new_dirent()
196 return sd; in configfs_new_dirent()
209 struct configfs_dirent * sd; in configfs_dirent_exists() local
211 list_for_each_entry(sd, &parent_sd->s_children, s_sibling) { in configfs_dirent_exists()
212 if (sd->s_element) { in configfs_dirent_exists()
213 const unsigned char *existing = configfs_get_name(sd); in configfs_dirent_exists()
229 struct configfs_dirent * sd; in configfs_make_dirent() local
231 sd = configfs_new_dirent(parent_sd, element, type); in configfs_make_dirent()
232 if (IS_ERR(sd)) in configfs_make_dirent()
233 return PTR_ERR(sd); in configfs_make_dirent()
235 sd->s_mode = mode; in configfs_make_dirent()
236 sd->s_dentry = dentry; in configfs_make_dirent()
238 dentry->d_fsdata = configfs_get(sd); in configfs_make_dirent()
295 struct configfs_dirent *sd = dentry->d_fsdata; in configfs_create_dir() local
296 if (sd) { in configfs_create_dir()
298 list_del_init(&sd->s_sibling); in configfs_create_dir()
300 configfs_put(sd); in configfs_create_dir()
313 static void configfs_dir_set_ready(struct configfs_dirent *sd) in configfs_dir_set_ready() argument
317 sd->s_type &= ~CONFIGFS_USET_CREATING; in configfs_dir_set_ready()
318 list_for_each_entry(child_sd, &sd->s_children, s_sibling) in configfs_dir_set_ready()
333 int configfs_dirent_is_ready(struct configfs_dirent *sd) in configfs_dirent_is_ready() argument
338 ret = !(sd->s_type & CONFIGFS_USET_CREATING); in configfs_dirent_is_ready()
356 struct configfs_dirent *sd = dentry->d_fsdata; in configfs_create_link() local
357 if (sd) { in configfs_create_link()
359 list_del_init(&sd->s_sibling); in configfs_create_link()
361 configfs_put(sd); in configfs_create_link()
371 struct configfs_dirent * sd; in remove_dir() local
373 sd = d->d_fsdata; in remove_dir()
375 list_del_init(&sd->s_sibling); in remove_dir()
377 configfs_put(sd); in remove_dir()
415 static int configfs_attach_attr(struct configfs_dirent * sd, struct dentry * dentry) in configfs_attach_attr() argument
417 struct configfs_attribute * attr = sd->s_element; in configfs_attach_attr()
421 dentry->d_fsdata = configfs_get(sd); in configfs_attach_attr()
422 sd->s_dentry = dentry; in configfs_attach_attr()
428 configfs_put(sd); in configfs_attach_attr()
442 struct configfs_dirent * sd; in configfs_lookup() local
458 list_for_each_entry(sd, &parent_sd->s_children, s_sibling) { in configfs_lookup()
459 if (sd->s_type & CONFIGFS_NOT_PINNED) { in configfs_lookup()
460 const unsigned char * name = configfs_get_name(sd); in configfs_lookup()
466 err = configfs_attach_attr(sd, dentry); in configfs_lookup()
497 struct configfs_dirent *sd; in configfs_detach_prep() local
508 list_for_each_entry(sd, &parent_sd->s_children, s_sibling) { in configfs_detach_prep()
509 if (!sd->s_element || in configfs_detach_prep()
510 (sd->s_type & CONFIGFS_NOT_PINNED)) in configfs_detach_prep()
512 if (sd->s_type & CONFIGFS_USET_DEFAULT) { in configfs_detach_prep()
514 if (sd->s_type & CONFIGFS_USET_IN_MKDIR) { in configfs_detach_prep()
516 *wait_mutex = &d_inode(sd->s_dentry)->i_mutex; in configfs_detach_prep()
524 ret = configfs_detach_prep(sd->s_dentry, wait_mutex); in configfs_detach_prep()
544 struct configfs_dirent *sd; in configfs_detach_rollback() local
548 list_for_each_entry(sd, &parent_sd->s_children, s_sibling) in configfs_detach_rollback()
549 if (sd->s_type & CONFIGFS_USET_DEFAULT) in configfs_detach_rollback()
550 configfs_detach_rollback(sd->s_dentry); in configfs_detach_rollback()
557 struct configfs_dirent * sd, * tmp; in detach_attrs() local
566 list_for_each_entry_safe(sd, tmp, &parent_sd->s_children, s_sibling) { in detach_attrs()
567 if (!sd->s_element || !(sd->s_type & CONFIGFS_NOT_PINNED)) in detach_attrs()
570 list_del_init(&sd->s_sibling); in detach_attrs()
572 configfs_drop_dentry(sd, dentry); in detach_attrs()
573 configfs_put(sd); in detach_attrs()
614 struct configfs_dirent *sd, *tmp; in detach_groups() local
620 list_for_each_entry_safe(sd, tmp, &parent_sd->s_children, s_sibling) { in detach_groups()
621 if (!sd->s_element || in detach_groups()
622 !(sd->s_type & CONFIGFS_USET_DEFAULT)) in detach_groups()
625 child = sd->s_dentry; in detach_groups()
629 configfs_detach_group(sd->s_element); in detach_groups()
657 struct configfs_dirent *sd; in create_default_group() local
672 sd = child->d_fsdata; in create_default_group()
673 sd->s_type |= CONFIGFS_USET_DEFAULT; in create_default_group()
845 struct configfs_dirent *sd; in configfs_attach_group() local
849 sd = dentry->d_fsdata; in configfs_attach_group()
850 sd->s_type |= CONFIGFS_USET_DIR; in configfs_attach_group()
862 configfs_adjust_dir_dirent_depth_before_populate(sd); in configfs_attach_group()
869 configfs_adjust_dir_dirent_depth_after_populate(sd); in configfs_attach_group()
933 static void configfs_dump_one(struct configfs_dirent *sd, int level) in configfs_dump_one() argument
935 pr_info("%*s\"%s\":\n", level, " ", configfs_get_name(sd)); in configfs_dump_one()
937 #define type_print(_type) if (sd->s_type & _type) pr_info("%*s %s\n", level, " ", #_type); in configfs_dump_one()
948 static int configfs_dump(struct configfs_dirent *sd, int level) in configfs_dump() argument
953 configfs_dump_one(sd, level); in configfs_dump()
955 if (!(sd->s_type & (CONFIGFS_DIR|CONFIGFS_ROOT))) in configfs_dump()
958 list_for_each_entry(child_sd, &sd->s_children, s_sibling) { in configfs_dump()
1030 struct configfs_dirent *child_sd, *sd; in configfs_depend_prep() local
1034 sd = origin->d_fsdata; in configfs_depend_prep()
1036 if (sd->s_element == target) /* Boo-yah */ in configfs_depend_prep()
1039 list_for_each_entry(child_sd, &sd->s_children, s_sibling) { in configfs_depend_prep()
1134 struct configfs_dirent *sd; in configfs_undepend_item() local
1142 sd = target->ci_dentry->d_fsdata; in configfs_undepend_item()
1143 BUG_ON(sd->s_dependent_count < 1); in configfs_undepend_item()
1145 sd->s_dependent_count -= 1; in configfs_undepend_item()
1163 struct configfs_dirent *sd; in configfs_mkdir() local
1168 sd = dentry->d_parent->d_fsdata; in configfs_mkdir()
1174 if (!configfs_dirent_is_ready(sd)) { in configfs_mkdir()
1179 if (!(sd->s_type & CONFIGFS_USET_DIR)) { in configfs_mkdir()
1282 sd->s_type |= CONFIGFS_USET_IN_MKDIR; in configfs_mkdir()
1291 sd->s_type &= ~CONFIGFS_USET_IN_MKDIR; in configfs_mkdir()
1335 struct configfs_dirent *sd; in configfs_rmdir() local
1339 sd = dentry->d_fsdata; in configfs_rmdir()
1340 if (sd->s_type & CONFIGFS_USET_DEFAULT) in configfs_rmdir()
1371 ret = sd->s_dependent_count ? -EBUSY : 0; in configfs_rmdir()
1401 if (sd->s_type & CONFIGFS_USET_DIR) { in configfs_rmdir()
1520 static inline unsigned char dt_type(struct configfs_dirent *sd) in dt_type() argument
1522 return (sd->s_mode >> 12) & 15; in dt_type()
1607 struct configfs_dirent *sd = dentry->d_fsdata; in configfs_dir_lseek() local
1614 p = sd->s_children.next; in configfs_dir_lseek()
1615 while (n && p != &sd->s_children) { in configfs_dir_lseek()
1755 struct configfs_dirent *sd; in configfs_register_subsystem() local
1764 sd = root->d_fsdata; in configfs_register_subsystem()
1765 link_group(to_config_group(sd->s_element), group); in configfs_register_subsystem()
1774 err = configfs_attach_group(sd->s_element, &group->cg_item, in configfs_register_subsystem()