Commit d16076d9 authored by Jan Kara's avatar Jan Kara

udf: New directory iteration code

Add new support code for iterating directory entries. The code is also
more carefully verifying validity of on-disk directory entries to avoid
crashes on malicious media.
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent 3d2d7e61
This diff is collapsed.
...@@ -86,6 +86,24 @@ extern const struct address_space_operations udf_aops; ...@@ -86,6 +86,24 @@ extern const struct address_space_operations udf_aops;
extern const struct address_space_operations udf_adinicb_aops; extern const struct address_space_operations udf_adinicb_aops;
extern const struct address_space_operations udf_symlink_aops; extern const struct address_space_operations udf_symlink_aops;
struct udf_fileident_iter {
struct inode *dir; /* Directory we are working with */
loff_t pos; /* Logical position in a dir */
struct buffer_head *bh[2]; /* Buffer containing 'pos' and possibly
* next buffer if entry straddles
* blocks */
struct kernel_lb_addr eloc; /* Start of extent containing 'pos' */
uint32_t elen; /* Length of extent containing 'pos' */
sector_t loffset; /* Block offset of 'pos' within above
* extent */
struct extent_position epos; /* Position after the above extent */
struct fileIdentDesc fi; /* Copied directory entry */
uint8_t *name; /* Pointer to entry name */
uint8_t namebuf[UDF_NAME_LEN_CS0]; /* Storage for entry name in case
* the name is split between two blocks
*/
};
struct udf_fileident_bh { struct udf_fileident_bh {
struct buffer_head *sbh; struct buffer_head *sbh;
struct buffer_head *ebh; struct buffer_head *ebh;
...@@ -243,6 +261,11 @@ extern udf_pblk_t udf_new_block(struct super_block *sb, struct inode *inode, ...@@ -243,6 +261,11 @@ extern udf_pblk_t udf_new_block(struct super_block *sb, struct inode *inode,
uint16_t partition, uint32_t goal, int *err); uint16_t partition, uint32_t goal, int *err);
/* directory.c */ /* directory.c */
int udf_fiiter_init(struct udf_fileident_iter *iter, struct inode *dir,
loff_t pos);
int udf_fiiter_advance(struct udf_fileident_iter *iter);
void udf_fiiter_release(struct udf_fileident_iter *iter);
void udf_fiiter_write_fi(struct udf_fileident_iter *iter, uint8_t *impuse);
extern struct fileIdentDesc *udf_fileident_read(struct inode *, loff_t *, extern struct fileIdentDesc *udf_fileident_read(struct inode *, loff_t *,
struct udf_fileident_bh *, struct udf_fileident_bh *,
struct fileIdentDesc *, struct fileIdentDesc *,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment