Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
720e65f1
Commit
720e65f1
authored
Mar 07, 2002
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Automerge
parents
dbdb2c5a
d755c873
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
14 deletions
+18
-14
fs/jfs/jfs_dtree.c
fs/jfs/jfs_dtree.c
+14
-14
fs/jfs/jfs_dtree.h
fs/jfs/jfs_dtree.h
+4
-0
No files found.
fs/jfs/jfs_dtree.c
View file @
720e65f1
...
@@ -798,7 +798,7 @@ int dtInsert(tid_t tid, struct inode *ip,
...
@@ -798,7 +798,7 @@ int dtInsert(tid_t tid, struct inode *ip,
* insert entry for new key
* insert entry for new key
*/
*/
if
(
DO_INDEX
(
ip
))
{
if
(
DO_INDEX
(
ip
))
{
if
(
JFS_IP
(
ip
)
->
next_index
==
-
1
)
{
if
(
JFS_IP
(
ip
)
->
next_index
==
DIREND
)
{
DT_PUTPAGE
(
mp
);
DT_PUTPAGE
(
mp
);
return
EMLINK
;
return
EMLINK
;
}
}
...
@@ -2885,7 +2885,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
...
@@ -2885,7 +2885,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
int
do_index
=
0
;
int
do_index
=
0
;
uint
loop_count
=
0
;
uint
loop_count
=
0
;
if
(
filp
->
f_pos
==
-
1
)
if
(
filp
->
f_pos
==
DIREND
)
return
0
;
return
0
;
if
(
DO_INDEX
(
ip
))
{
if
(
DO_INDEX
(
ip
))
{
...
@@ -2904,25 +2904,25 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
...
@@ -2904,25 +2904,25 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
dir_table_slot_t
dirtab_slot
;
dir_table_slot_t
dirtab_slot
;
if
(
dtEmpty
(
ip
))
{
if
(
dtEmpty
(
ip
))
{
filp
->
f_pos
=
-
1
;
filp
->
f_pos
=
DIREND
;
return
0
;
return
0
;
}
}
repeat:
repeat:
rc
=
get_index
(
ip
,
dir_index
,
&
dirtab_slot
);
rc
=
get_index
(
ip
,
dir_index
,
&
dirtab_slot
);
if
(
rc
)
{
if
(
rc
)
{
filp
->
f_pos
=
-
1
;
filp
->
f_pos
=
DIREND
;
return
rc
;
return
rc
;
}
}
if
(
dirtab_slot
.
flag
==
DIR_INDEX_FREE
)
{
if
(
dirtab_slot
.
flag
==
DIR_INDEX_FREE
)
{
if
(
loop_count
++
>
JFS_IP
(
ip
)
->
next_index
)
{
if
(
loop_count
++
>
JFS_IP
(
ip
)
->
next_index
)
{
jERROR
(
1
,
(
"jfs_readdir detected "
jERROR
(
1
,
(
"jfs_readdir detected "
"infinite loop!
\n
"
));
"infinite loop!
\n
"
));
filp
->
f_pos
=
-
1
;
filp
->
f_pos
=
DIREND
;
return
0
;
return
0
;
}
}
dir_index
=
le32_to_cpu
(
dirtab_slot
.
addr2
);
dir_index
=
le32_to_cpu
(
dirtab_slot
.
addr2
);
if
(
dir_index
==
-
1
)
{
if
(
dir_index
==
-
1
)
{
filp
->
f_pos
=
-
1
;
filp
->
f_pos
=
DIREND
;
return
0
;
return
0
;
}
}
goto
repeat
;
goto
repeat
;
...
@@ -2931,7 +2931,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
...
@@ -2931,7 +2931,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
index
=
dirtab_slot
.
slot
;
index
=
dirtab_slot
.
slot
;
DT_GETPAGE
(
ip
,
bn
,
mp
,
PSIZE
,
p
,
rc
);
DT_GETPAGE
(
ip
,
bn
,
mp
,
PSIZE
,
p
,
rc
);
if
(
rc
)
{
if
(
rc
)
{
filp
->
f_pos
=
-
1
;
filp
->
f_pos
=
DIREND
;
return
0
;
return
0
;
}
}
if
(
p
->
header
.
flag
&
BT_INTERNAL
)
{
if
(
p
->
header
.
flag
&
BT_INTERNAL
)
{
...
@@ -2968,7 +2968,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
...
@@ -2968,7 +2968,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
* Find first entry of left-most leaf
* Find first entry of left-most leaf
*/
*/
if
(
dtEmpty
(
ip
))
{
if
(
dtEmpty
(
ip
))
{
filp
->
f_pos
=
-
1
;
filp
->
f_pos
=
DIREND
;
return
0
;
return
0
;
}
}
...
@@ -3013,7 +3013,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
...
@@ -3013,7 +3013,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
}
}
if
(
dtEmpty
(
ip
))
{
if
(
dtEmpty
(
ip
))
{
filp
->
f_pos
=
-
1
;
filp
->
f_pos
=
DIREND
;
return
0
;
return
0
;
}
}
...
@@ -3021,7 +3021,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
...
@@ -3021,7 +3021,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
jERROR
(
1
,
jERROR
(
1
,
(
"jfs_readdir: unexpected rc = %d from dtReadNext
\n
"
,
(
"jfs_readdir: unexpected rc = %d from dtReadNext
\n
"
,
rc
));
rc
));
filp
->
f_pos
=
-
1
;
filp
->
f_pos
=
DIREND
;
return
0
;
return
0
;
}
}
/* get start leaf page and index */
/* get start leaf page and index */
...
@@ -3029,7 +3029,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
...
@@ -3029,7 +3029,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
/* offset beyond directory eof ? */
/* offset beyond directory eof ? */
if
(
bn
<
0
)
{
if
(
bn
<
0
)
{
filp
->
f_pos
=
-
1
;
filp
->
f_pos
=
DIREND
;
return
0
;
return
0
;
}
}
}
}
...
@@ -3038,7 +3038,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
...
@@ -3038,7 +3038,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
if
(
d_name
==
NULL
)
{
if
(
d_name
==
NULL
)
{
DT_PUTPAGE
(
mp
);
DT_PUTPAGE
(
mp
);
jERROR
(
1
,
(
"jfs_readdir: kmalloc failed!
\n
"
));
jERROR
(
1
,
(
"jfs_readdir: kmalloc failed!
\n
"
));
filp
->
f_pos
=
-
1
;
filp
->
f_pos
=
DIREND
;
return
0
;
return
0
;
}
}
while
(
1
)
{
while
(
1
)
{
...
@@ -3087,13 +3087,13 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
...
@@ -3087,13 +3087,13 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
*/
*/
if
(
p
->
header
.
flag
&
BT_ROOT
)
{
if
(
p
->
header
.
flag
&
BT_ROOT
)
{
filp
->
f_pos
=
-
1
;
filp
->
f_pos
=
DIREND
;
break
;
break
;
}
}
bn
=
le64_to_cpu
(
p
->
header
.
next
);
bn
=
le64_to_cpu
(
p
->
header
.
next
);
if
(
bn
==
0
)
{
if
(
bn
==
0
)
{
filp
->
f_pos
=
-
1
;
filp
->
f_pos
=
DIREND
;
break
;
break
;
}
}
...
...
fs/jfs/jfs_dtree.h
View file @
720e65f1
...
@@ -252,6 +252,10 @@ typedef union {
...
@@ -252,6 +252,10 @@ typedef union {
#define DIRENTSIZ(namlen) \
#define DIRENTSIZ(namlen) \
( (sizeof(struct dirent) - 2*(JFS_NAME_MAX+1) + 2*((namlen)+1) + 3) &~ 3 )
( (sizeof(struct dirent) - 2*(JFS_NAME_MAX+1) + 2*((namlen)+1) + 3) &~ 3 )
/*
* Maximum file offset for directories.
*/
#define DIREND INT_MAX
/*
/*
* external declarations
* external declarations
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment