Commit 871b9b14 authored by Pali Rohár's avatar Pali Rohár Committed by Jan Kara

udf: Move OSTA Identifier Suffix macros from ecma_167.h to osta_udf.h

Rename structure name and its members to match naming convention and fix
endianity type for UDFRevision member. Also remove duplicate definition of
UDF_ID_COMPLIANT which is already in osta_udf.h.

Link: https://lore.kernel.org/r/20200107212904.30471-2-pali.rohar@gmail.comSigned-off-by: default avatarPali Rohár <pali.rohar@gmail.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent 800552ce
......@@ -88,20 +88,6 @@ struct regid {
#define ENTITYID_FLAGS_DIRTY 0x00
#define ENTITYID_FLAGS_PROTECTED 0x01
/* OSTA UDF 2.1.5.2 */
#define UDF_ID_COMPLIANT "*OSTA UDF Compliant"
/* OSTA UDF 2.1.5.3 */
struct domainEntityIDSuffix {
uint16_t revision;
uint8_t flags;
uint8_t reserved[5];
};
/* OSTA UDF 2.1.5.3 */
#define ENTITYIDSUFFIX_FLAGS_HARDWRITEPROTECT 0
#define ENTITYIDSUFFIX_FLAGS_SOFTWRITEPROTECT 1
/* Volume Structure Descriptor (ECMA 167r3 2/9.1) */
#define VSD_STD_ID_LEN 5
struct volStructDesc {
......
......@@ -62,8 +62,14 @@
#define UDF_ID_METADATA "*UDF Metadata Partition"
/* Identifier Suffix (UDF 2.50 2.1.5.3) */
#define IS_DF_HARD_WRITE_PROTECT 0x01
#define IS_DF_SOFT_WRITE_PROTECT 0x02
#define DOMAIN_FLAGS_HARD_WRITE_PROTECT 0x01
#define DOMAIN_FLAGS_SOFT_WRITE_PROTECT 0x02
struct domainIdentSuffix {
__le16 UDFRevision;
uint8_t domainFlags;
uint8_t reserved[5];
} __packed;
struct UDFIdentSuffix {
__le16 UDFRevision;
......
......@@ -767,7 +767,7 @@ static int udf_check_vsd(struct super_block *sb)
static int udf_verify_domain_identifier(struct super_block *sb,
struct regid *ident, char *dname)
{
struct domainEntityIDSuffix *suffix;
struct domainIdentSuffix *suffix;
if (memcmp(ident->ident, UDF_ID_COMPLIANT, strlen(UDF_ID_COMPLIANT))) {
udf_warn(sb, "Not OSTA UDF compliant %s descriptor.\n", dname);
......@@ -778,9 +778,9 @@ static int udf_verify_domain_identifier(struct super_block *sb,
dname);
goto force_ro;
}
suffix = (struct domainEntityIDSuffix *)ident->identSuffix;
if (suffix->flags & (1 << ENTITYIDSUFFIX_FLAGS_HARDWRITEPROTECT) ||
suffix->flags & (1 << ENTITYIDSUFFIX_FLAGS_SOFTWRITEPROTECT)) {
suffix = (struct domainIdentSuffix *)ident->identSuffix;
if ((suffix->domainFlags & DOMAIN_FLAGS_HARD_WRITE_PROTECT) ||
(suffix->domainFlags & DOMAIN_FLAGS_SOFT_WRITE_PROTECT)) {
if (!sb_rdonly(sb)) {
udf_warn(sb, "Descriptor for %s marked write protected."
" Forcing read only mount.\n", dname);
......
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