Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@penguin.transmeta.com>2002-03-07 00:51:20 -0800
committerLinus Torvalds <torvalds@penguin.transmeta.com>2002-03-07 00:51:20 -0800
commit720e65f1e77d8a3fac5fc06f64f65f6045645b2d (patch)
tree4bb00dac5c755829d2ede3e079d44252d6b7748e
parentdbdb2c5aa95320558f0e21571f223d71bb8d30a4 (diff)
parentd755c8739c884ad035ca576e8d3e7e99ae693f1c (diff)
Automerge
-rw-r--r--fs/jfs/jfs_dtree.c28
-rw-r--r--fs/jfs/jfs_dtree.h4
2 files changed, 18 insertions, 14 deletions
diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c
index 42e1b280ca12..725c1f20ac7d 100644
--- a/fs/jfs/jfs_dtree.c
+++ b/fs/jfs/jfs_dtree.c
@@ -798,7 +798,7 @@ int dtInsert(tid_t tid, struct inode *ip,
* insert entry for new key
*/
if (DO_INDEX(ip)) {
- if (JFS_IP(ip)->next_index == -1) {
+ if (JFS_IP(ip)->next_index == DIREND) {
DT_PUTPAGE(mp);
return EMLINK;
}
@@ -2885,7 +2885,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
int do_index = 0;
uint loop_count = 0;
- if (filp->f_pos == -1)
+ if (filp->f_pos == DIREND)
return 0;
if (DO_INDEX(ip)) {
@@ -2904,25 +2904,25 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
dir_table_slot_t dirtab_slot;
if (dtEmpty(ip)) {
- filp->f_pos = -1;
+ filp->f_pos = DIREND;
return 0;
}
repeat:
rc = get_index(ip, dir_index, &dirtab_slot);
if (rc) {
- filp->f_pos = -1;
+ filp->f_pos = DIREND;
return rc;
}
if (dirtab_slot.flag == DIR_INDEX_FREE) {
if (loop_count++ > JFS_IP(ip)->next_index) {
jERROR(1, ("jfs_readdir detected "
"infinite loop!\n"));
- filp->f_pos = -1;
+ filp->f_pos = DIREND;
return 0;
}
dir_index = le32_to_cpu(dirtab_slot.addr2);
if (dir_index == -1) {
- filp->f_pos = -1;
+ filp->f_pos = DIREND;
return 0;
}
goto repeat;
@@ -2931,7 +2931,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
index = dirtab_slot.slot;
DT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc) {
- filp->f_pos = -1;
+ filp->f_pos = DIREND;
return 0;
}
if (p->header.flag & BT_INTERNAL) {
@@ -2968,7 +2968,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
* Find first entry of left-most leaf
*/
if (dtEmpty(ip)) {
- filp->f_pos = -1;
+ filp->f_pos = DIREND;
return 0;
}
@@ -3013,7 +3013,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
}
if (dtEmpty(ip)) {
- filp->f_pos = -1;
+ filp->f_pos = DIREND;
return 0;
}
@@ -3021,7 +3021,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
jERROR(1,
("jfs_readdir: unexpected rc = %d from dtReadNext\n",
rc));
- filp->f_pos = -1;
+ filp->f_pos = DIREND;
return 0;
}
/* get start leaf page and index */
@@ -3029,7 +3029,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
/* offset beyond directory eof ? */
if (bn < 0) {
- filp->f_pos = -1;
+ filp->f_pos = DIREND;
return 0;
}
}
@@ -3038,7 +3038,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
if (d_name == NULL) {
DT_PUTPAGE(mp);
jERROR(1, ("jfs_readdir: kmalloc failed!\n"));
- filp->f_pos = -1;
+ filp->f_pos = DIREND;
return 0;
}
while (1) {
@@ -3087,13 +3087,13 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
*/
if (p->header.flag & BT_ROOT) {
- filp->f_pos = -1;
+ filp->f_pos = DIREND;
break;
}
bn = le64_to_cpu(p->header.next);
if (bn == 0) {
- filp->f_pos = -1;
+ filp->f_pos = DIREND;
break;
}
diff --git a/fs/jfs/jfs_dtree.h b/fs/jfs/jfs_dtree.h
index 5ea922aeeb28..06a928b87460 100644
--- a/fs/jfs/jfs_dtree.h
+++ b/fs/jfs/jfs_dtree.h
@@ -252,6 +252,10 @@ typedef union {
#define DIRENTSIZ(namlen) \
( (sizeof(struct dirent) - 2*(JFS_NAME_MAX+1) + 2*((namlen)+1) + 3) &~ 3 )
+/*
+ * Maximum file offset for directories.
+ */
+#define DIREND INT_MAX
/*
* external declarations