summaryrefslogtreecommitdiffstats
path: root/fs/coda/cnode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/coda/cnode.c')
-rw-r--r--fs/coda/cnode.c53
1 files changed, 39 insertions, 14 deletions
diff --git a/fs/coda/cnode.c b/fs/coda/cnode.c
index aa67a22e4..2f0f86878 100644
--- a/fs/coda/cnode.c
+++ b/fs/coda/cnode.c
@@ -15,7 +15,7 @@ extern int coda_print_entry;
/* cnode.c */
-static void coda_fill_inode (struct inode *inode, struct coda_vattr *attr)
+static void coda_fill_inode(struct inode *inode, struct coda_vattr *attr)
{
CDEBUG(D_SUPER, "ino: %ld\n", inode->i_ino);
@@ -30,6 +30,16 @@ static void coda_fill_inode (struct inode *inode, struct coda_vattr *attr)
inode->i_op = &coda_dir_inode_operations;
else if (S_ISLNK(inode->i_mode))
inode->i_op = &coda_symlink_inode_operations;
+ else if (S_ISCHR(inode->i_mode)) {
+ inode->i_op = &chrdev_inode_operations;
+ inode->i_rdev = to_kdev_t(attr->va_rdev);
+ } else if (S_ISBLK(inode->i_mode)) {
+ inode->i_op = &blkdev_inode_operations;
+ inode->i_rdev = to_kdev_t(attr->va_rdev);
+ } else if (S_ISFIFO(inode->i_mode))
+ init_fifo(inode);
+ else if (S_ISSOCK(inode->i_mode))
+ inode->i_op = NULL;
else {
printk ("coda_read_inode: what's this? i_mode = %o\n",
inode->i_mode);
@@ -54,12 +64,12 @@ int coda_cnode_make(struct inode **inode, ViceFid *fid, struct super_block *sb)
ENTRY;
/*
- * We get inode numbers from Venus -- see venus source
- */
+ * We get inode numbers from Venus -- see venus source
+ */
error = venus_getattr(sb, fid, &attr);
if ( error ) {
- printk("coda_cnode_make: coda_getvattr returned %d for %s.\n",
+ CDEBUG(D_CNODE, "coda_cnode_make: coda_getvattr returned %d for %s.\n",
error, coda_f2s(fid));
*inode = NULL;
return error;
@@ -82,16 +92,26 @@ int coda_cnode_make(struct inode **inode, ViceFid *fid, struct super_block *sb)
INIT_LIST_HEAD(&(cnp->c_cnhead));
INIT_LIST_HEAD(&(cnp->c_volrootlist));
} else {
- printk("coda_cnode make on initialized inode %ld, %s!\n",
+ cnp->c_flags = 0;
+ CDEBUG(D_CNODE, "coda_cnode make on initialized"
+ "inode %ld, %s!\n",
(*inode)->i_ino, coda_f2s(&cnp->c_fid));
}
/* fill in the inode attributes */
- if ( coda_fid_is_volroot(fid) )
+ if ( coda_f2i(fid) != ino ) {
+ if ( !coda_fid_is_weird(fid) )
+ printk("Coda: unknown weird fid: ino %ld, fid %s."
+ "Tell Peter.\n", ino, coda_f2s(&cnp->c_fid));
list_add(&cnp->c_volrootlist, &sbi->sbi_volroothead);
+ CDEBUG(D_UPCALL, "Added %ld ,%s to volroothead\n",
+ ino, coda_f2s(&cnp->c_fid));
+ }
coda_fill_inode(*inode, &attr);
- CDEBUG(D_CNODE, "Done linking: ino %ld, at 0x%x with cnp 0x%x, cnp->c_vnode 0x%x\n", (*inode)->i_ino, (int) (*inode), (int) cnp, (int)cnp->c_vnode);
+ CDEBUG(D_DOWNCALL, "Done making inode: ino %ld, count %d with %s\n",
+ (*inode)->i_ino, (*inode)->i_count,
+ coda_f2s(&cnp->c_fid));
EXIT;
return 0;
@@ -119,7 +139,6 @@ struct inode *coda_fid_to_inode(ViceFid *fid, struct super_block *sb)
struct coda_inode_info *cnp;
ENTRY;
- CDEBUG(D_INODE, "%s\n", coda_f2s(fid));
if ( !sb ) {
printk("coda_fid_to_inode: no sb!\n");
@@ -130,9 +149,10 @@ struct inode *coda_fid_to_inode(ViceFid *fid, struct super_block *sb)
printk("coda_fid_to_inode: no fid!\n");
return NULL;
}
+ CDEBUG(D_INODE, "%s\n", coda_f2s(fid));
- if ( coda_fid_is_volroot(fid) ) {
+ if ( coda_fid_is_weird(fid) ) {
struct coda_inode_info *cii;
struct list_head *lh, *le;
struct coda_sb_info *sbi = coda_sbp(sb);
@@ -141,9 +161,14 @@ struct inode *coda_fid_to_inode(ViceFid *fid, struct super_block *sb)
while ( (le = le->next) != lh ) {
cii = list_entry(le, struct coda_inode_info,
c_volrootlist);
- if ( cii->c_fid.Volume == fid->Volume) {
+ CDEBUG(D_DOWNCALL, "iterating, now doing %s, ino %ld\n",
+ coda_f2s(&cii->c_fid), cii->c_vnode->i_ino);
+ if ( coda_fideq(&cii->c_fid, fid) ) {
inode = cii->c_vnode;
CDEBUG(D_INODE, "volume root, found %ld\n", cii->c_vnode->i_ino);
+ if ( cii->c_magic != CODA_CNODE_MAGIC )
+ printk("%s: Bad magic in inode, tell Peter.\n",
+ __FUNCTION__);
return cii->c_vnode;
}
@@ -151,7 +176,7 @@ struct inode *coda_fid_to_inode(ViceFid *fid, struct super_block *sb)
return NULL;
}
- /* fid is not volume root, hence ino is computable */
+ /* fid is not weird: ino should be computable */
nr = coda_f2i(fid);
inode = iget(sb, nr);
if ( !inode ) {
@@ -173,9 +198,9 @@ struct inode *coda_fid_to_inode(ViceFid *fid, struct super_block *sb)
These have the same inode as the root of the volume they
mount, but the fid will be wrong.
*/
- if ( !coda_fideq(fid, &(cnp->c_fid)) &&
- !coda_fid_is_volroot(&(cnp->c_fid))) {
- printk("coda_fid2inode: bad cnode! Tell Peter.\n");
+ if ( !coda_fideq(fid, &(cnp->c_fid)) ) {
+ /* printk("coda_fid2inode: bad cnode (ino %ld, fid %s)"
+ "Tell Peter.\n", nr, coda_f2s(fid)); */
iput(inode);
return NULL;
}