-
-void smfs_clear_dentry(struct dentry *dentry)
-{
- struct qstr *name = NULL;
-
- if (dentry) {
- if (!atomic_dec_and_lock(&dentry->d_count, &dcache_lock))
- return;
- list_del(&dentry->d_hash);
- INIT_LIST_HEAD(&dentry->d_hash);
- list_del(&dentry->d_child);
- if (dentry->d_inode) {
- dentry->d_inode = NULL;
- list_del_init(&dentry->d_alias);
- }
-
- name = &(dentry->d_name);
- if (name->len > DNAME_INLINE_LEN-1) {
- SM_FREE((char *)name->name, NAME_ALLOC_LEN(name->len));
- }
- }
-}
-
-int smfs_prepare_dentry(struct dentry *dentry,
- struct dentry *parent,
- struct qstr *name)
-{
- char *str = NULL;
-
- if (name->len > DNAME_INLINE_LEN-1) {
- SM_ALLOC(str, NAME_ALLOC_LEN(name->len));
- if (!str)
- return (-ENOMEM);
- } else
- str = dentry->d_iname;
-
- memcpy(str, name->name, name->len);
- str[name->len] = 0;
-
- atomic_set(&dentry->d_count, 1);
- dentry->d_vfs_flags = 0;
- dentry->d_flags = 0;
- dentry->d_inode = NULL;
- dentry->d_parent = NULL;
- dentry->d_sb = NULL;
- dentry->d_name.name = str;
- dentry->d_name.len = name->len;
- dentry->d_name.hash = name->hash;
- dentry->d_op = NULL;
- dentry->d_fsdata = NULL;
- dentry->d_mounted = 0;
- INIT_LIST_HEAD(&dentry->d_hash);
- INIT_LIST_HEAD(&dentry->d_lru);
- INIT_LIST_HEAD(&dentry->d_subdirs);
- INIT_LIST_HEAD(&dentry->d_alias);
-
- if (parent) {
- dentry->d_parent = dget(parent);
- dentry->d_sb = parent->d_sb;
- list_add(&dentry->d_child, &parent->d_subdirs);
- } else
- INIT_LIST_HEAD(&dentry->d_child);
-
- return 0;
-}
-static void prepare_parent_dentry(struct dentry *dentry, struct inode *inode)