patch-2.1.45 linux/fs/isofs/namei.c
Next file: linux/fs/lockd/clntlock.c
Previous file: linux/fs/isofs/inode.c
Back to the patch index
Back to the overall index
- Lines: 151
- Date:
Wed Jul 16 14:18:57 1997
- Orig file:
v2.1.44/linux/fs/isofs/namei.c
- Orig date:
Mon Jun 16 16:35:57 1997
diff -u --recursive --new-file v2.1.44/linux/fs/isofs/namei.c linux/fs/isofs/namei.c
@@ -59,14 +59,13 @@
* entry - you'll have to do that yourself if you want to.
*/
static struct buffer_head * isofs_find_entry(struct inode * dir,
- const char * name, int namelen, unsigned long * ino, unsigned long * ino_back)
+ const char * name, int namelen, unsigned long * ino)
{
unsigned long bufsize = ISOFS_BUFFER_SIZE(dir);
unsigned char bufbits = ISOFS_BUFFER_BITS(dir);
unsigned int block, i, f_pos, offset, inode_number;
struct buffer_head * bh;
unsigned int old_offset;
- unsigned int backlink;
int dlen, rrflag, match;
char * dpnt;
struct iso_directory_record * de;
@@ -86,7 +85,6 @@
while (f_pos < dir->i_size) {
de = (struct iso_directory_record *) (bh->b_data + offset);
- backlink = dir->i_ino;
inode_number = (block << bufbits) + (offset & (bufsize - 1));
/* If byte is zero, this is the end of file, or time to move to
@@ -120,28 +118,6 @@
return 0;
}
- /* Handle the '.' case */
-
- if (de->name[0]==0 && de->name_len[0]==1) {
- inode_number = dir->i_ino;
- backlink = 0;
- }
-
- /* Handle the '..' case */
-
- if (de->name[0]==1 && de->name_len[0]==1) {
-#if 0
- printk("Doing .. (%d %d)",
- dir->i_sb->s_firstdatazone,
- dir->i_ino);
-#endif
- if((dir->i_sb->u.isofs_sb.s_firstdatazone) != dir->i_ino)
- inode_number = dir->u.isofs_i.i_backlink;
- else
- inode_number = dir->i_ino;
- backlink = 0;
- }
-
dlen = de->name_len[0];
dpnt = de->name;
/* Now convert the filename in the buffer to lower case */
@@ -183,16 +159,8 @@
inode_number =
isofs_lookup_grandparent(dir,
find_rock_ridge_relocation(de,dir));
- if(inode_number == -1){
- /* Should never happen */
- printk("Backlink not properly set %x %lx.\n",
- isonum_733(de->extent),
- dir->i_ino);
- goto out;
- }
}
*ino = inode_number;
- *ino_back = backlink;
return bh;
}
}
@@ -201,62 +169,48 @@
return NULL;
}
-int isofs_lookup(struct inode * dir,const char * name, int len,
- struct inode ** result)
+int isofs_lookup(struct inode * dir, struct dentry * dentry)
{
- unsigned long ino, ino_back;
+ unsigned long ino;
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, dentry->d_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(dentry->d_name.len, GFP_KERNEL)) != NULL) {
int i;
char c;
- for (i=0; i<len; i++) {
- c = name[i];
+ for (i=0; i<dentry->d_name.len; i++) {
+ c = dentry->d_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, dentry->d_name.len, &ino);
kfree(lcname);
} else
- bh = isofs_find_entry(dir,name,len, &ino, &ino_back);
+ bh = isofs_find_entry(dir, dentry->d_name.name, dentry->d_name.len, &ino);
- if (!bh) {
- iput(dir);
- return -ENOENT;
- }
- brelse(bh);
-
- if (!(*result = iget(dir->i_sb,ino))) {
- iput(dir);
- return -EACCES;
+ inode = NULL;
+ if (bh) {
+ brelse(bh);
+
+ 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;
-
- iput(dir);
+ d_add(dentry, inode);
return 0;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov