// SPDX-License-Identifier: GPL-2.0-only /* * QNX4 file system, Linux implementation. * * Version : 0.2.1 * * Using parts of the xiafs filesystem. * * History : * * 01-06-1998 by Richard Frowijn : first release. * 20-06-1998 by Frank Denis : Linux 2.1.99+ support, boot signature, misc. * 30-06-1998 by Frank Denis : first step to write inodes.
*/
/* * Check the root directory of the filesystem to make sure * it really _is_ a qnx4 filesystem, and to check the size * of the directory entry.
*/ staticconstchar *qnx4_checkroot(struct super_block *sb, struct qnx4_super_block *s)
{ struct buffer_head *bh; struct qnx4_inode_entry *rootdir; int rd, rl; int i, j;
if (s->RootDir.di_fname[0] != '/' || s->RootDir.di_fname[1] != '\0') return"no qnx4 filesystem (no root dir).";
QNX4DEBUG((KERN_NOTICE "QNX4 filesystem found on dev %s.\n", sb->s_id));
rd = le32_to_cpu(s->RootDir.di_first_xtnt.xtnt_blk) - 1;
rl = le32_to_cpu(s->RootDir.di_first_xtnt.xtnt_size); for (j = 0; j < rl; j++) {
bh = sb_bread(sb, rd + j); /* root dir, first block */ if (bh == NULL) return"unable to read root entry.";
rootdir = (struct qnx4_inode_entry *) bh->b_data; for (i = 0; i < QNX4_INODES_PER_BLOCK; i++, rootdir++) {
QNX4DEBUG((KERN_INFO "rootdir entry found : [%s]\n", rootdir->di_fname)); if (strcmp(rootdir->di_fname, QNX4_BMNAME) != 0) continue;
qnx4_sb(sb)->BitMap = kmemdup(rootdir, sizeof(struct qnx4_inode_entry),
GFP_KERNEL);
brelse(bh); if (!qnx4_sb(sb)->BitMap) return"not enough memory for bitmap inode"; /* keep bitmap inode known */ return NULL;
}
brelse(bh);
} return"bitmap file not found.";
}
/* Check the superblock signature. Since the qnx4 code is dangerous, we should leave as quickly as possible
if we don't belong here... */
bh = sb_bread(s, 1); if (!bh) {
printk(KERN_ERR "qnx4: unable to read the superblock\n"); return -EINVAL;
}
/* check before allocating dentries, inodes, .. */
errmsg = qnx4_checkroot(s, (struct qnx4_super_block *) bh->b_data);
brelse(bh); if (errmsg != NULL) { if (!silent)
printk(KERN_ERR "qnx4: %s\n", errmsg); return -EINVAL;
}
/* does root not have inode number QNX4_ROOT_INO ?? */
root = qnx4_iget(s, QNX4_ROOT_INO * QNX4_INODES_PER_BLOCK); if (IS_ERR(root)) {
printk(KERN_ERR "qnx4: get inode failed\n"); return PTR_ERR(root);
}
s->s_root = d_make_root(root); if (s->s_root == NULL) return -ENOMEM;
QNX4DEBUG((KERN_INFO "reading inode : [%d]\n", ino)); if (!ino) {
printk(KERN_ERR "qnx4: bad inode number on dev %s: %lu is " "out of range\n",
sb->s_id, ino);
iget_failed(inode); return ERR_PTR(-EIO);
}
block = ino / QNX4_INODES_PER_BLOCK;
if (!(bh = sb_bread(sb, block))) {
printk(KERN_ERR "qnx4: major problem: unable to read inode from dev " "%s\n", sb->s_id);
iget_failed(inode); return ERR_PTR(-EIO);
}
raw_inode = ((struct qnx4_inode_entry *) bh->b_data) +
(ino % QNX4_INODES_PER_BLOCK);
staticvoid destroy_inodecache(void)
{ /* * Make sure all delayed rcu free inodes are flushed before we * destroy cache.
*/
rcu_barrier();
kmem_cache_destroy(qnx4_inode_cachep);
}
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.