Exemplo n.º 1
0
Arquivo: namei.c Projeto: Zkin/tux3
static int __tux3_mknod(struct inode *dir, struct dentry *dentry,
			struct tux_iattr *iattr, dev_t rdev)
{
	struct inode *inode;
	int err, is_dir = S_ISDIR(iattr->mode);

	if (!huge_valid_dev(rdev))
		return -EINVAL;

	if (is_dir && dir->i_nlink >= TUX_LINK_MAX)
		return -EMLINK;

	change_begin(tux_sb(dir->i_sb));
	inode = tux_create_inode(dir, iattr, rdev);
	err = PTR_ERR(inode);
	if (!IS_ERR(inode)) {
		err = tux_add_dirent(dir, dentry, inode);
		if (!err) {
			if (is_dir)
				inode_inc_link_count(dir);
			goto out;
		}
		clear_nlink(inode);
		tux3_mark_inode_dirty(inode);
		iput(inode);
	}
out:
	change_end(tux_sb(dir->i_sb));
	return err;
}
Exemplo n.º 2
0
Arquivo: namei.c Projeto: Zkin/tux3
static int __tux3_symlink(struct inode *dir, struct dentry *dentry,
			  struct tux_iattr *iattr, const char *symname)
{
	struct sb *sb = tux_sb(dir->i_sb);
	struct inode *inode;
	unsigned len = strlen(symname) + 1;
	int err;

	/* FIXME: We want more length? */
	if (len > PAGE_CACHE_SIZE)
		return -ENAMETOOLONG;

	change_begin(sb);
	inode = tux_create_inode(dir, iattr, 0);
	err = PTR_ERR(inode);
	if (!IS_ERR(inode)) {
		err = page_symlink(inode, symname, len);
		if (!err) {
			err = tux_add_dirent(dir, dentry, inode);
			if (!err)
				goto out;
		}
		inode_dec_link_count(inode);
		iput(inode);
	}
out:
	change_end(sb);

	return err;
}
Exemplo n.º 3
0
static int tux3_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
{
	struct inode *inode;
	int err;

	if (!huge_valid_dev(rdev))
		return -EINVAL;

	change_begin(tux_sb(dir->i_sb));
	inode = tux_create_inode(dir, mode, rdev);
	err = PTR_ERR(inode);
	if (!IS_ERR(inode)) {
		err = tux_add_dirent(dir, dentry, inode);
		if (!err) {
			if ((inode->i_mode & S_IFMT) == S_IFDIR)
				inode_inc_link_count(dir);
			goto out;
		}
		clear_nlink(inode);
		mark_inode_dirty(inode);
		iput(inode);
	}
out:
	change_end(tux_sb(dir->i_sb));
	return err;
}
Exemplo n.º 4
0
static int tux3_symlink(struct inode *dir, struct dentry *dentry,
			const char *symname)
{
	struct inode *inode;
	int err;

	change_begin(tux_sb(dir->i_sb));
	inode = tux_create_inode(dir, S_IFLNK | S_IRWXUGO, 0);
	err = PTR_ERR(inode);
	if (!IS_ERR(inode)) {
		err = page_symlink(inode, symname, strlen(symname) + 1);
		if (!err) {
			err = tux_add_dirent(dir, dentry, inode);
			if (!err)
				goto out;
		}
		inode_dec_link_count(inode);
		iput(inode);
	}
out:
	change_end(tux_sb(dir->i_sb));
	return err;
}
Exemplo n.º 5
0
static int __tux3_symlink(struct inode *dir, struct dentry *dentry,
			  struct tux_iattr *iattr, const char *symname)
{
	if(DEBUG_MODE_K==1)
	{
		printf("\t\t\t\t%25s[K]  %25s  %4d  #in\n",__FILE__,__func__,__LINE__);
	}
	struct sb *sb = tux_sb(dir->i_sb);
	struct inode *inode;
	unsigned len = strlen(symname) + 1;
	int err;

	/* FIXME: We want more length? */
	if (len > PAGE_CACHE_SIZE)
		return -ENAMETOOLONG;

	change_begin(sb);
	inode = tux_create_inode(dir, iattr, 0);
	err = PTR_ERR(inode);
	if (!IS_ERR(inode)) {
		err = page_symlink(inode, symname, len);
		if (!err) {
			err = tux_add_dirent(dir, dentry, inode);
			if (!err) {
				unlock_new_inode(inode);
				goto out;
			}
		}
		inode_dec_link_count(inode);
		unlock_new_inode(inode);
		iput(inode);
	}
out:
	change_end(sb);

	return err;
}
Exemplo n.º 6
0
static int __tux3_mknod(struct inode *dir, struct dentry *dentry,
			struct tux_iattr *iattr, dev_t rdev)
{
	if(DEBUG_MODE_K==1)
	{
		printf("\t\t\t\t%25s[K]  %25s  %4d  #in\n",__FILE__,__func__,__LINE__);
	}
	struct inode *inode;
	int err, is_dir = S_ISDIR(iattr->mode);

	if (!huge_valid_dev(rdev))
		return -EINVAL;

	if (is_dir && dir->i_nlink >= TUX_LINK_MAX)
		return -EMLINK;

	change_begin(tux_sb(dir->i_sb));
	inode = tux_create_inode(dir, iattr, rdev);
	err = PTR_ERR(inode);
	if (!IS_ERR(inode)) {
		err = tux_add_dirent(dir, dentry, inode);
		if (!err) {
			unlock_new_inode(inode);
			if (is_dir)
				inode_inc_link_count(dir);
			goto out;
		}
		clear_nlink(inode);
		tux3_mark_inode_dirty(inode);
		unlock_new_inode(inode);
		iput(inode);
	}
out:
	change_end(tux_sb(dir->i_sb));
	return err;
}