block.c (f87a0e29a9814a7ab6ee92b238989fed6186c4f3) block.c (5b7ba05fe7313b03712e129a86fa70c2c215e908)
1/*
2 * QEMU System Emulator block driver
3 *
4 * Copyright (c) 2003 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 1911 unchanged lines hidden (view full) ---

1920 bs_queue = g_new0(BlockReopenQueue, 1);
1921 QSIMPLEQ_INIT(bs_queue);
1922 }
1923
1924 if (!options) {
1925 options = qdict_new();
1926 }
1927
1/*
2 * QEMU System Emulator block driver
3 *
4 * Copyright (c) 2003 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 1911 unchanged lines hidden (view full) ---

1920 bs_queue = g_new0(BlockReopenQueue, 1);
1921 QSIMPLEQ_INIT(bs_queue);
1922 }
1923
1924 if (!options) {
1925 options = qdict_new();
1926 }
1927
1928 /* Check if this BlockDriverState is already in the queue */
1929 QSIMPLEQ_FOREACH(bs_entry, bs_queue, entry) {
1930 if (bs == bs_entry->state.bs) {
1931 break;
1932 }
1933 }
1934
1928 /*
1929 * Precedence of options:
1930 * 1. Explicitly passed in options (highest)
1931 * 2. Set in flags (only for top level)
1932 * 3. Retained from explicitly set options of bs
1933 * 4. Inherited from parent node
1934 * 5. Retained from effective options of bs
1935 */

--- 4 unchanged lines hidden (view full) ---

1940 * corresponding QDict option is set, it takes precedence. Otherwise
1941 * the flag is translated into a QDict option. The old setting of bs is
1942 * not considered.
1943 */
1944 update_options_from_flags(options, flags);
1945 }
1946
1947 /* Old explicitly set values (don't overwrite by inherited value) */
1935 /*
1936 * Precedence of options:
1937 * 1. Explicitly passed in options (highest)
1938 * 2. Set in flags (only for top level)
1939 * 3. Retained from explicitly set options of bs
1940 * 4. Inherited from parent node
1941 * 5. Retained from effective options of bs
1942 */

--- 4 unchanged lines hidden (view full) ---

1947 * corresponding QDict option is set, it takes precedence. Otherwise
1948 * the flag is translated into a QDict option. The old setting of bs is
1949 * not considered.
1950 */
1951 update_options_from_flags(options, flags);
1952 }
1953
1954 /* Old explicitly set values (don't overwrite by inherited value) */
1948 old_options = qdict_clone_shallow(bs->explicit_options);
1955 if (bs_entry) {
1956 old_options = qdict_clone_shallow(bs_entry->state.explicit_options);
1957 } else {
1958 old_options = qdict_clone_shallow(bs->explicit_options);
1959 }
1949 bdrv_join_options(bs, options, old_options);
1950 QDECREF(old_options);
1951
1952 explicit_options = qdict_clone_shallow(options);
1953
1954 /* Inherit from parent node */
1955 if (parent_options) {
1956 assert(!flags);

--- 22 unchanged lines hidden (view full) ---

1979 child_key_dot = g_strdup_printf("%s.", child->name);
1980 qdict_extract_subqdict(options, &new_child_options, child_key_dot);
1981 g_free(child_key_dot);
1982
1983 bdrv_reopen_queue_child(bs_queue, child->bs, new_child_options, 0,
1984 child->role, options, flags);
1985 }
1986
1960 bdrv_join_options(bs, options, old_options);
1961 QDECREF(old_options);
1962
1963 explicit_options = qdict_clone_shallow(options);
1964
1965 /* Inherit from parent node */
1966 if (parent_options) {
1967 assert(!flags);

--- 22 unchanged lines hidden (view full) ---

1990 child_key_dot = g_strdup_printf("%s.", child->name);
1991 qdict_extract_subqdict(options, &new_child_options, child_key_dot);
1992 g_free(child_key_dot);
1993
1994 bdrv_reopen_queue_child(bs_queue, child->bs, new_child_options, 0,
1995 child->role, options, flags);
1996 }
1997
1987 bs_entry = g_new0(BlockReopenQueueEntry, 1);
1988 QSIMPLEQ_INSERT_TAIL(bs_queue, bs_entry, entry);
1998 if (!bs_entry) {
1999 bs_entry = g_new0(BlockReopenQueueEntry, 1);
2000 QSIMPLEQ_INSERT_TAIL(bs_queue, bs_entry, entry);
2001 } else {
2002 QDECREF(bs_entry->state.options);
2003 QDECREF(bs_entry->state.explicit_options);
2004 }
1989
1990 bs_entry->state.bs = bs;
1991 bs_entry->state.options = options;
1992 bs_entry->state.explicit_options = explicit_options;
1993 bs_entry->state.flags = flags;
1994
1995 return bs_queue;
1996}

--- 2017 unchanged lines hidden ---
2005
2006 bs_entry->state.bs = bs;
2007 bs_entry->state.options = options;
2008 bs_entry->state.explicit_options = explicit_options;
2009 bs_entry->state.flags = flags;
2010
2011 return bs_queue;
2012}

--- 2017 unchanged lines hidden ---