• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ CODA_FTOC函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中CODA_FTOC函数的典型用法代码示例。如果您正苦于以下问题:C++ CODA_FTOC函数的具体用法?C++ CODA_FTOC怎么用?C++ CODA_FTOC使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了CODA_FTOC函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: coda_file_mmap

static int
coda_file_mmap(struct file *coda_file, struct vm_area_struct *vma)
{
    struct coda_file_info *cfi;
    struct coda_inode_info *cii;
    struct file *host_file;
    struct inode *coda_inode, *host_inode;

    cfi = CODA_FTOC(coda_file);
    BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
    host_file = cfi->cfi_container;

    if (!host_file->f_op || !host_file->f_op->mmap)
        return -ENODEV;

    coda_inode = coda_file->f_path.dentry->d_inode;
    host_inode = host_file->f_path.dentry->d_inode;
    coda_file->f_mapping = host_file->f_mapping;
    if (coda_inode->i_mapping == &coda_inode->i_data)
        coda_inode->i_mapping = host_inode->i_mapping;

    /* only allow additional mmaps as long as userspace isn't changing
     * the container file on us! */
    else if (coda_inode->i_mapping != host_inode->i_mapping)
        return -EBUSY;

    /* keep track of how often the coda_inode/host_file has been mmapped */
    cii = ITOC(coda_inode);
    cii->c_mapcount++;
    cfi->cfi_mapcount++;

    return host_file->f_op->mmap(host_file, vma);
}
开发者ID:antonywcl,项目名称:AR-5315u_PLD,代码行数:33,代码来源:file.c


示例2: coda_readdir

/* file operations for directories */
int coda_readdir(struct file *coda_file, void *dirent, filldir_t filldir)
{
	struct dentry *coda_dentry = coda_file->f_dentry;
	struct coda_file_info *cfi;
	struct file *host_file;
	int ret;

	cfi = CODA_FTOC(coda_file);
	if (!cfi || cfi->cfi_magic != CODA_MAGIC) BUG();
	host_file = cfi->cfi_container;

	coda_vfs_stat.readdir++;

	down(&host_file->f_dentry->d_inode->i_sem);
	host_file->f_pos = coda_file->f_pos;

	if ( !host_file->f_op->readdir ) {
		/* Venus: we must read Venus dirents from the file */
		ret = coda_venus_readdir(host_file, filldir, dirent, coda_dentry);
	} else {
		/* potemkin case: we were handed a directory inode */
		ret = vfs_readdir(host_file, filldir, dirent);
	}

	coda_file->f_pos = host_file->f_pos;
	up(&host_file->f_dentry->d_inode->i_sem);

	return ret;
}
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-e-f_fw-20-10-7-5,代码行数:30,代码来源:dir.c


示例3: coda_release

int coda_release(struct inode *coda_inode, struct file *coda_file)
{
	unsigned short flags = (coda_file->f_flags) & (~O_EXCL);
	unsigned short coda_flags = coda_flags_to_cflags(flags);
	struct coda_file_info *cfi;
	struct coda_inode_info *cii;
	struct inode *host_inode;
	int err;

	cfi = CODA_FTOC(coda_file);
	BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);

	err = venus_close(coda_inode->i_sb, coda_i2f(coda_inode),
			  coda_flags, coda_file->f_cred->fsuid);

	host_inode = cfi->cfi_container->f_path.dentry->d_inode;
	cii = ITOC(coda_inode);

	/* did we mmap this file? */
	spin_lock(&cii->c_lock);
	if (coda_inode->i_mapping == &host_inode->i_data) {
		cii->c_mapcount -= cfi->cfi_mapcount;
		if (!cii->c_mapcount)
			coda_inode->i_mapping = &coda_inode->i_data;
	}
	spin_unlock(&cii->c_lock);

	fput(cfi->cfi_container);
	kfree(coda_file->private_data);
	coda_file->private_data = NULL;

	/* VFS fput ignores the return value from file_operations->release, so
	 * there is no use returning an error here */
	return 0;
}
开发者ID:adis1313,项目名称:android_kernel_samsung_msm8974,代码行数:35,代码来源:file.c


示例4: coda_fsync

