Lines Matching refs:sd
42 struct configfs_dirent *sd = dentry->d_fsdata; in configfs_d_iput() local
44 if (sd) { in configfs_d_iput()
53 if (sd->s_dentry == dentry) in configfs_d_iput()
54 sd->s_dentry = NULL; in configfs_d_iput()
57 configfs_put(sd); in configfs_d_iput()
88 static void configfs_init_dirent_depth(struct configfs_dirent *sd) in configfs_init_dirent_depth() argument
90 sd->s_depth = -1; in configfs_init_dirent_depth()
94 struct configfs_dirent *sd) in configfs_set_dir_dirent_depth() argument
99 sd->s_depth = parent_depth + 1; in configfs_set_dir_dirent_depth()
103 configfs_adjust_dir_dirent_depth_before_populate(struct configfs_dirent *sd) in configfs_adjust_dir_dirent_depth_before_populate() argument
115 if (sd->s_depth == -1) in configfs_adjust_dir_dirent_depth_before_populate()
120 sd->s_depth = 0; in configfs_adjust_dir_dirent_depth_before_populate()
124 configfs_adjust_dir_dirent_depth_after_populate(struct configfs_dirent *sd) in configfs_adjust_dir_dirent_depth_after_populate() argument
127 sd->s_depth = -1; in configfs_adjust_dir_dirent_depth_after_populate()
132 static void configfs_init_dirent_depth(struct configfs_dirent *sd) in configfs_init_dirent_depth() argument
137 struct configfs_dirent *sd) in configfs_set_dir_dirent_depth() argument
142 configfs_adjust_dir_dirent_depth_before_populate(struct configfs_dirent *sd) in configfs_adjust_dir_dirent_depth_before_populate() argument
147 configfs_adjust_dir_dirent_depth_after_populate(struct configfs_dirent *sd) in configfs_adjust_dir_dirent_depth_after_populate() argument
186 struct configfs_dirent * sd; in configfs_new_dirent() local
188 sd = kmem_cache_zalloc(configfs_dir_cachep, GFP_KERNEL); in configfs_new_dirent()
189 if (!sd) in configfs_new_dirent()
192 atomic_set(&sd->s_count, 1); in configfs_new_dirent()
193 INIT_LIST_HEAD(&sd->s_children); in configfs_new_dirent()
194 sd->s_element = element; in configfs_new_dirent()
195 sd->s_type = type; in configfs_new_dirent()
196 configfs_init_dirent_depth(sd); in configfs_new_dirent()
200 kmem_cache_free(configfs_dir_cachep, sd); in configfs_new_dirent()
203 sd->s_frag = get_fragment(frag); in configfs_new_dirent()
204 list_add(&sd->s_sibling, &parent_sd->s_children); in configfs_new_dirent()
207 return sd; in configfs_new_dirent()
220 struct configfs_dirent * sd; in configfs_dirent_exists() local
222 list_for_each_entry(sd, &parent_sd->s_children, s_sibling) { in configfs_dirent_exists()
223 if (sd->s_element) { in configfs_dirent_exists()
224 const unsigned char *existing = configfs_get_name(sd); in configfs_dirent_exists()
240 struct configfs_dirent * sd; in configfs_make_dirent() local
242 sd = configfs_new_dirent(parent_sd, element, type, frag); in configfs_make_dirent()
243 if (IS_ERR(sd)) in configfs_make_dirent()
244 return PTR_ERR(sd); in configfs_make_dirent()
246 sd->s_mode = mode; in configfs_make_dirent()
247 sd->s_dentry = dentry; in configfs_make_dirent()
249 dentry->d_fsdata = configfs_get(sd); in configfs_make_dirent()
256 struct configfs_dirent *sd = dentry->d_fsdata; in configfs_remove_dirent() local
258 if (!sd) in configfs_remove_dirent()
261 list_del_init(&sd->s_sibling); in configfs_remove_dirent()
263 configfs_put(sd); in configfs_remove_dirent()
323 static void configfs_dir_set_ready(struct configfs_dirent *sd) in configfs_dir_set_ready() argument
327 sd->s_type &= ~CONFIGFS_USET_CREATING; in configfs_dir_set_ready()
328 list_for_each_entry(child_sd, &sd->s_children, s_sibling) in configfs_dir_set_ready()
343 int configfs_dirent_is_ready(struct configfs_dirent *sd) in configfs_dirent_is_ready() argument
348 ret = !(sd->s_type & CONFIGFS_USET_CREATING); in configfs_dirent_is_ready()
425 static int configfs_attach_attr(struct configfs_dirent * sd, struct dentry * dentry) in configfs_attach_attr() argument
427 struct configfs_attribute * attr = sd->s_element; in configfs_attach_attr()
431 dentry->d_fsdata = configfs_get(sd); in configfs_attach_attr()
432 sd->s_dentry = dentry; in configfs_attach_attr()
437 configfs_put(sd); in configfs_attach_attr()
440 if (sd->s_type & CONFIGFS_ITEM_BIN_ATTR) { in configfs_attach_attr()
456 struct configfs_dirent * sd; in configfs_lookup() local
472 list_for_each_entry(sd, &parent_sd->s_children, s_sibling) { in configfs_lookup()
473 if (sd->s_type & CONFIGFS_NOT_PINNED) { in configfs_lookup()
474 const unsigned char * name = configfs_get_name(sd); in configfs_lookup()
480 err = configfs_attach_attr(sd, dentry); in configfs_lookup()
511 struct configfs_dirent *sd; in configfs_detach_prep() local
522 list_for_each_entry(sd, &parent_sd->s_children, s_sibling) { in configfs_detach_prep()
523 if (!sd->s_element || in configfs_detach_prep()
524 (sd->s_type & CONFIGFS_NOT_PINNED)) in configfs_detach_prep()
526 if (sd->s_type & CONFIGFS_USET_DEFAULT) { in configfs_detach_prep()
528 if (sd->s_type & CONFIGFS_USET_IN_MKDIR) { in configfs_detach_prep()
530 *wait= dget(sd->s_dentry); in configfs_detach_prep()
538 ret = configfs_detach_prep(sd->s_dentry, wait); in configfs_detach_prep()
558 struct configfs_dirent *sd; in configfs_detach_rollback() local
562 list_for_each_entry(sd, &parent_sd->s_children, s_sibling) in configfs_detach_rollback()
563 if (sd->s_type & CONFIGFS_USET_DEFAULT) in configfs_detach_rollback()
564 configfs_detach_rollback(sd->s_dentry); in configfs_detach_rollback()
571 struct configfs_dirent * sd, * tmp; in detach_attrs() local
580 list_for_each_entry_safe(sd, tmp, &parent_sd->s_children, s_sibling) { in detach_attrs()
581 if (!sd->s_element || !(sd->s_type & CONFIGFS_NOT_PINNED)) in detach_attrs()
584 list_del_init(&sd->s_sibling); in detach_attrs()
586 configfs_drop_dentry(sd, dentry); in detach_attrs()
587 configfs_put(sd); in detach_attrs()
637 struct configfs_dirent *sd, *tmp; in detach_groups() local
643 list_for_each_entry_safe(sd, tmp, &parent_sd->s_children, s_sibling) { in detach_groups()
644 if (!sd->s_element || in detach_groups()
645 !(sd->s_type & CONFIGFS_USET_DEFAULT)) in detach_groups()
648 child = sd->s_dentry; in detach_groups()
652 configfs_detach_group(sd->s_element); in detach_groups()
681 struct configfs_dirent *sd; in create_default_group() local
696 sd = child->d_fsdata; in create_default_group()
697 sd->s_type |= CONFIGFS_USET_DEFAULT; in create_default_group()
868 struct configfs_dirent *sd; in configfs_attach_group() local
872 sd = dentry->d_fsdata; in configfs_attach_group()
873 sd->s_type |= CONFIGFS_USET_DIR; in configfs_attach_group()
885 configfs_adjust_dir_dirent_depth_before_populate(sd); in configfs_attach_group()
892 configfs_adjust_dir_dirent_depth_after_populate(sd); in configfs_attach_group()
956 static void configfs_dump_one(struct configfs_dirent *sd, int level) in configfs_dump_one() argument
958 pr_info("%*s\"%s\":\n", level, " ", configfs_get_name(sd)); in configfs_dump_one()
960 #define type_print(_type) if (sd->s_type & _type) pr_info("%*s %s\n", level, " ", #_type); in configfs_dump_one()
971 static int configfs_dump(struct configfs_dirent *sd, int level) in configfs_dump() argument
976 configfs_dump_one(sd, level); in configfs_dump()
978 if (!(sd->s_type & (CONFIGFS_DIR|CONFIGFS_ROOT))) in configfs_dump()
981 list_for_each_entry(child_sd, &sd->s_children, s_sibling) { in configfs_dump()
1053 struct configfs_dirent *child_sd, *sd; in configfs_depend_prep() local
1057 sd = origin->d_fsdata; in configfs_depend_prep()
1059 if (sd->s_element == target) /* Boo-yah */ in configfs_depend_prep()
1062 list_for_each_entry(child_sd, &sd->s_children, s_sibling) { in configfs_depend_prep()
1176 struct configfs_dirent *sd; in configfs_undepend_item() local
1184 sd = target->ci_dentry->d_fsdata; in configfs_undepend_item()
1185 BUG_ON(sd->s_dependent_count < 1); in configfs_undepend_item()
1187 sd->s_dependent_count -= 1; in configfs_undepend_item()
1278 struct configfs_dirent *sd; in configfs_mkdir() local
1284 sd = dentry->d_parent->d_fsdata; in configfs_mkdir()
1290 if (!configfs_dirent_is_ready(sd)) { in configfs_mkdir()
1295 if (!(sd->s_type & CONFIGFS_USET_DIR)) { in configfs_mkdir()
1404 sd->s_type |= CONFIGFS_USET_IN_MKDIR; in configfs_mkdir()
1413 sd->s_type &= ~CONFIGFS_USET_IN_MKDIR; in configfs_mkdir()
1458 struct configfs_dirent *sd; in configfs_rmdir() local
1463 sd = dentry->d_fsdata; in configfs_rmdir()
1464 if (sd->s_type & CONFIGFS_USET_DEFAULT) in configfs_rmdir()
1495 ret = sd->s_dependent_count ? -EBUSY : 0; in configfs_rmdir()
1517 frag = sd->s_frag; in configfs_rmdir()
1536 if (sd->s_type & CONFIGFS_USET_DIR) { in configfs_rmdir()
1617 static inline unsigned char dt_type(struct configfs_dirent *sd) in dt_type() argument
1619 return (sd->s_mode >> 12) & 15; in dt_type()
1701 struct configfs_dirent *sd = dentry->d_fsdata; in configfs_dir_lseek() local
1708 p = sd->s_children.next; in configfs_dir_lseek()
1709 while (n && p != &sd->s_children) { in configfs_dir_lseek()
1792 struct configfs_dirent *sd = dentry->d_fsdata; in configfs_unregister_group() local
1793 struct configfs_fragment *frag = sd->s_frag; in configfs_unregister_group()
1869 struct configfs_dirent *sd; in configfs_register_subsystem() local
1885 sd = root->d_fsdata; in configfs_register_subsystem()
1886 link_group(to_config_group(sd->s_element), group); in configfs_register_subsystem()
1895 err = configfs_attach_group(sd->s_element, &group->cg_item, in configfs_register_subsystem()
1924 struct configfs_dirent *sd = dentry->d_fsdata; in configfs_unregister_subsystem() local
1925 struct configfs_fragment *frag = sd->s_frag; in configfs_unregister_subsystem()