Пример #1
0
static int devpts_remount(struct super_block * sb, int * flags, char * data)
{
	struct devpts_sb_info *sbi = sb->u.generic_sbp;
	int res = devpts_parse_options(data,sbi);
	if (res) {
		printk("devpts: called with bogus options\n");
		return -EINVAL;
	}
	return 0;
}
Пример #2
0
struct super_block *devpts_read_super(struct super_block *s, void *data,
                                      int silent)
{
    struct inode * inode;
    struct devpts_sb_info *sbi;

    sbi = (struct devpts_sb_info *) kmalloc(sizeof(struct devpts_sb_info), GFP_KERNEL);
    if ( !sbi )
        goto fail;

    sbi->magic  = DEVPTS_SBI_MAGIC;
    sbi->max_ptys = unix98_max_ptys;
    sbi->inodes = kmalloc(sizeof(struct inode *) * sbi->max_ptys, GFP_KERNEL);
    if ( !sbi->inodes )
        goto fail_free;
    memset(sbi->inodes, 0, sizeof(struct inode *) * sbi->max_ptys);

    if ( devpts_parse_options(data,sbi) && !silent) {
        printk("devpts: called with bogus options\n");
        goto fail_inode;
    }

    inode = new_inode(s);
    if (!inode)
        goto fail_inode;
    inode->i_ino = 1;
    inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
    inode->i_blocks = 0;
    inode->i_blksize = 1024;
    inode->i_uid = inode->i_gid = 0;
    inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
    inode->i_op = &devpts_root_inode_operations;
    inode->i_fop = &devpts_root_operations;
    inode->i_nlink = 2;

    s->u.generic_sbp = (void *) sbi;
    s->s_blocksize = 1024;
    s->s_blocksize_bits = 10;
    s->s_magic = DEVPTS_SUPER_MAGIC;
    s->s_op = &devpts_sops;
    s->s_root = d_alloc_root(inode);
    if (s->s_root)
        return s;

    printk("devpts: get root dentry failed\n");
    iput(inode);
fail_inode:
    kfree(sbi->inodes);
fail_free:
    kfree(sbi);
fail:
    return NULL;
}