dir.c (9f30a04d768f64280dc0c40b730746e82f298d88) dir.c (5955102c9984fa081b2d570cfac75c97eecf8f3b)
1/*
2 * linux/fs/hpfs/dir.c
3 *
4 * Mikulas Patocka (mikulas@artax.karlin.mff.cuni.cz), 1998-1999
5 *
6 * directory VFS functions
7 */
8

--- 19 unchanged lines hidden (view full) ---

28 struct inode *i = file_inode(filp);
29 struct hpfs_inode_info *hpfs_inode = hpfs_i(i);
30 struct super_block *s = i->i_sb;
31
32 /* Somebody else will have to figure out what to do here */
33 if (whence == SEEK_DATA || whence == SEEK_HOLE)
34 return -EINVAL;
35
1/*
2 * linux/fs/hpfs/dir.c
3 *
4 * Mikulas Patocka (mikulas@artax.karlin.mff.cuni.cz), 1998-1999
5 *
6 * directory VFS functions
7 */
8

--- 19 unchanged lines hidden (view full) ---

28 struct inode *i = file_inode(filp);
29 struct hpfs_inode_info *hpfs_inode = hpfs_i(i);
30 struct super_block *s = i->i_sb;
31
32 /* Somebody else will have to figure out what to do here */
33 if (whence == SEEK_DATA || whence == SEEK_HOLE)
34 return -EINVAL;
35
36 mutex_lock(&i->i_mutex);
36 inode_lock(i);
37 hpfs_lock(s);
38
39 /*pr_info("dir lseek\n");*/
40 if (new_off == 0 || new_off == 1 || new_off == 11 || new_off == 12 || new_off == 13) goto ok;
41 pos = ((loff_t) hpfs_de_as_down_as_possible(s, hpfs_inode->i_dno) << 4) + 1;
42 while (pos != new_off) {
43 if (map_pos_dirent(i, &pos, &qbh)) hpfs_brelse4(&qbh);
44 else goto fail;
45 if (pos == 12) goto fail;
46 }
47 hpfs_add_pos(i, &filp->f_pos);
48ok:
49 filp->f_pos = new_off;
50 hpfs_unlock(s);
37 hpfs_lock(s);
38
39 /*pr_info("dir lseek\n");*/
40 if (new_off == 0 || new_off == 1 || new_off == 11 || new_off == 12 || new_off == 13) goto ok;
41 pos = ((loff_t) hpfs_de_as_down_as_possible(s, hpfs_inode->i_dno) << 4) + 1;
42 while (pos != new_off) {
43 if (map_pos_dirent(i, &pos, &qbh)) hpfs_brelse4(&qbh);
44 else goto fail;
45 if (pos == 12) goto fail;
46 }
47 hpfs_add_pos(i, &filp->f_pos);
48ok:
49 filp->f_pos = new_off;
50 hpfs_unlock(s);
51 mutex_unlock(&i->i_mutex);
51 inode_unlock(i);
52 return new_off;
53fail:
54 /*pr_warn("illegal lseek: %016llx\n", new_off);*/
55 hpfs_unlock(s);
52 return new_off;
53fail:
54 /*pr_warn("illegal lseek: %016llx\n", new_off);*/
55 hpfs_unlock(s);
56 mutex_unlock(&i->i_mutex);
56 inode_unlock(i);
57 return -ESPIPE;
58}
59
60static int hpfs_readdir(struct file *file, struct dir_context *ctx)
61{
62 struct inode *inode = file_inode(file);
63 struct hpfs_inode_info *hpfs_inode = hpfs_i(inode);
64 struct quad_buffer_head qbh;

--- 267 unchanged lines hidden ---
57 return -ESPIPE;
58}
59
60static int hpfs_readdir(struct file *file, struct dir_context *ctx)
61{
62 struct inode *inode = file_inode(file);
63 struct hpfs_inode_info *hpfs_inode = hpfs_i(inode);
64 struct quad_buffer_head qbh;

--- 267 unchanged lines hidden ---