summaryrefslogtreecommitdiffstats
path: root/fs/udf/udfdecl.h
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2018-06-13 17:30:14 +0200
committerJan Kara <jack@suse.cz>2018-06-20 11:05:49 +0200
commitf2e83347119acc0412941c5a23d895624c9300e2 (patch)
tree7c57d33e7bc50b49fff6c5edc73a8992bfae83ff /fs/udf/udfdecl.h
parentudf: Detect incorrect directory size (diff)
downloadlinux-f2e83347119acc0412941c5a23d895624c9300e2.tar.xz
linux-f2e83347119acc0412941c5a23d895624c9300e2.zip
udf: Provide function for calculating dir entry length
Provide function for calculating directory entry length and use to reduce code duplication. Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf/udfdecl.h')
-rw-r--r--fs/udf/udfdecl.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h
index bae311b59400..ed890bc4416d 100644
--- a/fs/udf/udfdecl.h
+++ b/fs/udf/udfdecl.h
@@ -132,6 +132,12 @@ struct inode *udf_find_metadata_inode_efe(struct super_block *sb,
extern int udf_write_fi(struct inode *inode, struct fileIdentDesc *,
struct fileIdentDesc *, struct udf_fileident_bh *,
uint8_t *, uint8_t *);
+static inline unsigned int udf_dir_entry_len(struct fileIdentDesc *cfi)
+{
+ return ALIGN(sizeof(struct fileIdentDesc) +
+ le16_to_cpu(cfi->lengthOfImpUse) + cfi->lengthFileIdent,
+ UDF_NAME_PAD);
+}
/* file.c */
extern long udf_ioctl(struct file *, unsigned int, unsigned long);