Patchwork [RFC] Removing old command line options

login
register
mail settings
Submitter Brad Hards
Date April 25, 2011, 1:38 a.m.
Message ID <201104251138.26790.bradh@frogmouth.net>
Download mbox | patch
Permalink /patch/92691/
State New
Headers show

Comments

Brad Hards - April 25, 2011, 1:38 a.m.
I've been trying to update the documentation (currently on neworking), and one
of the things that makes it hard is that there are a few old (legacy) command
line options (e.g. --tftp).

Removing them is easy, but not really nice to users who depend on them. So I
was thinking about a migration approach. 

I came up with two alternatives.

Simplest approach is just to add a warning for the next release, and remove
the option in the next+1 release.



The other alternative is to add an intermediate state, so its a warning
in the next release, and requires an --enable-legacy-options command
line argument to get it back in next+1. Then its gone in next+2.

Thoughts? Comments?

Brad
Mulyadi Santosa - April 25, 2011, 3:02 a.m.
Hi...

On Mon, Apr 25, 2011 at 08:38, Brad Hards <bradh@frogmouth.net> wrote:
> I've been trying to update the documentation (currently on neworking), and one
> of the things that makes it hard is that there are a few old (legacy) command
> line options (e.g. --tftp).
>
> Removing them is easy, but not really nice to users who depend on them. So I
> was thinking about a migration approach.
>
> I came up with two alternatives.
>
> Simplest approach is just to add a warning for the next release, and remove
> the option in the next+1 release.

I vote the above alternative.... simply because in the end, user needs
to be notified real soon and they need to think for the alternative
real soon too. Delaying such action just will make situation worse.

Patch

diff --git a/vl.c b/vl.c
index 68c3b53..a972712 100644
--- a/vl.c
+++ b/vl.c
@@ -1941,6 +1941,13 @@  static const QEMUOption *lookup_opt(int argc, char **argv,
     return popt;
 }                                                                                                                                                                                              
                                                                                                                                                                                                
+static void display_legacy_warning(const char *option_name)                                                                                                                                    
+{                                                                                                                                                                                              
+    fprintf(stderr, "%s is a legacy option, which will be removed in a future "                                                                                                                
+                    "version of QEMU. Consult the manual for replacement.\n",                                                                                                                  
+                    option_name);
+}
+
 int main(int argc, char **argv, char **envp)
 {
     const char *gdbstub_dev = NULL;
@@ -2277,12 +2284,15 @@  int main(int argc, char **argv, char **envp)
                 break;
 #ifdef CONFIG_SLIRP
             case QEMU_OPTION_tftp:
+                display_legacy_warning("--tftp");
                 legacy_tftp_prefix = optarg;
                 break;
             case QEMU_OPTION_bootp:
+                display_legacy_warning("--bootp");
                 legacy_bootp_filename = optarg;
                 break;
             case QEMU_OPTION_redir:
+                display_legacy_warning("--redir");
                 if (net_slirp_redir(optarg) < 0)
                     exit(1);
                 break;