Exemplo n.º 1
0
static struct dentry *jfs_lookup(struct inode *dip, struct dentry *dentry, struct nameidata *nd)
{
	struct btstack btstack;
	ino_t inum;
	struct inode *ip;
	struct component_name key;
	int rc;

	jfs_info("jfs_lookup: name = %s", dentry->d_name.name);

	if ((rc = get_UCSname(&key, dentry)))
		return ERR_PTR(rc);
	rc = dtSearch(dip, &key, &inum, &btstack, JFS_LOOKUP);
	free_UCSname(&key);
	if (rc == -ENOENT) {
		ip = NULL;
	} else if (rc) {
		jfs_err("jfs_lookup: dtSearch returned %d", rc);
		ip = ERR_PTR(rc);
	} else {
		ip = jfs_iget(dip->i_sb, inum);
		if (IS_ERR(ip))
			jfs_err("jfs_lookup: iget failed on inum %d", (uint)inum);
	}

	return d_splice_alias(ip, dentry);
}
Exemplo n.º 2
0
struct dentry *jfs_get_parent(struct dentry *dentry)
{
    unsigned long parent_ino;

    parent_ino =
        le32_to_cpu(JFS_IP(dentry->d_inode)->i_dtroot.header.idotdot);

    return d_obtain_alias(jfs_iget(dentry->d_inode->i_sb, parent_ino));
}
Exemplo n.º 3
0
static struct dentry *jfs_lookup(struct inode *dip, struct dentry *dentry, struct nameidata *nd)
{
	struct btstack btstack;
	ino_t inum;
	struct inode *ip;
	struct component_name key;
	const char *name = dentry->d_name.name;
	int len = dentry->d_name.len;
	int rc;

	jfs_info("jfs_lookup: name = %s", name);

	if (JFS_SBI(dip->i_sb)->mntflag & JFS_OS2)
		dentry->d_op = &jfs_ci_dentry_operations;

	if ((name[0] == '.') && (len == 1))
		inum = dip->i_ino;
	else if (strcmp(name, "..") == 0)
		inum = PARENT(dip);
	else {
		if ((rc = get_UCSname(&key, dentry)))
			return ERR_PTR(rc);
		rc = dtSearch(dip, &key, &inum, &btstack, JFS_LOOKUP);
		free_UCSname(&key);
		if (rc == -ENOENT) {
			d_add(dentry, NULL);
			return NULL;
		} else if (rc) {
			jfs_err("jfs_lookup: dtSearch returned %d", rc);
			return ERR_PTR(rc);
		}
	}

	ip = jfs_iget(dip->i_sb, inum);
	if (IS_ERR(ip)) {
		jfs_err("jfs_lookup: iget failed on inum %d", (uint) inum);
		return ERR_CAST(ip);
	}

	dentry = d_splice_alias(ip, dentry);

	if (dentry && (JFS_SBI(dip->i_sb)->mntflag & JFS_OS2))
		dentry->d_op = &jfs_ci_dentry_operations;

	return dentry;
}
Exemplo n.º 4
0
static struct inode *jfs_nfs_get_inode(struct super_block *sb,
                                       u64 ino, u32 generation)
{
    struct inode *inode;

    if (ino == 0)
        return ERR_PTR(-ESTALE);
    inode = jfs_iget(sb, ino);
    if (IS_ERR(inode))
        return ERR_CAST(inode);

    if (generation && inode->i_generation != generation) {
        iput(inode);
        return ERR_PTR(-ESTALE);
    }

    return inode;
}