本文整理汇总了C++中d_splice_alias函数的典型用法代码示例。如果您正苦于以下问题:C++ d_splice_alias函数的具体用法?C++ d_splice_alias怎么用?C++ d_splice_alias使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了d_splice_alias函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: fuse_lock_inode
static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
unsigned int flags)
{
int err;
struct fuse_entry_out outarg;
struct inode *inode;
struct dentry *newent;
bool outarg_valid = true;
fuse_lock_inode(dir);
err = fuse_lookup_name(dir->i_sb, get_node_id(dir), &entry->d_name,
&outarg, &inode);
fuse_unlock_inode(dir);
if (err == -ENOENT) {
outarg_valid = false;
err = 0;
}
if (err)
goto out_err;
err = -EIO;
if (inode && get_node_id(inode) == FUSE_ROOT_ID)
goto out_iput;
newent = d_splice_alias(inode, entry);
err = PTR_ERR(newent);
if (IS_ERR(newent))
goto out_err;
entry = newent ? newent : entry;
if (outarg_valid)
fuse_change_entry_timeout(entry, &outarg);
else
fuse_invalidate_entry_cache(entry);
fuse_advise_use_readdirplus(dir);
return newent;
out_iput:
iput(inode);
out_err:
return ERR_PTR(err);
}
开发者ID:513855417,项目名称:linux,代码行数:43,代码来源:dir.c
示例2: min
/***** Get inode using directory and name */
static struct dentry *msdos_lookup(struct inode *dir, struct dentry *dentry,
struct nameidata *nd)
{
struct super_block *sb = dir->i_sb;
struct fat_slot_info sinfo;
struct inode *inode;
int err;
char szBuffer[20];
int len = min((int)dentry->d_name.len, 19);
memset(szBuffer, 0, 20);
__memcpy(szBuffer, dentry->d_name.name, len);
printk (KERN_INFO "myfat: msdos_lookup, dir is %s\n", szBuffer);
lock_super(sb);
err = msdos_find(dir, dentry->d_name.name, dentry->d_name.len, &sinfo);
if (err) {
if (err == -ENOENT) {
inode = NULL;
goto out;
}
goto error;
}
inode = fat_build_inode(sb, sinfo.de, sinfo.i_pos); // by rzq: hold the reference count
brelse(sinfo.bh);
if (IS_ERR(inode)) {
err = PTR_ERR(inode);
goto error;
}
out:
unlock_super(sb);
dentry->d_op = &msdos_dentry_operations;
dentry = d_splice_alias(inode, dentry);
if (dentry)
dentry->d_op = &msdos_dentry_operations;
return dentry;
error:
unlock_super(sb);
return ERR_PTR(err);
}
开发者ID:alex-ren,项目名称:ATS_LDD,代码行数:44,代码来源:msdos_inode.c
示例3: printk
/* access routines: lookup, readlink, permission */
static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, struct nameidata *nd)
{
struct inode *inode = NULL;
struct CodaFid resfid = { { 0, } };
int type = 0;
int error = 0;
const char *name = entry->d_name.name;
size_t length = entry->d_name.len;
if (length > CODA_MAXNAMLEN) {
printk(KERN_ERR "name too long: lookup, %s (%*s)\n",
coda_i2s(dir), (int)length, name);
return ERR_PTR(-ENAMETOOLONG);
}
/* control object, create inode on the fly */
if (coda_isroot(dir) && coda_iscontrol(name, length)) {
error = coda_cnode_makectl(&inode, dir->i_sb);
type = CODA_NOCACHE;
goto exit;
}
lock_kernel();
error = venus_lookup(dir->i_sb, coda_i2f(dir), name, length,
&type, &resfid);
if (!error)
error = coda_cnode_make(&inode, &resfid, dir->i_sb);
unlock_kernel();
if (error && error != -ENOENT)
return ERR_PTR(error);
exit:
entry->d_op = &coda_dentry_operations;
if (inode && (type & CODA_NOCACHE))
coda_flag_inode(inode, C_VATTR | C_PURGE);
return d_splice_alias(inode, entry);
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:43,代码来源:dir.c
示例4: ospfs_dir_lookup
static struct dentry *
ospfs_dir_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *ignore)
{
// Find the OSPFS inode corresponding to 'dir'
ospfs_inode_t *dir_oi = ospfs_inode(dir->i_ino);
struct inode *entry_inode = NULL;
int entry_off;
// Make sure filename is not too long
if (dentry->d_name.len > OSPFS_MAXNAMELEN)
return (struct dentry *) ERR_PTR(-ENAMETOOLONG);
// Mark with our operations
dentry->d_op = &ospfs_dentry_ops;
// Search through the directory block
for (entry_off = 0; entry_off < dir_oi->oi_size;
entry_off += OSPFS_DIRENTRY_SIZE) {
// Find the OSPFS inode for the entry
ospfs_direntry_t *od = ospfs_inode_data(dir_oi, entry_off);
// Set 'entry_inode' if we find the file we are looking for
if (od->od_ino > 0
&& strlen(od->od_name) == dentry->d_name.len
&& memcmp(od->od_name, dentry->d_name.name, dentry->d_name.len) == 0) {
entry_inode = ospfs_mk_linux_inode(dir->i_sb, od->od_ino);
if (!entry_inode)
return (struct dentry *) ERR_PTR(-EINVAL);
break;
}
}
// We return a dentry whether or not the file existed.
// The file exists if and only if 'entry_inode != NULL'.
// If the file doesn't exist, the dentry is called a "negative dentry".
// d_splice_alias() attaches the inode to the dentry.
// If it returns a new dentry, we need to set its operations.
if ((dentry = d_splice_alias(entry_inode, dentry)))
dentry->d_op = &ospfs_dentry_ops;
return dentry;
}
开发者ID:wenlongx,项目名称:UCLA_CS,代码行数:42,代码来源:ospfsmod_freeblock.c
示例5: ERR_PTR
static struct dentry *hmfs_lookup(struct inode *dir, struct dentry *dentry,
unsigned int flags)
{
struct inode *inode = NULL;
struct hmfs_dir_entry *de;
if (dentry->d_name.len > HMFS_NAME_LEN)
return ERR_PTR(-ENAMETOOLONG);
inode_read_lock(dir);
de = hmfs_find_entry(dir, &dentry->d_name, NULL, NULL);
inode_read_unlock(dir);
if (de) {
inode = hmfs_iget(dir->i_sb, de->ino);
if (IS_ERR(inode))
return ERR_CAST(inode);
}
return d_splice_alias(inode, dentry);
}
开发者ID:timemath,项目名称:hmfs,代码行数:20,代码来源:namei.c
示例6: tux_find_dirent
static struct dentry *tux3_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
{
struct buffer_head *buffer;
struct inode *inode;
tux_dirent *entry;
entry = tux_find_dirent(dir, dentry->d_name.name, dentry->d_name.len, &buffer);
if (IS_ERR(entry)) {
if (PTR_ERR(entry) != -ENOENT)
return ERR_PTR(PTR_ERR(entry));
inode = NULL;
goto out;
}
inode = tux3_iget(dir->i_sb, from_be_u64(entry->inum));
brelse(buffer);
if (IS_ERR(inode))
return ERR_PTR(PTR_ERR(inode));
out:
return d_splice_alias(inode, dentry);
}
开发者ID:CSRedRat,项目名称:tux3,代码行数:20,代码来源:namei.c
示例7: D1
/* We keep the dirent list sorted in increasing order of name hash,
and we use the same hash function as the dentries. Makes this
nice and simple
*/
static struct dentry *jffs2_lookup(struct inode *dir_i, struct dentry *target,
struct nameidata *nd)
{
struct jffs2_inode_info *dir_f;
struct jffs2_sb_info *c;
struct jffs2_full_dirent *fd = NULL, *fd_list;
uint32_t ino = 0;
struct inode *inode = NULL;
D1(printk(KERN_DEBUG "jffs2_lookup()\n"));
if (target->d_name.len > JFFS2_MAX_NAME_LEN)
return ERR_PTR(-ENAMETOOLONG);
dir_f = JFFS2_INODE_INFO(dir_i);
c = JFFS2_SB_INFO(dir_i->i_sb);
mutex_lock(&dir_f->sem);
/* NB: The 2.2 backport will need to explicitly check for '.' and '..' here */
for (fd_list = dir_f->dents; fd_list && fd_list->nhash <= target->d_name.hash; fd_list = fd_list->next) {
if (fd_list->nhash == target->d_name.hash &&
(!fd || fd_list->version > fd->version) &&
strlen(fd_list->name) == target->d_name.len &&
!strncmp(fd_list->name, target->d_name.name, target->d_name.len)) {
fd = fd_list;
}
}
if (fd)
ino = fd->ino;
mutex_unlock(&dir_f->sem);
if (ino) {
inode = jffs2_iget(dir_i->i_sb, ino);
if (IS_ERR(inode)) {
printk(KERN_WARNING "iget() failed for ino #%u\n", ino);
return ERR_CAST(inode);
}
}
return d_splice_alias(inode, target);
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:45,代码来源:dir.c
示例8: jffs2_dbg
/* We keep the dirent list sorted in increasing order of name hash,
and we use the same hash function as the dentries. Makes this
nice and simple
*/
static struct dentry *jffs2_lookup(struct inode *dir_i, struct dentry *target,
unsigned int flags)
{
struct jffs2_inode_info *dir_f;
struct jffs2_full_dirent *fd = NULL, *fd_list;
uint32_t ino = 0;
struct inode *inode = NULL;
unsigned int nhash;
jffs2_dbg(1, "jffs2_lookup()\n");
if (target->d_name.len > JFFS2_MAX_NAME_LEN)
return ERR_PTR(-ENAMETOOLONG);
dir_f = JFFS2_INODE_INFO(dir_i);
/* The 'nhash' on the fd_list is not the same as the dentry hash */
nhash = full_name_hash(NULL, target->d_name.name, target->d_name.len);
mutex_lock(&dir_f->sem);
/* NB: The 2.2 backport will need to explicitly check for '.' and '..' here */
for (fd_list = dir_f->dents; fd_list && fd_list->nhash <= nhash; fd_list = fd_list->next) {
if (fd_list->nhash == nhash &&
(!fd || fd_list->version > fd->version) &&
strlen(fd_list->name) == target->d_name.len &&
!strncmp(fd_list->name, target->d_name.name, target->d_name.len)) {
fd = fd_list;
}
}
if (fd)
ino = fd->ino;
mutex_unlock(&dir_f->sem);
if (ino) {
inode = jffs2_iget(dir_i->i_sb, ino);
if (IS_ERR(inode))
pr_warn("iget() failed for ino #%u\n", ino);
}
return d_splice_alias(inode, target);
}
开发者ID:robeat101,项目名称:linux,代码行数:45,代码来源:dir.c
示例9: ERR_PTR
static struct dentry *ext2_lookup(struct inode * dir, struct dentry *dentry, unsigned int flags)
{
struct inode * inode;
ino_t ino;
if (dentry->d_name.len > EXT2_NAME_LEN)
return ERR_PTR(-ENAMETOOLONG);
ino = ext2_inode_by_name(dir, &dentry->d_name);
inode = NULL;
if (ino) {
inode = ext2_iget(dir->i_sb, ino);
if (inode == ERR_PTR(-ESTALE)) {
ext2_error(dir->i_sb, __func__,
"deleted inode referenced: %lu",
(unsigned long) ino);
return ERR_PTR(-EIO);
}
}
return d_splice_alias(inode, dentry);
}
开发者ID:RealJohnGalt,项目名称:linux,代码行数:21,代码来源:namei.c
示例10: INITIALIZE_PATH
static struct dentry *reiserfs_lookup(struct inode *dir, struct dentry *dentry,
unsigned int flags)
{
int retval;
struct inode *inode = NULL;
struct reiserfs_dir_entry de;
INITIALIZE_PATH(path_to_entry);
if (REISERFS_MAX_NAME(dir->i_sb->s_blocksize) < dentry->d_name.len)
return ERR_PTR(-ENAMETOOLONG);
reiserfs_write_lock(dir->i_sb);
de.de_gen_number_bit_string = NULL;
retval =
reiserfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len,
&path_to_entry, &de);
pathrelse(&path_to_entry);
if (retval == NAME_FOUND) {
inode = reiserfs_iget(dir->i_sb,
(struct cpu_key *)&de.de_dir_id);
if (!inode || IS_ERR(inode)) {
reiserfs_write_unlock(dir->i_sb);
return ERR_PTR(-EACCES);
}
/*
* Propagate the private flag so we know we're
* in the priv tree
*/
if (IS_PRIVATE(dir))
inode->i_flags |= S_PRIVATE;
}
reiserfs_write_unlock(dir->i_sb);
if (retval == IO_ERROR) {
return ERR_PTR(-EIO);
}
return d_splice_alias(inode, dentry);
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:40,代码来源:namei.c
示例11: xfs_vn_lookup
STATIC struct dentry *
xfs_vn_lookup(
struct inode *dir,
struct dentry *dentry,
struct nameidata *nd)
{
bhv_vnode_t *cvp;
int error;
if (dentry->d_name.len >= MAXNAMELEN)
return ERR_PTR(-ENAMETOOLONG);
error = xfs_lookup(XFS_I(dir), dentry, &cvp);
if (unlikely(error)) {
if (unlikely(error != ENOENT))
return ERR_PTR(-error);
d_add(dentry, NULL);
return NULL;
}
return d_splice_alias(vn_to_inode(cvp), dentry);
}
开发者ID:Tigrouzen,项目名称:k1099,代码行数:22,代码来源:xfs_iops.c
示例12: tux_find_dirent
static struct dentry *tux3_lookup(struct inode *dir, struct dentry *dentry,
unsigned int flags)
{
struct buffer_head *buffer;
struct inode *inode;
tux_dirent *entry;
inum_t inum;
entry = tux_find_dirent(dir, &dentry->d_name, &buffer);
if (IS_ERR(entry)) {
if (PTR_ERR(entry) != -ENOENT)
return ERR_CAST(entry);
inode = NULL;
goto out;
}
inum = be64_to_cpu(entry->inum);
blockput(buffer);
inode = tux3_iget(tux_sb(dir->i_sb), inum);
out:
return d_splice_alias(inode, dentry);
}
开发者ID:Zkin,项目名称:tux3,代码行数:22,代码来源:namei.c
示例13: linvfs_lookup
STATIC struct dentry *
linvfs_lookup(
struct inode *dir,
struct dentry *dentry,
struct nameidata *nd)
{
struct vnode *vp = LINVFS_GET_VP(dir), *cvp;
int error;
if (dentry->d_name.len >= MAXNAMELEN)
return ERR_PTR(-ENAMETOOLONG);
VOP_LOOKUP(vp, dentry, &cvp, 0, NULL, NULL, error);
if (error) {
if (unlikely(error != ENOENT))
return ERR_PTR(-error);
d_add(dentry, NULL);
return NULL;
}
return d_splice_alias(LINVFS_GET_IP(cvp), dentry);
}
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-e-f_fw-20-10-7-5,代码行数:22,代码来源:xfs_iops.c
示例14: xfs_vn_ci_lookup
STATIC struct dentry *
xfs_vn_ci_lookup(
struct inode *dir,
struct dentry *dentry,
struct nameidata *nd)
{
struct xfs_inode *ip;
struct xfs_name xname;
struct xfs_name ci_name;
struct qstr dname;
int error;
if (dentry->d_name.len >= MAXNAMELEN)
return ERR_PTR(-ENAMETOOLONG);
xfs_dentry_to_name(&xname, dentry);
error = xfs_lookup(XFS_I(dir), &xname, &ip, &ci_name);
if (unlikely(error)) {
if (unlikely(error != ENOENT))
return ERR_PTR(-error);
/*
* call d_add(dentry, NULL) here when d_drop_negative_children
* is called in xfs_vn_mknod (ie. allow negative dentries
* with CI filesystems).
*/
return NULL;
}
/* if exact match, just splice and exit */
if (!ci_name.name)
return d_splice_alias(VFS_I(ip), dentry);
/* else case-insensitive match... */
dname.name = ci_name.name;
dname.len = ci_name.len;
dentry = d_add_ci(dentry, VFS_I(ip), &dname);
kmem_free(ci_name.name);
return dentry;
}
开发者ID:Stefan-Schmidt,项目名称:linux-2.6,代码行数:39,代码来源:xfs_iops.c
示例15: mutex_lock
static struct dentry *kernfs_iop_lookup(struct inode *dir,
struct dentry *dentry,
unsigned int flags)
{
struct dentry *ret;
struct kernfs_node *parent = dentry->d_parent->d_fsdata;
struct kernfs_node *kn;
struct inode *inode;
const void *ns = NULL;
mutex_lock(&kernfs_mutex);
if (kernfs_ns_enabled(parent))
ns = kernfs_info(dir->i_sb)->ns;
kn = kernfs_find_ns(parent, dentry->d_name.name, ns);
/* no such entry */
if (!kn || !kernfs_active(kn)) {
ret = NULL;
goto out_unlock;
}
kernfs_get(kn);
dentry->d_fsdata = kn;
/* attach dentry and inode */
inode = kernfs_get_inode(dir->i_sb, kn);
if (!inode) {
ret = ERR_PTR(-ENOMEM);
goto out_unlock;
}
/* instantiate and hash dentry */
ret = d_splice_alias(inode, dentry);
out_unlock:
mutex_unlock(&kernfs_mutex);
return ret;
}
开发者ID:andy-shev,项目名称:linux,代码行数:38,代码来源:dir.c
示例16: jfs_info
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 ((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);
}
return d_splice_alias(ip, dentry);
}
开发者ID:Berrrry,项目名称:SPH-L710_NA_Kernel,代码行数:38,代码来源:namei.c
示例17: gfs2_lookupi
static struct dentry *__gfs2_lookup(struct inode *dir, struct dentry *dentry,
struct file *file, int *opened)
{
struct inode *inode;
struct dentry *d;
struct gfs2_holder gh;
struct gfs2_glock *gl;
int error;
inode = gfs2_lookupi(dir, &dentry->d_name, 0);
if (!inode)
return NULL;
if (IS_ERR(inode))
return ERR_CAST(inode);
gl = GFS2_I(inode)->i_gl;
error = gfs2_glock_nq_init(gl, LM_ST_SHARED, LM_FLAG_ANY, &gh);
if (error) {
iput(inode);
return ERR_PTR(error);
}
d = d_splice_alias(inode, dentry);
if (IS_ERR(d)) {
iput(inode);
gfs2_glock_dq_uninit(&gh);
return d;
}
if (file && S_ISREG(inode->i_mode))
error = finish_open(file, dentry, gfs2_open_common, opened);
gfs2_glock_dq_uninit(&gh);
if (error) {
dput(d);
return ERR_PTR(error);
}
return d;
}
开发者ID:stevenvo,项目名称:cs500-build-rpi,代码行数:38,代码来源:inode.c
示例18: ERR_PTR
static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry,
unsigned int flags)
{
struct inode *inode = NULL;
struct f2fs_dir_entry *de;
struct page *page;
if (dentry->d_name.len > F2FS_NAME_LEN)
return ERR_PTR(-ENAMETOOLONG);
de = f2fs_find_entry(dir, &dentry->d_name, &page);
if (de) {
nid_t ino = le32_to_cpu(de->ino);
f2fs_dentry_kunmap(dir, page);
f2fs_put_page(page, 0);
inode = f2fs_iget(dir->i_sb, ino);
if (IS_ERR(inode))
return ERR_CAST(inode);
}
return d_splice_alias(inode, dentry);
}
开发者ID:383530895,项目名称:linux,代码行数:23,代码来源:namei.c
示例19: lock_super
/***** Get inode using directory and name */
static struct dentry *msdos_lookup(struct inode *dir, struct dentry *dentry,
struct nameidata *nd)
{
struct super_block *sb = dir->i_sb;
struct fat_slot_info sinfo;
struct inode *inode;
int err;
lock_super(sb);
err = msdos_find(dir, dentry->d_name.name, dentry->d_name.len, &sinfo);
if (err) {
if (err == -ENOENT) {
inode = NULL;
goto out;
}
goto error;
}
inode = fat_build_inode(sb, sinfo.de, sinfo.i_pos);
brelse(sinfo.bh);
if (IS_ERR(inode)) {
err = PTR_ERR(inode);
goto error;
}
out:
unlock_super(sb);
dentry->d_op = &msdos_dentry_operations;
dentry = d_splice_alias(inode, dentry);
if (dentry)
dentry->d_op = &msdos_dentry_operations;
return dentry;
error:
unlock_super(sb);
return ERR_PTR(err);
}
开发者ID:emreharbutoglu,项目名称:Xperia-X10-Kernel-2.6.29,代码行数:38,代码来源:namei_msdos.c
示例20: mutex_lock
/***** Get inode using directory and name */
static struct dentry *vxext_lookup(struct inode *dir, struct dentry *dentry,
unsigned int flags)
{
struct super_block *sb = dir->i_sb;
struct fat_slot_info sinfo;
struct inode *inode;
int err;
mutex_lock(&MSDOS_SB(sb)->s_lock);
err = vxext_find(dir, dentry->d_name.name, dentry->d_name.len, &sinfo);
switch (err) {
case -ENOENT:
inode = NULL;
break;
case 0:
inode = fat_build_inode(sb, sinfo.de, sinfo.i_pos);
brelse(sinfo.bh);
break;
default:
inode = ERR_PTR(err);
}
mutex_unlock(&MSDOS_SB(sb)->s_lock);
return d_splice_alias(inode, dentry);
}
开发者ID:jens-maus,项目名称:vxext_fs,代码行数:25,代码来源:vxext.c
注:本文中的d_splice_alias函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论