static int coda_mkdir(struct inode *dir, struct dentry *de, int mode) { struct inode *inode; struct coda_vattr attrs; const char *name = de->d_name.name; int len = de->d_name.len; int error; struct CodaFid newfid; if (coda_isroot(dir) && coda_iscontrol(name, len)) return -EPERM; attrs.va_mode = mode; error = venus_mkdir(dir->i_sb, coda_i2f(dir), name, len, &newfid, &attrs); if (error) goto err_out; inode = coda_iget(dir->i_sb, &newfid, &attrs); if (IS_ERR(inode)) { error = PTR_ERR(inode); goto err_out; } /* invalidate the directory cnode's attributes */ coda_dir_inc_nlink(dir); coda_dir_update_mtime(dir); d_instantiate(de, inode); return 0; err_out: d_drop(de); return error; }
static int coda_mkdir(struct inode *dir, struct dentry *de, int mode) { struct inode *inode; struct coda_vattr attrs; const char *name = de->d_name.name; int len = de->d_name.len; int error; struct ViceFid newfid; coda_vfs_stat.mkdir++; if (coda_isroot(dir) && coda_iscontrol(name, len)) return -EPERM; CDEBUG(D_INODE, "mkdir %s (len %d) in %s, mode %o.\n", name, len, coda_i2s(dir), mode); attrs.va_mode = mode; error = venus_mkdir(dir->i_sb, coda_i2f(dir), name, len, &newfid, &attrs); if ( error ) { CDEBUG(D_INODE, "mkdir error: %s result %d\n", coda_f2s(&newfid), error); d_drop(de); return error; } CDEBUG(D_INODE, "mkdir: new dir has fid %s.\n", coda_f2s(&newfid)); inode = coda_iget(dir->i_sb, &newfid, &attrs); if ( IS_ERR(inode) ) { d_drop(de); return PTR_ERR(inode); } /* invalidate the directory cnode's attributes */ coda_dir_changed(dir, 1); d_instantiate(de, inode); return 0; }
static int coda_mkdir(struct inode *dir, struct dentry *de, int mode) { struct inode *inode; struct coda_vattr attrs; const char *name = de->d_name.name; int len = de->d_name.len; int error; struct CodaFid newfid; lock_kernel(); coda_vfs_stat.mkdir++; if (coda_isroot(dir) && coda_iscontrol(name, len)) { unlock_kernel(); return -EPERM; } attrs.va_mode = mode; error = venus_mkdir(dir->i_sb, coda_i2f(dir), name, len, &newfid, &attrs); if ( error ) { unlock_kernel(); d_drop(de); return error; } inode = coda_iget(dir->i_sb, &newfid, &attrs); if ( IS_ERR(inode) ) { unlock_kernel(); d_drop(de); return PTR_ERR(inode); } /* invalidate the directory cnode's attributes */ coda_dir_changed(dir, 1); unlock_kernel(); d_instantiate(de, inode); return 0; }