int coda_fsync(struct file *coda_file, struct dentry *coda_dentry, int datasync)
{
	struct file *host_file;
	struct dentry *host_dentry;
	struct inode *host_inode, *coda_inode = coda_dentry->d_inode;
	struct coda_file_info *cfi;
	int err = 0;

	if (!(S_ISREG(coda_inode->i_mode) || S_ISDIR(coda_inode->i_mode) ||
	      S_ISLNK(coda_inode->i_mode)))
		return -EINVAL;

	cfi = CODA_FTOC(coda_file);
	if (!cfi || cfi->cfi_magic != CODA_MAGIC) BUG();
	host_file = cfi->cfi_container;

	coda_vfs_stat.fsync++;

	if (host_file->f_op && host_file->f_op->fsync) {
		host_dentry = host_file->f_dentry;
		host_inode = host_dentry->d_inode;
		down(&host_inode->i_sem);
		err = host_file->f_op->fsync(host_file, host_dentry, datasync);
		up(&host_inode->i_sem);
	}

	if ( !err && !datasync ) {
		lock_kernel();
		err = venus_fsync(coda_inode->i_sb, coda_i2f(coda_inode));
		unlock_kernel();
	}

	return err;
}
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-e-f_fw-20-10-7-5,代码行数:34,代码来源:file.c


示例5: coda_file_write

static ssize_t
coda_file_write(struct file *coda_file, const char *buf, size_t count, loff_t *ppos)
{
	struct inode *coda_inode = coda_file->f_dentry->d_inode;
	struct coda_file_info *cfi;
	struct file *host_file;
	ssize_t ret;

	cfi = CODA_FTOC(coda_file);
	if (!cfi || cfi->cfi_magic != CODA_MAGIC) BUG();
	host_file = cfi->cfi_container;

	if (!host_file->f_op || !host_file->f_op->write)
		return -EINVAL;

	down(&coda_inode->i_sem);

	ret = host_file->f_op->write(host_file, buf, count, ppos);

	coda_inode->i_size = host_file->f_dentry->d_inode->i_size;
	coda_inode->i_blocks = (coda_inode->i_size + 511) >> 9;
	coda_inode->i_mtime = coda_inode->i_ctime = CURRENT_TIME;
	up(&coda_inode->i_sem);

	return ret;
}
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-e-f_fw-20-10-7-5,代码行数:26,代码来源:file.c


示例6: coda_fsync

int coda_fsync(struct file *coda_file, loff_t start, loff_t end, int datasync)
{
	struct file *host_file;
	struct inode *coda_inode = coda_file->f_path.dentry->d_inode;
	struct coda_file_info *cfi;
	int err;

	if (!(S_ISREG(coda_inode->i_mode) || S_ISDIR(coda_inode->i_mode) ||
	      S_ISLNK(coda_inode->i_mode)))
		return -EINVAL;

	err = filemap_write_and_wait_range(coda_inode->i_mapping, start, end);
	if (err)
		return err;
	mutex_lock(&coda_inode->i_mutex);

	cfi = CODA_FTOC(coda_file);
	BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
	host_file = cfi->cfi_container;

	err = vfs_fsync(host_file, datasync);
	if (!err && !datasync)
		err = venus_fsync(coda_inode->i_sb, coda_i2f(coda_inode));
	mutex_unlock(&coda_inode->i_mutex);

	return err;
}
开发者ID:adis1313,项目名称:android_kernel_samsung_msm8974,代码行数:27,代码来源:file.c


示例7: coda_file_write

static ssize_t
coda_file_write(struct file *coda_file, const char __user *buf, size_t count, loff_t *ppos)
{
    struct inode *host_inode, *coda_inode = coda_file->f_path.dentry->d_inode;
    struct coda_file_info *cfi;
    struct file *host_file;
    ssize_t ret;

    cfi = CODA_FTOC(coda_file);
    BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
    host_file = cfi->cfi_container;

    if (!host_file->f_op || !host_file->f_op->write)
        return -EINVAL;

    host_inode = host_file->f_path.dentry->d_inode;
    mutex_lock(&coda_inode->i_mutex);

    ret = host_file->f_op->write(host_file, buf, count, ppos);

    coda_inode->i_size = host_inode->i_size;
    coda_inode->i_blocks = (coda_inode->i_size + 511) >> 9;
    coda_inode->i_mtime = coda_inode->i_ctime = CURRENT_TIME_SEC;
    mutex_unlock(&coda_inode->i_mutex);

    return ret;
}
开发者ID:antonywcl,项目名称:AR-5315u_PLD,代码行数:27,代码来源:file.c


