VirtualBox

source: vbox/trunk/src/VBox/Additions/linux/sharedfolders/lnkops.c@ 76938

Last change on this file since 76938 was 76938, checked in by vboxsync, 6 years ago

Additions/linux/vboxvideo: Fix incorrect type in assignment sparse warning
bugref:8282: Additions/linux: track kernel changes to vboxvideo in our own tree

Sparse emitted the following warning:
../drivers/staging/vboxvideo/vbox_fb.c:173:27: warning: incorrect type in as

signment (different address spaces)

../drivers/staging/vboxvideo/vbox_fb.c:173:27: expected char [noderef] <a

sn:2>*screen_base

../drivers/staging/vboxvideo/vbox_fb.c:173:27: got void *virtual


The vbox_bo buffer object kernel mapping is handled by a call
to ttm_bo_kmap() prior to the assignment of bo->kmap.virtual to
info->screen_base of type char iomem*.
Casting bo->kmap.virtual to char
iomem* in this assignment fixes
the warning.


vboxvideo: Fix address space of expression removal sparse warning


Sparse emitted the following warning:
../drivers/staging/vboxvideo/vbox_main.c:64:25: warning: cast removes address space of expression


vbox->vbva_buffers iomapping is handled by calling vbox_accel_init()
from vbox_hw_init().
force attribute is used in assignment to vbva to fix the warning.


Signed-off-by: Alexander Kapshuk <alexander.kapshuk@…>
Reviewed-by: Hans de Goede <hdegoede@…>
Signed-off-by: Greg Kroah-Hartman <gregkh@…>

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 KB
Line 
1/* $Id: lnkops.c 76938 2019-01-22 16:50:18Z vboxsync $ */
2/** @file
3 * vboxsf - VBox Linux Shared Folders VFS, operations for symbolic links.
4 */
5
6/*
7 * Copyright (C) 2010-2019 Oracle Corporation
8 *
9 * Permission is hereby granted, free of charge, to any person
10 * obtaining a copy of this software and associated documentation
11 * files (the "Software"), to deal in the Software without
12 * restriction, including without limitation the rights to use,
13 * copy, modify, merge, publish, distribute, sublicense, and/or sell
14 * copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following
16 * conditions:
17 *
18 * The above copyright notice and this permission notice shall be
19 * included in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
23 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
26 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28 * OTHER DEALINGS IN THE SOFTWARE.
29 */
30
31#include "vfsmod.h"
32
33#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
34
35# if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
36# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
37static const char *sf_follow_link(struct dentry *dentry, void **cookie)
38#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
39static void *sf_follow_link(struct dentry *dentry, struct nameidata *nd)
40#else
41static int sf_follow_link(struct dentry *dentry, struct nameidata *nd)
42# endif
43{
44 struct inode *inode = dentry->d_inode;
45 struct sf_glob_info *sf_g = GET_GLOB_INFO(inode->i_sb);
46 struct sf_inode_info *sf_i = GET_INODE_INFO(inode);
47 int error = -ENOMEM;
48 char *path = (char *)get_zeroed_page(GFP_KERNEL);
49 int rc;
50
51 if (path) {
52 error = 0;
53 rc = VbglR0SfReadLink(&client_handle, &sf_g->map, sf_i->path,
54 PATH_MAX, path);
55 if (RT_FAILURE(rc)) {
56 LogFunc(("VbglR0SfReadLink failed, caller=%s, rc=%Rrc\n", __func__, rc));
57 free_page((unsigned long)path);
58 error = -EPROTO;
59 }
60 }
61# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
62 return error ? ERR_PTR(error) : (*cookie = path);
63# else
64 nd_set_link(nd, error ? ERR_PTR(error) : path);
65# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
66 return NULL;
67# else
68 return 0;
69# endif
70#endif
71}
72
73# if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
74# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
75static void sf_put_link(struct dentry *dentry, struct nameidata *nd,
76 void *cookie)
77#else
78static void sf_put_link(struct dentry *dentry, struct nameidata *nd)
79#endif
80{
81 char *page = nd_get_link(nd);
82 if (!IS_ERR(page))
83 free_page((unsigned long)page);
84}
85# endif
86
87# else /* LINUX_VERSION_CODE >= 4.5.0 */
88static const char *sf_get_link(struct dentry *dentry, struct inode *inode,
89 struct delayed_call *done)
90{
91 struct sf_glob_info *sf_g = GET_GLOB_INFO(inode->i_sb);
92 struct sf_inode_info *sf_i = GET_INODE_INFO(inode);
93 char *path;
94 int rc;
95
96 if (!dentry)
97 return ERR_PTR(-ECHILD);
98 path = kzalloc(PAGE_SIZE, GFP_KERNEL);
99 if (!path)
100 return ERR_PTR(-ENOMEM);
101 rc = VbglR0SfReadLink(&client_handle, &sf_g->map, sf_i->path, PATH_MAX,
102 path);
103 if (RT_FAILURE(rc)) {
104 LogFunc(("VbglR0SfReadLink failed, caller=%s, rc=%Rrc\n",
105 __func__, rc));
106 kfree(path);
107 return ERR_PTR(-EPROTO);
108 }
109 set_delayed_call(done, kfree_link, path);
110 return path;
111}
112# endif /* LINUX_VERSION_CODE >= 4.5.0 */
113
114struct inode_operations sf_lnk_iops = {
115# if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
116 .readlink = generic_readlink,
117# endif
118# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
119 .get_link = sf_get_link
120# elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
121 .follow_link = sf_follow_link,
122 .put_link = free_page_put_link,
123# else
124 .follow_link = sf_follow_link,
125 .put_link = sf_put_link
126# endif
127};
128
129#endif /* LINUX_VERSION_CODE >= 2.6.0 */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette