quota/genetlink: use proper genetlink multicast APIs
[deliverable/linux.git] / fs / quota / netlink.c
index 16e8abb7709ba04fb1bcc1520573acf568e68eb9..aa22fe03b76c65a7f37629928745b9a6b36cdda2 100644 (file)
 
 /* Netlink family structure for quota */
 static struct genl_family quota_genl_family = {
-       .id = GENL_ID_GENERATE,
+       /*
+        * Needed due to multicast group ID abuse - old code assumed
+        * the family ID was also a valid multicast group ID (which
+        * isn't true) and userspace might thus rely on it. Assign a
+        * static ID for this group to make dealing with that easier.
+        */
+       .id = GENL_ID_VFS_DQUOT,
        .hdrsize = 0,
        .name = "VFS_DQUOT",
        .version = 1,
        .maxattr = QUOTA_NL_A_MAX,
 };
 
+static struct genl_multicast_group quota_mcgrp = {
+       .name = "events",
+};
+
 /**
  * quota_send_warning - Send warning to userspace about exceeded quota
  * @type: The quota type: USRQQUOTA, GRPQUOTA,...
@@ -78,7 +88,7 @@ void quota_send_warning(struct kqid qid, dev_t dev,
                goto attr_err_out;
        genlmsg_end(skb, msg_head);
 
-       genlmsg_multicast(skb, 0, quota_genl_family.id, GFP_NOFS);
+       genlmsg_multicast(skb, 0, quota_mcgrp.id, GFP_NOFS);
        return;
 attr_err_out:
        printk(KERN_ERR "VFS: Not enough space to compose quota message!\n");
@@ -92,6 +102,9 @@ static int __init quota_init(void)
        if (genl_register_family(&quota_genl_family) != 0)
                printk(KERN_ERR
                       "VFS: Failed to create quota netlink interface.\n");
+       if (genl_register_mc_group(&quota_genl_family, &quota_mcgrp))
+               printk(KERN_ERR
+                      "VFS: Failed to register quota mcast group.\n");
        return 0;
 };
 
This page took 0.024965 seconds and 5 git commands to generate.