示例8: coda_readdir

static int coda_readdir(struct file *coda_file, void *buf, filldir_t filldir)
{
	struct coda_file_info *cfi;
	struct file *host_file;
	int ret;

	cfi = CODA_FTOC(coda_file);
	BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
	host_file = cfi->cfi_container;

	if (!host_file->f_op)
		return -ENOTDIR;

	if (host_file->f_op->readdir)
	{
		struct inode *host_inode = host_file->f_path.dentry->d_inode;

		mutex_lock(&host_inode->i_mutex);
		host_file->f_pos = coda_file->f_pos;

		ret = -ENOENT;
		if (!IS_DEADDIR(host_inode)) {
			ret = host_file->f_op->readdir(host_file, buf, filldir);
			file_accessed(host_file);
		}

		coda_file->f_pos = host_file->f_pos;
		mutex_unlock(&host_inode->i_mutex);
	}
	else 
		ret = coda_venus_readdir(coda_file, buf, filldir);

	return ret;
}
开发者ID:MiniBlu,项目名称:cm11_kernel_htc_msm8974a3ul,代码行数:34,代码来源:dir.c


示例9: coda_file_read_iter

static ssize_t
coda_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
{
	struct file *coda_file = iocb->ki_filp;
	struct coda_file_info *cfi = CODA_FTOC(coda_file);

	BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);

	return vfs_iter_read(cfi->cfi_container, to, &iocb->ki_pos);
}
开发者ID:AshishNamdev,项目名称:linux,代码行数:10,代码来源:file.c


示例10: coda_file_read

static ssize_t
coda_file_read(struct file *coda_file, char __user *buf, size_t count, loff_t *ppos)
{
    struct coda_file_info *cfi;
    struct file *host_file;

    cfi = CODA_FTOC(coda_file);
    BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
    host_file = cfi->cfi_container;

    if (!host_file->f_op || !host_file->f_op->read)
        return -EINVAL;

    return host_file->f_op->read(host_file, buf, count, ppos);
}
开发者ID:antonywcl,项目名称:AR-5315u_PLD,代码行数:15,代码来源:file.c


示例11: coda_file_sendfile

static ssize_t
coda_file_sendfile(struct file *coda_file, loff_t *ppos, size_t count,
		   read_actor_t actor, void *target)
{
	struct coda_file_info *cfi;
	struct file *host_file;

	cfi = CODA_FTOC(coda_file);
	BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
	host_file = cfi->cfi_container;

	if (!host_file->f_op || !host_file->f_op->sendfile)
		return -EINVAL;

	return host_file->f_op->sendfile(host_file, ppos, count, actor, target);
}
开发者ID:FatSunHYS,项目名称:OSCourseDesign,代码行数:16,代码来源:file.c


示例12: coda_file_splice_read

static ssize_t
coda_file_splice_read(struct file *coda_file, loff_t *ppos,
                      struct pipe_inode_info *pipe, size_t count,
                      unsigned int flags)
{
    struct coda_file_info *cfi;
    struct file *host_file;

    cfi = CODA_FTOC(coda_file);
    BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
    host_file = cfi->cfi_container;

    if (!host_file->f_op || !host_file->f_op->splice_read)
        return -EINVAL;

    return host_file->f_op->splice_read(host_file, ppos, pipe, count,flags);
}
开发者ID:antonywcl,项目名称:AR-5315u_PLD,代码行数:17,代码来源:file.c


示例13: coda_release

int coda_release(struct inode *coda_inode, struct file *coda_file)
{
	unsigned short flags = (coda_file->f_flags) & (~O_EXCL);
	unsigned short coda_flags = coda_flags_to_cflags(flags);
	struct coda_file_info *cfi;
	struct coda_inode_info *cii;
	struct inode *host_inode;
	int err = 0;

	lock_kernel();
	coda_vfs_stat.release++;
 
	if (!use_coda_close) {
		err = venus_release(coda_inode->i_sb, coda_i2f(coda_inode),
				    coda_flags);
		if (err == -EOPNOTSUPP) {
			use_coda_close = 1;
			err = 0;
		}
	}

	cfi = CODA_FTOC(coda_file);
	if (!cfi || cfi->cfi_magic != CODA_MAGIC) BUG();

	if (use_coda_close)
		err = venus_close(coda_inode->i_sb, coda_i2f(coda_inode),
				  coda_flags, &cfi->cfi_cred);

	host_inode = cfi->cfi_container->f_dentry->d_inode;
	cii = ITOC(coda_inode);

	/* did we mmap this file? */
	if (coda_inode->i_mapping == &host_inode->i_data) {
		cii->c_mapcount -= cfi->cfi_mapcount;
		if (!cii->c_mapcount)
			coda_inode->i_mapping = &coda_inode->i_data;
	}

	fput(cfi->cfi_container);

	kfree(coda_file->private_data);
	coda_file->private_data = NULL;

	unlock_kernel();
	return err;
}
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-e-f_fw-20-10-7-5,代码行数:46,代码来源:file.c


