brcompat: Add comments to sysfs code.
authorBen Pfaff <blp@nicira.com>
Wed, 5 Aug 2009 20:09:15 +0000 (13:09 -0700)
committerBen Pfaff <blp@nicira.com>
Thu, 6 Aug 2009 23:57:06 +0000 (16:57 -0700)
I got tired of figuring out over and over what these function calls do.

datapath/brc_sysfs_dp.c
datapath/brc_sysfs_if.c

index bb779b6356eca7767fc0c9aa39d93b773b392150..d5c4fc2fbabf583129607f4577276ee772d7abf8 100644 (file)
@@ -486,8 +486,9 @@ int brc_sysfs_add_dp(struct datapath *dp)
                goto out1;
        }
 
+       /* Create /sys/class/net/<devname>/bridge directory. */
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
-       kobject_set_name(&dp->ifobj, SYSFS_BRIDGE_PORT_SUBDIR);
+       kobject_set_name(&dp->ifobj, SYSFS_BRIDGE_PORT_SUBDIR); /* "bridge" */
        dp->ifobj.ktype = NULL;
        dp->ifobj.kset = NULL;
        dp->ifobj.parent = kobj;
index ceda1297e8899238302adf1ec8505d7b00d432c3..5cae6a9f0a05440c618d114998f52fc59906bf06 100644 (file)
@@ -289,8 +289,9 @@ int brc_sysfs_add_if(struct net_bridge_port *p)
        struct brport_attribute **a;
        int err;
 
+       /* Create /sys/class/net/<devname>/brport directory. */
        kobject_init(&p->kobj);
-       kobject_set_name(&p->kobj, SYSFS_BRIDGE_PORT_ATTR);
+       kobject_set_name(&p->kobj, SYSFS_BRIDGE_PORT_ATTR); /* "brport" */
        p->kobj.ktype = &brport_ktype;
        p->kobj.kset = NULL;
        p->kobj.parent = &(p->dev->class_dev.kobj);
@@ -299,18 +300,23 @@ int brc_sysfs_add_if(struct net_bridge_port *p)
        if (err)
                goto err_put;
 
+       /* Create symlink from /sys/class/net/<devname>/brport/bridge to
+        * /sys/class/net/<bridgename>. */
        err = sysfs_create_link(&p->kobj,
                                &dp->ports[ODPP_LOCAL]->dev->class_dev.kobj,
-                               SYSFS_BRIDGE_PORT_LINK);
+                               SYSFS_BRIDGE_PORT_LINK); /* "bridge" */
        if (err)
                goto err_del;
 
+       /* Populate /sys/class/net/<devname>/brport directory with files. */
        for (a = brport_attrs; *a; ++a) {
                err = sysfs_create_file(&p->kobj, &((*a)->attr));
                if (err)
                        goto err_del;
        }
 
+       /* Create symlink from /sys/class/net/<bridgename>/brif/<devname> to
+        * /sys/class/net/<devname>/brport.  */
        err = sysfs_create_link(&dp->ifobj, &p->kobj, p->dev->name);
        if (err)
                goto err_del;