/** * ecryptfs_threadfn * @ignored: ignored * * The eCryptfs kernel thread that has the responsibility of getting * the lower file with RW permissions. * * Returns zero on success; non-zero otherwise
*/ staticint ecryptfs_threadfn(void *ignored)
{
set_freezable(); while (1) { struct ecryptfs_open_req *req;
/** * ecryptfs_privileged_open * @lower_file: Result of dentry_open by root on lower dentry * @lower_dentry: Lower dentry for file to open * @lower_mnt: Lower vfsmount for file to open * @cred: credential to use for this call * * This function gets a r/w file opened against the lower dentry. * * Returns zero on success; non-zero otherwise
*/ int ecryptfs_privileged_open(struct file **lower_file, struct dentry *lower_dentry, struct vfsmount *lower_mnt, conststruct cred *cred)
{ struct ecryptfs_open_req req; int flags = O_LARGEFILE; int rc = 0;
/* Corresponding dput() and mntput() are done when the * lower file is fput() when all eCryptfs files for the inode are
* released. */
flags |= IS_RDONLY(d_inode(lower_dentry)) ? O_RDONLY : O_RDWR;
(*lower_file) = dentry_open(&req.path, flags, cred); if (!IS_ERR(*lower_file)) goto out; if ((flags & O_ACCMODE) == O_RDONLY) {
rc = PTR_ERR((*lower_file)); goto out;
}
mutex_lock(&ecryptfs_kthread_ctl.mux); if (ecryptfs_kthread_ctl.flags & ECRYPTFS_KTHREAD_ZOMBIE) {
rc = -EIO;
mutex_unlock(&ecryptfs_kthread_ctl.mux);
printk(KERN_ERR "%s: We are in the middle of shutting down; " "aborting privileged request to open lower file\n",
__func__); goto out;
}
list_add_tail(&req.kthread_ctl_list, &ecryptfs_kthread_ctl.req_list);
mutex_unlock(&ecryptfs_kthread_ctl.mux);
wake_up(&ecryptfs_kthread_ctl.wait);
wait_for_completion(&req.done); if (IS_ERR(*lower_file))
rc = PTR_ERR(*lower_file);
out: return rc;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.