A patch to allow INITRD to compile (against 2.1.44)

NIIBE Yutaka (gniibe@mri.co.jp)
Mon, 14 Jul 1997 11:04:45 +0900


Hello Linus and all,

Thanks for the feature of INITRD, I'm using it very conveniently.

2.1.44 can't compile with INITRD. As I'd like to be brave to try
2.1.44 and pre-patches :-), I made a patch for myself. So far, it
works for me. I did my best, but the authors of INITRD know more.
Anyhow, let's begin. It's better than nothing, I believe.

-- 
NIIBE Yutaka

================== $ TZ=UTC diff -u linux-2.1.44/fs/super.c linux.new/fs/super.c --- linux-2.1.44/fs/super.c Mon Jul 7 03:13:54 1997 +++ linux.new/fs/super.c Mon Jul 14 01:38:02 1997 @@ -1094,7 +1094,7 @@ { kdev_t old_root_dev; struct vfsmount *vfsmnt; - struct inode *old_root,*old_pwd,*inode; + struct dentry *old_root,*old_pwd,*dir_d = NULL; unsigned long old_fs; int error; @@ -1107,24 +1107,29 @@ } ROOT_DEV = new_root_dev; do_mount_root(); - old_fs = get_fs(); - set_fs(get_ds()); - error = namei(put_old, &inode); - if (error) inode = NULL; - set_fs(old_fs); - if (!error && (atomic_read(&inode->i_count) != 1 || inode->i_mount)) + dir_d = lookup_dentry(put_old, NULL, 1); + if (IS_ERR(dir_d)) { + error = PTR_ERR(dir_d); + } else if (dir_d->d_inode == NULL) { + dput(dir_d); + error = -ENOENT; + } else { + error = 0; + } + if (!error && dir_d->d_covers != dir_d) { + dput(dir_d); error = -EBUSY; - if (!error && !S_ISDIR(inode->i_mode)) + } + if (!error && !S_ISDIR(dir_d->d_inode->i_mode)) { + dput(dir_d); error = -ENOTDIR; - iput(old_root); /* current->fs->root */ - iput(old_pwd); /* current->fs->pwd */ + } + dput(old_root); + dput(old_pwd); if (error) { int umount_error; - if (inode) iput(inode); printk(KERN_NOTICE "Trying to unmount old root ... "); - old_root->i_mount = old_root; - /* does this belong into do_mount_root ? */ umount_error = do_umount(old_root_dev,1); if (umount_error) printk(KERN_ERR "error %d\n",umount_error); else { @@ -1133,16 +1138,16 @@ } return umount_error ? error : 0; } - iput(old_root); /* sb->s_covered */ remove_vfsmnt(old_root_dev); vfsmnt = add_vfsmnt(old_root_dev,"/dev/root.old",put_old); if (!vfsmnt) printk(KERN_CRIT "Trouble: add_vfsmnt failed\n"); else { - vfsmnt->mnt_sb = old_root->i_sb; - vfsmnt->mnt_sb->s_covered = inode; + vfsmnt->mnt_sb = old_root->d_inode->i_sb; + d_mount(dir_d,vfsmnt->mnt_sb->s_root); vfsmnt->mnt_flags = vfsmnt->mnt_sb->s_flags; } - inode->i_mount = old_root; + d_umount(old_root); + d_mount(dir_d,old_root); return 0; }

==================