.. | .. |
---|
1 | 1 | // SPDX-License-Identifier: GPL-2.0 |
---|
2 | | -/* Copyright (C) 2007-2018 B.A.T.M.A.N. contributors: |
---|
| 2 | +/* Copyright (C) 2007-2020 B.A.T.M.A.N. contributors: |
---|
3 | 3 | * |
---|
4 | 4 | * Marek Lindner |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or |
---|
7 | | - * modify it under the terms of version 2 of the GNU General Public |
---|
8 | | - * License as published by the Free Software Foundation. |
---|
9 | | - * |
---|
10 | | - * This program is distributed in the hope that it will be useful, but |
---|
11 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
13 | | - * General Public License for more details. |
---|
14 | | - * |
---|
15 | | - * You should have received a copy of the GNU General Public License |
---|
16 | | - * along with this program; if not, see <http://www.gnu.org/licenses/>. |
---|
17 | 5 | */ |
---|
18 | 6 | |
---|
19 | 7 | #include "icmp_socket.h" |
---|
.. | .. |
---|
47 | 35 | #include <linux/wait.h> |
---|
48 | 36 | #include <uapi/linux/batadv_packet.h> |
---|
49 | 37 | |
---|
| 38 | +#include "debugfs.h" |
---|
50 | 39 | #include "hard-interface.h" |
---|
51 | 40 | #include "log.h" |
---|
52 | 41 | #include "originator.h" |
---|
.. | .. |
---|
74 | 63 | if (!try_module_get(THIS_MODULE)) |
---|
75 | 64 | return -EBUSY; |
---|
76 | 65 | |
---|
77 | | - nonseekable_open(inode, file); |
---|
| 66 | + batadv_debugfs_deprecated(file, ""); |
---|
| 67 | + |
---|
| 68 | + stream_open(inode, file); |
---|
78 | 69 | |
---|
79 | 70 | socket_client = kmalloc(sizeof(*socket_client), GFP_KERNEL); |
---|
80 | 71 | if (!socket_client) { |
---|
.. | .. |
---|
143 | 134 | |
---|
144 | 135 | if (!buf || count < sizeof(struct batadv_icmp_packet)) |
---|
145 | 136 | return -EINVAL; |
---|
146 | | - |
---|
147 | | - if (!access_ok(VERIFY_WRITE, buf, count)) |
---|
148 | | - return -EFAULT; |
---|
149 | 137 | |
---|
150 | 138 | error = wait_event_interruptible(socket_client->queue_wait, |
---|
151 | 139 | socket_client->queue_len); |
---|
.. | .. |
---|
323 | 311 | /** |
---|
324 | 312 | * batadv_socket_setup() - Create debugfs "socket" file |
---|
325 | 313 | * @bat_priv: the bat priv with all the soft interface information |
---|
326 | | - * |
---|
327 | | - * Return: 0 on success or negative error number in case of failure |
---|
328 | 314 | */ |
---|
329 | | -int batadv_socket_setup(struct batadv_priv *bat_priv) |
---|
| 315 | +void batadv_socket_setup(struct batadv_priv *bat_priv) |
---|
330 | 316 | { |
---|
331 | | - struct dentry *d; |
---|
332 | | - |
---|
333 | | - if (!bat_priv->debug_dir) |
---|
334 | | - goto err; |
---|
335 | | - |
---|
336 | | - d = debugfs_create_file(BATADV_ICMP_SOCKET, 0600, bat_priv->debug_dir, |
---|
337 | | - bat_priv, &batadv_fops); |
---|
338 | | - if (!d) |
---|
339 | | - goto err; |
---|
340 | | - |
---|
341 | | - return 0; |
---|
342 | | - |
---|
343 | | -err: |
---|
344 | | - return -ENOMEM; |
---|
| 317 | + debugfs_create_file(BATADV_ICMP_SOCKET, 0600, bat_priv->debug_dir, |
---|
| 318 | + bat_priv, &batadv_fops); |
---|
345 | 319 | } |
---|
346 | 320 | |
---|
347 | 321 | /** |
---|