示例14: coda_flush

int coda_flush(struct file *coda_file, fl_owner_t id)
{
	unsigned short flags = coda_file->f_flags & ~O_EXCL;
	unsigned short coda_flags = coda_flags_to_cflags(flags);
	struct coda_file_info *cfi;
	struct inode *coda_inode;
	int err = 0, fcnt;

	lock_kernel();

	coda_vfs_stat.flush++;

	/* last close semantics */
	fcnt = file_count(coda_file);
	if (fcnt > 1)
		goto out;

	/* No need to make an upcall when we have not made any modifications
	 * to the file */
	if ((coda_file->f_flags & O_ACCMODE) == O_RDONLY)
		goto out;

	if (use_coda_close)
		goto out;

	cfi = CODA_FTOC(coda_file);
	BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);

	coda_inode = coda_file->f_dentry->d_inode;

	err = venus_store(coda_inode->i_sb, coda_i2f(coda_inode), coda_flags,
			  coda_file->f_uid);

	if (err == -EOPNOTSUPP) {
		use_coda_close = 1;
		err = 0;
	}

out:
	unlock_kernel();
	return err;
}
开发者ID:FatSunHYS,项目名称:OSCourseDesign,代码行数:42,代码来源:file.c


示例15: coda_file_splice_read

static ssize_t
coda_file_splice_read(struct file *coda_file, loff_t *ppos,
		      struct pipe_inode_info *pipe, size_t count,
		      unsigned int flags)
{
	ssize_t (*splice_read)(struct file *, loff_t *,
			       struct pipe_inode_info *, size_t, unsigned int);
	struct coda_file_info *cfi;
	struct file *host_file;

	cfi = CODA_FTOC(coda_file);
	BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
	host_file = cfi->cfi_container;

	splice_read = host_file->f_op->splice_read;
	if (!splice_read)
		splice_read = default_file_splice_read;

	return splice_read(host_file, ppos, pipe, count, flags);
}
开发者ID:adis1313,项目名称:android_kernel_samsung_msm8974,代码行数:20,代码来源:file.c


示例16: coda_readdir

/* file operations for directories */
int coda_readdir(struct file *coda_file, void *dirent, filldir_t filldir)
{
	struct dentry *coda_dentry = coda_file->f_path.dentry;
	struct coda_file_info *cfi;
	struct file *host_file;
	struct inode *host_inode;
	int ret;

	cfi = CODA_FTOC(coda_file);
	BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
	host_file = cfi->cfi_container;

	coda_vfs_stat.readdir++;

	host_inode = host_file->f_path.dentry->d_inode;
	mutex_lock(&host_inode->i_mutex);
	host_file->f_pos = coda_file->f_pos;

	if (!host_file->f_op->readdir) {
		/* Venus: we must read Venus dirents from the file */
		ret = coda_venus_readdir(host_file, filldir, dirent, coda_dentry);
	} else {
		/* potemkin case: we were handed a directory inode. */
		/* Yuk, we can't call vfs_readdir because we are already
		 * holding the inode semaphore. */
		ret = -ENOTDIR;
		if (!host_file->f_op || !host_file->f_op->readdir)
			goto out;

		ret = -ENOENT;
		if (!IS_DEADDIR(host_inode)) {
			ret = host_file->f_op->readdir(host_file, filldir, dirent);
			file_accessed(host_file);
		}
	}
out:
	coda_file->f_pos = host_file->f_pos;
	mutex_unlock(&host_inode->i_mutex);

	return ret;
}
开发者ID:Mr-Aloof,项目名称:wl500g,代码行数:42,代码来源:dir.c


