1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26#include <net/wimax.h>
27#include <net/genetlink.h>
28#include <linux/wimax.h>
29#include <linux/security.h>
30#include "wimax-internal.h"
31
32#define D_SUBMODULE op_state_get
33#include "debug-levels.h"
34
35
36static const struct nla_policy wimax_gnl_state_get_policy[WIMAX_GNL_ATTR_MAX + 1] = {
37 [WIMAX_GNL_STGET_IFIDX] = {
38 .type = NLA_U32,
39 },
40};
41
42
43
44
45
46
47
48
49
50
51static
52int wimax_gnl_doit_state_get(struct sk_buff *skb, struct genl_info *info)
53{
54 int result, ifindex;
55 struct wimax_dev *wimax_dev;
56
57 d_fnstart(3, NULL, "(skb %p info %p)\n", skb, info);
58 result = -ENODEV;
59 if (info->attrs[WIMAX_GNL_STGET_IFIDX] == NULL) {
60 printk(KERN_ERR "WIMAX_GNL_OP_STATE_GET: can't find IFIDX "
61 "attribute\n");
62 goto error_no_wimax_dev;
63 }
64 ifindex = nla_get_u32(info->attrs[WIMAX_GNL_STGET_IFIDX]);
65 wimax_dev = wimax_dev_get_by_genl_info(info, ifindex);
66 if (wimax_dev == NULL)
67 goto error_no_wimax_dev;
68
69 result = wimax_state_get(wimax_dev);
70 dev_put(wimax_dev->net_dev);
71error_no_wimax_dev:
72 d_fnend(3, NULL, "(skb %p info %p) = %d\n", skb, info, result);
73 return result;
74}
75
76
77struct genl_ops wimax_gnl_state_get = {
78 .cmd = WIMAX_GNL_OP_STATE_GET,
79 .flags = GENL_ADMIN_PERM,
80 .policy = wimax_gnl_state_get_policy,
81 .doit = wimax_gnl_doit_state_get,
82 .dumpit = NULL,
83};
84