• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ BFS_SB函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中BFS_SB函数的典型用法代码示例。如果您正苦于以下问题:C++ BFS_SB函数的具体用法?C++ BFS_SB怎么用?C++ BFS_SB使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了BFS_SB函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: bfs_put_super

static void bfs_put_super(struct super_block *s)
{
	struct bfs_sb_info *info = BFS_SB(s);
	brelse(info->si_sbh);
	kfree(info->si_imap);
	kfree(info);
	s->s_fs_info = NULL;
}
开发者ID:Antonio-Zhou,项目名称:Linux-2.6.11,代码行数:8,代码来源:inode.c


示例2: bfs_write_super

static void bfs_write_super(struct super_block *s)
{
    lock_kernel();
    if (!(s->s_flags & MS_RDONLY))
        mark_buffer_dirty(BFS_SB(s)->si_sbh);
    s->s_dirt = 0;
    unlock_kernel();
}
开发者ID:Tigrouzen,项目名称:k1099,代码行数:8,代码来源:inode.c


示例3: bfs_delete_inode

static void bfs_delete_inode(struct inode *inode)
{
    unsigned long ino = inode->i_ino;
    struct bfs_inode *di;
    struct buffer_head *bh;
    int block, off;
    struct super_block *s = inode->i_sb;
    struct bfs_sb_info *info = BFS_SB(s);
    struct bfs_inode_info *bi = BFS_I(inode);

    dprintf("ino=%08lx\n", ino);

    truncate_inode_pages(&inode->i_data, 0);

    if ((ino < BFS_ROOT_INO) || (ino > info->si_lasti)) {
        printf("invalid ino=%08lx\n", ino);
        return;
    }

    inode->i_size = 0;
    inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
    lock_kernel();
    mark_inode_dirty(inode);

    block = (ino - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1;
    bh = sb_bread(s, block);
    if (!bh) {
        printf("Unable to read inode %s:%08lx\n",
               inode->i_sb->s_id, ino);
        unlock_kernel();
        return;
    }
    off = (ino - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK;
    di = (struct bfs_inode *)bh->b_data + off;
    memset((void *)di, 0, sizeof(struct bfs_inode));
    mark_buffer_dirty(bh);
    brelse(bh);

    if (bi->i_dsk_ino) {
        if (bi->i_sblock)
            info->si_freeb += bi->i_eblock + 1 - bi->i_sblock;
        info->si_freei++;
        clear_bit(ino, info->si_imap);
        dump_imap("delete_inode", s);
    }

    /*
     * If this was the last file, make the previous block
     * "last block of the last file" even if there is no
     * real file there, saves us 1 gap.
     */
    if (info->si_lf_eblk == bi->i_eblock) {
        info->si_lf_eblk = bi->i_sblock - 1;
        mark_buffer_dirty(info->si_sbh);
    }
    unlock_kernel();
    clear_inode(inode);
}
开发者ID:Tigrouzen,项目名称:k1099,代码行数:58,代码来源:inode.c


示例4: dump_imap

void dump_imap(const char *prefix, struct super_block * s)
{
#if 0
	int i;
	char *tmpbuf = (char *)get_zeroed_page(GFP_KERNEL);

	if (!tmpbuf)
		return;
	for (i=BFS_SB(s)->si_lasti; i>=0; i--) {
		if (i>PAGE_SIZE-100) break;
		if (test_bit(i, BFS_SB(s)->si_imap))
			strcat(tmpbuf, "1");
		else
			strcat(tmpbuf, "0");
	}
	printk(KERN_ERR "BFS-fs: %s: lasti=%08lx <%s>\n", prefix, BFS_SB(s)->si_lasti, tmpbuf);
	free_page((unsigned long)tmpbuf);
#endif
}
开发者ID:Antonio-Zhou,项目名称:Linux-2.6.11,代码行数:19,代码来源:inode.c


示例5: bfs_read_inode

static void bfs_read_inode(struct inode * inode)
{
	unsigned long ino = inode->i_ino;
	struct bfs_inode * di;
	struct buffer_head * bh;
	int block, off;

	if (ino < BFS_ROOT_INO || ino > BFS_SB(inode->i_sb)->si_lasti) {
		printf("Bad inode number %s:%08lx\n", inode->i_sb->s_id, ino);
		make_bad_inode(inode);
		return;
	}

	block = (ino - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1;
	bh = sb_bread(inode->i_sb, block);
	if (!bh) {
		printf("Unable to read inode %s:%08lx\n", inode->i_sb->s_id, ino);
		make_bad_inode(inode);
		return;
	}

	off = (ino - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK;
	di = (struct bfs_inode *)bh->b_data + off;

	inode->i_mode = 0x0000FFFF & di->i_mode;
	if (di->i_vtype == BFS_VDIR) {
		inode->i_mode |= S_IFDIR;
		inode->i_op = &bfs_dir_inops;
		inode->i_fop = &bfs_dir_operations;
	} else if (di->i_vtype == BFS_VREG) {
		inode->i_mode |= S_IFREG;
		inode->i_op = &bfs_file_inops;
		inode->i_fop = &bfs_file_operations;
		inode->i_mapping->a_ops = &bfs_aops;
	}

	inode->i_uid = di->i_uid;
	inode->i_gid = di->i_gid;
	inode->i_nlink = di->i_nlink;
	inode->i_size = BFS_FILESIZE(di);
	inode->i_blocks = BFS_FILEBLOCKS(di);
	inode->i_blksize = PAGE_SIZE;
	inode->i_atime.tv_sec = di->i_atime;
	inode->i_mtime.tv_sec = di->i_mtime;
	inode->i_ctime.tv_sec = di->i_ctime;
	inode->i_atime.tv_nsec = 0;
	inode->i_mtime.tv_nsec = 0;
	inode->i_ctime.tv_nsec = 0;
	BFS_I(inode)->i_dsk_ino = di->i_ino; /* can be 0 so we store a copy */
	BFS_I(inode)->i_sblock = di->i_sblock;
	BFS_I(inode)->i_eblock = di->i_eblock;

	brelse(bh);
}
开发者ID:Antonio-Zhou,项目名称:Linux-2.6.11,代码行数:54,代码来源:inode.c


示例6: bfs_put_super

static void bfs_put_super(struct super_block *s)
{
	struct bfs_sb_info *info = BFS_SB(s);

	if (!info)
		return;

	mutex_destroy(&info->bfs_lock);
	kfree(info);
	s->s_fs_info = NULL;
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:11,代码来源:inode.c


示例7: bfs_write_inode

static int bfs_write_inode(struct inode *inode, int unused)
{
    unsigned int ino = (u16)inode->i_ino;
    unsigned long i_sblock;
    struct bfs_inode *di;
    struct buffer_head *bh;
    int block, off;

    dprintf("ino=%08x\n", ino);

    if ((ino < BFS_ROOT_INO) || (ino > BFS_SB(inode->i_sb)->si_lasti)) {
        printf("Bad inode number %s:%08x\n", inode->i_sb->s_id, ino);
        return -EIO;
    }

    lock_kernel();
    block = (ino - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1;
    bh = sb_bread(inode->i_sb, block);
    if (!bh) {
        printf("Unable to read inode %s:%08x\n",
               inode->i_sb->s_id, ino);
        unlock_kernel();
        return -EIO;
    }

    off = (ino - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK;
    di = (struct bfs_inode *)bh->b_data + off;

    if (ino == BFS_ROOT_INO)
        di->i_vtype = cpu_to_le32(BFS_VDIR);
    else
        di->i_vtype = cpu_to_le32(BFS_VREG);

    di->i_ino = cpu_to_le16(ino);
    di->i_mode = cpu_to_le32(inode->i_mode);
    di->i_uid = cpu_to_le32(inode->i_uid);
    di->i_gid = cpu_to_le32(inode->i_gid);
    di->i_nlink = cpu_to_le32(inode->i_nlink);
    di->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
    di->i_mtime = cpu_to_le32(inode->i_mtime.tv_sec);
    di->i_ctime = cpu_to_le32(inode->i_ctime.tv_sec);
    i_sblock = BFS_I(inode)->i_sblock;
    di->i_sblock = cpu_to_le32(i_sblock);
    di->i_eblock = cpu_to_le32(BFS_I(inode)->i_eblock);
    di->i_eoffset = cpu_to_le32(i_sblock * BFS_BSIZE + inode->i_size - 1);

    mark_buffer_dirty(bh);
    brelse(bh);
    unlock_kernel();
    return 0;
}
开发者ID:Tigrouzen,项目名称:k1099,代码行数:51,代码来源:inode.c


示例8: bfs_delete_inode

static void bfs_delete_inode(struct inode * inode)
{
	unsigned long ino = inode->i_ino;
	struct bfs_inode * di;
	struct buffer_head * bh;
	int block, off;
	struct super_block * s = inode->i_sb;
	struct bfs_sb_info * info = BFS_SB(s);

	dprintf("ino=%08lx\n", inode->i_ino);

	if (inode->i_ino < BFS_ROOT_INO || inode->i_ino > info->si_lasti) {
		printf("invalid ino=%08lx\n", inode->i_ino);
		return;
	}
	
	inode->i_size = 0;
	inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
	lock_kernel();
	mark_inode_dirty(inode);
	block = (ino - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1;
	bh = sb_bread(s, block);
	if (!bh) {
		printf("Unable to read inode %s:%08lx\n", inode->i_sb->s_id, ino);
		unlock_kernel();
		return;
	}
	off = (ino - BFS_ROOT_INO)%BFS_INODES_PER_BLOCK;
	di = (struct bfs_inode *)bh->b_data + off;
	if (di->i_ino) {
		info->si_freeb += BFS_FILEBLOCKS(di);
		info->si_freei++;
		clear_bit(di->i_ino, info->si_imap);
		dump_imap("delete_inode", s);
	}
	di->i_ino = 0;
	di->i_sblock = 0;
	mark_buffer_dirty(bh);
	brelse(bh);

	/* if this was the last file, make the previous 
	   block "last files last block" even if there is no real file there,
	   saves us 1 gap */
	if (info->si_lf_eblk == BFS_I(inode)->i_eblock) {
		info->si_lf_eblk = BFS_I(inode)->i_sblock - 1;
		mark_buffer_dirty(info->si_sbh);
	}
	unlock_kernel();
	clear_inode(inode);
}
开发者ID:Antonio-Zhou,项目名称:Linux-2.6.11,代码行数:50,代码来源:inode.c


示例9: bfs_statfs

static int bfs_statfs(struct super_block *s, struct kstatfs *buf)
{
	struct bfs_sb_info *info = BFS_SB(s);
	u64 id = huge_encode_dev(s->s_bdev->bd_dev);
	buf->f_type = BFS_MAGIC;
	buf->f_bsize = s->s_blocksize;
	buf->f_blocks = info->si_blocks;
	buf->f_bfree = buf->f_bavail = info->si_freeb;
	buf->f_files = info->si_lasti + 1 - BFS_ROOT_INO;
	buf->f_ffree = info->si_freei;
	buf->f_fsid.val[0] = (u32)id;
	buf->f_fsid.val[1] = (u32)(id >> 32);
	buf->f_namelen = BFS_NAMELEN;
	return 0;
}
开发者ID:Antonio-Zhou,项目名称:Linux-2.6.11,代码行数:15,代码来源:inode.c



注:本文中的BFS_SB函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ BF_WriteByte函数代码示例发布时间:2022-05-30
下一篇:
C++ BFS函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap