staticint adfs_checkdiscrecord(struct adfs_discrecord *dr)
{ unsignedint max_idlen; int i;
/* sector size must be 256, 512 or 1024 bytes */ if (dr->log2secsize != 8 &&
dr->log2secsize != 9 &&
dr->log2secsize != 10) return 1;
/* idlen must be at least log2secsize + 3 */ if (dr->idlen < dr->log2secsize + 3) return 1;
/* we cannot have such a large disc that we * are unable to represent sector offsets in * 32 bits. This works out at 2.0 TB.
*/ if (le32_to_cpu(dr->disc_size_high) >> dr->log2secsize) return 1;
/* * Maximum idlen is limited to 16 bits for new directories by * the three-byte storage of an indirect disc address. For * big directories, idlen must be no greater than 19 v2 [1.0]
*/
max_idlen = dr->format_version ? 19 : 16; if (dr->idlen > max_idlen) return 1;
/* reserved bytes should be zero */ for (i = 0; i < sizeof(dr->unused52); i++) if (dr->unused52[i] != 0) return 1;
staticint adfs_drop_inode(struct inode *inode)
{ /* always drop inodes if we are read-only */ return !IS_ENABLED(CONFIG_ADFS_FS_RW) || IS_RDONLY(inode);
}
staticvoid destroy_inodecache(void)
{ /* * Make sure all delayed rcu free inodes are flushed before we * destroy cache.
*/
rcu_barrier();
kmem_cache_destroy(adfs_inode_cachep);
}
/* Do some sanity checks on the ADFS disc record */
dr = (struct adfs_discrecord *)(b_data + ADFS_DR_OFFSET); if (adfs_checkdiscrecord(dr)) return -EILSEQ;
/* Do some sanity checks on the ADFS disc record */
dr = (struct adfs_discrecord *)(bh->b_data + 4); if (adfs_checkdiscrecord(dr) || dr->nzones_high || dr->nzones != 1) return -EILSEQ;
/* Try to probe the filesystem boot block */
ret = adfs_probe(sb, ADFS_DISCRECORD, 1, adfs_validate_bblk); if (ret == -EILSEQ)
ret = adfs_probe(sb, 0, silent, adfs_validate_dr0); if (ret == -EILSEQ) { if (!silent)
adfs_msg(sb, KERN_ERR, "error: can't find an ADFS filesystem on dev %s.",
sb->s_id);
ret = -EINVAL;
} if (ret) goto error;
/* set up enough so that we can read an inode */
sb->s_op = &adfs_sops;
dr = adfs_map_discrecord(asb->s_map);
root_obj.parent_id = root_obj.indaddr = le32_to_cpu(dr->root);
root_obj.name_len = 0; /* Set root object date as 01 Jan 1987 00:00:00 */
root_obj.loadaddr = 0xfff0003f;
root_obj.execaddr = 0xec22c000;
root_obj.size = ADFS_NEWDIR_SIZE;
root_obj.attr = ADFS_NDA_DIRECTORY | ADFS_NDA_OWNER_READ |
ADFS_NDA_OWNER_WRITE | ADFS_NDA_PUBLIC_READ;
/* * If this is a F+ disk with variable length directories, * get the root_size from the disc record.
*/ if (dr->format_version) {
root_obj.size = le32_to_cpu(dr->root_size);
asb->s_dir = &adfs_fplus_dir_ops;
asb->s_namelen = ADFS_FPLUS_NAME_LEN;
} else {
asb->s_dir = &adfs_f_dir_ops;
asb->s_namelen = ADFS_F_NAME_LEN;
} /* * ,xyz hex filetype suffix may be added by driver * to files that have valid RISC OS filetype
*/ if (asb->s_ftsuffix)
asb->s_namelen += 4;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.