void gra2cairo_remove_fontmap(const char *fontalias) { struct fontmap *fnew; if (nhash_get_ptr(Gra2cairoConf->fontmap, fontalias, (void *) &fnew) == 0) { free_font_map(fnew); nhash_del(Gra2cairoConf->fontmap, fontalias); } }
int aufs_rmdir(struct inode *dir, struct dentry *dentry) { int err, rmdir_later; struct inode *inode, *hidden_dir; struct dentry *parent, *wh_dentry, *hidden_dentry, *hidden_parent; struct dtime dt; aufs_bindex_t bwh, bindex, bstart; struct rmdir_whtmp_arg *arg; struct aufs_nhash *whlist; LKTRTrace("i%lu, %.*s\n", dir->i_ino, DLNPair(dentry)); IMustLock(dir); inode = dentry->d_inode; if (unlikely(!inode)) return -ENOENT; // possible? IMustLock(inode); whlist = nhash_new(GFP_KERNEL); err = PTR_ERR(whlist); if (IS_ERR(whlist)) goto out; err = -ENOMEM; arg = kmalloc(sizeof(*arg), GFP_KERNEL); //arg = NULL; if (unlikely(!arg)) goto out_whlist; aufs_read_lock(dentry, AUFS_D_WLOCK); parent = dentry->d_parent; di_write_lock_parent(parent); err = test_empty(dentry, whlist); //err = -1; if (unlikely(err)) goto out_arg; bstart = dbstart(dentry); bwh = dbwh(dentry); bindex = -1; wh_dentry = lock_hdir_create_wh(dentry, /*isdir*/ 1, &bindex, &dt); //wh_dentry = ERR_PTR(-1); err = PTR_ERR(wh_dentry); if (IS_ERR(wh_dentry)) goto out_arg; hidden_dentry = au_h_dptr(dentry); dget(hidden_dentry); hidden_parent = hidden_dentry->d_parent; hidden_dir = hidden_parent->d_inode; rmdir_later = 0; if (bindex == bstart) { IMustLock(hidden_dir); err = renwh_and_rmdir(dentry, bstart, whlist, dir); //err = -1; if (err > 0) { rmdir_later = err; err = 0; } } else { DEBUG_ON(!wh_dentry); hidden_parent = wh_dentry->d_parent; DEBUG_ON(hidden_parent != au_h_dptr_i(parent, bindex)); hidden_dir = hidden_parent->d_inode; IMustLock(hidden_dir); err = 0; } if (!err) { au_reset_hinotify(inode, /*flags*/0); inode->i_nlink = 0; set_dbdiropq(dentry, -1); epilog(dir, dentry, bindex); if (rmdir_later) { kick_rmdir_whtmp(hidden_dentry, whlist, bstart, dir, inode, arg); arg = NULL; } goto out_unlock; /* success */ } /* revert */ LKTRLabel(revert); if (wh_dentry) { int rerr; rerr = do_revert(err, wh_dentry, dentry, bwh, &dt, need_dlgt(dir->i_sb)); if (rerr) err = rerr; } out_unlock: hdir_unlock(hidden_dir, dir, bindex); dput(wh_dentry); dput(hidden_dentry); out_arg: di_write_unlock(parent); aufs_read_unlock(dentry, AUFS_D_WLOCK); kfree(arg); out_whlist: nhash_del(whlist); out: TraceErr(err); return err; }