patch-2.0.34 linux/fs/isofs/namei.c
Next file: linux/fs/isofs/rock.c
Previous file: linux/fs/isofs/joliet.c
Back to the patch index
Back to the overall index
- Lines: 171
- Date:
Wed Jun 3 15:17:49 1998
- Orig file:
v2.0.33/linux/fs/isofs/namei.c
- Orig date:
Tue Aug 12 14:06:35 1997
diff -u --recursive --new-file v2.0.33/linux/fs/isofs/namei.c linux/fs/isofs/namei.c
@@ -58,8 +58,9 @@
* itself (as an inode number). It does NOT read the inode of the
* 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)
+static struct buffer_head *
+isofs_find_entry(struct inode * dir, const char * name, int namelen,
+ unsigned long * ino, unsigned long * ino_back)
{
unsigned long bufsize = ISOFS_BUFFER_SIZE(dir);
unsigned char bufbits = ISOFS_BUFFER_BITS(dir);
@@ -68,8 +69,9 @@
void * cpnt = NULL;
unsigned int old_offset;
unsigned int backlink;
- int dlen, rrflag, match;
+ int dlen, match;
char * dpnt;
+ unsigned char *page = NULL;
struct iso_directory_record * de;
char c;
@@ -100,7 +102,7 @@
+ ISOFS_BLOCK_SIZE);
block = isofs_bmap(dir,f_pos>>bufbits);
if (!block || !(bh = bread(dir->i_dev,block,bufsize)))
- return 0;
+ return NULL;
continue; /* Will kick out if past end of directory */
}
@@ -114,7 +116,7 @@
unsigned int frag1;
frag1 = bufsize - old_offset;
cpnt = kmalloc(*((unsigned char *) de),GFP_KERNEL);
- if (!cpnt) return 0;
+ if (!cpnt) return NULL;
memcpy(cpnt, bh->b_data + old_offset, frag1);
de = (struct iso_directory_record *) cpnt;
@@ -123,21 +125,24 @@
block = isofs_bmap(dir,f_pos>>bufbits);
if (!block || !(bh = bread(dir->i_dev,block,bufsize))) {
kfree(cpnt);
- return 0;
+ return NULL;
};
memcpy((char *)cpnt+frag1, bh->b_data, offset);
}
-
+
+ dlen = de->name_len[0];
+ dpnt = de->name;
+
/* Handle the '.' case */
- if (de->name[0]==0 && de->name_len[0]==1) {
+ if (*dpnt==0 && dlen==1) {
inode_number = dir->i_ino;
backlink = 0;
}
/* Handle the '..' case */
- if (de->name[0]==1 && de->name_len[0]==1) {
+ else if (*dpnt==1 && dlen==1) {
#if 0
printk("Doing .. (%d %d)",
dir->i_sb->s_firstdatazone,
@@ -148,31 +153,39 @@
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 */
- rrflag = get_rock_ridge_filename(de, &dpnt, &dlen, dir);
- if (rrflag) {
- if (rrflag == -1) goto out; /* Relocated deep directory */
} else {
- if(dir->i_sb->u.isofs_sb.s_mapping == 'n') {
- for (i = 0; i < dlen; i++) {
- c = dpnt[i];
- if (c >= 'A' && c <= 'Z') c |= 0x20; /* lower case */
- if (c == ';' && i == dlen-2 && dpnt[i+1] == '1') {
- dlen -= 2;
- break;
- }
- if (c == ';') c = '.';
- de->name[i] = c;
- }
- /* This allows us to match with and without a trailing
- period. */
- if(dpnt[dlen-1] == '.' && namelen == dlen-1)
- dlen--;
- }
+ if (dir->i_sb->u.isofs_sb.s_rock ||
+ dir->i_sb->u.isofs_sb.s_joliet_level) {
+ page = (unsigned char *)
+ __get_free_page(GFP_KERNEL);
+ if (!page) return NULL;
+ }
+ if (dir->i_sb->u.isofs_sb.s_rock &&
+ ((i = get_rock_ridge_filename(de, page, dir)))){
+ if (i == -1)
+ goto out;/* Relocated deep directory */
+ dlen = i;
+ dpnt = page;
+ } else if (dir->i_sb->u.isofs_sb.s_joliet_level) {
+ dlen = get_joliet_filename(de, dir, page);
+ dpnt = page;
+ } else if (dir->i_sb->u.isofs_sb.s_mapping == 'n') {
+ for (i = 0; i < dlen; i++) {
+ c = dpnt[i];
+ /* lower case */
+ if (c >= 'A' && c <= 'Z') c |= 0x20;
+ if (c == ';' && i == dlen-2 && dpnt[i+1] == '1') {
+ dlen -= 2;
+ break;
+ }
+ if (c == ';') c = '.';
+ dpnt[i] = c;
+ }
+ /* This allows us to match with and without
+ * a trailing period. */
+ if(dpnt[dlen-1] == '.' && namelen == dlen-1)
+ dlen--;
+ }
}
/*
* Skip hidden or associated files unless unhide is set
@@ -190,7 +203,7 @@
cpnt = NULL;
}
- if(rrflag) kfree(dpnt);
+ if (page) free_page((unsigned long) page);
if (match) {
if(inode_number == -1) {
/* Should only happen for the '..' entry */
@@ -239,6 +252,7 @@
if (dcache_lookup(dir, name, len, &ino)) ino_back = dir->i_ino;
+
if (!ino) {
char *lcname;
@@ -265,8 +279,9 @@
iput(dir);
return -ENOENT;
}
- if (ino_back == dir->i_ino)
+ if (ino_back == dir->i_ino) {
dcache_add(dir, name, len, ino);
+ }
brelse(bh);
}
@@ -282,7 +297,7 @@
*/
if (ino_back && !(*result)->i_pipe && (*result)->i_sb == dir->i_sb) {
- (*result)->u.isofs_i.i_backlink = ino_back;
+ (*result)->u.isofs_i.i_backlink = ino_back;
}
iput(dir);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov