From owner-freebsd-arch@FreeBSD.ORG Thu Aug 19 21:18:30 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 30D8F16A4CE for ; Thu, 19 Aug 2004 21:18:30 +0000 (GMT) Received: from athena.softcardsystems.com (mail.softcardsystems.com [12.34.136.114]) by mx1.FreeBSD.org (Postfix) with ESMTP id D258243D1F for ; Thu, 19 Aug 2004 21:18:29 +0000 (GMT) (envelope-from sah@softcardsystems.com) Received: from athena (athena [12.34.136.114])i7JMHtKn020359 for ; Thu, 19 Aug 2004 17:17:55 -0500 Date: Thu, 19 Aug 2004 17:17:55 -0500 (EST) From: Sam X-X-Sender: sah@athena To: freebsd-arch@freebsd.org Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Subject: struct buf fields X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2004 21:18:30 -0000 Hello - I'm writing a block device driver for 4.x and would like to change b_pblkno as I issue requests to the device. Is this legal? Cheers, Sam From owner-freebsd-arch@FreeBSD.ORG Sat Aug 21 19:18:21 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0E0E816A4CE for ; Sat, 21 Aug 2004 19:18:21 +0000 (GMT) Received: from kane.otenet.gr (kane.otenet.gr [195.170.0.27]) by mx1.FreeBSD.org (Postfix) with ESMTP id 47CD543D2F for ; Sat, 21 Aug 2004 19:18:20 +0000 (GMT) (envelope-from keramida@freebsd.org) Received: from gothmog.gr (patr530-a129.otenet.gr [212.205.215.129]) i7LJIHK2008730 for ; Sat, 21 Aug 2004 22:18:18 +0300 Received: from gothmog.gr (gothmog [127.0.0.1]) by gothmog.gr (8.13.1/8.13.1) with ESMTP id i7LJGxdu000678 for ; Sat, 21 Aug 2004 22:16:59 +0300 (EEST) (envelope-from keramida@freebsd.org) Received: (from giorgos@localhost) by gothmog.gr (8.13.1/8.13.1/Submit) id i7LJGxe5000677 for freebsd-arch@freebsd.org; Sat, 21 Aug 2004 22:16:59 +0300 (EEST) (envelope-from keramida@freebsd.org) Date: Sat, 21 Aug 2004 22:16:59 +0300 From: Giorgos Keramidas To: freebsd-arch@freebsd.org Message-ID: <20040821191659.GA94336@gothmog.gr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: Introducing a poweroff(8) command X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Aug 2004 19:18:21 -0000 Hi guys, In response to PR misc/70476 about `halt -p' I wrote a simple patch to introduce a "poweroff" command that will default to "halt -p" behavior and inhibit the need for changing the default behavior of halt(8). o Does this look ok to you all? o Should I suggest using it as a workaround of the behavior described in the PR? The attached patch also fixes a bug described in PR bin/70536 (which I have submitted after looking around at the source code of reboot.c) but I can make these two separate diffs if we think it's worth it. === References === http://www.FreeBSD.org/cgi/query-pr.cgi?pr=misc/70476 http://www.FreeBSD.org/cgi/query-pr.cgi?pr=bin/70536 From owner-freebsd-arch@FreeBSD.ORG Sat Aug 21 20:24:24 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2B77A16A4CE for ; Sat, 21 Aug 2004 20:24:24 +0000 (GMT) Received: from nic.ach.sch.gr (nic.sch.gr [194.63.238.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 14CEC43D45 for ; Sat, 21 Aug 2004 20:24:22 +0000 (GMT) (envelope-from keramida@ceid.upatras.gr) Received: (qmail 16960 invoked by uid 207); 21 Aug 2004 20:24:16 -0000 Received: from keramida@ceid.upatras.gr by nic by uid 201 with qmail-scanner-1.21 (sophie: 3.04/2.19/3.81. Clear:RC:1(81.186.70.28):. Processed in 2.057545 secs); 21 Aug 2004 20:24:16 -0000 Received: from dialup28.ach.sch.gr (HELO gothmog.gr) ([81.186.70.28]) (envelope-sender ) by nic.sch.gr (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 21 Aug 2004 20:24:13 -0000 Received: from gothmog.gr (gothmog [127.0.0.1]) by gothmog.gr (8.13.1/8.13.1) with ESMTP id i7LKMrDh084955 for ; Sat, 21 Aug 2004 23:22:53 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from giorgos@localhost) by gothmog.gr (8.13.1/8.13.1/Submit) id i7LKMq7p084944 for freebsd-arch@freebsd.org; Sat, 21 Aug 2004 23:22:52 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Date: Sat, 21 Aug 2004 23:22:52 +0300 From: Giorgos Keramidas To: freebsd-arch@freebsd.org Message-ID: <20040821202252.GB94336@gothmog.gr> References: <20040821191659.GA94336@gothmog.gr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040821191659.GA94336@gothmog.gr> Subject: Re: Introducing a poweroff(8) command X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Aug 2004 20:24:24 -0000 On 2004-08-21 22:16, Giorgos Keramidas wrote: > Hi guys, > > In response to PR misc/70476 about `halt -p' I wrote a simple patch to > introduce a "poweroff" command that will default to "halt -p" behavior > and inhibit the need for changing the default behavior of halt(8). > > o Does this look ok to you all? > > o Should I suggest using it as a workaround of the behavior > described in the PR? It would be nice if I also included the patch :-? %%% Add a hard link to reboot(8) called "poweroff" which defaults to the same behavior as "halt -p". Also fix a related bug while here. When called as "halt -p" the previous reboot program would not disallow the use of -d for saving kernel dumps (it would inhibit dumps without the -p option though). Index: Makefile =================================================================== RCS file: /home/ncvs/src/sbin/reboot/Makefile,v retrieving revision 1.13 diff -u -r1.13 Makefile --- Makefile 22 Mar 2004 00:52:27 -0000 1.13 +++ Makefile 21 Aug 2004 18:45:36 -0000 @@ -14,8 +14,8 @@ MLINKS+= boot_i386.8 boot.8 .endif -LINKS= ${BINDIR}/reboot ${BINDIR}/halt ${BINDIR}/reboot ${BINDIR}/fastboot \ - ${BINDIR}/reboot ${BINDIR}/fasthalt +LINKS= ${BINDIR}/reboot ${BINDIR}/halt ${BINDIR}/reboot ${BINDIR}/poweroff \ + ${BINDIR}/reboot ${BINDIR}/fastboot ${BINDIR}/reboot ${BINDIR}/fasthalt SCRIPTS= nextboot.sh Index: reboot.8 =================================================================== RCS file: /home/ncvs/src/sbin/reboot/reboot.8,v retrieving revision 1.22 diff -u -r1.22 reboot.8 --- reboot.8 9 Apr 2004 19:58:35 -0000 1.22 +++ reboot.8 17 Aug 2004 22:04:34 -0000 @@ -34,6 +34,7 @@ .Sh NAME .Nm reboot , .Nm halt , +.Nm poweroff , .Nm fastboot , .Nm fasthalt .Nd stopping and restarting the system @@ -41,6 +42,9 @@ .Nm halt .Op Fl lnqp .Op Fl k Ar kernel +.Nm poweroff +.Op Fl lnqp +.Op Fl k Ar kernel .Nm .Op Fl dlnqp .Op Fl k Ar kernel @@ -52,7 +56,8 @@ .Op Fl k Ar kernel .Sh DESCRIPTION The -.Nm halt +.Nm halt , +.Nm poweroff and .Nm utilities flush the file system cache to disk, send all running processes @@ -91,9 +96,10 @@ This option is intended for applications such as .Xr shutdown 8 , that call -.Nm -or +.Nm , .Nm halt +or +.Nm poweroff and log this themselves. .It Fl n The file system cache is not flushed. @@ -106,6 +112,9 @@ This option should probably not be used. .It Fl p The system will turn off the power if it can. +This is the default action if +.Nm poweroff +is called. If the power down action fails, the system will halt or reboot normally, depending on whether .Nm halt Index: reboot.c =================================================================== RCS file: /home/ncvs/src/sbin/reboot/reboot.c,v retrieving revision 1.20 diff -u -r1.20 reboot.c --- reboot.c 9 Apr 2004 19:58:35 -0000 1.20 +++ reboot.c 17 Aug 2004 21:55:57 -0000 @@ -70,9 +70,13 @@ char *kernel, *p; const char *user; - if (strstr((p = rindex(*argv, '/')) ? p + 1 : *argv, "halt")) { + p = rindex(*argv, '/') ? p + 1 : *argv; + if (strcmp(p, "halt") == 0) { dohalt = 1; howto = RB_HALT; + } else if (strcmp(p, "poweroff") == 0) { + dohalt = 1; + howto = RB_POWEROFF; } else howto = 0; kflag = lflag = nflag = qflag = 0; @@ -108,6 +112,8 @@ if ((howto & (RB_DUMP | RB_HALT)) == (RB_DUMP | RB_HALT)) errx(1, "cannot dump (-d) when halting; must reboot instead"); + if ((howto & (RB_DUMP | RB_POWEROFF)) == (RB_DUMP | RB_POWEROFF)) + errx(1, "cannot dump (-d) when powering off; must reboot instead"); if (geteuid()) { errno = EPERM; err(1, NULL); %%% From owner-freebsd-arch@FreeBSD.ORG Sat Aug 21 22:50:58 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6D44416A4CF for ; Sat, 21 Aug 2004 22:50:58 +0000 (GMT) Received: from gw.Awfulhak.org (awfulhak.demon.co.uk [80.177.173.150]) by mx1.FreeBSD.org (Postfix) with ESMTP id BA85043D5C for ; Sat, 21 Aug 2004 22:50:57 +0000 (GMT) (envelope-from brian@Awfulhak.org) Received: from dev.lan.Awfulhak.org (brian@dev.lan.Awfulhak.org [172.16.0.5]) by gw.Awfulhak.org (8.12.11/8.12.11) with SMTP id i7LMonBS063369; Sat, 21 Aug 2004 23:50:50 +0100 (BST) (envelope-from brian@Awfulhak.org) Date: Sat, 21 Aug 2004 23:50:48 +0100 From: Brian Somers To: Giorgos Keramidas Message-Id: <20040821235048.6244270a@dev.lan.Awfulhak.org> In-Reply-To: <20040821202252.GB94336@gothmog.gr> References: <20040821191659.GA94336@gothmog.gr> <20040821202252.GB94336@gothmog.gr> X-Mailer: Sylpheed-Claws 0.9.12 (GTK+ 1.2.10; i386-portbld-freebsd5.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=0.0 required=5.0 tests=none autolearn=no version=2.64 X-Spam-Checker-Version: SpamAssassin 2.64 (2004-01-11) on gw.lan.Awfulhak.org cc: freebsd-arch@freebsd.org Subject: Re: Introducing a poweroff(8) command X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Aug 2004 22:50:58 -0000 On Sat, 21 Aug 2004 23:22:52 +0300, Giorgos Keramidas wrote: > On 2004-08-21 22:16, Giorgos Keramidas wrote: > > Hi guys, > > > > In response to PR misc/70476 about `halt -p' I wrote a simple patch to > > introduce a "poweroff" command that will default to "halt -p" behavior > > and inhibit the need for changing the default behavior of halt(8). > > > > o Does this look ok to you all? > > > > o Should I suggest using it as a workaround of the behavior > > described in the PR? > > It would be nice if I also included the patch :-? IMHO poweroff should behave like ``shutdown -p now'' rather than ``halt -p''. -- Brian Don't _EVER_ lose your sense of humour !