"Dr. David Alan Gilbert" <dgilb...@redhat.com> wrote: > * Juan Quintela (quint...@redhat.com) wrote: >> So we don't have to compile everything in, or have ifdefs > > Can you explain to me what this is allowing us to do?
See the zstd support. We don't need to do anything in any other file. If you compile-in the multifd-zstd.c code, you have it. It is to avoid this kind of constructs: if (strstart(uri, "tcp:", &p)) { tcp_start_outgoing_migration(s, p, &local_err); #ifdef CONFIG_RDMA } else if (strstart(uri, "rdma:", &p)) { rdma_start_outgoing_migration(s, p, &local_err); #endif } else if (strstart(uri, "exec:", &p)) { exec_start_outgoing_migration(s, p, &local_err); } else if (strstart(uri, "unix:", &p)) { unix_start_outgoing_migration(s, p, &local_err); } else if (strstart(uri, "fd:", &p)) { fd_start_outgoing_migration(s, p, &local_err); } else { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "uri", "a valid migration protocol"); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_FAILED); block_cleanup_parameters(s); return; } This is the following bit that I am going to try, put all the code of rdma/exec/... in its own file, being able to compile it out and not having ifdefs left and right. (In the case of zstd, we still have some code in because I don't know how to convince qapi of doing: #ifdef CONFIG_ZSTD { 'enum': 'MultiFDMethod', #ifdef CONFIG_ZSTD 'data': [ 'none', 'zlib', 'zstd' ] } #else 'data': [ 'none', 'zlib' ] } #endif If I am told how to fix this, I will change static MultiFDMethods *multifd_ops[MULTIFD_METHOD__MAX] = { [MULTIFD_METHOD_NONE] = &multifd_nocomp_ops, }; And remove the last dependency. Thanks, Juan.