From owner-freebsd-hackers@FreeBSD.ORG Mon Nov 9 14:39:17 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 25B0A1065693 for ; Mon, 9 Nov 2009 14:39:17 +0000 (UTC) (envelope-from a_best01@uni-muenster.de) Received: from zivm-exrelay2.uni-muenster.de (ZIVM-EXRELAY2.UNI-MUENSTER.DE [128.176.192.15]) by mx1.freebsd.org (Postfix) with ESMTP id A8B0E8FC1C for ; Mon, 9 Nov 2009 14:39:16 +0000 (UTC) X-IronPort-AV: E=Sophos;i="4.44,708,1249250400"; d="scan'208";a="228503710" Received: from zivmaildisp1.uni-muenster.de (HELO ZIVMAILUSER03.UNI-MUENSTER.DE) ([128.176.188.85]) by zivm-relay2.uni-muenster.de with ESMTP; 09 Nov 2009 15:39:14 +0100 Received: by ZIVMAILUSER03.UNI-MUENSTER.DE (Postfix, from userid 149459) id BE4E11B0751; Mon, 9 Nov 2009 15:39:14 +0100 (CET) Date: Mon, 09 Nov 2009 15:39:14 +0100 (CET) From: Alexander Best Sender: Organization: Westfaelische Wilhelms-Universitaet Muenster To: Giorgos Keramidas Message-ID: In-Reply-To: <873a4o2my9.fsf@kobe.laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@FreeBSD.org Subject: Re: [patch] burncd: honour for envar SPEED X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2009 14:39:17 -0000 Giorgos Keramidas schrieb am 2009-11-09: > On Mon, 09 Nov 2009 01:47:40 +0100 (CET), Alexander Best > wrote: > > any thoughts on these small changes to burncd? > > Index: usr.sbin/burncd/burncd.c > > =================================================================== > > --- usr.sbin/burncd/burncd.c (revision 199064) > > +++ usr.sbin/burncd/burncd.c (working copy) > > @@ -78,13 +78,16 @@ > > { > > int arg, addr, ch, fd; > > int dao = 0, eject = 0, fixate = 0, list = 0, multi = 0, > > preemp = 0; > > - int nogap = 0, speed = 4 * 177, test_write = 0, force = 0; > > + int nogap = 0, speed = 0, test_write = 0, force = 0; > > int block_size = 0, block_type = 0, cdopen = 0, dvdrw = 0; > > const char *dev; > > if ((dev = getenv("CDROM")) == NULL) > > dev = "/dev/acd0"; > > + if ((speed = getenv("SPEED")) == NULL) > > + speed = 4 * 177; > > + > > while ((ch = getopt(argc, argv, "def:Flmnpqs:tv")) != -1) { > > switch (ch) { > > case 'd': > Hi Alexander, > The idea seems very good, but since the value of SPEED is user > supplied > data, I would rather see a bit of validation code after getenv(). > With > this version of the patch, burncd would happily accept and try to use > values that are quite absurd, i.e.: > env SPEED=12234567890 burncd ... > It may also be sensible to do the translation from "human readable" > speed values and the multiplication with 177 _after_ the value has > been > parsed from getenv(), so that e.g. one can write: > env SPEED=4 burncd > and get behavior similar to the current default. i don't quite get why the value supplied with the envar has to be validated. if the user supplies a speed value using the -s switch no validation (except <= 0) is being performed either. also i think there's a speed check in the atapi code. if the speed requested is > the maximum driver speed it gets set to the maximum driver speed automatically. cheers. alex