Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1472519 > unrolled thread
| Started by | Oleg Nesterov <oleg@redhat.com> |
|---|---|
| First post | 2016-08-30 16:40 +0200 |
| Last post | 2016-09-03 02:20 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [RFC 1/3] x86/vdso: create vdso file, use it for mapping Oleg Nesterov <oleg@redhat.com> - 2016-08-30 16:40 +0200
Re: [RFC 1/3] x86/vdso: create vdso file, use it for mapping Dmitry Safonov <0x7f454c46@gmail.com> - 2016-08-30 17:00 +0200
Re: [RFC 1/3] x86/vdso: create vdso file, use it for mapping Al Viro <viro@ZenIV.linux.org.uk> - 2016-09-03 02:20 +0200
| From | Oleg Nesterov <oleg@redhat.com> |
|---|---|
| Date | 2016-08-30 16:40 +0200 |
| Subject | Re: [RFC 1/3] x86/vdso: create vdso file, use it for mapping |
| Message-ID | <sbSmJ-67O-3@gated-at.bofh.it> |
On 08/25, Dmitry Safonov wrote:
>
> +static __init struct file *init_vdso_file(const struct vdso_image *vdso_image,
> + const char *name)
> +{
> + struct super_block *sb;
> + struct qstr name_str;
> + struct inode *inode;
> + struct path path;
> + struct file *res;
> +
> + if (IS_ERR(vdso_mnt))
> + return ERR_CAST(vdso_mnt);
> + sb = vdso_mnt->mnt_sb;
> +
> + name_str.hash = 0;
> + name_str.len = strlen(name);
> + name_str.name = name;
> +
> + res = ERR_PTR(-ENOMEM);
> + path.mnt = mntget(vdso_mnt);
> + path.dentry = d_alloc_pseudo(sb, &name_str);
> + if (!path.dentry)
> + goto put_path;
> + d_set_d_op(path.dentry, &vdso_dops);
> +
> + res = ERR_PTR(-ENOSPC);
> + inode = ramfs_get_inode(sb, NULL, S_IFREG | S_IRUGO | S_IXUGO, 0);
> + if (!inode)
> + goto put_path;
> +
> + inode->i_flags |= S_PRIVATE;
> + d_instantiate(path.dentry, inode);
> + inode->i_size = vdso_image->size;
> +
> + res = ERR_PTR(add_vdso_pages_to_page_cache(vdso_image, inode));
> + if (IS_ERR(res))
> + goto put_path;
> +
> + res = alloc_file(&path, FMODE_READ, &ramfs_file_operations);
> + if (!IS_ERR(res))
> + return res;
> +
> +put_path:
> + path_put(&path);
> + return res;
> +}
Not sure... I think alloc_anon_inode() makes more sense.
Perhaps you can look at fs/aio.c and extract some bits of code into
the new helpers which could be used by both aio_fs and vdso_fs?
Oleg.
[toc] | [next] | [standalone]
| From | Dmitry Safonov <0x7f454c46@gmail.com> |
|---|---|
| Date | 2016-08-30 17:00 +0200 |
| Message-ID | <sbSG5-6ew-9@gated-at.bofh.it> |
| In reply to | #1472519 |
2016-08-30 17:33 GMT+03:00 Oleg Nesterov <oleg@redhat.com>:
> On 08/25, Dmitry Safonov wrote:
>>
>> +static __init struct file *init_vdso_file(const struct vdso_image *vdso_image,
>> + const char *name)
>> +{
>> + struct super_block *sb;
>> + struct qstr name_str;
>> + struct inode *inode;
>> + struct path path;
>> + struct file *res;
>> +
>> + if (IS_ERR(vdso_mnt))
>> + return ERR_CAST(vdso_mnt);
>> + sb = vdso_mnt->mnt_sb;
>> +
>> + name_str.hash = 0;
>> + name_str.len = strlen(name);
>> + name_str.name = name;
>> +
>> + res = ERR_PTR(-ENOMEM);
>> + path.mnt = mntget(vdso_mnt);
>> + path.dentry = d_alloc_pseudo(sb, &name_str);
>> + if (!path.dentry)
>> + goto put_path;
>> + d_set_d_op(path.dentry, &vdso_dops);
>> +
>> + res = ERR_PTR(-ENOSPC);
>> + inode = ramfs_get_inode(sb, NULL, S_IFREG | S_IRUGO | S_IXUGO, 0);
>> + if (!inode)
>> + goto put_path;
>> +
>> + inode->i_flags |= S_PRIVATE;
>> + d_instantiate(path.dentry, inode);
>> + inode->i_size = vdso_image->size;
>> +
>> + res = ERR_PTR(add_vdso_pages_to_page_cache(vdso_image, inode));
>> + if (IS_ERR(res))
>> + goto put_path;
>> +
>> + res = alloc_file(&path, FMODE_READ, &ramfs_file_operations);
>> + if (!IS_ERR(res))
>> + return res;
>> +
>> +put_path:
>> + path_put(&path);
>> + return res;
>> +}
>
> Not sure... I think alloc_anon_inode() makes more sense.
>
> Perhaps you can look at fs/aio.c and extract some bits of code into
> the new helpers which could be used by both aio_fs and vdso_fs?
Thanks, will do for the next version.
--
Dmitry
[toc] | [prev] | [next] | [standalone]
| From | Al Viro <viro@ZenIV.linux.org.uk> |
|---|---|
| Date | 2016-09-03 02:20 +0200 |
| Message-ID | <sd6QG-6ph-19@gated-at.bofh.it> |
| In reply to | #1472519 |
On Tue, Aug 30, 2016 at 04:33:12PM +0200, Oleg Nesterov wrote: > > + inode = ramfs_get_inode(sb, NULL, S_IFREG | S_IRUGO | S_IXUGO, 0); > Not sure... I think alloc_anon_inode() makes more sense. Compared to this, you mean? It's going to give you the wrong permissions/i_op/a_ops, and you'll have to assign them manually. ramfs already gives the right ones for what's wanted, AFAICS.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web