+static int
+netdev_linux_create_tap_pl(const struct netdev_class *class OVS_UNUSED,
+ const char *name, struct netdev_dev **netdev_devp)
+{
+ struct netdev_dev_linux *netdev_dev;
+ struct tap_state *state;
+ char real_name[IFNAMSIZ];
+ int error;
+
+ netdev_dev = xzalloc(sizeof *netdev_dev);
+ state = &netdev_dev->state.tap;
+
+ error = cache_notifier_ref();
+ if (error) {
+ goto error;
+ }
+
+ /* Open tap device. */
+ state->fd = tun_alloc(IFF_TAP, real_name);
+ if (state->fd < 0) {
+ error = errno;
+ VLOG_WARN("tun_alloc(IFF_TAP, %s) failed: %s", name, strerror(error));
+ goto error_unref_notifier;
+ }
+ if (strcmp(name, real_name)) {
+ VLOG_WARN("tap_pl: requested %s, created %s", name, real_name);
+ }
+
+ /* Make non-blocking. */
+ error = set_nonblocking(state->fd);
+ if (error) {
+ goto error_unref_notifier;
+ }
+
+ netdev_dev_init(&netdev_dev->netdev_dev, name, &netdev_tap_pl_class);
+ *netdev_devp = &netdev_dev->netdev_dev;
+ return 0;
+
+error_unref_notifier:
+ cache_notifier_unref();
+error:
+ free(netdev_dev);
+ return error;
+}
+