本文整理汇总了C++中d_alloc_root函数的典型用法代码示例。如果您正苦于以下问题:C++ d_alloc_root函数的具体用法?C++ d_alloc_root怎么用?C++ d_alloc_root使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了d_alloc_root函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: cramfs_fill_super
static int cramfs_fill_super(struct super_block *sb, void *data, int silent)
{
int i;
struct cramfs_super super;
unsigned long root_offset;
struct cramfs_sb_info *sbi;
struct inode *root;
sb->s_flags |= MS_RDONLY;
sbi = kzalloc(sizeof(struct cramfs_sb_info), GFP_KERNEL);
if (!sbi)
return -ENOMEM;
sb->s_fs_info = sbi;
/* Invalidate the read buffers on mount: think disk change.. */
mutex_lock(&read_mutex);
for (i = 0; i < READ_BUFFERS; i++)
buffer_blocknr[i] = -1;
/* Read the first block and get the superblock from it */
memcpy(&super, cramfs_read(sb, 0, sizeof(super)), sizeof(super));
mutex_unlock(&read_mutex);
/* Do sanity checks on the superblock */
if (super.magic != CRAMFS_MAGIC) {
/* check for wrong endianess */
if (super.magic == CRAMFS_MAGIC_WEND) {
if (!silent)
printk(KERN_ERR "cramfs: wrong endianess\n");
goto out;
}
/* check at 512 byte offset */
mutex_lock(&read_mutex);
memcpy(&super, cramfs_read(sb, 512, sizeof(super)), sizeof(super));
mutex_unlock(&read_mutex);
if (super.magic != CRAMFS_MAGIC) {
if (super.magic == CRAMFS_MAGIC_WEND && !silent)
printk(KERN_ERR "cramfs: wrong endianess\n");
else if (!silent)
printk(KERN_ERR "cramfs: wrong magic\n");
goto out;
}
}
/* get feature flags first */
if (super.flags & ~CRAMFS_SUPPORTED_FLAGS) {
printk(KERN_ERR "cramfs: unsupported filesystem features\n");
goto out;
}
/* Check that the root inode is in a sane state */
if (!S_ISDIR(super.root.mode)) {
printk(KERN_ERR "cramfs: root is not a directory\n");
goto out;
}
/* correct strange, hard-coded permissions of mkcramfs */
super.root.mode |= (S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
root_offset = super.root.offset << 2;
if (super.flags & CRAMFS_FLAG_FSID_VERSION_2) {
sbi->size=super.size;
sbi->blocks=super.fsid.blocks;
sbi->files=super.fsid.files;
} else {
sbi->size=1<<28;
sbi->blocks=0;
sbi->files=0;
}
sbi->magic=super.magic;
sbi->flags=super.flags;
if (root_offset == 0)
printk(KERN_INFO "cramfs: empty filesystem");
else if (!(super.flags & CRAMFS_FLAG_SHIFTED_ROOT_OFFSET) &&
((root_offset != sizeof(struct cramfs_super)) &&
(root_offset != 512 + sizeof(struct cramfs_super))))
{
printk(KERN_ERR "cramfs: bad root offset %lu\n", root_offset);
goto out;
}
/* Set it all up.. */
sb->s_op = &cramfs_ops;
root = get_cramfs_inode(sb, &super.root, 0);
if (IS_ERR(root))
goto out;
sb->s_root = d_alloc_root(root);
if (!sb->s_root) {
iput(root);
goto out;
}
return 0;
out:
kfree(sbi);
sb->s_fs_info = NULL;
return -EINVAL;
}
开发者ID:AndrewDB,项目名称:rk3066-kernel,代码行数:98,代码来源:inode.c
示例2: hfs_fill_super
/*
* hfs_read_super()
*
* This is the function that is responsible for mounting an HFS
* filesystem. It performs all the tasks necessary to get enough data
* from the disk to read the root inode. This includes parsing the
* mount options, dealing with Macintosh partitions, reading the
* superblock and the allocation bitmap blocks, calling
* hfs_btree_init() to get the necessary data about the extents and
* catalog B-trees and, finally, reading the root inode into memory.
*/
static int hfs_fill_super(struct super_block *sb, void *data, int silent)
{
struct hfs_sb_info *sbi;
struct hfs_find_data fd;
hfs_cat_rec rec;
struct inode *root_inode;
int res;
sbi = kzalloc(sizeof(struct hfs_sb_info), GFP_KERNEL);
if (!sbi)
return -ENOMEM;
sb->s_fs_info = sbi;
INIT_HLIST_HEAD(&sbi->rsrc_inodes);
res = -EINVAL;
if (!parse_options((char *)data, sbi)) {
printk(KERN_ERR "hfs: unable to parse mount options.\n");
goto bail;
}
sb->s_op = &hfs_super_operations;
sb->s_flags |= MS_NODIRATIME;
mutex_init(&sbi->bitmap_lock);
res = hfs_mdb_get(sb);
if (res) {
if (!silent)
printk(KERN_WARNING "hfs: can't find a HFS filesystem on dev %s.\n",
hfs_mdb_name(sb));
res = -EINVAL;
goto bail;
}
/* try to get the root inode */
hfs_find_init(HFS_SB(sb)->cat_tree, &fd);
res = hfs_cat_find_brec(sb, HFS_ROOT_CNID, &fd);
if (!res) {
if (fd.entrylength > sizeof(rec) || fd.entrylength < 0) {
res = -EIO;
goto bail;
}
hfs_bnode_read(fd.bnode, &rec, fd.entryoffset, fd.entrylength);
}
if (res) {
hfs_find_exit(&fd);
goto bail_no_root;
}
res = -EINVAL;
root_inode = hfs_iget(sb, &fd.search_key->cat, &rec);
hfs_find_exit(&fd);
if (!root_inode)
goto bail_no_root;
res = -ENOMEM;
sb->s_root = d_alloc_root(root_inode);
if (!sb->s_root)
goto bail_iput;
sb->s_root->d_op = &hfs_dentry_operations;
/* everything's okay */
return 0;
bail_iput:
iput(root_inode);
bail_no_root:
printk(KERN_ERR "hfs: get root inode failed.\n");
bail:
hfs_mdb_put(sb);
return res;
}
开发者ID:12rafael,项目名称:jellytimekernel,代码行数:82,代码来源:super.c
示例3: befs_fill_super
/* Allocate private field of the superblock, fill it.
*
* Finish filling the public superblock fields
* Make the root directory
* Load a set of NLS translations if needed.
*/
static int
befs_fill_super(struct super_block *sb, void *data, int silent)
{
struct buffer_head *bh;
befs_sb_info *befs_sb;
befs_super_block *disk_sb;
struct inode *root;
const unsigned long sb_block = 0;
const off_t x86_sb_off = 512;
sb->s_fs_info = kmalloc(sizeof (*befs_sb), GFP_KERNEL);
if (sb->s_fs_info == NULL) {
printk(KERN_ERR
"BeFS(%s): Unable to allocate memory for private "
"portion of superblock. Bailing.\n", sb->s_id);
goto unaquire_none;
}
befs_sb = BEFS_SB(sb);
memset(befs_sb, 0, sizeof(befs_sb_info));
if (!parse_options((char *) data, &befs_sb->mount_opts)) {
befs_error(sb, "cannot parse mount options");
goto unaquire_priv_sbp;
}
befs_debug(sb, "---> befs_fill_super()");
#ifndef CONFIG_BEFS_RW
if (!(sb->s_flags & MS_RDONLY)) {
befs_warning(sb,
"No write support. Marking filesystem read-only");
sb->s_flags |= MS_RDONLY;
}
#endif /* CONFIG_BEFS_RW */
/*
* Set dummy blocksize to read super block.
* Will be set to real fs blocksize later.
*
* Linux 2.4.10 and later refuse to read blocks smaller than
* the hardsect size for the device. But we also need to read at
* least 1k to get the second 512 bytes of the volume.
* -WD 10-26-01
*/
sb_min_blocksize(sb, 1024);
if (!(bh = sb_bread(sb, sb_block))) {
befs_error(sb, "unable to read superblock");
goto unaquire_priv_sbp;
}
/* account for offset of super block on x86 */
disk_sb = (befs_super_block *) bh->b_data;
if ((le32_to_cpu(disk_sb->magic1) == BEFS_SUPER_MAGIC1) ||
(be32_to_cpu(disk_sb->magic1) == BEFS_SUPER_MAGIC1)) {
befs_debug(sb, "Using PPC superblock location");
} else {
befs_debug(sb, "Using x86 superblock location");
disk_sb =
(befs_super_block *) ((void *) bh->b_data + x86_sb_off);
}
if (befs_load_sb(sb, disk_sb) != BEFS_OK)
goto unaquire_bh;
befs_dump_super_block(sb, disk_sb);
brelse(bh);
if (befs_check_sb(sb) != BEFS_OK)
goto unaquire_priv_sbp;
if( befs_sb->num_blocks > ~((sector_t)0) ) {
befs_error(sb, "blocks count: %Lu "
"is larger than the host can use",
befs_sb->num_blocks);
goto unaquire_priv_sbp;
}
/*
* set up enough so that it can read an inode
* Fill in kernel superblock fields from private sb
*/
sb->s_magic = BEFS_SUPER_MAGIC;
/* Set real blocksize of fs */
sb_set_blocksize(sb, (ulong) befs_sb->block_size);
sb->s_op = (struct super_operations *) &befs_sops;
root = iget(sb, iaddr2blockno(sb, &(befs_sb->root_dir)));
sb->s_root = d_alloc_root(root);
if (!sb->s_root) {
iput(root);
befs_error(sb, "get root inode failed");
goto unaquire_priv_sbp;
//.........这里部分代码省略.........
开发者ID:liucx6312,项目名称:supermicro_ipmi_firmware,代码行数:101,代码来源:linuxvfs.c
示例4: autofs_fill_super
int autofs_fill_super(struct super_block *s, void *data, int silent)
{
struct inode * root_inode;
struct dentry * root;
struct file * pipe;
int pipefd;
struct autofs_sb_info *sbi;
int minproto, maxproto;
pid_t pgid;
sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
if (!sbi)
goto fail_unlock;
DPRINTK(("autofs: starting up, sbi = %p\n",sbi));
s->s_fs_info = sbi;
sbi->magic = AUTOFS_SBI_MAGIC;
sbi->pipe = NULL;
sbi->catatonic = 1;
sbi->exp_timeout = 0;
autofs_initialize_hash(&sbi->dirhash);
sbi->queues = NULL;
memset(sbi->symlink_bitmap, 0, sizeof(long)*AUTOFS_SYMLINK_BITMAP_LEN);
sbi->next_dir_ino = AUTOFS_FIRST_DIR_INO;
s->s_blocksize = 1024;
s->s_blocksize_bits = 10;
s->s_magic = AUTOFS_SUPER_MAGIC;
s->s_op = &autofs_sops;
s->s_time_gran = 1;
sbi->sb = s;
root_inode = iget(s, AUTOFS_ROOT_INO);
root = d_alloc_root(root_inode);
pipe = NULL;
if (!root)
goto fail_iput;
/* Can this call block? - WTF cares? s is locked. */
if (parse_options(data, &pipefd, &root_inode->i_uid,
&root_inode->i_gid, &pgid, &minproto,
&maxproto)) {
printk("autofs: called with bogus options\n");
goto fail_dput;
}
/* Couldn't this be tested earlier? */
if (minproto > AUTOFS_PROTO_VERSION ||
maxproto < AUTOFS_PROTO_VERSION) {
printk("autofs: kernel does not match daemon version\n");
goto fail_dput;
}
DPRINTK(("autofs: pipe fd = %d, pgrp = %u\n", pipefd, pgid));
sbi->oz_pgrp = find_get_pid(pgid);
if (!sbi->oz_pgrp) {
printk("autofs: could not find process group %d\n", pgid);
goto fail_dput;
}
pipe = fget(pipefd);
if (!pipe) {
printk("autofs: could not open pipe file descriptor\n");
goto fail_put_pid;
}
if (!pipe->f_op || !pipe->f_op->write)
goto fail_fput;
sbi->pipe = pipe;
sbi->catatonic = 0;
/*
* Success! Install the root dentry now to indicate completion.
*/
s->s_root = root;
return 0;
fail_fput:
printk("autofs: pipe file descriptor does not contain proper ops\n");
fput(pipe);
fail_put_pid:
put_pid(sbi->oz_pgrp);
fail_dput:
dput(root);
goto fail_free;
fail_iput:
printk("autofs: get root dentry failed\n");
iput(root_inode);
fail_free:
kfree(sbi);
s->s_fs_info = NULL;
fail_unlock:
return -EINVAL;
}
开发者ID:3sOx,项目名称:asuswrt-merlin,代码行数:96,代码来源:inode.c
示例5: SUPER_INFO
struct super_block *efs_read_super(struct super_block *s, void *d, int silent) {
kdev_t dev = s->s_dev;
struct efs_sb_info *sb;
struct buffer_head *bh;
sb = SUPER_INFO(s);
s->s_magic = EFS_SUPER_MAGIC;
s->s_blocksize = EFS_BLOCKSIZE;
s->s_blocksize_bits = EFS_BLOCKSIZE_BITS;
if( set_blocksize(dev, EFS_BLOCKSIZE) < 0)
{
printk(KERN_ERR "EFS: device does not support %d byte blocks\n",
EFS_BLOCKSIZE);
goto out_no_fs_ul;
}
/* read the vh (volume header) block */
bh = sb_bread(s, 0);
if (!bh) {
printk(KERN_ERR "EFS: cannot read volume header\n");
goto out_no_fs_ul;
}
/*
* if this returns zero then we didn't find any partition table.
* this isn't (yet) an error - just assume for the moment that
* the device is valid and go on to search for a superblock.
*/
sb->fs_start = efs_validate_vh((struct volume_header *) bh->b_data);
brelse(bh);
if (sb->fs_start == -1) {
goto out_no_fs_ul;
}
bh = sb_bread(s, sb->fs_start + EFS_SUPER);
if (!bh) {
printk(KERN_ERR "EFS: cannot read superblock\n");
goto out_no_fs_ul;
}
if (efs_validate_super(sb, (struct efs_super *) bh->b_data)) {
#ifdef DEBUG
printk(KERN_WARNING "EFS: invalid superblock at block %u\n", sb->fs_start + EFS_SUPER);
#endif
brelse(bh);
goto out_no_fs_ul;
}
brelse(bh);
if (!(s->s_flags & MS_RDONLY)) {
#ifdef DEBUG
printk(KERN_INFO "EFS: forcing read-only mode\n");
#endif
s->s_flags |= MS_RDONLY;
}
s->s_op = &efs_superblock_operations;
s->s_root = d_alloc_root(iget(s, EFS_ROOTINODE));
if (!(s->s_root)) {
printk(KERN_ERR "EFS: get root inode failed\n");
goto out_no_fs;
}
return(s);
out_no_fs_ul:
out_no_fs:
return(NULL);
}
开发者ID:JBTech,项目名称:ralink_rt5350,代码行数:73,代码来源:super.c
示例6: ncp_fill_super
//.........这里部分代码省略.........
server->timeout_tm.data = (unsigned long)server;
server->timeout_tm.function = ncpdgram_timeout_call;
}
ncp_lock_server(server);
error = ncp_connect(server);
ncp_unlock_server(server);
if (error < 0)
goto out_packet;
DPRINTK("ncp_fill_super: NCP_SBP(sb) = %x\n", (int) NCP_SBP(sb));
error = -EMSGSIZE; /* -EREMOTESIDEINCOMPATIBLE */
#ifdef CONFIG_NCPFS_PACKET_SIGNING
if (ncp_negotiate_size_and_options(server, default_bufsize,
NCP_DEFAULT_OPTIONS, &(server->buffer_size), &options) == 0)
{
if (options != NCP_DEFAULT_OPTIONS)
{
if (ncp_negotiate_size_and_options(server,
default_bufsize,
options & 2,
&(server->buffer_size), &options) != 0)
{
goto out_disconnect;
}
}
if (options & 2)
server->sign_wanted = 1;
}
else
#endif /* CONFIG_NCPFS_PACKET_SIGNING */
if (ncp_negotiate_buffersize(server, default_bufsize,
&(server->buffer_size)) != 0)
goto out_disconnect;
DPRINTK("ncpfs: bufsize = %d\n", server->buffer_size);
memset(&finfo, 0, sizeof(finfo));
finfo.i.attributes = aDIR;
finfo.i.dataStreamSize = 0; /* ignored */
finfo.i.dirEntNum = 0;
finfo.i.DosDirNum = 0;
#ifdef CONFIG_NCPFS_SMALLDOS
finfo.i.NSCreator = NW_NS_DOS;
#endif
finfo.volume = NCP_NUMBER_OF_VOLUMES;
/* set dates of mountpoint to Jan 1, 1986; 00:00 */
finfo.i.creationTime = finfo.i.modifyTime
= cpu_to_le16(0x0000);
finfo.i.creationDate = finfo.i.modifyDate
= finfo.i.lastAccessDate
= cpu_to_le16(0x0C21);
finfo.i.nameLen = 0;
finfo.i.entryName[0] = '\0';
finfo.opened = 0;
finfo.ino = 2; /* tradition */
server->name_space[finfo.volume] = NW_NS_DOS;
error = -ENOMEM;
root_inode = ncp_iget(sb, &finfo);
if (!root_inode)
goto out_disconnect;
DPRINTK("ncp_fill_super: root vol=%d\n", NCP_FINFO(root_inode)->volNumber);
sb->s_root = d_alloc_root(root_inode);
if (!sb->s_root)
goto out_no_root;
sb->s_root->d_op = &ncp_root_dentry_operations;
return 0;
out_no_root:
iput(root_inode);
out_disconnect:
ncp_lock_server(server);
ncp_disconnect(server);
ncp_unlock_server(server);
out_packet:
ncp_stop_tasks(server);
vfree(server->packet);
out_nls:
#ifdef CONFIG_NCPFS_NLS
unload_nls(server->nls_io);
unload_nls(server->nls_vol);
#endif
out_fput2:
if (server->info_filp)
fput(server->info_filp);
out_fput:
/* 23/12/1998 Marcin Dalecki <[email protected]>:
*
* The previously used put_filp(ncp_filp); was bogous, since
* it doesn't proper unlocking.
*/
fput(ncp_filp);
out:
sb->s_fs_info = NULL;
kfree(server);
return error;
}
开发者ID:xf739645524,项目名称:kernel-rhel5,代码行数:101,代码来源:inode.c
示例7: squashfs_fill_super
//.........这里部分代码省略.........
msblk->id_table = NULL;
goto failed_mount;
}
next_table = le64_to_cpu(msblk->id_table[0]);
/* Handle inode lookup table */
lookup_table_start = le64_to_cpu(sblk->lookup_table_start);
if (lookup_table_start == SQUASHFS_INVALID_BLK)
goto handle_fragments;
/* Allocate and read inode lookup table */
msblk->inode_lookup_table = squashfs_read_inode_lookup_table(sb,
lookup_table_start, next_table, msblk->inodes);
if (IS_ERR(msblk->inode_lookup_table)) {
ERROR("unable to read inode lookup table\n");
err = PTR_ERR(msblk->inode_lookup_table);
msblk->inode_lookup_table = NULL;
goto failed_mount;
}
next_table = le64_to_cpu(msblk->inode_lookup_table[0]);
sb->s_export_op = &squashfs_export_ops;
handle_fragments:
fragments = le32_to_cpu(sblk->fragments);
if (fragments == 0)
goto check_directory_table;
msblk->fragment_cache = squashfs_cache_init("fragment",
SQUASHFS_CACHED_FRAGMENTS, msblk->block_size);
if (msblk->fragment_cache == NULL) {
err = -ENOMEM;
goto failed_mount;
}
/* Allocate and read fragment index table */
msblk->fragment_index = squashfs_read_fragment_index_table(sb,
le64_to_cpu(sblk->fragment_table_start), next_table, fragments);
if (IS_ERR(msblk->fragment_index)) {
ERROR("unable to read fragment index table\n");
err = PTR_ERR(msblk->fragment_index);
msblk->fragment_index = NULL;
goto failed_mount;
}
next_table = le64_to_cpu(msblk->fragment_index[0]);
check_directory_table:
/* Sanity check directory_table */
if (msblk->directory_table > next_table) {
err = -EINVAL;
goto failed_mount;
}
/* Sanity check inode_table */
if (msblk->inode_table >= msblk->directory_table) {
err = -EINVAL;
goto failed_mount;
}
/* allocate root */
root = new_inode(sb);
if (!root) {
err = -ENOMEM;
goto failed_mount;
}
err = squashfs_read_inode(root, root_inode);
if (err) {
make_bad_inode(root);
iput(root);
goto failed_mount;
}
insert_inode_hash(root);
sb->s_root = d_alloc_root(root);
if (sb->s_root == NULL) {
ERROR("Root inode create failed\n");
err = -ENOMEM;
iput(root);
goto failed_mount;
}
TRACE("Leaving squashfs_fill_super\n");
kfree(sblk);
return 0;
failed_mount:
squashfs_cache_delete(msblk->block_cache);
squashfs_cache_delete(msblk->fragment_cache);
squashfs_cache_delete(msblk->read_page);
squashfs_decompressor_free(msblk, msblk->stream);
kfree(msblk->inode_lookup_table);
kfree(msblk->fragment_index);
kfree(msblk->id_table);
kfree(msblk->xattr_id_table);
kfree(sb->s_fs_info);
sb->s_fs_info = NULL;
kfree(sblk);
return err;
}
开发者ID:32743069,项目名称:amlogic_common_3050,代码行数:101,代码来源:super.c
示例8: cramfs_fill_super
//.........这里部分代码省略.........
if (!mtd)
goto not_mtdblock;
if (mtd->type != MTD_NANDFLASH)
goto not_mtdblock;
cramfs_read = cramfs_read_nand;
sbi->mtd = mtd;
blocks = mtd->size / mtd->erasesize;
block_map = kmalloc(blocks * sizeof(int), GFP_KERNEL);
for (i = 0; i < blocks; i++) {
block_map[i] = -1;
}
sbi->block_map = block_map;
sbi->nblock = blocks;
}
not_mtdblock:
/* Invalidate the read buffers on mount: think disk change.. */
mutex_lock(&read_mutex);
for (i = 0; i < READ_BUFFERS; i++)
buffer_blocknr[i] = -1;
/* Read the first block and get the superblock from it */
memcpy(&super, cramfs_read(sb, 0, sizeof(super)), sizeof(super));
mutex_unlock(&read_mutex);
/* Do sanity checks on the superblock */
if (super.magic != CRAMFS_MAGIC) {
/* check for wrong endianess */
if (super.magic == CRAMFS_MAGIC_WEND) {
if (!silent)
printk(KERN_ERR "cramfs: wrong endianess\n");
goto out;
}
/* check at 512 byte offset */
mutex_lock(&read_mutex);
memcpy(&super, cramfs_read(sb, 512, sizeof(super)), sizeof(super));
mutex_unlock(&read_mutex);
if (super.magic != CRAMFS_MAGIC) {
if (super.magic == CRAMFS_MAGIC_WEND && !silent)
printk(KERN_ERR "cramfs: wrong endianess\n");
else if (!silent)
printk(KERN_ERR "cramfs: wrong magic\n");
goto out;
}
}
/* get feature flags first */
if (super.flags & ~CRAMFS_SUPPORTED_FLAGS) {
printk(KERN_ERR "cramfs: unsupported filesystem features\n");
goto out;
}
/* Check that the root inode is in a sane state */
if (!S_ISDIR(super.root.mode)) {
printk(KERN_ERR "cramfs: root is not a directory\n");
goto out;
}
root_offset = super.root.offset << 2;
if (super.flags & CRAMFS_FLAG_FSID_VERSION_2) {
sbi->size=super.size;
sbi->blocks=super.fsid.blocks;
sbi->files=super.fsid.files;
} else {
sbi->size=1<<28;
sbi->blocks=0;
sbi->files=0;
}
sbi->magic=super.magic;
sbi->flags=super.flags;
if (root_offset == 0)
printk(KERN_INFO "cramfs: empty filesystem");
else if (!(super.flags & CRAMFS_FLAG_SHIFTED_ROOT_OFFSET) &&
((root_offset != sizeof(struct cramfs_super)) &&
(root_offset != 512 + sizeof(struct cramfs_super))))
{
printk(KERN_ERR "cramfs: bad root offset %lu\n", root_offset);
goto out;
}
/* Set it all up.. */
sb->s_op = &cramfs_ops;
root = get_cramfs_inode(sb, &super.root);
if (!root)
goto out;
sb->s_root = d_alloc_root(root);
if (!sb->s_root) {
iput(root);
goto out;
}
return 0;
out:
kfree(sbi);
sb->s_fs_info = NULL;
return -EINVAL;
}
开发者ID:acassis,项目名称:emlinux-ssd1935,代码行数:101,代码来源:inode.c
示例9: HgfsGetRootDentry
static int
HgfsGetRootDentry(struct super_block *sb, // IN: Super block object
struct dentry **rootDentry) // OUT: Root dentry
{
int result = -ENOMEM;
struct inode *rootInode;
struct dentry *tempRootDentry = NULL;
struct HgfsAttrInfo rootDentryAttr;
HgfsInodeInfo *iinfo;
ASSERT(sb);
ASSERT(rootDentry);
LOG(6, (KERN_DEBUG "VMware hgfs: %s: entered\n", __func__));
rootInode = HgfsGetInode(sb, HGFS_ROOT_INO);
if (rootInode == NULL) {
LOG(6, (KERN_DEBUG "VMware hgfs: %s: Could not get the root inode\n",
__func__));
goto exit;
}
/*
* On an allocation failure in read_super, the inode will have been
* marked "bad". If it was, we certainly don't want to start playing with
* the HgfsInodeInfo. So quietly put the inode back and fail.
*/
if (is_bad_inode(rootInode)) {
LOG(6, (KERN_DEBUG "VMware hgfs: %s: encountered bad inode\n",
__func__));
goto exit;
}
tempRootDentry = d_alloc_root(rootInode);
if (tempRootDentry == NULL) {
LOG(4, (KERN_WARNING "VMware hgfs: %s: Could not get "
"root dentry\n", __func__));
goto exit;
}
rootInode = NULL;
result = HgfsPrivateGetattr(tempRootDentry, &rootDentryAttr, NULL);
if (result) {
LOG(4, (KERN_WARNING "VMware hgfs: HgfsReadSuper: Could not"
"instantiate the root dentry\n"));
goto exit;
}
iinfo = INODE_GET_II_P(tempRootDentry->d_inode);
iinfo->isFakeInodeNumber = FALSE;
iinfo->isReferencedInode = TRUE;
if (rootDentryAttr.mask & HGFS_ATTR_VALID_FILEID) {
iinfo->hostFileId = rootDentryAttr.hostFileId;
}
HgfsChangeFileAttributes(tempRootDentry->d_inode, &rootDentryAttr);
HgfsDentryAgeReset(tempRootDentry);
tempRootDentry->d_op = &HgfsDentryOperations;
*rootDentry = tempRootDentry;
result = 0;
LOG(6, (KERN_DEBUG "VMware hgfs: %s: finished\n", __func__));
exit:
if (result) {
iput(rootInode);
dput(tempRootDentry);
*rootDentry = NULL;
}
return result;
}
开发者ID:protomouse,项目名称:open-vm-tools,代码行数:73,代码来源:filesystem.c
示例10: f2fs_fill_super
//.........这里部分代码省略.........
}
err = build_node_manager(sbi);
if (err) {
f2fs_msg(sb, KERN_ERR,
"Failed to initialize F2FS node manager");
goto free_nm;
}
build_gc_manager(sbi);
/* get an inode for node space */
sbi->node_inode = f2fs_iget(sb, F2FS_NODE_INO(sbi));
if (IS_ERR(sbi->node_inode)) {
f2fs_msg(sb, KERN_ERR, "Failed to read node inode");
err = PTR_ERR(sbi->node_inode);
goto free_nm;
}
/* if there are nt orphan nodes free them */
recover_orphan_inodes(sbi);
/* read root inode and dentry */
root = f2fs_iget(sb, F2FS_ROOT_INO(sbi));
if (IS_ERR(root)) {
f2fs_msg(sb, KERN_ERR, "Failed to read root inode");
err = PTR_ERR(root);
goto free_node_inode;
}
if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) {
err = -EINVAL;
goto free_root_inode;
}
sb->s_root = d_alloc_root(root); /* allocate root dentry */
if (!sb->s_root) {
err = -ENOMEM;
goto free_root_inode;
}
err = f2fs_build_stats(sbi);
if (err)
goto free_root_inode;
if (f2fs_proc_root)
sbi->s_proc = proc_mkdir(sb->s_id, f2fs_proc_root);
if (sbi->s_proc)
proc_create_data("segment_info", S_IRUGO, sbi->s_proc,
&f2fs_seq_segment_info_fops, sb);
if (test_opt(sbi, DISCARD)) {
struct request_queue *q = bdev_get_queue(sb->s_bdev);
if (!blk_queue_discard(q))
f2fs_msg(sb, KERN_WARNING,
"mounting with \"discard\" option, but "
"the device does not support discard");
}
sbi->s_kobj.kset = f2fs_kset;
init_completion(&sbi->s_kobj_unregister);
err = kobject_init_and_add(&sbi->s_kobj, &f2fs_ktype, NULL,
"%s", sb->s_id);
if (err)
goto free_proc;
/* recover fsynced data */
开发者ID:achaykin,项目名称:android_kernel_huawei_viva,代码行数:67,代码来源:super.c
示例11: cifs_read_super
static int
cifs_read_super(struct super_block *sb, void *data,
const char *devname, int silent)
{
struct inode *inode;
struct cifs_sb_info *cifs_sb;
int rc = 0;
/* BB should we make this contingent on mount parm? */
sb->s_flags |= MS_NODIRATIME | MS_NOATIME;
sb->s_fs_info = kzalloc(sizeof(struct cifs_sb_info), GFP_KERNEL);
cifs_sb = CIFS_SB(sb);
if (cifs_sb == NULL)
return -ENOMEM;
rc = bdi_setup_and_register(&cifs_sb->bdi, "cifs", BDI_CAP_MAP_COPY);
if (rc) {
kfree(cifs_sb);
return rc;
}
#ifdef CONFIG_CIFS_DFS_UPCALL
/* copy mount params to sb for use in submounts */
/* BB: should we move this after the mount so we
* do not have to do the copy on failed mounts?
* BB: May be it is better to do simple copy before
* complex operation (mount), and in case of fail
* just exit instead of doing mount and attempting
* undo it if this copy fails?*/
if (data) {
int len = strlen(data);
cifs_sb->mountdata = kzalloc(len + 1, GFP_KERNEL);
if (cifs_sb->mountdata == NULL) {
bdi_destroy(&cifs_sb->bdi);
kfree(sb->s_fs_info);
sb->s_fs_info = NULL;
return -ENOMEM;
}
strncpy(cifs_sb->mountdata, data, len + 1);
cifs_sb->mountdata[len] = '\0';
}
#endif
rc = cifs_mount(sb, cifs_sb, data, devname);
if (rc) {
if (!silent)
cERROR(1, "cifs_mount failed w/return code = %d", rc);
goto out_mount_failed;
}
sb->s_magic = CIFS_MAGIC_NUMBER;
sb->s_op = &cifs_super_ops;
sb->s_bdi = &cifs_sb->bdi;
/* if (cifs_sb->tcon->ses->server->maxBuf > MAX_CIFS_HDR_SIZE + 512)
sb->s_blocksize =
cifs_sb->tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE; */
sb->s_blocksize = CIFS_MAX_MSGSIZE;
sb->s_blocksize_bits = 14; /* default 2**14 = CIFS_MAX_MSGSIZE */
inode = cifs_root_iget(sb, ROOT_I);
if (IS_ERR(inode)) {
rc = PTR_ERR(inode);
inode = NULL;
goto out_no_root;
}
sb->s_root = d_alloc_root(inode);
if (!sb->s_root) {
rc = -ENOMEM;
goto out_no_root;
}
#ifdef CONFIG_CIFS_EXPERIMENTAL
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
cFYI(1, "export ops supported");
sb->s_export_op = &cifs_export_ops;
}
#endif /* EXPERIMENTAL */
return 0;
out_no_root:
cERROR(1, "cifs_read_super: get root inode failed");
if (inode)
iput(inode);
cifs_umount(sb, cifs_sb);
out_mount_failed:
if (cifs_sb) {
#ifdef CONFIG_CIFS_DFS_UPCALL
if (cifs_sb->mountdata) {
kfree(cifs_sb->mountdata);
cifs_sb->mountdata = NULL;
}
#endif
unload_nls(cifs_sb->local_nls);
bdi_destroy(&cifs_sb->bdi);
//.........这里部分代码省略.........
开发者ID:virtuoso,项目名称:linux-2.6,代码行数:101,代码来源:cifsfs.c
示例12: bfs_read_super
static struct super_block * bfs_read_super(struct super_block * s,
void * data, int silent)
{
kdev_t dev;
struct buffer_head * bh;
struct bfs_super_block * bfs_sb;
struct inode * inode;
int i, imap_len;
dev = s->s_dev;
set_blocksize(dev, BFS_BSIZE);
s->s_blocksize = BFS_BSIZE;
s->s_blocksize_bits = BFS_BSIZE_BITS;
bh = sb_bread(s, 0);
if(!bh)
goto out;
bfs_sb = (struct bfs_super_block *)bh->b_data;
if (bfs_sb->s_magic != BFS_MAGIC) {
if (!silent)
printf("No BFS filesystem on %s (magic=%08x)\n",
bdevname(dev), bfs_sb->s_magic);
goto out;
}
if (BFS_UNCLEAN(bfs_sb, s) && !silent)
printf("%s is unclean, continuing\n", bdevname(dev));
s->s_magic = BFS_MAGIC;
s->su_bfs_sb = bfs_sb;
s->su_sbh = bh;
s->su_lasti = (bfs_sb->s_start - BFS_BSIZE)/sizeof(struct bfs_inode)
+ BFS_ROOT_INO - 1;
imap_len = s->su_lasti/8 + 1;
s->su_imap = kmalloc(imap_len, GFP_KERNEL);
if (!s->su_imap)
goto out;
memset(s->su_imap, 0, imap_len);
for (i=0; i<BFS_ROOT_INO; i++)
set_bit(i, s->su_imap);
s->s_op = &bfs_sops;
inode = iget(s, BFS_ROOT_INO);
if (!inode) {
kfree(s->su_imap);
goto out;
}
s->s_root = d_alloc_root(inode);
if (!s->s_root) {
iput(inode);
kfree(s->su_imap);
goto out;
}
s->su_blocks = (bfs_sb->s_end + 1)>>BFS_BSIZE_BITS; /* for statfs(2) */
s->su_freeb = (bfs_sb->s_end + 1 - bfs_sb->s_start)>>BFS_BSIZE_BITS;
s->su_freei = 0;
s->su_lf_eblk = 0;
s->su_lf_sblk = 0;
s->su_lf_ioff = 0;
for (i=BFS_ROOT_INO; i<=s->su_lasti; i++) {
inode = iget(s,i);
if (inode->iu_dsk_ino == 0)
s->su_freei++;
else {
set_bit(i, s->su_imap);
s->su_freeb -= inode->i_blocks;
if (inode->iu_eblock > s->su_lf_eblk) {
s->su_lf_eblk = inode->iu_eblock;
s->su_lf_sblk = inode->iu_sblock;
s->su_lf_ioff = BFS_INO2OFF(i);
}
}
iput(inode);
}
if (!(s->s_flags & MS_RDONLY)) {
mark_buffer_dirty(bh);
s->s_dirt = 1;
}
dump_imap("read_super", s);
return s;
out:
brelse(bh);
return NULL;
}
开发者ID:JBTech,项目名称:ralink_rt5350,代码行数:86,代码来源:inode.c
示例13: affs_fill_super
//.........这里部分代码省略.........
* when reading. As long as they aren't supported, writing is
* not recommended.
*/
if ((chksum == FS_DCFFS || chksum == MUFS_DCFFS || chksum == FS_DCOFS
|| chksum == MUFS_DCOFS) && !(sb->s_flags & MS_RDONLY)) {
printk(KERN_NOTICE "AFFS: Dircache FS - mounting %s read only\n",
sb->s_id);
sb->s_flags |= MS_RDONLY;
}
switch (chksum) {
case MUFS_FS:
case MUFS_INTLFFS:
case MUFS_DCFFS:
sbi->s_flags |= SF_MUFS;
/* fall thru */
case FS_INTLFFS:
case FS_DCFFS:
sbi->s_flags |= SF_INTL;
break;
case MUFS_FFS:
sbi->s_flags |= SF_MUFS;
break;
case FS_FFS:
break;
case MUFS_OFS:
sbi->s_flags |= SF_MUFS;
/* fall thru */
case FS_OFS:
sbi->s_flags |= SF_OFS;
sb->s_flags |= MS_NOEXEC;
break;
case MUFS_DCOFS:
case MUFS_INTLOFS:
sbi->s_flags |= SF_MUFS;
case FS_DCOFS:
case FS_INTLOFS:
sbi->s_flags |= SF_INTL | SF_OFS;
sb->s_flags |= MS_NOEXEC;
break;
default:
printk(KERN_ERR "AFFS: Unknown filesystem on device %s: %08X\n",
sb->s_id, chksum);
goto out_error;
}
if (mount_flags & SF_VERBOSE) {
u8 len = AFFS_ROOT_TAIL(sb, root_bh)->disk_name[0];
printk(KERN_NOTICE "AFFS: Mounting volume \"%.*s\": Type=%.3s\\%c, Blocksize=%d\n",
len > 31 ? 31 : len,
AFFS_ROOT_TAIL(sb, root_bh)->disk_name + 1,
sig, sig[3] + '0', blocksize);
}
sb->s_flags |= MS_NODEV | MS_NOSUID;
sbi->s_data_blksize = sb->s_blocksize;
if (sbi->s_flags & SF_OFS)
sbi->s_data_blksize -= 24;
/* Keep super block in cache */
sbi->s_root_bh = root_bh;
/* N.B. after this point s_root_bh must be released */
tmp_flags = sb->s_flags;
if (affs_init_bitmap(sb, &tmp_flags))
goto out_error;
sb->s_flags = tmp_flags;
/* set up enough so that it can read an inode */
root_inode = affs_iget(sb, root_block);
if (IS_ERR(root_inode)) {
ret = PTR_ERR(root_inode);
goto out_error_noinode;
}
sb->s_root = d_alloc_root(root_inode);
if (!sb->s_root) {
printk(KERN_ERR "AFFS: Get root inode failed\n");
goto out_error;
}
sb->s_root->d_op = &affs_dentry_operations;
pr_debug("AFFS: s_flags=%lX\n",sb->s_flags);
return 0;
/*
* Begin the cascaded cleanup ...
*/
out_error:
if (root_inode)
iput(root_inode);
out_error_noinode:
kfree(sbi->s_bitmap);
affs_brelse(root_bh);
kfree(sbi->s_prefix);
kfree(sbi);
sb->s_fs_info = NULL;
return ret;
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:101,代码来源:super.c
示例14: ntfs_read_super
/* Called to mount a filesystem by read_super() in fs/super.c
* Return a super block, the main structure of a filesystem
*
* NOTE : Don't store a pointer to an option, as the page containing the
* options is freed after ntfs_read_super() returns.
*
* NOTE : A context switch can happen in kernel code only if the code blocks
* (= calls schedule() in kernel/sched.c).
*/
struct super_block * ntfs_read_super(struct super_block *sb,
void *options, int silent)
{
ntfs_volume *vol;
struct buffer_head *bh;
int i;
ntfs_debug(DEBUG_OTHER, "ntfs_read_super\n");
#ifdef NTFS_IN_LINUX_KERNEL
vol = NTFS_SB2VOL(sb);
#else
if(!(vol = ntfs_malloc(sizeof(ntfs_volume))))
goto ntfs_read_super_dec;
NTFS_SB2VOL(sb)=vol;
#endif
if(!parse_options(vol,(char*)options))
goto ntfs_read_super_vol;
#if 0
/* Set to read only, user option might reset it */
sb->s_flags |= MS_RDONLY;
#endif
/* Assume a 512 bytes block device for now */
set_blocksize(sb->s_dev, 512);
/* Read the super block (boot block) */
if(!(bh=bread(sb->s_dev,0,512))) {
ntfs_error("Reading super block failed\n");
goto ntfs_read_super_unl;
}
ntfs_debug(DEBUG_OTHER, "Done reading boot block\n");
/* Check for 'NTFS' magic number */
if(!IS_NTFS_VOLUME(bh->b_data)){
ntfs_debug(DEBUG_OTHER, "Not a NTFS volume\n");
brelse(bh);
goto ntfs_read_super_unl;
}
ntfs_debug(DEBUG_OTHER, "Going to init volume\n");
ntfs_init_volume(vol,bh->b_data);
ntfs_debug(DEBUG_OTHER, "MFT record at cluster 0x%X\n",vol->mft_cluster);
brelse(bh);
NTFS_SB(vol)=sb;
ntfs_debug(DEBUG_OTHER, "Done to init volume\n");
/* Inform the kernel that a device block is a NTFS cluster */
sb->s_blocksize=vol->clustersize;
for(i=sb->s_blocksize,sb->s_blocksize_bits=0;i != 1;i>>=1)
sb->s_blocksize_bits++;
set_blocksize(sb->s_dev,sb->s_blocksize);
ntfs_debug(DEBUG_OTHER, "set_blocksize\n");
/* Allocate a MFT record (MFT record can be smaller than a cluster) */
if(!(vol->mft=ntfs_malloc(max(vol->mft_recordsize,vol->clustersize))))
goto ntfs_read_super_unl;
/* Read at least the MFT record for $MFT */
for(i=0;i<max(vol->mft_clusters_per_record,1);i++){
if(!(bh=bread(sb->s_dev,vol->mft_cluster+i,vol->clustersize))) {
ntfs_error("Could not read MFT record 0\n");
goto ntfs_read_super_mft;
}
ntfs_memcpy(vol->mft+i*vol->clustersize,bh->b_data,vol->clustersize);
brelse(bh);
ntfs_debug(DEBUG_OTHER, "Read cluster %x\n",vol->mft_cluster+i);
}
/* Check and fixup this MFT record */
if(!ntfs_check_mft_record(vol,vol->mft)){
ntfs_error("Invalid MFT record 0\n");
goto ntfs_read_super_mft;
}
/* Inform the kernel about which super operations are available */
sb->s_op = &ntfs_super_operations;
sb->s_magic = NTFS_SUPER_MAGIC;
ntfs_debug(DEBUG_OTHER, "Reading special files\n");
if(ntfs_load_special_files(vol)){
ntfs_error("Error loading special files\n");
goto ntfs_read_super_mft;
}
ntfs_debug(DEBUG_OTHER, "Getting RootDir\n");
/* Get the root directory */
if(!(sb->s_root=d_alloc_root(iget(sb,FILE_ROOT)))){
ntfs_error("Could not get root dir inode\n");
goto ntfs_read_super_mft;
//.........这里部分代码省略.........
开发者ID:dmgerman,项目名称:original,代码行数:101,代码来源:fs.c
示例15: v9fs_get_sb
static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data,
struct vfsmount *mnt)
{
struct super_block *sb = NULL;
struct v9fs_fcall *fcall = NULL;
struct inode *inode = NULL;
struct dentry *root = NULL;
struct v9fs_session_info *v9ses = NULL;
struct v9fs_fid *root_fid = NULL;
int mode = S_IRWXUGO | S_ISVTX;
uid_t uid = current->fsuid;
gid_t gid = current->fsgid;
int stat_result = 0;
int newfid = 0;
int retval = 0;
dprintk(DEBUG_VFS, " \n");
v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL);
if (!v9ses)
return -ENOMEM;
if ((newfid = v9fs_session_init(v9ses, dev_name, data)) < 0) {
dprintk(DEBUG_ERROR, "problem initiating session\n");
retval = newfid;
goto out_free_session;
}
sb = sget(fs_type, NULL, v9fs_set_super, v9ses);
if (IS_ERR(sb)) {
retval = PTR_ERR(sb);
goto out_close_session;
}
v9fs_fill_super(sb, v9ses, flags);
inode = v9fs_get_inode(sb, S_IFDIR | mode);
if (IS_ERR(inode)) {
retval = PTR_ERR(inode);
goto put_back_sb;
}
inode->i_uid = uid;
inode->i_gid = gid;
root = d_alloc_root(inode);
if (!root) {
retval = -ENOMEM;
goto put_back_sb;
}
sb->s_root = root;
stat_result = v9fs_t_stat(v9ses, newfid, &fcall);
if (stat_result < 0) {
dprintk(DEBUG_ERROR, "stat error\n");
v9fs_t_clunk(v9ses, newfid);
} else {
/* Setup the Root Inode */
root_fid = v9fs_fid_create(v9ses, newfid);
if (root_fid == NULL) {
retval = -ENOMEM;
goto put_back_sb;
}
retval = v9fs_fid_insert(root_fid, root);
if (retval < 0) {
kfree(fcall);
goto put_back_sb;
}
root_fid->qid = fcall->params.rstat.stat.qid;
root->d_inode->i_ino =
v9fs_qid2ino(&fcall->params.rstat.stat.qid);
v9fs_stat2inode(&fcall->params.rstat.stat, root->d_inode, sb);
}
kfree(fcall);
if (stat_result < 0) {
retval = stat_result;
goto put_back_sb;
}
return simple_set_mnt(mnt, sb);
out_close_session:
v9fs_session_close(v9ses);
out_free_session:
kfree(v9ses);
return retval;
put_back_sb:
/* deactivate_super calls v9fs_kill_super which will frees the rest */
up_write(&sb->s_umount);
deactivate_super(sb);
return retval;
}
开发者ID:FatSunHYS,项目名称:OSCourseDesign,代码行数:98,代码来源:vfs_super.c
示例16: qnx4_fill_super
static int qnx4_fill_super(struct super_block *s, void *data, int silent)
{
struct buffer_head *bh;
struct inode *root;
const char *errmsg;
struct qnx4_sb_info *qs;
int ret = -EINVAL;
qs = kzalloc(sizeof(struct qnx4_sb_info), GFP_KERNEL);
if (!qs)
return -ENOMEM;
s->s_fs_info = qs;
sb_set_blocksize(s, QNX4_BLOCK_SIZE);
/* 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("qnx4: unable to read the superblock\n");
goto outnobh;
}
if ( le32_to_cpup((__le32*) bh->b_data) != QNX4_SUPER_MAGIC ) {
if (!silent)
printk("qnx4: wrong fsid in superblock.\n");
goto out;
}
s->s_op = &qnx4_sops;
s->s_magic = QNX4_SUPER_MAGIC;
#ifndef CONFIG_QNX4FS_RW
s->s_flags |= MS_RDONLY; /* Yup, read-only yet */
#endif
qnx4_sb(s)->sb_buf = bh;
qnx4_sb(s)->sb = (struct qnx4_super_block *) bh->b_data;
/* check before allocating dentries, inodes, .. */
errmsg = qnx4_checkroot(s);
if (errmsg != NULL) {
if (!silent)
printk("qnx4: %s\n", errmsg);
goto out;
}
/* 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("qnx4: get inode failed\n");
ret = PTR_ERR(root);
goto out;
}
ret = -ENOMEM;
s->s_root = d_alloc_root(root);
if (s->s_root == NULL)
goto outi;
brelse(bh);
return 0;
outi:
iput(root);
out:
brelse(bh);
outnobh:
kfree(qs);
s->s_fs_info = NULL;
return ret;
}
开发者ID:Tigrouzen,项目名称:k1099,代码行数:71,代码来源:inode.c
示例17: efs_fill_super
static int efs_fill_super(struct super_block *s, void *d, int silent)
{
struct efs_sb_info *sb;
struct buffer_head *bh;
struct inode *root;
sb = kmalloc(sizeof(struct efs_sb_info), GFP_KERNEL);
if (!sb)
return -ENOMEM;
s->s_fs_info = sb;
memset(sb, 0, sizeof(struct efs_sb_info));
s->s_magic = EFS_SUPER_MAGIC;
if (!sb_set_blocksize(s, EFS_BLOCKSIZE)) {
printk(KERN_ERR "EFS: device does not support %d byte blocks\n",
EFS_BLOCKSIZE);
goto out_no_fs_ul;
}
/* read the vh (volume header) block */
bh = sb_bread(s, 0);
if (!bh) {
printk(KERN_ERR "EFS: cannot read volume header\n");
goto out_no_fs_ul;
}
/*
* if this returns zero then we didn't find any partition table.
* this isn't (yet) an error - just assume for the moment that
* the device is valid and go on to search for a superblock.
*/
sb->fs_start = efs_validate_vh((struct volume_header *) bh->b_data);
brelse(bh);
if (sb->fs_start == -1) {
goto out_no_fs_ul;
}
bh = sb_bread(s, sb->fs_start + EFS_SUPER);
if (!bh) {
printk(KERN_ERR "EFS: cannot read su
|
请发表评论