예제 #1
0
/* Intialize cache device info and fragment size for disk cache partition. */
int
osi_InitCacheInfo(char *aname)
{
    int code;
    extern afs_dcache_id_t cacheInode;
    struct dentry *dp;
    extern struct osi_dev cacheDev;
    extern afs_int32 afs_fsfragsize;
    extern struct super_block *afs_cacheSBp;
    extern struct vfsmount *afs_cacheMnt;
    code = osi_lookupname_internal(aname, 1, &afs_cacheMnt, &dp);
    if (code)
	return ENOENT;

    osi_get_fh(dp, &cacheInode.ufs);
    cacheDev.dev = dp->d_inode->i_sb->s_dev;
    afs_fsfragsize = dp->d_inode->i_sb->s_blocksize - 1;
    afs_cacheSBp = dp->d_inode->i_sb;

    dput(dp);

    afs_init_sb_export_ops(afs_cacheSBp);

    return 0;
}
예제 #2
0
파일: osi_misc.c 프로젝트: bagdxk/openafs
int osi_abspath(char *aname, char *buf, int buflen,
		int followlink, char **pathp)
{
    struct dentry *dp = NULL;
    struct vfsmount *mnt = NULL;
    char *name, *path;
    int code;

    name = afs_getname(aname);
    if (IS_ERR(name))
	return -PTR_ERR(name);
    code = osi_lookupname_internal(name, followlink, &mnt, &dp);
    if (!code) {
#if defined(D_PATH_TAKES_STRUCT_PATH)
	afs_linux_path_t p = { mnt, dp };
	path = d_path(&p, buf, buflen);
#else
	path = d_path(dp, mnt, buf, buflen);
#endif

	if (IS_ERR(path)) {
	    code = -PTR_ERR(path);
	} else {
	    *pathp = path;
	}

	dput(dp);
	mntput(mnt);
    }

    afs_putname(name);
    return code;
}
예제 #3
0
int
osi_lookupname(char *aname, uio_seg_t seg, int followlink,
               struct dentry **dpp)
{
    int code;
    char *tname;
    code = ENOENT;
    if (seg == AFS_UIOUSER) {
        tname = getname(aname);
        if (IS_ERR(tname))
            return PTR_ERR(tname);
    } else {
        tname = aname;
    }
    code = osi_lookupname_internal(tname, followlink, NULL, dpp);
    if (seg == AFS_UIOUSER) {
        putname(tname);
    }
    return code;
}
예제 #4
0
파일: osi_misc.c 프로젝트: bagdxk/openafs
int
osi_lookupname(char *aname, uio_seg_t seg, int followlink,
	       struct dentry **dpp)
{
    int code;
    char *name;

    if (seg == AFS_UIOUSER) {
	name = afs_getname(aname);
	if (IS_ERR(name))
	    return -PTR_ERR(name);
    } else {
	name = aname;
    }
    code = osi_lookupname_internal(name, followlink, NULL, dpp);
    if (seg == AFS_UIOUSER) {
	afs_putname(name);
    }
    return code;
}
예제 #5
0
/* Intialize cache device info and fragment size for disk cache partition. */
int
osi_InitCacheInfo(char *aname)
{
    int code;
#if defined(LINUX_USE_FH)
    int max_len = sizeof(struct fid);
#else
    extern ino_t cacheInode;
#endif
    struct dentry *dp;
    extern ino_t cacheInode;
    extern struct osi_dev cacheDev;
    extern afs_int32 afs_fsfragsize;
    extern struct super_block *afs_cacheSBp;
    extern struct vfsmount *afs_cacheMnt;
    code = osi_lookupname_internal(aname, 1, &afs_cacheMnt, &dp);
    if (code)
	return ENOENT;

#if defined(LINUX_USE_FH)
    if (dp->d_sb->s_export_op->encode_fh) {
	cacheitems_fh_type = dp->d_sb->s_export_op->encode_fh(dp, (__u32 *)&cacheitems_fh, &max_len, 0);
    } else {
        cacheitems_fh_type = FILEID_INO32_GEN;
	cacheitems_fh.i32.ino = dp->d_inode->i_ino;
        cacheitems_fh.i32.gen = dp->d_inode->i_generation;
    }
#else
    cacheInode = dp->d_inode->i_ino;
#endif
    cacheDev.dev = dp->d_inode->i_sb->s_dev;
    afs_fsfragsize = dp->d_inode->i_sb->s_blocksize - 1;
    afs_cacheSBp = dp->d_inode->i_sb;

    dput(dp);

    return 0;
}