lkml.org 
[lkml]   [1997]   [Jul]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectPatches to allow minix, isofs, and ufs to compile

Here are some patches which I believe make minix, isofs, and ufs
filesystems properly support the new dcache abstraction in 2.1.44. I
haven't had the chance to test these changes yet, and the dcache
abstraction isn't completely documented, but everything compiles without
warning and I believe I was able to figure out the dcache interface
correctly.

In any case, it's better than the current 2.1.44 situation, which is not
to compile at all if you need one of these three filesystems. :-)

- Ted


Patch generated: on Tue Jul 8 22:08:30 EDT 1997 by tytso@rsts-11
against Linux version 2.1.44

===================================================================
RCS file: include/linux/RCS/minix_fs.h,v
retrieving revision 1.1
diff -u -r1.1 include/linux/minix_fs.h
--- include/linux/minix_fs.h 1997/07/08 14:37:01 1.1
+++ include/linux/minix_fs.h 1997/07/08 18:33:35
@@ -88,19 +88,18 @@

#ifdef __KERNEL__

-extern int minix_lookup(struct inode * dir,const char * name, int len,
+extern int minix_lookup(struct inode * dir, struct qstr *name,
struct inode ** result);
-extern int minix_create(struct inode * dir,const char * name, int len, int mode,
- struct inode ** result);
-extern int minix_mkdir(struct inode * dir, const char * name, int len, int mode);
-extern int minix_rmdir(struct inode * dir, const char * name, int len);
-extern int minix_unlink(struct inode * dir, const char * name, int len);
-extern int minix_symlink(struct inode * inode, const char * name, int len,
+extern int minix_create(struct inode * dir, struct dentry *dentry, int mode);
+extern int minix_mkdir(struct inode * dir, struct dentry *dentry, int mode);
+extern int minix_rmdir(struct inode * dir, struct dentry *dentry);
+extern int minix_unlink(struct inode * dir, struct dentry *dentry);
+extern int minix_symlink(struct inode * inode, struct dentry *dentry,
const char * symname);
-extern int minix_link(struct inode * oldinode, struct inode * dir, const char * name, int len);
-extern int minix_mknod(struct inode * dir, const char * name, int len, int mode, int rdev);
-extern int minix_rename(struct inode * old_dir, const char * old_name, int old_len,
- struct inode * new_dir, const char * new_name, int new_len);
+extern int minix_link(struct inode * oldinode, struct inode * dir, struct dentry *dentry);
+extern int minix_mknod(struct inode * dir, struct dentry *dentry, int mode, int rdev);
+extern int minix_rename(struct inode * old_dir, struct dentry *old_dentry,
+ struct inode * new_dir, struct dentry *new_dentry);
extern struct inode * minix_new_inode(const struct inode * dir);
extern void minix_free_inode(struct inode * inode);
extern unsigned long minix_count_free_inodes(struct super_block *sb);
===================================================================
RCS file: fs/minix/RCS/inode.c,v
retrieving revision 1.1
diff -u -r1.1 fs/minix/inode.c
--- fs/minix/inode.c 1997/07/08 13:24:38 1.1
+++ fs/minix/inode.c 1997/07/08 15:14:35
@@ -18,6 +18,7 @@
#include <linux/string.h>
#include <linux/stat.h>
#include <linux/locks.h>
+#include <linux/dalloc.h>
#include <linux/init.h>

#include <asm/system.h>
@@ -125,15 +126,13 @@
* it really _is_ a minix filesystem, and to check the size
* of the directory entry.
*/
-static const char * minix_checkroot(struct super_block *s)
+static const char * minix_checkroot(struct super_block *s, struct inode *dir)
{
- struct inode * dir;
struct buffer_head *bh;
struct minix_dir_entry *de;
const char * errmsg;
int dirsize;

- dir = s->s_mounted;
if (!S_ISDIR(dir->i_mode))
return "root directory is not a directory";

@@ -172,7 +171,8 @@
int i, block;
kdev_t dev = s->s_dev;
const char * errmsg;
-
+ struct inode *root_inode;
+
if (32 != sizeof (struct minix_inode))
panic("bad V1 i-node size");
if (64 != sizeof(struct minix2_inode))
@@ -272,8 +272,9 @@
/* set up enough so that it can read an inode */
s->s_dev = dev;
s->s_op = &minix_sops;
- s->s_mounted = iget(s,MINIX_ROOT_INO);
- if (!s->s_mounted) {
+ root_inode = iget(s,MINIX_ROOT_INO);
+ s->s_root = d_alloc_root(root_inode, NULL);
+ if (!s->s_root) {
s->s_dev = 0;
brelse(bh);
if (!silent)
@@ -282,11 +283,11 @@
return NULL;
}

- errmsg = minix_checkroot(s);
+ errmsg = minix_checkroot(s, root_inode);
if (errmsg) {
if (!silent)
printk("MINIX-fs: %s\n", errmsg);
- iput (s->s_mounted);
+ d_delete(s->s_root); /* XXX Is this enough? */
s->s_dev = 0;
brelse (bh);
MOD_DEC_USE_COUNT;
===================================================================
RCS file: fs/minix/RCS/file.c,v
retrieving revision 1.1
diff -u -r1.1 fs/minix/file.c
--- fs/minix/file.c 1997/07/08 13:32:41 1.1
+++ fs/minix/file.c 1997/07/08 13:33:10
@@ -58,6 +58,7 @@
NULL, /* mknod */
NULL, /* rename */
NULL, /* readlink */
+ NULL, /* follow_link */
generic_readpage, /* readpage */
NULL, /* writepage */
minix_bmap, /* bmap */
===================================================================
RCS file: fs/minix/RCS/namei.c,v
retrieving revision 1.1
diff -u -r1.1 fs/minix/namei.c
--- fs/minix/namei.c 1997/07/08 14:19:37 1.1
+++ fs/minix/namei.c 1997/07/08 18:35:08
@@ -104,7 +104,7 @@
return NULL;
}

-int minix_lookup(struct inode * dir,const char * name, int len,
+int minix_lookup(struct inode * dir, struct qstr *name,
struct inode ** result)
{
int ino;
@@ -114,21 +114,14 @@
*result = NULL;
if (!dir)
return -ENOENT;
- if (!S_ISDIR(dir->i_mode)) {
- iput(dir);
+ if (!S_ISDIR(dir->i_mode))
return -ENOENT;
- }
- if (!(bh = minix_find_entry(dir,name,len,&de))) {
- iput(dir);
+ if (!(bh = minix_find_entry(dir, name->name, name->len, &de)))
return -ENOENT;
- }
ino = de->inode;
brelse(bh);
- if (!(*result = iget(dir->i_sb,ino))) {
- iput(dir);
+ if (!(*result = iget(dir->i_sb,ino)))
return -EACCES;
- }
- iput(dir);
return 0;
}

@@ -208,42 +201,37 @@
return 0;
}

-int minix_create(struct inode * dir,const char * name, int len, int mode,
- struct inode ** result)
+int minix_create(struct inode * dir, struct dentry *dentry, int mode)
{
int error;
struct inode * inode;
struct buffer_head * bh;
struct minix_dir_entry * de;

- *result = NULL;
if (!dir)
return -ENOENT;
inode = minix_new_inode(dir);
- if (!inode) {
- iput(dir);
+ if (!inode)
return -ENOSPC;
- }
inode->i_op = &minix_file_inode_operations;
inode->i_mode = mode;
inode->i_dirt = 1;
- error = minix_add_entry(dir,name,len, &bh ,&de);
+ error = minix_add_entry(dir, dentry->d_name.name,
+ dentry->d_name.len, &bh ,&de);
if (error) {
inode->i_nlink--;
inode->i_dirt = 1;
iput(inode);
- iput(dir);
return error;
}
de->inode = inode->i_ino;
mark_buffer_dirty(bh, 1);
brelse(bh);
- iput(dir);
- *result = inode;
+ d_instantiate(dentry, inode, 0);
return 0;
}

-int minix_mknod(struct inode * dir, const char * name, int len, int mode, int rdev)
+int minix_mknod(struct inode * dir, struct dentry *dentry, int mode, int rdev)
{
int error;
struct inode * inode;
@@ -252,17 +240,15 @@

if (!dir)
return -ENOENT;
- bh = minix_find_entry(dir,name,len,&de);
+ bh = minix_find_entry(dir, dentry->d_name.name,
+ dentry->d_name.len, &de);
if (bh) {
brelse(bh);
- iput(dir);
return -EEXIST;
}
inode = minix_new_inode(dir);
- if (!inode) {
- iput(dir);
+ if (!inode)
return -ENOSPC;
- }
inode->i_uid = current->fsuid;
inode->i_mode = mode;
inode->i_op = NULL;
@@ -284,23 +270,21 @@
if (S_ISBLK(mode) || S_ISCHR(mode))
inode->i_rdev = to_kdev_t(rdev);
inode->i_dirt = 1;
- error = minix_add_entry(dir, name, len, &bh, &de);
+ error = minix_add_entry(dir, dentry->d_name.name, dentry->d_name.len, &bh, &de);
if (error) {
inode->i_nlink--;
inode->i_dirt = 1;
iput(inode);
- iput(dir);
return error;
}
de->inode = inode->i_ino;
mark_buffer_dirty(bh, 1);
brelse(bh);
- iput(dir);
- iput(inode);
+ d_instantiate(dentry, inode, 0);
return 0;
}

-int minix_mkdir(struct inode * dir, const char * name, int len, int mode)
+int minix_mkdir(struct inode * dir, struct dentry *dentry, int mode)
{
int error;
struct inode * inode;
@@ -308,31 +292,24 @@
struct minix_dir_entry * de;
struct minix_sb_info * info;

- if (!dir || !dir->i_sb) {
- iput(dir);
+ if (!dir || !dir->i_sb)
return -EINVAL;
- }
info = &dir->i_sb->u.minix_sb;
- bh = minix_find_entry(dir,name,len,&de);
+ bh = minix_find_entry(dir, dentry->d_name.name,
+ dentry->d_name.len, &de);
if (bh) {
brelse(bh);
- iput(dir);
return -EEXIST;
}
- if (dir->i_nlink >= MINIX_LINK_MAX) {
- iput(dir);
+ if (dir->i_nlink >= MINIX_LINK_MAX)
return -EMLINK;
- }
inode = minix_new_inode(dir);
- if (!inode) {
- iput(dir);
+ if (!inode)
return -ENOSPC;
- }
inode->i_op = &minix_dir_inode_operations;
inode->i_size = 2 * info->s_dirsize;
dir_block = minix_bread(inode,0,1);
if (!dir_block) {
- iput(dir);
inode->i_nlink--;
inode->i_dirt = 1;
iput(inode);
@@ -351,9 +328,9 @@
if (dir->i_mode & S_ISGID)
inode->i_mode |= S_ISGID;
inode->i_dirt = 1;
- error = minix_add_entry(dir, name, len, &bh, &de);
+ error = minix_add_entry(dir, dentry->d_name.name,
+ dentry->d_name.len, &bh, &de);
if (error) {
- iput(dir);
inode->i_nlink=0;
iput(inode);
return error;
@@ -362,9 +339,8 @@
mark_buffer_dirty(bh, 1);
dir->i_nlink++;
dir->i_dirt = 1;
- iput(dir);
- iput(inode);
brelse(bh);
+ d_instantiate(dentry, inode, D_DIR);
return 0;
}

@@ -427,7 +403,7 @@
return 1;
}

-int minix_rmdir(struct inode * dir, const char * name, int len)
+int minix_rmdir(struct inode * dir, struct dentry *dentry)
{
int retval;
struct inode * inode;
@@ -435,13 +411,14 @@
struct minix_dir_entry * de;

inode = NULL;
- bh = minix_find_entry(dir,name,len,&de);
+ bh = minix_find_entry(dir, dentry->d_name.name,
+ dentry->d_name.len, &de);
retval = -ENOENT;
if (!bh)
goto end_rmdir;
retval = -EPERM;
- if (!(inode = iget(dir->i_sb, de->inode)))
- goto end_rmdir;
+ inode = dentry->d_inode;
+
if ((dir->i_mode & S_ISVTX) && !fsuser() &&
current->fsuid != inode->i_uid &&
current->fsuid != dir->i_uid)
@@ -476,15 +453,14 @@
inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
dir->i_nlink--;
dir->i_dirt=1;
+ d_delete(dentry);
retval = 0;
end_rmdir:
- iput(dir);
- iput(inode);
brelse(bh);
return retval;
}

-int minix_unlink(struct inode * dir, const char * name, int len)
+int minix_unlink(struct inode * dir, struct dentry *dentry)
{
int retval;
struct inode * inode;
@@ -494,16 +470,16 @@
repeat:
retval = -ENOENT;
inode = NULL;
- bh = minix_find_entry(dir,name,len,&de);
+ bh = minix_find_entry(dir, dentry->d_name.name,
+ dentry->d_name.len, &de);
if (!bh)
goto end_unlink;
- if (!(inode = iget(dir->i_sb, de->inode)))
- goto end_unlink;
+ inode = dentry->d_inode;
+
retval = -EPERM;
if (S_ISDIR(inode->i_mode))
goto end_unlink;
if (de->inode != inode->i_ino) {
- iput(inode);
brelse(bh);
current->counter = 0;
schedule();
@@ -531,15 +507,15 @@
inode->i_nlink--;
inode->i_ctime = dir->i_ctime;
inode->i_dirt = 1;
+ d_delete(dentry); /* This also frees the inode */
retval = 0;
end_unlink:
brelse(bh);
- iput(inode);
- iput(dir);
return retval;
}

-int minix_symlink(struct inode * dir, const char * name, int len, const char * symname)
+int minix_symlink(struct inode * dir, struct dentry *dentry,
+ const char * symname)
{
struct minix_dir_entry * de;
struct inode * inode = NULL;
@@ -547,15 +523,13 @@
int i;
char c;

- if (!(inode = minix_new_inode(dir))) {
- iput(dir);
+ if (!(inode = minix_new_inode(dir)))
return -ENOSPC;
- }
+
inode->i_mode = S_IFLNK | 0777;
inode->i_op = &minix_symlink_inode_operations;
name_block = minix_bread(inode,0,1);
if (!name_block) {
- iput(dir);
inode->i_nlink--;
inode->i_dirt = 1;
iput(inode);
@@ -569,68 +543,62 @@
brelse(name_block);
inode->i_size = i;
inode->i_dirt = 1;
- bh = minix_find_entry(dir,name,len,&de);
+ bh = minix_find_entry(dir, dentry->d_name.name,
+ dentry->d_name.len, &de);
if (bh) {
inode->i_nlink--;
inode->i_dirt = 1;
iput(inode);
brelse(bh);
- iput(dir);
return -EEXIST;
}
- i = minix_add_entry(dir, name, len, &bh, &de);
+ i = minix_add_entry(dir, dentry->d_name.name,
+ dentry->d_name.len, &bh, &de);
if (i) {
inode->i_nlink--;
inode->i_dirt = 1;
iput(inode);
- iput(dir);
return i;
}
de->inode = inode->i_ino;
mark_buffer_dirty(bh, 1);
brelse(bh);
- iput(dir);
- iput(inode);
+ d_instantiate(dentry, inode, 0);
return 0;
}

-int minix_link(struct inode * oldinode, struct inode * dir, const char * name, int len)
+int minix_link(struct inode * inode, struct inode * dir,
+ struct dentry *dentry)
{
int error;
struct minix_dir_entry * de;
struct buffer_head * bh;

- if (S_ISDIR(oldinode->i_mode)) {
- iput(oldinode);
- iput(dir);
+ if (S_ISDIR(inode->i_mode))
return -EPERM;
- }
- if (oldinode->i_nlink >= MINIX_LINK_MAX) {
- iput(oldinode);
- iput(dir);
+
+ if (inode->i_nlink >= MINIX_LINK_MAX)
return -EMLINK;
- }
- bh = minix_find_entry(dir,name,len,&de);
+
+ bh = minix_find_entry(dir, dentry->d_name.name,
+ dentry->d_name.len, &de);
if (bh) {
brelse(bh);
- iput(dir);
- iput(oldinode);
return -EEXIST;
}
- error = minix_add_entry(dir, name, len, &bh, &de);
+ error = minix_add_entry(dir, dentry->d_name.name,
+ dentry->d_name.len, &bh, &de);
if (error) {
- iput(dir);
- iput(oldinode);
+ brelse(bh);
return error;
}
- de->inode = oldinode->i_ino;
+ de->inode = inode->i_ino;
mark_buffer_dirty(bh, 1);
brelse(bh);
- iput(dir);
- oldinode->i_nlink++;
- oldinode->i_ctime = CURRENT_TIME;
- oldinode->i_dirt = 1;
- iput(oldinode);
+ inode->i_nlink++;
+ inode->i_ctime = CURRENT_TIME;
+ inode->i_dirt = 1;
+ d_instantiate(dentry, inode, 0);
return 0;
}

@@ -649,7 +617,9 @@
if (new_inode->i_dev != old_inode->i_dev)
break;
ino = new_inode->i_ino;
- if (minix_lookup(new_inode,"..",2,&new_inode))
+ if (minix_lookup(new_inode,
+ &(struct qstr) { "..", 2, 0 },
+ &new_inode))
break;
if (new_inode->i_ino == ino)
break;
@@ -671,8 +641,8 @@
* Anybody can rename anything with this: the permission checks are left to the
* higher-level routines.
*/
-static int do_minix_rename(struct inode * old_dir, const char * old_name, int old_len,
- struct inode * new_dir, const char * new_name, int new_len)
+static int do_minix_rename(struct inode * old_dir, struct dentry *old_dentry,
+ struct inode * new_dir, struct dentry *new_dentry)
{
struct inode * old_inode, * new_inode;
struct buffer_head * old_bh, * new_bh, * dir_bh;
@@ -686,28 +656,26 @@
brelse(old_bh);
brelse(new_bh);
brelse(dir_bh);
- iput(old_inode);
- iput(new_inode);
current->counter = 0;
schedule();
start_up:
old_inode = new_inode = NULL;
old_bh = new_bh = dir_bh = NULL;
- old_bh = minix_find_entry(old_dir,old_name,old_len,&old_de);
+ old_bh = minix_find_entry(old_dir, old_dentry->d_name.name,
+ old_dentry->d_name.len, &old_de);
retval = -ENOENT;
if (!old_bh)
goto end_rename;
- old_inode = __iget(old_dir->i_sb, old_de->inode);
- if (!old_inode)
- goto end_rename;
+ old_inode = old_dentry->d_inode;
retval = -EPERM;
if ((old_dir->i_mode & S_ISVTX) &&
current->fsuid != old_inode->i_uid &&
current->fsuid != old_dir->i_uid && !fsuser())
goto end_rename;
- new_bh = minix_find_entry(new_dir,new_name,new_len,&new_de);
+ new_inode = new_dentry->d_inode;
+ new_bh = minix_find_entry(new_dir, new_dentry->d_name.name,
+ new_dentry->d_name.len, &new_de);
if (new_bh) {
- new_inode = __iget(new_dir->i_sb, new_de->inode);
if (!new_inode) {
brelse(new_bh);
new_bh = NULL;
@@ -754,7 +722,10 @@
goto end_rename;
}
if (!new_bh) {
- retval = minix_add_entry(new_dir,new_name,new_len,&new_bh,&new_de);
+ retval = minix_add_entry(new_dir,
+ new_dentry->d_name.name,
+ new_dentry->d_name.len,
+ &new_bh, &new_de);
if (retval)
goto end_rename;
}
@@ -794,15 +765,14 @@
new_dir->i_dirt = 1;
}
}
+ /* Update the dcache */
+ d_move(old_dentry, new_dentry->d_parent, &new_dentry->d_name);
+ d_delete(new_dentry);
retval = 0;
end_rename:
brelse(dir_bh);
brelse(old_bh);
brelse(new_bh);
- iput(old_inode);
- iput(new_inode);
- iput(old_dir);
- iput(new_dir);
return retval;
}

@@ -815,8 +785,8 @@
* the same device that races occur: many renames can happen at once, as long
* as they are on different partitions.
*/
-int minix_rename(struct inode * old_dir, const char * old_name, int old_len,
- struct inode * new_dir, const char * new_name, int new_len)
+int minix_rename(struct inode * old_dir, struct dentry *old_dentry,
+ struct inode * new_dir, struct dentry *new_dentry)
{
static struct wait_queue * wait = NULL;
static int lock = 0;
@@ -825,8 +795,8 @@
while (lock)
sleep_on(&wait);
lock = 1;
- result = do_minix_rename(old_dir, old_name, old_len,
- new_dir, new_name, new_len);
+ result = do_minix_rename(old_dir, old_dentry,
+ new_dir, new_dentry);
lock = 0;
wake_up(&wait);
return result;
===================================================================
RCS file: fs/minix/RCS/dir.c,v
retrieving revision 1.1
diff -u -r1.1 fs/minix/dir.c
--- fs/minix/dir.c 1997/07/08 18:36:20 1.1
+++ fs/minix/dir.c 1997/07/08 18:36:37
@@ -50,6 +50,7 @@
minix_mknod, /* mknod */
minix_rename, /* rename */
NULL, /* readlink */
+ NULL, /* follow_link */
NULL, /* readpage */
NULL, /* writepage */
NULL, /* bmap */
===================================================================
RCS file: include/linux/RCS/iso_fs.h,v
retrieving revision 1.1
diff -u -r1.1 include/linux/iso_fs.h
--- include/linux/iso_fs.h 1997/07/08 15:26:47 1.1
+++ include/linux/iso_fs.h 1997/07/08 18:43:29
@@ -152,7 +152,7 @@

extern int isofs_open(struct inode * inode, struct file * filp);
extern void isofs_release(struct inode * inode, struct file * filp);
-extern int isofs_lookup(struct inode * dir,const char * name, int len,
+extern int isofs_lookup(struct inode * dir, struct qstr *dentry,
struct inode ** result);
extern unsigned long isofs_count_free_inodes(struct super_block *sb);
extern int isofs_new_block(int dev);
===================================================================
RCS file: fs/isofs/RCS/inode.c,v
retrieving revision 1.1
diff -u -r1.1 fs/isofs/inode.c
--- fs/isofs/inode.c 1997/07/08 15:17:59 1.1
+++ fs/isofs/inode.c 1997/07/08 15:18:54
@@ -481,12 +481,12 @@
s->u.isofs_sb.s_mode = opt.mode & 0777;
s->s_blocksize = opt.blocksize;
s->s_blocksize_bits = blocksize_bits;
- s->s_mounted = iget(s, (isonum_733(rootp->extent) +
+ s->s_root = d_alloc_root(iget(s, (isonum_733(rootp->extent) +
isonum_711(rootp->ext_attr_length))
- << s -> u.isofs_sb.s_log_zone_size);
+ << s -> u.isofs_sb.s_log_zone_size), NULL);
unlock_super(s);

- if (!(s->s_mounted)) {
+ if (!(s->s_root)) {
s->s_dev = 0;
printk("get root inode failed\n");
MOD_DEC_USE_COUNT;
===================================================================
RCS file: fs/isofs/RCS/file.c,v
retrieving revision 1.1
diff -u -r1.1 fs/isofs/file.c
--- fs/isofs/file.c 1997/07/08 15:20:41 1.1
+++ fs/isofs/file.c 1997/07/08 15:21:10
@@ -47,6 +47,7 @@
NULL, /* mknod */
NULL, /* rename */
NULL, /* readlink */
+ NULL, /* follow_link */
generic_readpage, /* readpage */
NULL, /* writepage */
isofs_bmap, /* bmap */
===================================================================
RCS file: fs/isofs/RCS/dir.c,v
retrieving revision 1.1
diff -u -r1.1 fs/isofs/dir.c
--- fs/isofs/dir.c 1997/07/08 15:20:41 1.1
+++ fs/isofs/dir.c 1997/07/08 18:43:01
@@ -54,6 +54,7 @@
NULL, /* mknod */
NULL, /* rename */
NULL, /* readlink */
+ NULL, /* follow_link */
NULL, /* readpage */
NULL, /* writepage */
isofs_bmap, /* bmap */
===================================================================
RCS file: fs/isofs/RCS/namei.c,v
retrieving revision 1.1
diff -u -r1.1 fs/isofs/namei.c
--- fs/isofs/namei.c 1997/07/08 15:22:22 1.1
+++ fs/isofs/namei.c 1997/07/08 18:44:45
@@ -201,62 +201,60 @@
return NULL;
}

-int isofs_lookup(struct inode * dir,const char * name, int len,
- struct inode ** result)
+int isofs_lookup(struct inode * dir, struct qstr *name,
+ struct inode ** result)
{
unsigned long ino, ino_back;
struct buffer_head * bh;
char *lcname;
+ struct inode *inode;

#ifdef DEBUG
- printk("lookup: %x %d\n",dir->i_ino, len);
+ printk("lookup: %x %d\n",dir->i_ino, name->len);
#endif
- *result = NULL;
if (!dir)
return -ENOENT;

- if (!S_ISDIR(dir->i_mode)) {
- iput(dir);
+ if (!S_ISDIR(dir->i_mode))
return -ENOENT;
- }

/* If mounted with check=relaxed (and most likely norock),
* then first convert this name to lower case.
*/
if (dir->i_sb->u.isofs_sb.s_name_check == 'r' &&
- (lcname = kmalloc(len, GFP_KERNEL)) != NULL) {
+ (lcname = kmalloc(name->len, GFP_KERNEL)) != NULL) {
int i;
char c;

- for (i=0; i<len; i++) {
- c = name[i];
+ for (i=0; i<name->len; i++) {
+ c = name->name[i];
if (c >= 'A' && c <= 'Z') c |= 0x20;
lcname[i] = c;
}
- bh = isofs_find_entry(dir,lcname,len, &ino, &ino_back);
+ bh = isofs_find_entry(dir, lcname, name->len,
+ &ino, &ino_back);
kfree(lcname);
} else
- bh = isofs_find_entry(dir,name,len, &ino, &ino_back);
+ bh = isofs_find_entry(dir, name->name,
+ name->len, &ino, &ino_back);

- if (!bh) {
- iput(dir);
+ if (!bh)
return -ENOENT;
- }
brelse(bh);

- if (!(*result = iget(dir->i_sb,ino))) {
- iput(dir);
+ inode = iget(dir->i_sb,ino);
+ if (!inode)
return -EACCES;
- }

/* We need this backlink for the ".." entry unless the name that we
* are looking up traversed a mount point (in which case the inode
* may not even be on an iso9660 filesystem, and writing to
* u.isofs_i would only cause memory corruption).
*/
- if (ino_back && !(*result)->i_pipe && (*result)->i_sb == dir->i_sb)
- (*result)->u.isofs_i.i_backlink = ino_back;
+ if (ino_back && !inode->i_pipe && inode->i_sb == dir->i_sb)
+ inode->u.isofs_i.i_backlink = ino_back;
+
+ *result = inode;

- iput(dir);
return 0;
}
===================================================================
RCS file: include/linux/RCS/ufs_fs.h,v
retrieving revision 1.1
diff -u -r1.1 include/linux/ufs_fs.h
--- include/linux/ufs_fs.h 1997/07/08 15:29:36 1.1
+++ include/linux/ufs_fs.h 1997/07/08 18:48:20
@@ -225,7 +225,7 @@
extern void ufs_print_inode (struct inode *);

/* ufs_namei.c */
-extern int ufs_lookup (struct inode *, const char *, int, struct inode **);
+extern int ufs_lookup (struct inode *, struct qstr *, struct inode **);

/* ufs_super.c */
extern void ufs_warning (struct super_block *, const char *, const char *, ...)
===================================================================
RCS file: fs/ufs/RCS/ufs_file.c,v
retrieving revision 1.1
diff -u -r1.1 fs/ufs/ufs_file.c
--- fs/ufs/ufs_file.c 1997/07/08 15:30:16 1.1
+++ fs/ufs/ufs_file.c 1997/07/08 15:30:50
@@ -41,6 +41,7 @@
NULL, /* mknod */
NULL, /* rename */
NULL, /* readlink */
+ NULL, /* follow_link */
generic_readpage, /* readpage */
NULL, /* writepage */
ufs_bmap, /* bmap */
===================================================================
RCS file: fs/ufs/RCS/ufs_namei.c,v
retrieving revision 1.1
diff -u -r1.1 fs/ufs/ufs_namei.c
--- fs/ufs/ufs_namei.c 1997/07/08 15:30:16 1.1
+++ fs/ufs/ufs_namei.c 1997/07/08 19:00:50
@@ -35,12 +35,14 @@
}

/* XXX - this is a mess, especially for endianity */
-int ufs_lookup (struct inode * dir, const char * name, int len,
+int ufs_lookup (struct inode * dir, struct qstr *qname,
struct inode ** result)
{
unsigned long int lfragno, fragno;
struct buffer_head * bh;
struct ufs_direct * d;
+ const char *name = qname->name;
+ int len = qname->len;

if (dir->i_sb->u.ufs_sb.s_flags & UFS_DEBUG)
printk("Passed name: %s\nPassed length: %d\n", name, len);
===================================================================
RCS file: fs/ufs/RCS/ufs_super.c,v
retrieving revision 1.1
diff -u -r1.1 fs/ufs/ufs_super.c
--- fs/ufs/ufs_super.c 1997/07/08 15:37:34 1.1
+++ fs/ufs/ufs_super.c 1997/07/08 18:27:46
@@ -254,7 +254,7 @@
sb->u.ufs_sb.s_lmask = ~((ufs_swab32(usb->fs_fmask) - ufs_swab32(usb->fs_bmask))
>> ufs_swab32(usb->fs_fshift));
sb->u.ufs_sb.s_fsfrag = ufs_swab32(usb->fs_frag); /* XXX - rename this later */
- sb->s_mounted = iget(sb, UFS_ROOTINO);
+ sb->s_root = d_alloc_root(iget(sb, UFS_ROOTINO), NULL);

#ifdef DEBUG_UFS_SUPER
printk("ufs_read_super: inopb %u\n", sb->u.ufs_sb.s_inopb);
\
 
 \ /
  Last update: 2005-03-22 13:39    [from the cache]
©2003-2011 Jasper Spaans