示例#1
0
void bind(const gchar *host, const gchar *guest) {
  g_autoptr(GError) err = NULL;
  g_autoptr(GDir) dir = g_dir_open(host, 0, &err);

  if (err != NULL)
    fail("g_dir_open", errno);

  const gchar *item;

  while (item = g_dir_read_name(dir))
    if (!g_strv_contains(bind_blacklist, item))
      bind_mount_item(host, guest, item);

  bind_mount_host(host, guest);
}
示例#2
0
void bind(const gchar *host, const gchar *guest) {
  mount_tmpfs(guest);
  pivot_host(guest);

  g_autofree gchar *host_dir = g_build_filename("/host", host, NULL);

  g_autoptr(GError) err = NULL;
  g_autoptr(GDir) dir = g_dir_open(host_dir, 0, &err);

  if (err != NULL)
    fail("g_dir_open", errno);

  const gchar *item;

  while ((item = g_dir_read_name(dir)))
    if (!g_strv_contains(bind_blacklist, item))
      bind_mount_item(host_dir, "/", item);
}