From: Ben Pfaff Date: Wed, 5 Aug 2009 20:09:15 +0000 (-0700) Subject: brcompat: Add comments to sysfs code. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e93df1c46954b9a2c60c8e11bbf8ea25a1686ce;p=openvswitch brcompat: Add comments to sysfs code. I got tired of figuring out over and over what these function calls do. --- diff --git a/datapath/brc_sysfs_dp.c b/datapath/brc_sysfs_dp.c index bb779b63..d5c4fc2f 100644 --- a/datapath/brc_sysfs_dp.c +++ b/datapath/brc_sysfs_dp.c @@ -486,8 +486,9 @@ int brc_sysfs_add_dp(struct datapath *dp) goto out1; } + /* Create /sys/class/net//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; diff --git a/datapath/brc_sysfs_if.c b/datapath/brc_sysfs_if.c index ceda1297..5cae6a9f 100644 --- a/datapath/brc_sysfs_if.c +++ b/datapath/brc_sysfs_if.c @@ -289,8 +289,9 @@ int brc_sysfs_add_if(struct net_bridge_port *p) struct brport_attribute **a; int err; + /* Create /sys/class/net//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//brport/bridge to + * /sys/class/net/. */ 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//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//brif/ to + * /sys/class/net//brport. */ err = sysfs_create_link(&dp->ifobj, &p->kobj, p->dev->name); if (err) goto err_del;