/** * debugfs_remove - removes a file or directory from the debugfs filesystem * @dentry: a pointer to a the dentry of the file or directory to be * removed. * * This function removes a file or directory in debugfs that was previously * created with a call to another debugfs function (like * debugfs_create_file() or variants thereof.) * * This function is required to be called in order for the file to be * removed, no automatic cleanup of files will happen when a module is * removed, you are responsible here. */ void debugfs_remove(struct dentry *dentry) { struct dentry *parent; int ret = 0; if (!dentry) return; parent = dentry->d_parent; if (!parent || !parent->d_inode) return; mutex_lock(&parent->d_inode->i_mutex); if (debugfs_positive(dentry)) { if (dentry->d_inode) { dget(dentry); switch (dentry->d_inode->i_mode & S_IFMT) { case S_IFDIR: ret = simple_rmdir(parent->d_inode, dentry); break; case S_IFLNK: kfree(dentry->d_inode->i_private); /* fall through */ default: simple_unlink(parent->d_inode, dentry); break; } if (!ret) d_delete(dentry); dput(dentry); } } mutex_unlock(&parent->d_inode->i_mutex); simple_release_fs(&debugfs_mount, &debugfs_mount_count); }
static int __debugfs_remove(struct dentry *dentry, struct dentry *parent) { int ret = 0; if (debugfs_positive(dentry)) { if (dentry->d_inode) { dget(dentry); switch (dentry->d_inode->i_mode & S_IFMT) { case S_IFDIR: ret = simple_rmdir(parent->d_inode, dentry); break; case S_IFLNK: kfree(dentry->d_inode->i_private); /* fall through */ default: simple_unlink(parent->d_inode, dentry); break; } if (!ret) d_delete(dentry); dput(dentry); } } return ret; }
static int remove_device_files(struct super_block *sb, struct ipath_devdata *dd) { struct dentry *dir, *root; char unit[10]; int ret; root = dget(sb->s_root); mutex_lock(&root->d_inode->i_mutex); snprintf(unit, sizeof unit, "%02d", dd->ipath_unit); dir = lookup_one_len(unit, root, strlen(unit)); if (IS_ERR(dir)) { ret = PTR_ERR(dir); printk(KERN_ERR "Lookup of %s failed\n", unit); goto bail; } remove_file(dir, "flash"); remove_file(dir, "atomic_counters"); d_delete(dir); ret = simple_rmdir(root->d_inode, dir); bail: mutex_unlock(&root->d_inode->i_mutex); dput(root); return ret; }
static void hypfs_remove(struct dentry *dentry) { struct dentry *parent; parent = dentry->d_parent; if (S_ISDIR(dentry->d_inode->i_mode)) simple_rmdir(parent->d_inode, dentry); else simple_unlink(parent->d_inode, dentry); d_delete(dentry); dput(dentry); }
static int yramfs_dir_rmdir(struct inode *dir, struct dentry *dentry) { int err = 0; DBG_PRINT("rmdir %s", dentry->d_name.name); err = yramfs_dir_remove_path(dir, dentry); if (err) { DBG_PRINT("remove path failed:%d", err); } return simple_rmdir(dir, dentry); }
static void remove_dir(struct dentry * d) { struct dentry * parent = dget(d->d_parent); down(&parent->d_inode->i_sem); d_delete(d); if (d->d_inode) simple_rmdir(parent->d_inode,d); pr_debug(" o %s removing done (%d)\n",d->d_name.name, atomic_read(&d->d_count)); up(&parent->d_inode->i_sem); dput(parent); }
static void hypfs_remove(struct dentry *dentry) { struct dentry *parent; parent = dentry->d_parent; mutex_lock(&parent->d_inode->i_mutex); if (hypfs_positive(dentry)) { if (S_ISDIR(dentry->d_inode->i_mode)) simple_rmdir(parent->d_inode, dentry); else simple_unlink(parent->d_inode, dentry); } d_delete(dentry); dput(dentry); mutex_unlock(&parent->d_inode->i_mutex); }
static void hypfs_remove(struct dentry *dentry) { struct dentry *parent; parent = dentry->d_parent; inode_lock(d_inode(parent)); if (simple_positive(dentry)) { if (d_is_dir(dentry)) simple_rmdir(d_inode(parent), dentry); else simple_unlink(d_inode(parent), dentry); } d_delete(dentry); dput(dentry); inode_unlock(d_inode(parent)); }
/** * securityfs_remove - removes a file or directory from the securityfs filesystem * * @dentry: a pointer to a the dentry of the file or directory to be removed. * * This function removes a file or directory in securityfs that was previously * created with a call to another securityfs function (like * securityfs_create_file() or variants thereof.) * * This function is required to be called in order for the file to be * removed. No automatic cleanup of files will happen when a module is * removed; you are responsible here. */ void securityfs_remove(struct dentry *dentry) { struct inode *dir; if (!dentry || IS_ERR(dentry)) return; dir = d_inode(dentry->d_parent); inode_lock(dir); if (simple_positive(dentry)) { if (d_is_dir(dentry)) simple_rmdir(dir, dentry); else simple_unlink(dir, dentry); dput(dentry); } inode_unlock(dir); simple_release_fs(&mount, &mount_count); }
static int remove_device_files(struct super_block *sb, struct qib_devdata *dd) { struct dentry *dir, *root; char unit[10]; int ret, i; root = dget(sb->s_root); mutex_lock(&d_inode(root)->i_mutex); snprintf(unit, sizeof(unit), "%u", dd->unit); dir = lookup_one_len(unit, root, strlen(unit)); if (IS_ERR(dir)) { ret = PTR_ERR(dir); pr_err("Lookup of %s failed\n", unit); goto bail; } mutex_lock(&d_inode(dir)->i_mutex); remove_file(dir, "counters"); remove_file(dir, "counter_names"); remove_file(dir, "portcounter_names"); for (i = 0; i < dd->num_pports; i++) { char fname[24]; sprintf(fname, "port%dcounters", i + 1); remove_file(dir, fname); if (dd->flags & QIB_HAS_QSFP) { sprintf(fname, "qsfp%d", i + 1); remove_file(dir, fname); } } remove_file(dir, "flash"); mutex_unlock(&d_inode(dir)->i_mutex); ret = simple_rmdir(d_inode(root), dir); d_delete(dir); dput(dir); bail: mutex_unlock(&d_inode(root)->i_mutex); dput(root); return ret; }
/** * securityfs_remove - removes a file or directory from the securityfs filesystem * * @dentry: a pointer to a the dentry of the file or directory to be removed. * * This function removes a file or directory in securityfs that was previously * created with a call to another securityfs function (like * securityfs_create_file() or variants thereof.) * * This function is required to be called in order for the file to be * removed. No automatic cleanup of files will happen when a module is * removed; you are responsible here. */ void securityfs_remove(struct dentry *dentry) { struct dentry *parent; if (!dentry || IS_ERR(dentry)) return; parent = dentry->d_parent; if (!parent || d_really_is_negative(parent)) return; inode_lock(d_inode(parent)); if (simple_positive(dentry)) { if (d_is_dir(dentry)) simple_rmdir(d_inode(parent), dentry); else simple_unlink(d_inode(parent), dentry); dput(dentry); } inode_unlock(d_inode(parent)); simple_release_fs(&mount, &mount_count); }
/** * securityfs_remove - removes a file or directory from the securityfs filesystem * * @dentry: a pointer to a the dentry of the file or directory to be removed. * * This function removes a file or directory in securityfs that was previously * created with a call to another securityfs function (like * securityfs_create_file() or variants thereof.) * * This function is required to be called in order for the file to be * removed. No automatic cleanup of files will happen when a module is * removed; you are responsible here. */ void securityfs_remove(struct dentry *dentry) { struct dentry *parent; if (!dentry || IS_ERR(dentry)) return; parent = dentry->d_parent; if (!parent || !parent->d_inode) return; mutex_lock(&parent->d_inode->i_mutex); if (positive(dentry)) { if (dentry->d_inode) { if (S_ISDIR(dentry->d_inode->i_mode)) simple_rmdir(parent->d_inode, dentry); else simple_unlink(parent->d_inode, dentry); dput(dentry); } } mutex_unlock(&parent->d_inode->i_mutex); simple_release_fs(&mount, &mount_count); }
static int remove_device_files(struct super_block *sb, struct qib_devdata *dd) { struct dentry *dir, *root; char unit[10]; int ret, i; root = dget(sb->s_root); mutex_lock(&root->d_inode->i_mutex); snprintf(unit, sizeof unit, "%u", dd->unit); dir = lookup_one_len(unit, root, strlen(unit)); if (IS_ERR(dir)) { ret = PTR_ERR(dir); printk(KERN_ERR "Lookup of %s failed\n", unit); goto bail; } remove_file(dir, "counters"); remove_file(dir, "counter_names"); remove_file(dir, "portcounter_names"); for (i = 0; i < dd->num_pports; i++) { char portcntr[24]; sprintf(portcntr, "port%dcounters", i + 1); remove_file(dir, portcntr); } remove_file(dir, "flash"); d_delete(dir); ret = simple_rmdir(root->d_inode, dir); bail: mutex_unlock(&root->d_inode->i_mutex); dput(root); return ret; }
int sjfs_dir_iops_rmdir(struct inode *i,struct dentry *d) { printk("sjfs_dir_iops_rmdir -> simple_rmdir\n"); return simple_rmdir(i, d); }