示例17: coda_file_write_iter

static ssize_t
coda_file_write_iter(struct kiocb *iocb, struct iov_iter *to)
{
	struct file *coda_file = iocb->ki_filp;
	struct inode *coda_inode = file_inode(coda_file);
	struct coda_file_info *cfi = CODA_FTOC(coda_file);
	struct file *host_file;
	ssize_t ret;

	BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);

	host_file = cfi->cfi_container;
	file_start_write(host_file);
	inode_lock(coda_inode);
	ret = vfs_iter_write(cfi->cfi_container, to, &iocb->ki_pos);
	coda_inode->i_size = file_inode(host_file)->i_size;
	coda_inode->i_blocks = (coda_inode->i_size + 511) >> 9;
	coda_inode->i_mtime = coda_inode->i_ctime = current_time(coda_inode);
	inode_unlock(coda_inode);
	file_end_write(host_file);
	return ret;
}
开发者ID:AshishNamdev,项目名称:linux,代码行数:22,代码来源:file.c


示例18: coda_readdir

/* file operations for directories */
static int coda_readdir(struct file *coda_file, void *buf, filldir_t filldir)
{
	struct coda_file_info *cfi;
	struct file *host_file;
	int ret;

	cfi = CODA_FTOC(coda_file);
	BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
	host_file = cfi->cfi_container;

	if (!host_file->f_op)
		return -ENOTDIR;

	if (host_file->f_op->readdir)
	{
		/* potemkin case: we were handed a directory inode.
		 * We can't use vfs_readdir because we have to keep the file
		 * position in sync between the coda_file and the host_file.
		 * and as such we need grab the inode mutex. */
		struct inode *host_inode = host_file->f_path.dentry->d_inode;

		mutex_lock(&host_inode->i_mutex);
		host_file->f_pos = coda_file->f_pos;

		ret = -ENOENT;
		if (!IS_DEADDIR(host_inode)) {
			ret = host_file->f_op->readdir(host_file, buf, filldir);
			file_accessed(host_file);
		}

		coda_file->f_pos = host_file->f_pos;
		mutex_unlock(&host_inode->i_mutex);
	}
	else /* Venus: we must read Venus dirents from a file */
		ret = coda_venus_readdir(coda_file, buf, filldir);

	return ret;
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:39,代码来源:dir.c


示例19: coda_fsync

int coda_fsync(struct file *coda_file, struct dentry *coda_dentry, int datasync)
{
    struct file *host_file;
    struct inode *coda_inode = coda_dentry->d_inode;
    struct coda_file_info *cfi;
    int err = 0;

    if (!(S_ISREG(coda_inode->i_mode) || S_ISDIR(coda_inode->i_mode) ||
            S_ISLNK(coda_inode->i_mode)))
        return -EINVAL;

    cfi = CODA_FTOC(coda_file);
    BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
    host_file = cfi->cfi_container;

    err = vfs_fsync(host_file, host_file->f_path.dentry, datasync);
    if ( !err && !datasync ) {
        lock_kernel();
        err = venus_fsync(coda_inode->i_sb, coda_i2f(coda_inode));
        unlock_kernel();
    }

    return err;
}
开发者ID:antonywcl,项目名称:AR-5315u_PLD,代码行数:24,代码来源:file.c


示例20: coda_readdir

/* file operations for directories */
static int coda_readdir(struct file *coda_file, struct dir_context *ctx)
{
    struct coda_file_info *cfi;
    struct file *host_file;
    int ret;

    cfi = CODA_FTOC(coda_file);
    BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
    host_file = cfi->cfi_container;

    if (host_file->f_op->iterate) {
        struct inode *host_inode = file_inode(host_file);
        mutex_lock(&host_inode->i_mutex);
        ret = -ENOENT;
        if (!IS_DEADDIR(host_inode)) {
            ret = host_file->f_op->iterate(host_file, ctx);
            file_accessed(host_file);
        }
        mutex_unlock(&host_inode->i_mutex);
        return ret;
    }
    /* Venus: we must read Venus dirents from a file */
    return coda_venus_readdir(coda_file, ctx);
}
开发者ID:Nukil,项目名称:linux-2.6,代码行数:25,代码来源:dir.c



注:本文中的CODA_FTOC函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CODE函数代码示例发布时间:2022-05-30
下一篇:
C++ CNetAddr函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap