Omit parameter names from function prototypes when the names do not
give useful information, e.g.:
- int netdev_get_mtu(const struct netdev *);
+ int netdev_get_mtu(const struct netdev *, int *mtup);
STATEMENTS
struct ofpbuf b;
int mtu;
- mtu = netdev_get_mtu(cli->netdev);
+ netdev_get_mtu(cli->netdev, &mtu);
ofpbuf_init(&b, mtu + VLAN_ETH_HEADER_LEN);
netdev_get_etheraddr(cli->netdev, cli_mac);
for (; cli->received < 50; cli->received++) {
port->netdev = netdev;
port->internal = internal;
- mtu = netdev_get_mtu(netdev);
+ netdev_get_mtu(netdev, &mtu);
if (mtu > max_mtu) {
max_mtu = mtu;
}
return netdev->name;
}
-/* Returns the maximum size of transmitted (and received) packets on 'netdev',
- * in bytes, not including the hardware header; thus, this is typically 1500
- * bytes for Ethernet devices. */
+/* Retrieves the MTU of 'netdev'. The MTU is the maximum size of transmitted
+ * (and received) packets, in bytes, not including the hardware header; thus,
+ * this is typically 1500 bytes for Ethernet devices.
+ *
+ * If successful, returns 0 and stores the MTU size in '*mtup'. On failure,
+ * returns a positive errno value and stores ETH_PAYLOAD_MAX (1500) in
+ * '*mtup'. */
int
-netdev_get_mtu(const struct netdev *netdev)
+netdev_get_mtu(const struct netdev *netdev, int *mtup)
{
- return netdev->mtu;
+ *mtup = netdev->mtu;
+ return 0;
}
/* Stores the features supported by 'netdev' into each of '*current',
int netdev_set_etheraddr(struct netdev *, const uint8_t mac[6]);
int netdev_get_etheraddr(const struct netdev *, uint8_t mac[6]);
const char *netdev_get_name(const struct netdev *);
-int netdev_get_mtu(const struct netdev *);
+int netdev_get_mtu(const struct netdev *, int *mtup);
int netdev_get_features(struct netdev *,
uint32_t *current, uint32_t *advertised,
uint32_t *supported, uint32_t *peer);