Lines Matching refs:sd
56 struct configfs_dirent *sd = dentry->d_fsdata; in configfs_d_iput() local
58 if (sd) { in configfs_d_iput()
67 if (sd->s_dentry == dentry) in configfs_d_iput()
68 sd->s_dentry = NULL; in configfs_d_iput()
71 configfs_put(sd); in configfs_d_iput()
102 static void configfs_init_dirent_depth(struct configfs_dirent *sd) in configfs_init_dirent_depth() argument
104 sd->s_depth = -1; in configfs_init_dirent_depth()
108 struct configfs_dirent *sd) in configfs_set_dir_dirent_depth() argument
113 sd->s_depth = parent_depth + 1; in configfs_set_dir_dirent_depth()
117 configfs_adjust_dir_dirent_depth_before_populate(struct configfs_dirent *sd) in configfs_adjust_dir_dirent_depth_before_populate() argument
129 if (sd->s_depth == -1) in configfs_adjust_dir_dirent_depth_before_populate()
134 sd->s_depth = 0; in configfs_adjust_dir_dirent_depth_before_populate()
138 configfs_adjust_dir_dirent_depth_after_populate(struct configfs_dirent *sd) in configfs_adjust_dir_dirent_depth_after_populate() argument
141 sd->s_depth = -1; in configfs_adjust_dir_dirent_depth_after_populate()
146 static void configfs_init_dirent_depth(struct configfs_dirent *sd) in configfs_init_dirent_depth() argument
151 struct configfs_dirent *sd) in configfs_set_dir_dirent_depth() argument
156 configfs_adjust_dir_dirent_depth_before_populate(struct configfs_dirent *sd) in configfs_adjust_dir_dirent_depth_before_populate() argument
161 configfs_adjust_dir_dirent_depth_after_populate(struct configfs_dirent *sd) in configfs_adjust_dir_dirent_depth_after_populate() argument
173 struct configfs_dirent * sd; in configfs_new_dirent() local
175 sd = kmem_cache_zalloc(configfs_dir_cachep, GFP_KERNEL); in configfs_new_dirent()
176 if (!sd) in configfs_new_dirent()
179 atomic_set(&sd->s_count, 1); in configfs_new_dirent()
180 INIT_LIST_HEAD(&sd->s_links); in configfs_new_dirent()
181 INIT_LIST_HEAD(&sd->s_children); in configfs_new_dirent()
182 sd->s_element = element; in configfs_new_dirent()
183 sd->s_type = type; in configfs_new_dirent()
184 configfs_init_dirent_depth(sd); in configfs_new_dirent()
188 kmem_cache_free(configfs_dir_cachep, sd); in configfs_new_dirent()
191 list_add(&sd->s_sibling, &parent_sd->s_children); in configfs_new_dirent()
194 return sd; in configfs_new_dirent()
207 struct configfs_dirent * sd; in configfs_dirent_exists() local
209 list_for_each_entry(sd, &parent_sd->s_children, s_sibling) { in configfs_dirent_exists()
210 if (sd->s_element) { in configfs_dirent_exists()
211 const unsigned char *existing = configfs_get_name(sd); in configfs_dirent_exists()
227 struct configfs_dirent * sd; in configfs_make_dirent() local
229 sd = configfs_new_dirent(parent_sd, element, type); in configfs_make_dirent()
230 if (IS_ERR(sd)) in configfs_make_dirent()
231 return PTR_ERR(sd); in configfs_make_dirent()
233 sd->s_mode = mode; in configfs_make_dirent()
234 sd->s_dentry = dentry; in configfs_make_dirent()
236 dentry->d_fsdata = configfs_get(sd); in configfs_make_dirent()
293 struct configfs_dirent *sd = dentry->d_fsdata; in configfs_create_dir() local
294 if (sd) { in configfs_create_dir()
296 list_del_init(&sd->s_sibling); in configfs_create_dir()
298 configfs_put(sd); in configfs_create_dir()
311 static void configfs_dir_set_ready(struct configfs_dirent *sd) in configfs_dir_set_ready() argument
315 sd->s_type &= ~CONFIGFS_USET_CREATING; in configfs_dir_set_ready()
316 list_for_each_entry(child_sd, &sd->s_children, s_sibling) in configfs_dir_set_ready()
331 int configfs_dirent_is_ready(struct configfs_dirent *sd) in configfs_dirent_is_ready() argument
336 ret = !(sd->s_type & CONFIGFS_USET_CREATING); in configfs_dirent_is_ready()
354 struct configfs_dirent *sd = dentry->d_fsdata; in configfs_create_link() local
355 if (sd) { in configfs_create_link()
357 list_del_init(&sd->s_sibling); in configfs_create_link()
359 configfs_put(sd); in configfs_create_link()
369 struct configfs_dirent * sd; in remove_dir() local
371 sd = d->d_fsdata; in remove_dir()
373 list_del_init(&sd->s_sibling); in remove_dir()
375 configfs_put(sd); in remove_dir()
413 static int configfs_attach_attr(struct configfs_dirent * sd, struct dentry * dentry) in configfs_attach_attr() argument
415 struct configfs_attribute * attr = sd->s_element; in configfs_attach_attr()
419 dentry->d_fsdata = configfs_get(sd); in configfs_attach_attr()
420 sd->s_dentry = dentry; in configfs_attach_attr()
426 configfs_put(sd); in configfs_attach_attr()
440 struct configfs_dirent * sd; in configfs_lookup() local
456 list_for_each_entry(sd, &parent_sd->s_children, s_sibling) { in configfs_lookup()
457 if (sd->s_type & CONFIGFS_NOT_PINNED) { in configfs_lookup()
458 const unsigned char * name = configfs_get_name(sd); in configfs_lookup()
464 err = configfs_attach_attr(sd, dentry); in configfs_lookup()
495 struct configfs_dirent *sd; in configfs_detach_prep() local
506 list_for_each_entry(sd, &parent_sd->s_children, s_sibling) { in configfs_detach_prep()
507 if (!sd->s_element || in configfs_detach_prep()
508 (sd->s_type & CONFIGFS_NOT_PINNED)) in configfs_detach_prep()
510 if (sd->s_type & CONFIGFS_USET_DEFAULT) { in configfs_detach_prep()
512 if (sd->s_type & CONFIGFS_USET_IN_MKDIR) { in configfs_detach_prep()
514 *wait_mutex = &d_inode(sd->s_dentry)->i_mutex; in configfs_detach_prep()
522 ret = configfs_detach_prep(sd->s_dentry, wait_mutex); in configfs_detach_prep()
542 struct configfs_dirent *sd; in configfs_detach_rollback() local
546 list_for_each_entry(sd, &parent_sd->s_children, s_sibling) in configfs_detach_rollback()
547 if (sd->s_type & CONFIGFS_USET_DEFAULT) in configfs_detach_rollback()
548 configfs_detach_rollback(sd->s_dentry); in configfs_detach_rollback()
555 struct configfs_dirent * sd, * tmp; in detach_attrs() local
564 list_for_each_entry_safe(sd, tmp, &parent_sd->s_children, s_sibling) { in detach_attrs()
565 if (!sd->s_element || !(sd->s_type & CONFIGFS_NOT_PINNED)) in detach_attrs()
568 list_del_init(&sd->s_sibling); in detach_attrs()
570 configfs_drop_dentry(sd, dentry); in detach_attrs()
571 configfs_put(sd); in detach_attrs()
612 struct configfs_dirent *sd, *tmp; in detach_groups() local
618 list_for_each_entry_safe(sd, tmp, &parent_sd->s_children, s_sibling) { in detach_groups()
619 if (!sd->s_element || in detach_groups()
620 !(sd->s_type & CONFIGFS_USET_DEFAULT)) in detach_groups()
623 child = sd->s_dentry; in detach_groups()
627 configfs_detach_group(sd->s_element); in detach_groups()
655 struct configfs_dirent *sd; in create_default_group() local
670 sd = child->d_fsdata; in create_default_group()
671 sd->s_type |= CONFIGFS_USET_DEFAULT; in create_default_group()
843 struct configfs_dirent *sd; in configfs_attach_group() local
847 sd = dentry->d_fsdata; in configfs_attach_group()
848 sd->s_type |= CONFIGFS_USET_DIR; in configfs_attach_group()
860 configfs_adjust_dir_dirent_depth_before_populate(sd); in configfs_attach_group()
867 configfs_adjust_dir_dirent_depth_after_populate(sd); in configfs_attach_group()
931 static void configfs_dump_one(struct configfs_dirent *sd, int level) in configfs_dump_one() argument
933 pr_info("%*s\"%s\":\n", level, " ", configfs_get_name(sd)); in configfs_dump_one()
935 #define type_print(_type) if (sd->s_type & _type) pr_info("%*s %s\n", level, " ", #_type); in configfs_dump_one()
946 static int configfs_dump(struct configfs_dirent *sd, int level) in configfs_dump() argument
951 configfs_dump_one(sd, level); in configfs_dump()
953 if (!(sd->s_type & (CONFIGFS_DIR|CONFIGFS_ROOT))) in configfs_dump()
956 list_for_each_entry(child_sd, &sd->s_children, s_sibling) { in configfs_dump()
1028 struct configfs_dirent *child_sd, *sd; in configfs_depend_prep() local
1032 sd = origin->d_fsdata; in configfs_depend_prep()
1034 if (sd->s_element == target) /* Boo-yah */ in configfs_depend_prep()
1037 list_for_each_entry(child_sd, &sd->s_children, s_sibling) { in configfs_depend_prep()
1132 struct configfs_dirent *sd; in configfs_undepend_item() local
1140 sd = target->ci_dentry->d_fsdata; in configfs_undepend_item()
1141 BUG_ON(sd->s_dependent_count < 1); in configfs_undepend_item()
1143 sd->s_dependent_count -= 1; in configfs_undepend_item()
1161 struct configfs_dirent *sd; in configfs_mkdir() local
1166 sd = dentry->d_parent->d_fsdata; in configfs_mkdir()
1172 if (!configfs_dirent_is_ready(sd)) { in configfs_mkdir()
1177 if (!(sd->s_type & CONFIGFS_USET_DIR)) { in configfs_mkdir()
1280 sd->s_type |= CONFIGFS_USET_IN_MKDIR; in configfs_mkdir()
1289 sd->s_type &= ~CONFIGFS_USET_IN_MKDIR; in configfs_mkdir()
1333 struct configfs_dirent *sd; in configfs_rmdir() local
1337 sd = dentry->d_fsdata; in configfs_rmdir()
1338 if (sd->s_type & CONFIGFS_USET_DEFAULT) in configfs_rmdir()
1369 ret = sd->s_dependent_count ? -EBUSY : 0; in configfs_rmdir()
1399 if (sd->s_type & CONFIGFS_USET_DIR) { in configfs_rmdir()
1518 static inline unsigned char dt_type(struct configfs_dirent *sd) in dt_type() argument
1520 return (sd->s_mode >> 12) & 15; in dt_type()
1605 struct configfs_dirent *sd = dentry->d_fsdata; in configfs_dir_lseek() local
1612 p = sd->s_children.next; in configfs_dir_lseek()
1613 while (n && p != &sd->s_children) { in configfs_dir_lseek()
1753 struct configfs_dirent *sd; in configfs_register_subsystem() local
1762 sd = root->d_fsdata; in configfs_register_subsystem()
1763 link_group(to_config_group(sd->s_element), group); in configfs_register_subsystem()
1772 err = configfs_attach_group(sd->s_element, &group->cg_item, in configfs_register_subsystem()