~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/smb/client/netlink.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 /*
  3  * Netlink routines for CIFS
  4  *
  5  * Copyright (c) 2020 Samuel Cabrero <scabrero@suse.de>
  6  */
  7 
  8 #include <net/genetlink.h>
  9 #include <uapi/linux/cifs/cifs_netlink.h>
 10 
 11 #include "netlink.h"
 12 #include "cifsglob.h"
 13 #include "cifs_debug.h"
 14 #include "cifs_swn.h"
 15 
 16 static const struct nla_policy cifs_genl_policy[CIFS_GENL_ATTR_MAX + 1] = {
 17         [CIFS_GENL_ATTR_SWN_REGISTRATION_ID]    = { .type = NLA_U32 },
 18         [CIFS_GENL_ATTR_SWN_NET_NAME]           = { .type = NLA_STRING },
 19         [CIFS_GENL_ATTR_SWN_SHARE_NAME]         = { .type = NLA_STRING },
 20         [CIFS_GENL_ATTR_SWN_IP]                 = { .len = sizeof(struct sockaddr_storage) },
 21         [CIFS_GENL_ATTR_SWN_NET_NAME_NOTIFY]    = { .type = NLA_FLAG },
 22         [CIFS_GENL_ATTR_SWN_SHARE_NAME_NOTIFY]  = { .type = NLA_FLAG },
 23         [CIFS_GENL_ATTR_SWN_IP_NOTIFY]          = { .type = NLA_FLAG },
 24         [CIFS_GENL_ATTR_SWN_KRB_AUTH]           = { .type = NLA_FLAG },
 25         [CIFS_GENL_ATTR_SWN_USER_NAME]          = { .type = NLA_STRING },
 26         [CIFS_GENL_ATTR_SWN_PASSWORD]           = { .type = NLA_STRING },
 27         [CIFS_GENL_ATTR_SWN_DOMAIN_NAME]        = { .type = NLA_STRING },
 28         [CIFS_GENL_ATTR_SWN_NOTIFICATION_TYPE]  = { .type = NLA_U32 },
 29         [CIFS_GENL_ATTR_SWN_RESOURCE_STATE]     = { .type = NLA_U32 },
 30         [CIFS_GENL_ATTR_SWN_RESOURCE_NAME]      = { .type = NLA_STRING},
 31 };
 32 
 33 static const struct genl_ops cifs_genl_ops[] = {
 34         {
 35                 .cmd = CIFS_GENL_CMD_SWN_NOTIFY,
 36                 .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
 37                 .doit = cifs_swn_notify,
 38         },
 39 };
 40 
 41 static const struct genl_multicast_group cifs_genl_mcgrps[] = {
 42         [CIFS_GENL_MCGRP_SWN] = { .name = CIFS_GENL_MCGRP_SWN_NAME },
 43 };
 44 
 45 struct genl_family cifs_genl_family = {
 46         .name           = CIFS_GENL_NAME,
 47         .version        = CIFS_GENL_VERSION,
 48         .hdrsize        = 0,
 49         .maxattr        = CIFS_GENL_ATTR_MAX,
 50         .module         = THIS_MODULE,
 51         .policy         = cifs_genl_policy,
 52         .ops            = cifs_genl_ops,
 53         .n_ops          = ARRAY_SIZE(cifs_genl_ops),
 54         .resv_start_op  = CIFS_GENL_CMD_SWN_NOTIFY + 1,
 55         .mcgrps         = cifs_genl_mcgrps,
 56         .n_mcgrps       = ARRAY_SIZE(cifs_genl_mcgrps),
 57 };
 58 
 59 /**
 60  * cifs_genl_init - Register generic netlink family
 61  *
 62  * Return zero if initialized successfully, otherwise non-zero.
 63  */
 64 int cifs_genl_init(void)
 65 {
 66         int ret;
 67 
 68         ret = genl_register_family(&cifs_genl_family);
 69         if (ret < 0) {
 70                 cifs_dbg(VFS, "%s: failed to register netlink family\n",
 71                                 __func__);
 72                 return ret;
 73         }
 74 
 75         return 0;
 76 }
 77 
 78 /**
 79  * cifs_genl_exit - Unregister generic netlink family
 80  */
 81 void cifs_genl_exit(void)
 82 {
 83         int ret;
 84 
 85         ret = genl_unregister_family(&cifs_genl_family);
 86         if (ret < 0) {
 87                 cifs_dbg(VFS, "%s: failed to unregister netlink family\n",
 88                                 __func__);
 89         }
 90 }
 91 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php