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; }
/* creation routines: create, mknod, mkdir, link, symlink */ static int coda_create(struct inode *dir, struct dentry *de, int mode, struct nameidata *nd) { int error; const char *name=de->d_name.name; int length=de->d_name.len; struct inode *inode; struct CodaFid newfid; struct coda_vattr attrs; if (coda_isroot(dir) && coda_iscontrol(name, length)) return -EPERM; error = venus_create(dir->i_sb, coda_i2f(dir), name, length, 0, mode, &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_update_mtime(dir); d_instantiate(de, inode); return 0; err_out: d_drop(de); return error; }
/* this is effectively coda_iget: - get attributes (might be cached) - get the inode for the fid using vfs iget - link the two up if this is needed - fill in the attributes */ int coda_cnode_make(struct inode **inode, ViceFid *fid, struct super_block *sb) { struct coda_vattr attr; int error; /* We get inode numbers from Venus -- see venus source */ error = venus_getattr(sb, fid, &attr); if ( error ) { CDEBUG(D_CNODE, "coda_cnode_make: coda_getvattr returned %d for %s.\n", error, coda_f2s(fid)); *inode = NULL; return error; } *inode = coda_iget(sb, fid, &attr); if ( IS_ERR(*inode) ) { printk("coda_cnode_make: coda_iget failed\n"); return PTR_ERR(*inode); } CDEBUG(D_DOWNCALL, "Done making inode: ino %ld, count %d with %s\n", (*inode)->i_ino, atomic_read(&(*inode)->i_count), coda_f2s(&ITOC(*inode)->c_fid)); return 0; }
/* this is effectively coda_iget: - get attributes (might be cached) - get the inode for the fid using vfs iget - link the two up if this is needed - fill in the attributes */ struct inode *coda_cnode_make(struct CodaFid *fid, struct super_block *sb) { struct coda_vattr attr; struct inode *inode; int error; /* We get inode numbers from Venus -- see venus source */ error = venus_getattr(sb, fid, &attr); if (error) return ERR_PTR(error); inode = coda_iget(sb, fid, &attr); if (IS_ERR(inode)) pr_warn("%s: coda_iget failed\n", __func__); return inode; }
struct inode *coda_cnode_make(struct CodaFid *fid, struct super_block *sb) { struct coda_vattr attr; struct inode *inode; int error; error = venus_getattr(sb, fid, &attr); if (error) return ERR_PTR(error); inode = coda_iget(sb, fid, &attr); if (IS_ERR(inode)) printk("coda_cnode_make: coda_iget failed\n"); return inode; }
/* this is effectively coda_iget: - get attributes (might be cached) - get the inode for the fid using vfs iget - link the two up if this is needed - fill in the attributes */ int coda_cnode_make(struct inode **inode, struct CodaFid *fid, struct super_block *sb) { struct coda_vattr attr; int error; /* We get inode numbers from Venus -- see venus source */ error = venus_getattr(sb, fid, &attr); if ( error ) { *inode = NULL; return error; } *inode = coda_iget(sb, fid, &attr); if ( IS_ERR(*inode) ) { printk("coda_cnode_make: coda_iget failed\n"); return PTR_ERR(*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 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_mknod(struct inode *dir, struct dentry *de, int mode, int rdev) { int error=0; const char *name=de->d_name.name; int length=de->d_name.len; struct inode *inode; struct ViceFid newfid; struct coda_vattr attrs; if ( coda_hasmknod == 0 ) return -EIO; coda_vfs_stat.create++; CDEBUG(D_INODE, "name: %s, length %d, mode %o, rdev %x\n", name, length, mode, rdev); if (coda_isroot(dir) && coda_iscontrol(name, length)) return -EPERM; error = venus_create(dir->i_sb, coda_i2f(dir), name, length, 0, mode, rdev, &newfid, &attrs); if ( error ) { CDEBUG(D_INODE, "mknod: %s, result %d\n", coda_f2s(&newfid), error); d_drop(de); return error; } 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, 0); 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; }
/* creation routines: create, mknod, mkdir, link, symlink */ static int coda_create(struct inode *dir, struct dentry *de, int mode, struct nameidata *nd) { int error=0; const char *name=de->d_name.name; int length=de->d_name.len; struct inode *inode; struct CodaFid newfid; struct coda_vattr attrs; lock_kernel(); coda_vfs_stat.create++; if (coda_isroot(dir) && coda_iscontrol(name, length)) { unlock_kernel(); return -EPERM; } error = venus_create(dir->i_sb, coda_i2f(dir), name, length, 0, mode, &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, 0); unlock_kernel(); d_instantiate(de, inode); return 0; }